query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Value returns the current value or a zeroinitialized value if the iterator has advanced beyond the end of the collection.
func (iter StorageInsightListResultIterator) Value() StorageInsight { if !iter.page.NotDone() { return StorageInsight{} } return iter.page.Values()[iter.i] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (it *Iterator) Value() interface{} { return it.n.v }", "func (it *Iterator) Value() interface{} { return it.n.v }", "func (iter MemberCollectionIterator) Value() Member {\n\tif !iter.page.NotDone() {\n\t\treturn Member{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iterator *Iterator) Value() interface{} {\n\treturn iterator.iterator.Value().(*data).value\n}", "func (i *IndexIterator) Value() int64 { return i.current.lpos }", "func (it *iterator) Value() []byte {\n\treturn it.current.value\n}", "func (iter *Iterator) Value() interface{} {\n\tif !iter.Valid() {\n\t\tpanic(\"Value() called on invalid Iterator\")\n\t}\n\tif iter.index == 1 {\n\t\treturn iter.self.value.Value()\n\t}\n\treturn iter.child.Value()\n}", "func (i *ArrayIterator) Value() Object {\n\treturn i.v[i.i-1]\n}", "func (m *Iterator) Value() Elem {\n\treturn m.buf[m.bufCur]\n}", "func (iter *SliceIterator) Value() interface{} {\n\treturn iter.s.At(iter.position)\n}", "func (i *ObjectIterator) Value() (Slice, error) {\n\tif i.position >= i.size {\n\t\treturn nil, WithStack(IndexOutOfBoundsError)\n\t}\n\tif current := i.current; current != nil {\n\t\tvalue, err := current.Next()\n\t\treturn value, WithStack(err)\n\t}\n\tvalue, err := i.s.getNthValue(i.position)\n\treturn value, WithStack(err)\n}", "func (i *Iterator) Value() ([]byte, error) {\n\treturn nil, errors.New(\"value failure\")\n}", "func (iter *IteratorBase) Value() []byte {\n\treturn iter.cur.value\n}", "func (i *BytesIterator) Value() Object {\n\treturn &Int{Value: int64(i.v[i.i-1])}\n}", "func (it *iterator) Value() []byte {\n\tif len(it.values) > 0 {\n\t\treturn it.values[0]\n\t}\n\treturn nil\n}", "func (it skipListIterator) Value() Value {\n\treturn it.current.value\n}", "func (i *Iterator) Value() []byte {\n\tv, _ := i.iterator.Item().ValueCopy(nil)\n\treturn v\n}", "func (s *Iterator) Value() []byte {\n\treturn s.i.Value()\n}", "func (i *Iterator) Value() interface{} {\n\tif len(i.Target) == 0 {\n\t\treturn nil\n\t}\n\treturn i.Target[i.Index]\n}", "func (iter UsageAggregationListResultIterator) Value() UsageAggregation {\n\tif !iter.page.NotDone() {\n\t\treturn UsageAggregation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter StorageContainerListResultIterator) Value() StorageContainer {\n\tif !iter.page.NotDone() {\n\t\treturn StorageContainer{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (m *mergedIterator) Value() []byte {\n\treturn m.curValue\n}", "func (iter *ListIterator) Value() interface{} {\n\tif iter.node == nil {\n\t\treturn nil\n\t}\n\treturn iter.node.Value\n}", "func (i *Iterator) Value() []byte {\n\treturn i.n.value\n}", "func (iter ExemptionListResultIterator) Value() Exemption {\n\tif !iter.page.NotDone() {\n\t\treturn Exemption{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter MachineListResultIterator) Value() Machine {\n\tif !iter.page.NotDone() {\n\t\treturn Machine{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter *FlatIterator) Value() []byte {\n\treturn iter.val\n}", "func (iter *dbCacheIterator) Value() []byte {\n\t// Nothing to return if iterator is exhausted.\n\tif iter.currentIter == nil {\n\t\treturn nil\n\t}\n\n\treturn iter.currentIter.Value()\n}", "func (itr *DequeIterator) Value() interface{} {\n\treturn itr.deque.At(itr.index)\n}", "func (iter ConsortiumMemberCollectionIterator) Value() ConsortiumMember {\n\tif !iter.page.NotDone() {\n\t\treturn ConsortiumMember{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter EndpointHealthDataListResultIterator) Value() EndpointHealthData {\n\tif !iter.page.NotDone() {\n\t\treturn EndpointHealthData{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (it *iterator) Value() []byte {\n\treturn utils.CopyBytes(it.value)\n}", "func (iter DataLakeStoreAccountInformationListResultIterator) Value() DataLakeStoreAccountInformation {\n\tif !iter.page.NotDone() {\n\t\treturn DataLakeStoreAccountInformation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter AppCollectionListResultIterator) Value() AppCollection {\n\tif !iter.page.NotDone() {\n\t\treturn AppCollection{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter CampaignsListResultIterator) Value() CampaignListResult {\n\tif !iter.page.NotDone() {\n\t\treturn CampaignListResult{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListResultIterator) Value() OperationResult {\n\tif !iter.page.NotDone() {\n\t\treturn OperationResult{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter StorageAccountInformationListResultIterator) Value() StorageAccountInformation {\n\tif !iter.page.NotDone() {\n\t\treturn StorageAccountInformation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter DataLakeAnalyticsAccountListResultIterator) Value() DataLakeAnalyticsAccountBasic {\n\tif !iter.page.NotDone() {\n\t\treturn DataLakeAnalyticsAccountBasic{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter AssignmentListResultIterator) Value() Assignment {\n\tif !iter.page.NotDone() {\n\t\treturn Assignment{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (i *Iterator) Val() []byte {\n\treturn i.i.Value()\n}", "func (iter VaultListResultIterator) Value() Vault {\n\tif !iter.page.NotDone() {\n\t\treturn Vault{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ProviderOperationsMetadataListResultIterator) Value() ProviderOperationsMetadata {\n\tif !iter.page.NotDone() {\n\t\treturn ProviderOperationsMetadata{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter QuotaListIterator) Value() Quota {\n\tif !iter.page.NotDone() {\n\t\treturn Quota{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (i *CollectionIterator) GetValue(dest interface{}) {\n\ti.get(dest)\n}", "func (iter PrivateCloudListIterator) Value() PrivateCloud {\n\tif !iter.page.NotDone() {\n\t\treturn PrivateCloud{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (i *MapIterator) Value() Object {\n\tk := i.k[i.i-1]\n\treturn i.v[k]\n}", "func (iter PeerAsnListResultIterator) Value() PeerAsn {\n\tif !iter.page.NotDone() {\n\t\treturn PeerAsn{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter TransactionNodeCollectionIterator) Value() TransactionNode {\n\tif !iter.page.NotDone() {\n\t\treturn TransactionNode{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ListResultIterator) Value() Model {\n\tif !iter.page.NotDone() {\n\t\treturn Model{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ResourceListResultIterator) Value() Resource {\n\tif !iter.page.NotDone() {\n\t\treturn Resource{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter RegisteredAsnListResultIterator) Value() RegisteredAsn {\n\tif !iter.page.NotDone() {\n\t\treturn RegisteredAsn{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter RoleAssignmentListResultIterator) Value() RoleAssignment {\n\tif !iter.page.NotDone() {\n\t\treturn RoleAssignment{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListResultIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListResultIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListResultIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListResultIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListResultIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationListResultIterator) Value() Operation {\n\tif !iter.page.NotDone() {\n\t\treturn Operation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter NamespaceListResultIterator) Value() NamespaceResource {\n\tif !iter.page.NotDone() {\n\t\treturn NamespaceResource{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter SQLServerListResultIterator) Value() SQLServer {\n\tif !iter.page.NotDone() {\n\t\treturn SQLServer{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo {\n\tif !iter.page.NotDone() {\n\t\treturn IotHubQuotaMetricInfo{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func Value(it Iterator) interface{} {\n\treturn neogointernal.Syscall1(\"System.Iterator.Value\", it)\n}", "func (iter *RbTreeIterator) Value() interface{} {\n\treturn iter.node.Value()\n}", "func (iter ClusterListIterator) Value() Cluster {\n\tif !iter.page.NotDone() {\n\t\treturn Cluster{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ServiceLocationListResultIterator) Value() ServiceLocation {\n\tif !iter.page.NotDone() {\n\t\treturn ServiceLocation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (it *ScriptingReturnValueIterator) Value() (interface{}, variables.VariableType) {\n\tif it.inx < len(it.values.values) {\n\t\ta := it.values.values[it.inx]\n\t\tif a == nil {\n\t\t\treturn nil, variables.Undefined\n\t\t} else if v, ok := isNumericConstant(a); ok {\n\t\t\treturn v, variables.NumericType\n\t\t} else {\n\t\t\tT().Errorf(\"not yet implemented: type for %v\", a)\n\t\t}\n\t}\n\treturn nil, variables.Undefined\n}", "func (iter DefinitionListResultIterator) Value() Definition {\n\tif !iter.page.NotDone() {\n\t\treturn Definition{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter MonitoredResourceListResponseIterator) Value() MonitoredResource {\n\tif !iter.page.NotDone() {\n\t\treturn MonitoredResource{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter RoleManagementPolicyAssignmentListResultIterator) Value() RoleManagementPolicyAssignment {\n\tif !iter.page.NotDone() {\n\t\treturn RoleManagementPolicyAssignment{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter AccountsIterator) Value() Account {\n\tif !iter.page.NotDone() {\n\t\treturn Account{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter RegistrationAssignmentListIterator) Value() RegistrationAssignment {\n\tif !iter.page.NotDone() {\n\t\treturn RegistrationAssignment{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ListIterator) Value() Response {\n\tif !iter.page.NotDone() {\n\t\treturn Response{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter DataLakeAnalyticsAccountListResultIterator) Value() DataLakeAnalyticsAccount {\n\tif !iter.page.NotDone() {\n\t\treturn DataLakeAnalyticsAccount{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter MachineExtensionsListResultIterator) Value() MachineExtension {\n\tif !iter.page.NotDone() {\n\t\treturn MachineExtension{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter SasTokenInformationListResultIterator) Value() SasTokenInformation {\n\tif !iter.page.NotDone() {\n\t\treturn SasTokenInformation{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (seq List) Value(i int) interface{} { return seq[i] }", "func (it *emptyIterator) Next() chunkenc.ValueType { return chunkenc.ValNone }", "func (it *LiveTweetIterator) Value() *Tweet {\n\tif it.err != nil {\n\t\tpanic(\"Iterator encountered an error; access it using Err\")\n\t}\n\n\tif it.position == -1 {\n\t\tpanic(\"Must call Next on iterator before a call to Value is allowed\")\n\t}\n\n\treturn it.currentTweets[it.position]\n}", "func (iter OperationListIterator) Value() OperationResponse {\n\tif !iter.page.NotDone() {\n\t\treturn OperationResponse{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter LocationListResultIterator) Value() Location {\n\tif !iter.page.NotDone() {\n\t\treturn Location{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ClassicAdministratorListResultIterator) Value() ClassicAdministrator {\n\tif !iter.page.NotDone() {\n\t\treturn ClassicAdministrator{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter VMResourcesListResponseIterator) Value() VMResources {\n\tif !iter.page.NotDone() {\n\t\treturn VMResources{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter OperationsIterator) Value() OperationDetail {\n\tif !iter.page.NotDone() {\n\t\treturn OperationDetail{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter RoleDefinitionListResultIterator) Value() RoleDefinition {\n\tif !iter.page.NotDone() {\n\t\treturn RoleDefinition{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (s *SequenceItemValue) GetValue() interface{} { return s.elements }", "func (iter DataLakeAnalyticsAccountListDataLakeStoreResultIterator) Value() DataLakeStoreAccountInfo {\n\tif !iter.page.NotDone() {\n\t\treturn DataLakeStoreAccountInfo{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ListBlobContainersResultIterator) Value() BlobContainer {\n\tif !iter.page.NotDone() {\n\t\treturn BlobContainer{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ConsumerGroupListResultIterator) Value() ConsumerGroupResource {\n\tif !iter.page.NotDone() {\n\t\treturn ConsumerGroupResource{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ServiceSkuListIterator) Value() AvailableServiceSku {\n\tif !iter.page.NotDone() {\n\t\treturn AvailableServiceSku{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ClusterListResultIterator) Value() Cluster {\n\tif !iter.page.NotDone() {\n\t\treturn Cluster{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter ServerListResultIterator) Value() Server {\n if !iter.page.NotDone() {\n return Server{}\n }\n return iter.page.Values()[iter.i]\n }", "func (iter ComputePolicyListResultIterator) Value() ComputePolicy {\n\tif !iter.page.NotDone() {\n\t\treturn ComputePolicy{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter DataPolicyManifestListResultIterator) Value() DataPolicyManifest {\n\tif !iter.page.NotDone() {\n\t\treturn DataPolicyManifest{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter DatabaseListResultIterator) Value() Database {\n if !iter.page.NotDone() {\n return Database{}\n }\n return iter.page.Values()[iter.i]\n }", "func (siter *SetIter) Value() []byte {\n\tres := siter.Iter.Key()[len(siter.Prefix):]\n\treturn res\n}", "func (iter SetDefinitionListResultIterator) Value() SetDefinition {\n\tif !iter.page.NotDone() {\n\t\treturn SetDefinition{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (iter MonitorResourceListResponseIterator) Value() MonitorResource {\n\tif !iter.page.NotDone() {\n\t\treturn MonitorResource{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}" ]
[ "0.7331515", "0.7331515", "0.7222755", "0.72159904", "0.7168204", "0.7164698", "0.7127758", "0.7110843", "0.71018595", "0.71010613", "0.70911396", "0.7088136", "0.70300305", "0.70141095", "0.6993626", "0.6991584", "0.6991083", "0.6989738", "0.6973094", "0.69698083", "0.6950591", "0.6931852", "0.68949056", "0.686572", "0.68650407", "0.68472207", "0.6845442", "0.6824475", "0.68191856", "0.67829645", "0.6779505", "0.6775359", "0.6767275", "0.6761578", "0.6744153", "0.6717288", "0.6711331", "0.67020494", "0.66888577", "0.6672291", "0.66681355", "0.66593814", "0.66568816", "0.66419977", "0.6630321", "0.6615195", "0.66023016", "0.6587666", "0.6577328", "0.6561416", "0.65610504", "0.6556975", "0.6556975", "0.6555545", "0.6554214", "0.6554214", "0.6554214", "0.6554214", "0.6554214", "0.6554214", "0.65093046", "0.64779234", "0.64769006", "0.6471347", "0.64707714", "0.6464829", "0.6463901", "0.64510906", "0.64449155", "0.64430517", "0.64409727", "0.6440042", "0.6434925", "0.6434353", "0.6432936", "0.6421908", "0.6418436", "0.6415468", "0.64076966", "0.6406034", "0.6396199", "0.63724655", "0.6367092", "0.63545156", "0.6340605", "0.6335643", "0.6323899", "0.63180953", "0.6316487", "0.63162243", "0.6302426", "0.6301088", "0.6293458", "0.629149", "0.62910897", "0.62895244", "0.6285196", "0.6278631", "0.6271395" ]
0.694033
21
Creates a new instance of the StorageInsightListResultIterator type.
func NewStorageInsightListResultIterator(page StorageInsightListResultPage) StorageInsightListResultIterator { return StorageInsightListResultIterator{page: page} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewStorageInsightListResultPage(cur StorageInsightListResult, getNextPage func(context.Context, StorageInsightListResult) (StorageInsightListResult, error)) StorageInsightListResultPage {\n\treturn StorageInsightListResultPage{\n\t\tfn: getNextPage,\n\t\tsilr: cur,\n\t}\n}", "func NewStorageInsightListResultPage(getNextPage func(context.Context, StorageInsightListResult) (StorageInsightListResult, error)) StorageInsightListResultPage {\n\treturn StorageInsightListResultPage{fn: getNextPage}\n}", "func NewStorageContainerListResultIterator(page StorageContainerListResultPage) StorageContainerListResultIterator {\n\treturn StorageContainerListResultIterator{page: page}\n}", "func NewListResultIterator(page ListResultPage) ListResultIterator {\n\treturn ListResultIterator{page: page}\n}", "func NewListResultIterator(page ListResultPage) ListResultIterator {\n\treturn ListResultIterator{page: page}\n}", "func (h *HotRegionStorage) NewIterator(requireTypes []string, startTime, endTime int64) HotRegionStorageIterator {\n\titers := make([]iterator.Iterator, len(requireTypes))\n\tfor index, requireType := range requireTypes {\n\t\trequireType = strings.ToLower(requireType)\n\t\tstartKey := HotRegionStorePath(requireType, startTime, 0)\n\t\tendKey := HotRegionStorePath(requireType, endTime, math.MaxUint64)\n\t\titer := h.LevelDBKV.NewIterator(&util.Range{Start: []byte(startKey), Limit: []byte(endKey)}, nil)\n\t\titers[index] = iter\n\t}\n\treturn HotRegionStorageIterator{\n\t\titers: iters,\n\t\tencryptionKeyManager: h.ekm,\n\t}\n}", "func NewServerListResultIterator (page ServerListResultPage) ServerListResultIterator {\n return ServerListResultIterator{page: page}\n }", "func NewStorageAccountInformationListResultIterator(page StorageAccountInformationListResultPage) StorageAccountInformationListResultIterator {\n\treturn StorageAccountInformationListResultIterator{page: page}\n}", "func NewConfigurationListResultIterator (page ConfigurationListResultPage) ConfigurationListResultIterator {\n return ConfigurationListResultIterator{page: page}\n }", "func (iter *StorageInsightListResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func (iter *StorageInsightListResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func New(isupport *isupport.ISupport) *List {\n\treturn &List{\n\t\tisupport: isupport,\n\t\tusers: make([]*User, 0, 64),\n\t\tindex: make(map[string]*User, 64),\n\t\tautosort: true,\n\t}\n}", "func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {\n\treturn OperationListResultIterator{page: page}\n}", "func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {\n\treturn OperationListResultIterator{page: page}\n}", "func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {\n\treturn OperationListResultIterator{page: page}\n}", "func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {\n\treturn OperationListResultIterator{page: page}\n}", "func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {\n\treturn OperationListResultIterator{page: page}\n}", "func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {\n\treturn OperationListResultIterator{page: page}\n}", "func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {\n\treturn OperationListResultIterator{page: page}\n}", "func NewList(storage storageInterface) *List {\n\treturn &List{storage: storage}\n}", "func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator {\n\treturn ServiceListResultIterator{page: page}\n}", "func NewDatabaseListResultIterator (page DatabaseListResultPage) DatabaseListResultIterator {\n return DatabaseListResultIterator{page: page}\n }", "func NewDefinitionListResultIterator(page DefinitionListResultPage) DefinitionListResultIterator {\n\treturn DefinitionListResultIterator{page: page}\n}", "func NewIter(ids ...uint64) *Iter {\n\treturn &Iter{v: ids}\n}", "func NewListIterator(page ListPage) ListIterator {\n\treturn ListIterator{page: page}\n}", "func NewExemptionListResultIterator(page ExemptionListResultPage) ExemptionListResultIterator {\n\treturn ExemptionListResultIterator{page: page}\n}", "func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {\n\treturn ListResultPage{\n\t\tfn: getNextPage,\n\t\tlr: cur,\n\t}\n}", "func NewMaintenanceWindowListResultIterator (page MaintenanceWindowListResultPage) MaintenanceWindowListResultIterator {\n return MaintenanceWindowListResultIterator{page: page}\n }", "func NewMachineListResultIterator(page MachineListResultPage) MachineListResultIterator {\n\treturn MachineListResultIterator{page: page}\n}", "func (silr StorageInsightListResult) storageInsightListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !silr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(silr.OdataNextLink)))\n}", "func NewStorageContainerListResultPage(getNextPage func(context.Context, StorageContainerListResult) (StorageContainerListResult, error)) StorageContainerListResultPage {\n\treturn StorageContainerListResultPage{fn: getNextPage}\n}", "func NewIterator(query Query, limit int) *Iterator {\n\treturn &Iterator{\n\t\tbuf: make([]Elem, 0, limit),\n\t\tbufCur: -1,\n\t\tlimit: limit,\n\t\tquery: query,\n\t\toffsetPeer: &tg.InputPeerEmpty{},\n\t}\n}", "func (snap *dbCacheSnapshot) NewIterator(slice *util.Range) *dbCacheIterator {\n\treturn &dbCacheIterator{\n\t\tdbIter: snap.dbSnapshot.NewIterator(slice, nil),\n\t\tcacheIter: newLdbCacheIter(snap, slice),\n\t\tcacheSnapshot: snap,\n\t}\n}", "func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {\n\treturn ListResultPage{fn: getNextPage}\n}", "func (silr StorageInsightListResult) storageInsightListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif silr.OdataNextLink == nil || len(to.String(silr.OdataNextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(silr.OdataNextLink)))\n}", "func (s *Snapshot) NewIter(o *IterOptions) (*Iterator, error) {\n\treturn s.NewIterWithContext(context.Background(), o)\n}", "func newLdbCacheIter(snap *dbCacheSnapshot, slice *util.Range) *ldbCacheIter {\n\titer := snap.pendingKeys.Iterator(slice.Start, slice.Limit)\n\treturn &ldbCacheIter{Iterator: iter}\n}", "func New() *List {\n return &List{size:0}\n}", "func New() *List {\n\treturn &List{size: 0}\n}", "func NewIterator(iter engine.Iterator, spans *SpanSet) *Iterator {\n\treturn &Iterator{\n\t\ti: iter,\n\t\tspans: spans,\n\t}\n}", "func ExampleStorageInsightConfigsClient_NewListByWorkspacePager() {\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 := armoperationalinsights.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewStorageInsightConfigsClient().NewListByWorkspacePager(\"OIAutoRest5123\", \"aztest5048\", nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.StorageInsightListResult = armoperationalinsights.StorageInsightListResult{\n\t\t// }\n\t}\n}", "func NewIterator(node *Node) *ListIterator {\n\treturn &ListIterator{node: node}\n}", "func (c *SyscallService) NewIterator(ctx context.Context, in *pb.IteratorRequest) (*pb.IteratorResponse, error) {\n\tnctx, ok := c.ctxmgr.Context(in.GetHeader().Ctxid)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"bad ctx id:%d\", in.Header.Ctxid)\n\t}\n\n\titer, err := nctx.Cache.Select(nctx.ContractName, in.Start, in.Limit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := new(pb.IteratorResponse)\n\tfor iter.Next() {\n\t\tout.Items = append(out.Items, &pb.IteratorItem{\n\t\t\tKey: iter.Key(),\n\t\t\tValue: iter.Data().GetPureData().GetValue(),\n\t\t})\n\t}\n\tif iter.Error() != nil {\n\t\treturn nil, err\n\t}\n\titer.Release()\n\treturn out, nil\n}", "func NewIterator(records ...Record) Iterator {\n\treturn recordsIterator(records)\n}", "func NewIter(iter *gocql.Iter) IterInterface {\n\treturn &Iter{\n\t\titer,\n\t}\n}", "func (iter *StorageContainerListResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func NewIter(values ...any) Iter {\n\tswitch len(values) {\n\tcase 0:\n\t\treturn emptyIter{}\n\tcase 1:\n\t\treturn &unitIter{value: values[0]}\n\tdefault:\n\t\titer := sliceIter(values)\n\t\treturn &iter\n\t}\n}", "func NewDataSourceListResultIterator(page DataSourceListResultPage) DataSourceListResultIterator {\n\treturn DataSourceListResultIterator{page: page}\n}", "func (client *ScriptExecutionsClient) NewListPager(resourceGroupName string, privateCloudName string, options *ScriptExecutionsClientListOptions) *runtime.Pager[ScriptExecutionsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ScriptExecutionsClientListResponse]{\n\t\tMore: func(page ScriptExecutionsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ScriptExecutionsClientListResponse) (ScriptExecutionsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, privateCloudName, 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 ScriptExecutionsClientListResponse{}, 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 ScriptExecutionsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ScriptExecutionsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func New() *List { return new(List).Init() }", "func NewSQLServerListResultIterator(page SQLServerListResultPage) SQLServerListResultIterator {\n\treturn SQLServerListResultIterator{page: page}\n}", "func NewList() *List {\n newObj := &List {\n counters : make(map[string]Counter),\n }\n\n return newObj\n}", "func NewOperationsIterator(page OperationsPage) OperationsIterator {\n\treturn OperationsIterator{page: page}\n}", "func New(size int) *List {\n\treturn &List{data: make([]string, size)}\n}", "func NewConfigurationListResultPage (getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage {\n return ConfigurationListResultPage{fn: getNextPage}\n }", "func (k *KVAdapter) NewIterator(prefix, start []byte) ethdb.Iterator {\n\tit := &iterator{\n\t\tnext: make(chan struct{}),\n\t\titems: make(chan keyvalue, 1),\n\t\terrCh: make(chan error, 1),\n\t}\n\tinited := false\n\tgo func() {\n\t\t_, ok := <-it.next\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tit.errCh <- k.kv.IterateSorted(kv.Key(prefix), func(key kv.Key, value []byte) bool {\n\t\t\tif start != nil && !inited && key < kv.Key(prefix)+kv.Key(start) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tinited = true\n\t\t\tit.items <- keyvalue{key: []byte(key), value: value}\n\t\t\t_, ok := <-it.next\n\t\t\treturn ok\n\t\t})\n\t\tclose(it.items)\n\t}()\n\treturn it\n}", "func NewComputePolicyListResultIterator(page ComputePolicyListResultPage) ComputePolicyListResultIterator {\n\treturn ComputePolicyListResultIterator{page: page}\n}", "func NewLister() Lister {\n\treturn _lister{\n\t\tioUtil: iioutil.New(),\n\t\tdotYmlUnmarshaller: dotyml.NewUnmarshaller(),\n\t}\n}", "func (page *StorageInsightListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *StorageInsightListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func NewSetDefinitionListResultIterator(page SetDefinitionListResultPage) SetDefinitionListResultIterator {\n\treturn SetDefinitionListResultIterator{page: page}\n}", "func NewIterator(ctx context.Context, db db.Database, branchID int64, commitID int64) (*Iterator, error) {\n\tdb = db.WithContext(ctx)\n\t// query for list entries\n\tquery, args, err := mvcc.ListEntriesQuery(db, branchID, mvcc.CommitID(commitID), \"\", \"\", -1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trows, err := db.Query(query, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Iterator{\n\t\trows: rows,\n\t}, nil\n}", "func New() *List {\n\treturn &List{\n\t\tfront: nil,\n\t\tlen: 0,\n\t}\n\n}", "func NewServiceProviderListResultIterator(page ServiceProviderListResultPage) ServiceProviderListResultIterator {\n\treturn ServiceProviderListResultIterator{page: page}\n}", "func (D Disk) NewIter() DiskIterator {\n\tvar I diskIterator\n\n\tfi, _ := D.filePnt.Stat()\n\n\tI.actualOfset = fi.Size() - 16\n\tI.filePointer = D.filePnt\n\tI.recordInx = D.recNun - 1\n\n\treturn &I\n}", "func NewOperationListIterator(page OperationListPage) OperationListIterator {\n\treturn OperationListIterator{page: page}\n}", "func NewOperationListIterator(page OperationListPage) OperationListIterator {\n\treturn OperationListIterator{page: page}\n}", "func NewOperationListIterator(page OperationListPage) OperationListIterator {\n\treturn OperationListIterator{page: page}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewDatabaseListResultPage (getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage {\n return DatabaseListResultPage{fn: getNextPage}\n }", "func (m *Nitro) NewIterator(snap *Snapshot) *Iterator {\n\tif !snap.Open() {\n\t\treturn nil\n\t}\n\tbuf := snap.db.store.MakeBuf()\n\treturn &Iterator{\n\t\tsnap: snap,\n\t\titer: m.store.NewIterator(m.iterCmp, buf),\n\t\tbuf: buf,\n\t}\n}", "func (c *LRU) NewIterator() *Iterator {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\treturn &Iterator{lru: c, this: c.ll.Front(), forward: true}\n}", "func New() *List {\n\treturn &List{nil, nil, 0, sync.RWMutex{}}\n}", "func (blockchain *Blockchain) NewIterator() *BlockchainIterator {\n\tblockchain_iterator := &BlockchainIterator{blockchain.last_block_hash, blockchain.database}\n\n\treturn blockchain_iterator\n}", "func (db *MemoryCache) NewIterator() Iterator {\n\treturn db.NewIteratorWithStart(nil)\n}", "func NewStorageAccountInformationListResultPage(getNextPage func(context.Context, StorageAccountInformationListResult) (StorageAccountInformationListResult, error)) StorageAccountInformationListResultPage {\n\treturn StorageAccountInformationListResultPage{fn: getNextPage}\n}", "func ExampleWatchlistsClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armsecurityinsights.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewWatchlistsClient().NewListPager(\"myRg\", \"myWorkspace\", &armsecurityinsights.WatchlistsClientListOptions{SkipToken: nil})\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.WatchlistList = armsecurityinsights.WatchlistList{\n\t\t// \tValue: []*armsecurityinsights.Watchlist{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"highValueAsset\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.SecurityInsights/Watchlists\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/watchlists/highValueAsset\"),\n\t\t// \t\t\tEtag: to.Ptr(\"\\\"0300bf09-0000-0000-0000-5c37296e0000\\\"\"),\n\t\t// \t\t\tProperties: &armsecurityinsights.WatchlistProperties{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Watchlist from CSV content\"),\n\t\t// \t\t\t\tCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-09-28T00:26:54.7746089+00:00\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: &armsecurityinsights.UserInfo{\n\t\t// \t\t\t\t\tName: to.Ptr(\"john doe\"),\n\t\t// \t\t\t\t\tEmail: to.Ptr(\"[email protected]\"),\n\t\t// \t\t\t\t\tObjectID: to.Ptr(\"2046feea-040d-4a46-9e2b-91c2941bfa70\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tDefaultDuration: to.Ptr(\"P1279DT12H30M5S\"),\n\t\t// \t\t\t\tDisplayName: to.Ptr(\"High Value Assets Watchlist\"),\n\t\t// \t\t\t\tIsDeleted: to.Ptr(false),\n\t\t// \t\t\t\tItemsSearchKey: to.Ptr(\"header1\"),\n\t\t// \t\t\t\tLabels: []*string{\n\t\t// \t\t\t\t\tto.Ptr(\"Tag1\"),\n\t\t// \t\t\t\t\tto.Ptr(\"Tag2\")},\n\t\t// \t\t\t\t\tProvider: to.Ptr(\"Microsoft\"),\n\t\t// \t\t\t\t\tSource: to.Ptr(armsecurityinsights.SourceLocalFile),\n\t\t// \t\t\t\t\tTenantID: to.Ptr(\"f686d426-8d16-42db-81b7-ab578e110ccd\"),\n\t\t// \t\t\t\t\tUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-09-28T00:26:57+00:00\"); return t}()),\n\t\t// \t\t\t\t\tUpdatedBy: &armsecurityinsights.UserInfo{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"john doe\"),\n\t\t// \t\t\t\t\t\tEmail: to.Ptr(\"[email protected]\"),\n\t\t// \t\t\t\t\t\tObjectID: to.Ptr(\"2046feea-040d-4a46-9e2b-91c2941bfa70\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tWatchlistAlias: to.Ptr(\"highValueAsset\"),\n\t\t// \t\t\t\t\tWatchlistID: to.Ptr(\"76d5a51f-ba1f-4038-9d22-59fda38dc017\"),\n\t\t// \t\t\t\t\tWatchlistType: to.Ptr(\"watchlist\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t}},\n\t\t// \t}\n\t}\n}", "func newErrorList() *errorList {\n\treturn &errorList{\n\t\tlist: make([]string, 0, 16),\n\t}\n}", "func (client *CloudServicesClient) NewListPager(resourceGroupName string, options *CloudServicesClientListOptions) *runtime.Pager[CloudServicesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CloudServicesClientListResponse]{\n\t\tMore: func(page CloudServicesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CloudServicesClientListResponse) (CloudServicesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CloudServicesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.pl.Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CloudServicesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CloudServicesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewIterator(pachClient *client.APIClient, taskDoer task.Doer, input *pps.Input) (Iterator, error) {\n\tfileSetID, err := Create(pachClient, taskDoer, input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewFileSetIterator(pachClient, fileSetID, nil), nil\n}", "func ExampleOperationsClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armsearch.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewOperationsClient().NewListPager(nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.OperationListResult = armsearch.OperationListResult{\n\t\t// \tValue: []*armsearch.Operation{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/operations/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Lists all of the available operations of the Microsoft.Search provider.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"List all available operations\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/register/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Registers the subscription for the search resource provider and enables the creation of search services.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Register the Search Resource Provider\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates or updates the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Set Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Reads the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/start/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Starts the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Start Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/stop/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Stops the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Stop Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/listAdminKeys/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Reads the admin keys.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Admin Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/regenerateAdminKey/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Regenerates the admin key.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Regenerate Admin Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/listQueryKeys/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of query API keys for the given Azure Search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Query Keys\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"API Keys\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/createQueryKey/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates the query key.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Query Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/deleteQueryKey/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes the query key.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Query Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"API Keys\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/checkNameAvailability/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Checks availability of the service name.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Check Service Name Availability\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Service Name Availability\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/diagnosticSettings/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Gets the diganostic setting read for the resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Diagnostic Setting\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Diagnostic Settings\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/diagnosticSettings/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates or updates the diganostic setting for the resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Set Diagnostic Setting\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Diagnostic Settings\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/metricDefinitions/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Gets the available metrics for the search service\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Read search service metric definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"The metric definitions for the search service\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/logDefinitions/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Gets the available logs for the search service\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Read search service log definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"The log definition for the search service\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/validate/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Validates a private endpoint connection create call from NRP side\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Validate Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates a private endpoint connection proxy with the specified parameters or updates the properties or tags for the specified private endpoint connection proxy\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of private endpoint connection proxies or gets the properties for the specified private endpoint connection proxy\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes an existing private endpoint connection proxy\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnections/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates a private endpoint connections with the specified parameters or updates the properties or tags for the specified private endpoint connections\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Private Endpoint Connection\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnections/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of private endpoint connections or gets the properties for the specified private endpoint connections\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Private Endpoint Connection\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnections/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes an existing private endpoint connections\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Private Endpoint Connection\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates a new shared private link resource with the specified parameters or updates the properties for the specified shared private link resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Shared Private Link Resource\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of shared private link resources or gets the properties for the specified shared private link resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Shared Private Link Resource\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes an existing shared private link resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Shared Private Link Resource\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/operationStatuses/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Get the details of a long running shared private link resource operation\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Operation Status\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func NewList(client *secretsapi.Client, p listPrimeable) *List {\n\treturn &List{\n\t\tsecretsClient: client,\n\t\tout: p.Output(),\n\t\tproj: p.Project(),\n\t}\n}", "func (db *DB) NewIterator() *levigo.Iterator {\n\treturn db.LevigoDB.NewIterator(db.roIt)\n}", "func New(itf interface{}) Iterator {\n\t// First, if the given interface already is an iterator.Iterator,\n\t// we return it as-is.\n\tif it, ok := itf.(Iterator); ok {\n\t\treturn it\n\t}\n\n\tvalue := reflect.ValueOf(itf)\n\tswitch value.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\t// In case the objects are sent as a slice or an array, we iterate over\n\t\t// them to produce a []interface{} which we then wrap on an\n\t\t// iterator.sliceIterator.\n\t\tvar slice []interface{}\n\t\tfor i := 0; i < value.Len(); i++ {\n\t\t\tslice = append(slice, value.Index(i).Interface())\n\t\t}\n\t\treturn newIteratorFromSlice(slice)\n\tdefault:\n\t\t// Otherwise, the objects is most probably a single object. In that case,\n\t\t// we consider it as a single object and produce a slice with this object\n\t\t// as the sole element, which we also wrap in an iterator.Iterator.\n\t\treturn newIteratorFromSlice([]interface{}{itf})\n\t}\n}", "func (s *Snapshot) NewIterator() *Iterator {\n\treturn s.db.NewIterator(s)\n}", "func (client *SourceControlConfigurationsClient) NewListPager(resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, options *SourceControlConfigurationsClientListOptions) *runtime.Pager[SourceControlConfigurationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SourceControlConfigurationsClientListResponse]{\n\t\tMore: func(page SourceControlConfigurationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SourceControlConfigurationsClientListResponse) (SourceControlConfigurationsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SourceControlConfigurationsClientListResponse{}, 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 SourceControlConfigurationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SourceControlConfigurationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewIterator(\n\treader xio.Reader64,\n\tdescr namespace.SchemaDescr,\n\topts encoding.Options,\n) encoding.ReaderIterator {\n\tstream := encoding.NewIStream(reader)\n\n\ti := &iterator{\n\t\topts: opts,\n\t\tstream: stream,\n\t\tmarshaller: newCustomMarshaller(),\n\t\ttsIterator: m3tsz.NewTimestampIterator(opts, true),\n\t}\n\ti.resetSchema(descr)\n\treturn i\n}", "func NewServicePrefixListResultIterator(page ServicePrefixListResultPage) ServicePrefixListResultIterator {\n\treturn ServicePrefixListResultIterator{page: page}\n}", "func (client InfraRoleInstancesClient) List(ctx context.Context, location string, filter string) (result InfraRoleInstanceListPage, err error) {\n\tresult.fn = client.listNextResults\n\treq, err := client.ListPreparer(ctx, location, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"fabric.InfraRoleInstancesClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.iril.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"fabric.InfraRoleInstancesClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.iril, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"fabric.InfraRoleInstancesClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func New(config *Configuration) *Cache {\n\tc := &Cache{\n\t\tlist: list.New(),\n\t\tConfiguration: config,\n\t\tbucketMask: uint32(config.buckets) - 1,\n\t\tbuckets: make([]*bucket, config.buckets),\n\t}\n\tfor i := 0; i < int(config.buckets); i++ {\n\t\tc.buckets[i] = &bucket{\n\t\t\tlookup: make(map[string]*Item),\n\t\t}\n\t}\n\tc.restart()\n\treturn c\n}", "func (db *FlatDatabase) NewIterator(prefix []byte, start []byte) *FlatIterator {\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\n\tif db.iterating {\n\t\treturn nil\n\t}\n\tdb.iterating = true\n\tdb.data.Seek(0, 0)\n\tdb.index.Seek(0, 0)\n\tdb.offset = 0\n\tdb.buff = db.buff[:0]\n\treturn &FlatIterator{db: db}\n}", "func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator {\n\treturn MonitoredResourceListResponseIterator{page: page}\n}", "func New() *LList {\n\tvar l LList\n\tl.size = 0\n\treturn &l\n}", "func New(filepath string) (*ListFile, error) {\n\tfile, err := os.OpenFile(filepath, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while OpenFile: %s\", err)\n\t}\n\n\tlf := &ListFile{\n\t\tfile: file,\n\t\tmu: &sync.RWMutex{},\n\t\t// Allow to create custom indexes:\n\t\tsecondaryIndexes: make(map[string]*Index),\n\t}\n\n\treturn lf, nil\n}", "func NewNamespaceListResultIterator(page NamespaceListResultPage) NamespaceListResultIterator {\n\treturn NamespaceListResultIterator{page: page}\n}" ]
[ "0.6524153", "0.64431185", "0.59345025", "0.57975084", "0.57975084", "0.5725435", "0.5640444", "0.5586114", "0.5554882", "0.55474985", "0.55474985", "0.5543725", "0.5497573", "0.5497573", "0.5497573", "0.5497573", "0.5497573", "0.5497573", "0.5497573", "0.54757637", "0.5469246", "0.54162", "0.53573996", "0.534516", "0.5227111", "0.5220512", "0.5188813", "0.5156858", "0.51553917", "0.514444", "0.51295507", "0.51065385", "0.5100804", "0.50731367", "0.50693923", "0.5058143", "0.50539255", "0.5024894", "0.4999822", "0.49918237", "0.4991322", "0.49808994", "0.49612606", "0.49543387", "0.49469957", "0.49387616", "0.49380672", "0.4918035", "0.491287", "0.4908314", "0.49048755", "0.48860332", "0.48805156", "0.4877673", "0.48640245", "0.48635027", "0.4852849", "0.484539", "0.4842996", "0.4842996", "0.48409393", "0.48249164", "0.482147", "0.48098254", "0.480269", "0.47954667", "0.47954667", "0.47954667", "0.4789512", "0.4789512", "0.4789512", "0.4789512", "0.4789512", "0.47884762", "0.4784861", "0.47664428", "0.475869", "0.47396255", "0.4737983", "0.47348565", "0.47296098", "0.47267497", "0.47196683", "0.47156337", "0.47152534", "0.47114816", "0.47075266", "0.47050744", "0.47040635", "0.47000903", "0.46943763", "0.46875763", "0.468642", "0.46857175", "0.4683511", "0.46810618", "0.4676661", "0.46709833", "0.46598166" ]
0.7153466
0
IsEmpty returns true if the ListResult contains no values.
func (silr StorageInsightListResult) IsEmpty() bool { return silr.Value == nil || len(*silr.Value) == 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (lr ListResult) IsEmpty() bool {\n\treturn lr.Value == nil || len(*lr.Value) == 0\n}", "func (lr ListResult) IsEmpty() bool {\n\treturn lr.Value == nil || len(*lr.Value) == 0\n}", "func (elr ExemptionListResult) IsEmpty() bool {\n\treturn elr.Value == nil || len(*elr.Value) == 0\n}", "func (ualr UsageAggregationListResult) IsEmpty() bool {\n\treturn ualr.Value == nil || len(*ualr.Value) == 0\n}", "func (dlr DatabaseListResult) IsEmpty() bool {\n return dlr.Value == nil || len(*dlr.Value) == 0\n }", "func (vlr VaultListResult) IsEmpty() bool {\n\treturn vlr.Value == nil || len(*vlr.Value) == 0\n}", "func (pomlr ProviderOperationsMetadataListResult) IsEmpty() bool {\n\treturn pomlr.Value == nil || len(*pomlr.Value) == 0\n}", "func (ralr RegisteredAsnListResult) IsEmpty() bool {\n\treturn ralr.Value == nil || len(*ralr.Value) == 0\n}", "func (slr ServerListResult) IsEmpty() bool {\n return slr.Value == nil || len(*slr.Value) == 0\n }", "func (clr CampaignsListResult) IsEmpty() bool {\n\treturn clr.Value == nil || len(*clr.Value) == 0\n}", "func (mlr MachineListResult) IsEmpty() bool {\n\treturn mlr.Value == nil || len(*mlr.Value) == 0\n}", "func (dlr DefinitionListResult) IsEmpty() bool {\n\treturn dlr.Value == nil || len(*dlr.Value) == 0\n}", "func (alr AppListResult) IsEmpty() bool {\n\treturn alr.Value == nil || len(*alr.Value) == 0\n}", "func (stilr SasTokenInformationListResult) IsEmpty() bool {\n\treturn stilr.Value == nil || len(*stilr.Value) == 0\n}", "func (sailr StorageAccountInformationListResult) IsEmpty() bool {\n\treturn sailr.Value == nil || len(*sailr.Value) == 0\n}", "func (splr ServiceProviderListResult) IsEmpty() bool {\n\treturn splr.Value == nil || len(*splr.Value) == 0\n}", "func (rlr ResourceListResult) IsEmpty() bool {\n\treturn rlr.Value == nil || len(*rlr.Value) == 0\n}", "func (melr MachineExtensionsListResult) IsEmpty() bool {\n\treturn melr.Value == nil || len(*melr.Value) == 0\n}", "func (ssrlr SQLServerRegistrationListResult) IsEmpty() bool {\n\treturn ssrlr.Value == nil || len(*ssrlr.Value) == 0\n}", "func (mwlr MaintenanceWindowListResult) IsEmpty() bool {\n return mwlr.Value == nil || len(*mwlr.Value) == 0\n }", "func (olr OperationListResult) IsEmpty() bool {\n\treturn olr.Value == nil || len(*olr.Value) == 0\n}", "func (olr OperationListResult) IsEmpty() bool {\n\treturn olr.Value == nil || len(*olr.Value) == 0\n}", "func (olr OperationListResult) IsEmpty() bool {\n\treturn olr.Value == nil || len(*olr.Value) == 0\n}", "func (olr OperationListResult) IsEmpty() bool {\n\treturn olr.Value == nil || len(*olr.Value) == 0\n}", "func (olr OperationListResult) IsEmpty() bool {\n\treturn olr.Value == nil || len(*olr.Value) == 0\n}", "func (olr OperationListResult) IsEmpty() bool {\n\treturn olr.Value == nil || len(*olr.Value) == 0\n}", "func (olr OperationListResult) IsEmpty() bool {\n\treturn olr.Value == nil || len(*olr.Value) == 0\n}", "func (slr ServiceListResult) IsEmpty() bool {\n\treturn slr.Value == nil || len(*slr.Value) == 0\n}", "func (sslr SQLServerListResult) IsEmpty() bool {\n\treturn sslr.Value == nil || len(*sslr.Value) == 0\n}", "func (dslr DataSourceListResult) IsEmpty() bool {\n\treturn dslr.Value == nil || len(*dslr.Value) == 0\n}", "func (clr ClusterListResult) IsEmpty() bool {\n\treturn clr.Value == nil || len(*clr.Value) == 0\n}", "func (dlaalr DataLakeAnalyticsAccountListResult) IsEmpty() bool {\n\treturn dlaalr.Value == nil || len(*dlaalr.Value) == 0\n}", "func (dlaalr DataLakeAnalyticsAccountListResult) IsEmpty() bool {\n\treturn dlaalr.Value == nil || len(*dlaalr.Value) == 0\n}", "func (itlr ImportTaskListResult) IsEmpty() bool {\n\treturn itlr.Value == nil || len(*itlr.Value) == 0\n}", "func (palr PeerAsnListResult) IsEmpty() bool {\n\treturn palr.Value == nil || len(*palr.Value) == 0\n}", "func (clr ConfigurationListResult) IsEmpty() bool {\n return clr.Value == nil || len(*clr.Value) == 0\n }", "func (reslr RoleEligibilityScheduleListResult) IsEmpty() bool {\n\treturn reslr.Value == nil || len(*reslr.Value) == 0\n}", "func (jrlr JobResponseListResult) IsEmpty() bool {\n\treturn jrlr.Value == nil || len(*jrlr.Value) == 0\n}", "func (rdlr RoleDefinitionListResult) IsEmpty() bool {\n\treturn rdlr.Value == nil || len(*rdlr.Value) == 0\n}", "func (etlr ExportTaskListResult) IsEmpty() bool {\n\treturn etlr.Value == nil || len(*etlr.Value) == 0\n}", "func (lstr ListSasTokensResult) IsEmpty() bool {\n\treturn lstr.Value == nil || len(*lstr.Value) == 0\n}", "func (nlr NamespaceListResult) IsEmpty() bool {\n\treturn nlr.Value == nil || len(*nlr.Value) == 0\n}", "func (alr AssignmentListResult) IsEmpty() bool {\n\treturn alr.Value == nil || len(*alr.Value) == 0\n}", "func (resilr RoleEligibilityScheduleInstanceListResult) IsEmpty() bool {\n\treturn resilr.Value == nil || len(*resilr.Value) == 0\n}", "func (aclr AppCollectionListResult) IsEmpty() bool {\n\treturn aclr.Value == nil || len(*aclr.Value) == 0\n}", "func (frlr FirewallRuleListResult) IsEmpty() bool {\n return frlr.Value == nil || len(*frlr.Value) == 0\n }", "func (ehdlr EndpointHealthDataListResult) IsEmpty() bool {\n\treturn ehdlr.Value == nil || len(*ehdlr.Value) == 0\n}", "func (dlsailr DataLakeStoreAccountInformationListResult) IsEmpty() bool {\n\treturn dlsailr.Value == nil || len(*dlsailr.Value) == 0\n}", "func (frlr FirewallRuleListResult) IsEmpty() bool {\n\treturn frlr.Value == nil || len(*frlr.Value) == 0\n}", "func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool {\n\treturn ihsdlr.Value == nil || len(*ihsdlr.Value) == 0\n}", "func (l List) IsEmpty() bool {\n\treturn l.Value == nil || len(*l.Value) == 0\n}", "func (resrlr RoleEligibilityScheduleRequestListResult) IsEmpty() bool {\n\treturn resrlr.Value == nil || len(*resrlr.Value) == 0\n}", "func (dpmlr DataPolicyManifestListResult) IsEmpty() bool {\n\treturn dpmlr.Value == nil || len(*dpmlr.Value) == 0\n}", "func (rdl RegistrationDefinitionList) IsEmpty() bool {\n\treturn rdl.Value == nil || len(*rdl.Value) == 0\n}", "func (llr LocationListResult) IsEmpty() bool {\n\treturn llr.Value == nil || len(*llr.Value) == 0\n}", "func (rmplr RoleManagementPolicyListResult) IsEmpty() bool {\n\treturn rmplr.Value == nil || len(*rmplr.Value) == 0\n}", "func (sllr ServiceLocationListResult) IsEmpty() bool {\n\treturn sllr.Value == nil || len(*sllr.Value) == 0\n}", "func (ralr RoleAssignmentListResult) IsEmpty() bool {\n\treturn ralr.Value == nil || len(*ralr.Value) == 0\n}", "func (list *List) Empty() bool {\n\treturn list.size == 0\n}", "func (ral RegistrationAssignmentList) IsEmpty() bool {\n\treturn ral.Value == nil || len(*ral.Value) == 0\n}", "func (sdlr SetDefinitionListResult) IsEmpty() bool {\n\treturn sdlr.Value == nil || len(*sdlr.Value) == 0\n}", "func (rplr RegisteredPrefixListResult) IsEmpty() bool {\n\treturn rplr.Value == nil || len(*rplr.Value) == 0\n}", "func (rasilr RoleAssignmentScheduleInstanceListResult) IsEmpty() bool {\n\treturn rasilr.Value == nil || len(*rasilr.Value) == 0\n}", "func (calr ClassicAdministratorListResult) IsEmpty() bool {\n\treturn calr.Value == nil || len(*calr.Value) == 0\n}", "func (pgr PermissionGetResult) IsEmpty() bool {\n\treturn pgr.Value == nil || len(*pgr.Value) == 0\n}", "func (rmpalr RoleManagementPolicyAssignmentListResult) IsEmpty() bool {\n\treturn rmpalr.Value == nil || len(*rmpalr.Value) == 0\n}", "func (vrlr VMResourcesListResponse) IsEmpty() bool {\n\treturn vrlr.Value == nil || len(*vrlr.Value) == 0\n}", "func (l *sampleList) Empty() bool { return len(l.samples) == 0 }", "func (sl ServiceList) IsEmpty() bool {\n\treturn sl.Value == nil || len(*sl.Value) == 0\n}", "func (list ResultNodeList) Empty() bool {\n\tfirstChunk := list.chunks\n\t// List contains only one chunk and no any node is in use in the chunk.\n\treturn firstChunk.next == firstChunk && firstChunk.Size() == 0\n}", "func (prv ProductResultValue) IsEmpty() bool {\n\treturn prv.Value == nil || len(*prv.Value) == 0\n}", "func (cplr ComputePolicyListResult) IsEmpty() bool {\n\treturn cplr.Value == nil || len(*cplr.Value) == 0\n}", "func (l *LDAPIdentityProviderList) Empty() bool {\n\treturn l == nil || len(l.items) == 0\n}", "func (cl CreatorList) IsEmpty() bool {\n\treturn cl.Value == nil || len(*cl.Value) == 0\n}", "func (l *AutoscalerResourceLimitsGPULimitList) Empty() bool {\n\treturn l == nil || len(l.items) == 0\n}", "func (sclr StorageContainerListResult) IsEmpty() bool {\n\treturn sclr.Value == nil || len(*sclr.Value) == 0\n}", "func (l *List) Empty() bool {\n\treturn l.size == 0\n}", "func (splr ServicePrefixListResult) IsEmpty() bool {\n\treturn splr.Value == nil || len(*splr.Value) == 0\n}", "func (r *SearchResults) Empty() bool {\n\treturn len(r.Defs) == 0 && len(r.People) == 0 && len(r.Repos) == 0 && len(r.Tree) == 0\n}", "func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool {\n\treturn ihqmilr.Value == nil || len(*ihqmilr.Value) == 0\n}", "func (pl ProjectList) IsEmpty() bool {\n\treturn pl.Value == nil || len(*pl.Value) == 0\n}", "func (ecrlr EligibleChildResourcesListResult) IsEmpty() bool {\n\treturn ecrlr.Value == nil || len(*ecrlr.Value) == 0\n}", "func (rasrlr RoleAssignmentScheduleRequestListResult) IsEmpty() bool {\n\treturn rasrlr.Value == nil || len(*rasrlr.Value) == 0\n}", "func (ql QuotaList) IsEmpty() bool {\n\treturn ql.Value == nil || len(*ql.Value) == 0\n}", "func (dvlr DeletedVaultListResult) IsEmpty() bool {\n\treturn dvlr.Value == nil || len(*dvlr.Value) == 0\n}", "func (raslr RoleAssignmentScheduleListResult) IsEmpty() bool {\n\treturn raslr.Value == nil || len(*raslr.Value) == 0\n}", "func (dlaaldlsr DataLakeAnalyticsAccountListDataLakeStoreResult) IsEmpty() bool {\n\treturn dlaaldlsr.Value == nil || len(*dlaaldlsr.Value) == 0\n}", "func (mrlr MonitoredResourceListResponse) IsEmpty() bool {\n\treturn mrlr.Value == nil || len(*mrlr.Value) == 0\n}", "func (dqr DevicesQueryResult) IsEmpty() bool {\n\treturn dqr.Value == nil || len(*dqr.Value) == 0\n}", "func (mtrlr MonitoringTagRulesListResponse) IsEmpty() bool {\n\treturn mtrlr.Value == nil || len(*mtrlr.Value) == 0\n}", "func (saarlr SharedAccessAuthorizationRuleListResult) IsEmpty() bool {\n\treturn saarlr.Value == nil || len(*saarlr.Value) == 0\n}", "func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {\n\treturn sasarlr.Value == nil || len(*sasarlr.Value) == 0\n}", "func (pr ProductResult) IsEmpty() bool {\n\treturn pr.Values == nil || len(*pr.Values) == 0\n}", "func (pcl PrivateCloudList) IsEmpty() bool {\n\treturn pcl.Value == nil || len(*pcl.Value) == 0\n}", "func (cglr ConsumerGroupListResult) IsEmpty() bool {\n\treturn cglr.Value == nil || len(*cglr.Value) == 0\n}", "func (l *AddonStatusList) Empty() bool {\n\treturn l == nil || len(l.items) == 0\n}", "func (l *SubscriptionRegistrationList) Empty() bool {\n\treturn l == nil || len(l.items) == 0\n}", "func (ssorlr SingleSignOnResourceListResponse) IsEmpty() bool {\n\treturn ssorlr.Value == nil || len(*ssorlr.Value) == 0\n}", "func (tl TaskList) IsEmpty() bool {\n\treturn tl.Value == nil || len(*tl.Value) == 0\n}" ]
[ "0.80844617", "0.80844617", "0.78851306", "0.787949", "0.7856272", "0.7838926", "0.7830791", "0.7816958", "0.7807133", "0.7804776", "0.77757543", "0.77610826", "0.7726823", "0.77260274", "0.77184886", "0.7691234", "0.76899546", "0.76828086", "0.7671709", "0.7655888", "0.7653615", "0.7653615", "0.7653615", "0.7653615", "0.7653615", "0.7653615", "0.7653615", "0.7650682", "0.7649539", "0.76474583", "0.7622186", "0.76189804", "0.76189804", "0.7612647", "0.76089454", "0.76015675", "0.75760245", "0.7571039", "0.7562475", "0.75592566", "0.75563437", "0.755614", "0.75496054", "0.7549234", "0.754238", "0.7538003", "0.752806", "0.7501953", "0.74991643", "0.7495947", "0.74620473", "0.74521655", "0.7451284", "0.7451162", "0.7440097", "0.7434087", "0.7425798", "0.7422766", "0.74102235", "0.7392168", "0.7391983", "0.73881805", "0.7379479", "0.73710513", "0.7344615", "0.7341048", "0.7336167", "0.73351246", "0.73118144", "0.73065436", "0.73065305", "0.73006094", "0.7288318", "0.72810745", "0.72801805", "0.72801024", "0.72699505", "0.72588956", "0.7256385", "0.7256116", "0.72560763", "0.7246817", "0.72455996", "0.7244496", "0.7244158", "0.7232092", "0.72279376", "0.7227216", "0.72256243", "0.72178847", "0.72163665", "0.72129977", "0.7202509", "0.7197432", "0.7194764", "0.71868545", "0.71820295", "0.7180458", "0.71750575" ]
0.797028
2
storageInsightListResultPreparer prepares a request to retrieve the next set of results. It returns nil if no more results exist.
func (silr StorageInsightListResult) storageInsightListResultPreparer(ctx context.Context) (*http.Request, error) { if silr.OdataNextLink == nil || len(to.String(silr.OdataNextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), autorest.WithBaseURL(to.String(silr.OdataNextLink))) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (silr StorageInsightListResult) storageInsightListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !silr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(silr.OdataNextLink)))\n}", "func (client StorageListResult) StorageListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (vlr VaultListResult) vaultListResultPreparer() (*http.Request, error) {\n\tif vlr.NextLink == nil || len(to.String(vlr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(vlr.NextLink)))\n}", "func (sclr StorageContainerListResult) storageContainerListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif sclr.NextLink == nil || len(to.String(sclr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(sclr.NextLink)))\n}", "func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) {\n if !dlr.hasNextLink() {\n return nil, nil\n }\n return autorest.Prepare((&http.Request{}).WithContext(ctx),\n autorest.AsJSON(),\n autorest.AsGet(),\n autorest.WithBaseURL(to.String( dlr.NextLink)));\n }", "func (splr ServiceProviderListResult) serviceProviderListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !splr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(splr.NextLink)))\n}", "func (rlr ResourceListResult) resourceListResultPreparer() (*http.Request, error) {\n\tif rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(rlr.NextLink)))\n}", "func (client SecretListResult) SecretListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (dlr DefinitionListResult) definitionListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !dlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(dlr.NextLink)))\n}", "func (mlr MachineListResult) machineListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !mlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(mlr.NextLink)))\n}", "func (client EncryptionProtectorListResult) EncryptionProtectorListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) {\n if !slr.hasNextLink() {\n return nil, nil\n }\n return autorest.Prepare((&http.Request{}).WithContext(ctx),\n autorest.AsJSON(),\n autorest.AsGet(),\n autorest.WithBaseURL(to.String( slr.NextLink)));\n }", "func (dslr DataSourceListResult) dataSourceListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !dslr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(dslr.NextLink)))\n}", "func (pomlr ProviderOperationsMetadataListResult) providerOperationsMetadataListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !pomlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(pomlr.NextLink)))\n}", "func (client DatabaseOperationListResult) DatabaseOperationListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (sailr StorageAccountInformationListResult) storageAccountInformationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif sailr.NextLink == nil || len(to.String(sailr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(sailr.NextLink)))\n}", "func (clr ConfigurationListResult) configurationListResultPreparer(ctx context.Context) (*http.Request, error) {\n if !clr.hasNextLink() {\n return nil, nil\n }\n return autorest.Prepare((&http.Request{}).WithContext(ctx),\n autorest.AsJSON(),\n autorest.AsGet(),\n autorest.WithBaseURL(to.String( clr.NextLink)));\n }", "func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client ListResult) ListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client ListResult) ListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (elr ExemptionListResult) exemptionListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !elr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(elr.NextLink)))\n}", "func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(olr.NextLink)))\n}", "func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(olr.NextLink)))\n}", "func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(lr.NextLink)))\n}", "func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !lr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(lr.NextLink)))\n}", "func (slr ServiceListResult) serviceListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !slr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(slr.NextLink)))\n}", "func (cplr ComputePolicyListResult) computePolicyListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif cplr.NextLink == nil || len(to.String(cplr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(cplr.NextLink)))\n}", "func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !olr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(olr.NextLink)))\n}", "func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !olr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(olr.NextLink)))\n}", "func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !olr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(olr.NextLink)))\n}", "func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !olr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(olr.NextLink)))\n}", "func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !olr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(olr.NextLink)))\n}", "func (llr LocationListResult) locationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !llr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(llr.NextLink)))\n}", "func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (l List) listPreparer(ctx context.Context) (*http.Request, error) {\n\tif l.NextLink == nil || len(to.String(l.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(l.NextLink)))\n}", "func (nlr NamespaceListResult) namespaceListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif nlr.NextLink == nil || len(to.String(nlr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(nlr.NextLink)))\n}", "func (client AccountListResult) AccountListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (itlr ImportTaskListResult) importTaskListResultPreparer() (*http.Request, error) {\n\tif itlr.NextLink == nil || len(to.String(itlr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(itlr.NextLink)))\n}", "func (client ImportTaskListResult) ImportTaskListResultPreparer() (*http.Request, error) {\r\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\r\n\t\treturn nil, nil\r\n\t}\r\n\treturn autorest.Prepare(&http.Request{},\r\n\t\tautorest.AsJSON(),\r\n\t\tautorest.AsGet(),\r\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\r\n}", "func (client NetworkInterfaceListResult) NetworkInterfaceListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client KeyListResult) KeyListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (mwlr MaintenanceWindowListResult) maintenanceWindowListResultPreparer(ctx context.Context) (*http.Request, error) {\n if !mwlr.hasNextLink() {\n return nil, nil\n }\n return autorest.Prepare((&http.Request{}).WithContext(ctx),\n autorest.AsJSON(),\n autorest.AsGet(),\n autorest.WithBaseURL(to.String( mwlr.NextLink)));\n }", "func (client WorkflowRunListResult) WorkflowRunListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client WorkflowListResult) WorkflowListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client ContainerGroupListResult) ContainerGroupListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client IotHubQuotaMetricInfoListResult) IotHubQuotaMetricInfoListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (melr MachineExtensionsListResult) machineExtensionsListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !melr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(melr.NextLink)))\n}", "func (client ServerListResult) ServerListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client WorkflowRunActionListResult) WorkflowRunActionListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (ehdlr EndpointHealthDataListResult) endpointHealthDataListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !ehdlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ehdlr.NextLink)))\n}", "func (ualr UsageAggregationListResult) usageAggregationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif ualr.NextLink == nil || len(to.String(ualr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ualr.NextLink)))\n}", "func (client AppListResult) AppListResultPreparer() (*http.Request, error) {\r\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\r\n\t\treturn nil, nil\r\n\t}\r\n\treturn autorest.Prepare(&http.Request{},\r\n\t\tautorest.AsJSON(),\r\n\t\tautorest.AsGet(),\r\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\r\n}", "func (stilr SasTokenInformationListResult) sasTokenInformationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif stilr.NextLink == nil || len(to.String(stilr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(stilr.NextLink)))\n}", "func (alr AppListResult) appListResultPreparer() (*http.Request, error) {\n\tif alr.NextLink == nil || len(to.String(alr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(alr.NextLink)))\n}", "func (client QueueListResult) QueueListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (sdlr SetDefinitionListResult) setDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !sdlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(sdlr.NextLink)))\n}", "func (clr ClusterListResult) clusterListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !clr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(clr.NextLink)))\n}", "func (client ServerKeyListResult) ServerKeyListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client ExportTaskListResult) ExportTaskListResultPreparer() (*http.Request, error) {\r\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\r\n\t\treturn nil, nil\r\n\t}\r\n\treturn autorest.Prepare(&http.Request{},\r\n\t\tautorest.AsJSON(),\r\n\t\tautorest.AsGet(),\r\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\r\n}", "func (client SyncAgentListResult) SyncAgentListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !ihqmilr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ihqmilr.NextLink)))\n}", "func (dlsailr DataLakeStoreAccountInformationListResult) dataLakeStoreAccountInformationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif dlsailr.NextLink == nil || len(to.String(dlsailr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(dlsailr.NextLink)))\n}", "func (client IotHubSkuDescriptionListResult) IotHubSkuDescriptionListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client VirtualNetworkRuleListResult) VirtualNetworkRuleListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (cglr ConsumerGroupListResult) consumerGroupListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif cglr.NextLink == nil || len(to.String(cglr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(cglr.NextLink)))\n}", "func (client WorkflowAccessKeyListResult) WorkflowAccessKeyListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client SubscriptionListResult) SubscriptionListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client SyncDatabaseIDListResult) SyncDatabaseIDListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client EntitiesClient) ListPreparer(ctx context.Context, skiptoken string, skip *int32, top *int32, selectParameter string, search string, filter string, view string, groupName string, cacheControl string) (*http.Request, error) {\n\tconst APIVersion = \"2020-05-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\tif len(skiptoken) > 0 {\n\t\tqueryParameters[\"$skiptoken\"] = autorest.Encode(\"query\", skiptoken)\n\t}\n\tif skip != nil {\n\t\tqueryParameters[\"$skip\"] = autorest.Encode(\"query\", *skip)\n\t}\n\tif top != nil {\n\t\tqueryParameters[\"$top\"] = autorest.Encode(\"query\", *top)\n\t}\n\tif len(selectParameter) > 0 {\n\t\tqueryParameters[\"$select\"] = autorest.Encode(\"query\", selectParameter)\n\t}\n\tif len(string(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\tif len(string(view)) > 0 {\n\t\tqueryParameters[\"$view\"] = autorest.Encode(\"query\", view)\n\t}\n\tif len(groupName) > 0 {\n\t\tqueryParameters[\"groupName\"] = autorest.Encode(\"query\", groupName)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/providers/Microsoft.Management/getEntities\"),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(cacheControl) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"Cache-Control\", autorest.String(cacheControl)))\n\t} else {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"Cache-Control\", autorest.String(\"no-cache\")))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (sllr ServiceLocationListResult) serviceLocationListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !sllr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(sllr.NextLink)))\n}", "func (etlr ExportTaskListResult) exportTaskListResultPreparer() (*http.Request, error) {\n\tif etlr.NextLink == nil || len(to.String(etlr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(etlr.NextLink)))\n}", "func (client DeletedKeyListResult) DeletedKeyListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client TopicListResult) TopicListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client JobResponseListResult) JobResponseListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (palr PeerAsnListResult) peerAsnListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !palr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(palr.NextLink)))\n}", "func (rdlr RoleDefinitionListResult) roleDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !rdlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(rdlr.NextLink)))\n}", "func (sslr SQLServerListResult) sQLServerListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif sslr.NextLink == nil || len(to.String(sslr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(sslr.NextLink)))\n}", "func (ql QuotaList) quotaListPreparer(ctx context.Context) (*http.Request, error) {\n\tif ql.NextLink == nil || len(to.String(ql.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ql.NextLink)))\n}", "func (client WorkflowTriggerListResult) WorkflowTriggerListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (clr CampaignsListResult) campaignsListResultPreparer() (*http.Request, error) {\n\tif clr.NextLink == nil || len(to.String(clr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(clr.NextLink)))\n}", "func (client IotHubDescriptionListResult) IotHubDescriptionListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client SyncAgentLinkedDatabaseListResult) SyncAgentLinkedDatabaseListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {\n if !frlr.hasNextLink() {\n return nil, nil\n }\n return autorest.Prepare((&http.Request{}).WithContext(ctx),\n autorest.AsJSON(),\n autorest.AsGet(),\n autorest.WithBaseURL(to.String( frlr.NextLink)));\n }", "func (client AppCollectionListResult) AppCollectionListResultPreparer() (*http.Request, error) {\r\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\r\n\t\treturn nil, nil\r\n\t}\r\n\treturn autorest.Prepare(&http.Request{},\r\n\t\tautorest.AsJSON(),\r\n\t\tautorest.AsGet(),\r\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\r\n}", "func (client CampaignsListResult) CampaignsListResultPreparer() (*http.Request, error) {\r\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\r\n\t\treturn nil, nil\r\n\t}\r\n\treturn autorest.Prepare(&http.Request{},\r\n\t\tautorest.AsJSON(),\r\n\t\tautorest.AsGet(),\r\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\r\n}", "func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) {\n\tif ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ol.NextLink)))\n}", "func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) {\n\tif ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ol.NextLink)))\n}", "func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) {\n\tif ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ol.NextLink)))\n}", "func (client SasDefinitionListResult) SasDefinitionListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (dvlr DeletedVaultListResult) deletedVaultListResultPreparer() (*http.Request, error) {\n\tif dvlr.NextLink == nil || len(to.String(dvlr.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(dvlr.NextLink)))\n}", "func (client SyncGroupListResult) SyncGroupListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (client SyncMemberListResult) SyncMemberListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (alr AssignmentListResult) assignmentListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !alr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(alr.NextLink)))\n}", "func (calr ClassicAdministratorListResult) classicAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !calr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(calr.NextLink)))\n}", "func (dpmlr DataPolicyManifestListResult) dataPolicyManifestListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !dpmlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(dpmlr.NextLink)))\n}", "func (urlr UserRoleListResponse) userRoleListResponsePreparer(ctx context.Context) (*http.Request, error) {\n\tif !urlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(urlr.NextLink)))\n}", "func (vrlr VMResourcesListResponse) vMResourcesListResponsePreparer(ctx context.Context) (*http.Request, error) {\n\tif !vrlr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(vrlr.NextLink)))\n}", "func (client DeletedSecretListResult) DeletedSecretListResultPreparer() (*http.Request, error) {\n\tif client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare(&http.Request{},\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(client.NextLink)))\n}", "func (ralr RegisteredAsnListResult) registeredAsnListResultPreparer(ctx context.Context) (*http.Request, error) {\n\tif !ralr.hasNextLink() {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(ralr.NextLink)))\n}" ]
[ "0.8456936", "0.78994244", "0.76883686", "0.76626384", "0.7549678", "0.7500875", "0.74216473", "0.7371019", "0.73405206", "0.73105043", "0.72988284", "0.726672", "0.72632885", "0.72602093", "0.7246187", "0.72368586", "0.7229456", "0.7209759", "0.7209759", "0.7201089", "0.7201089", "0.7168214", "0.7148915", "0.7148915", "0.71442837", "0.71362925", "0.7135914", "0.71335274", "0.71316034", "0.71316034", "0.71316034", "0.71316034", "0.71316034", "0.7115542", "0.7091875", "0.7090428", "0.70888156", "0.7088152", "0.70854354", "0.7082511", "0.70788795", "0.70646316", "0.70612323", "0.70560724", "0.7039573", "0.7026666", "0.70211196", "0.7015725", "0.69857687", "0.69824845", "0.6969205", "0.69624186", "0.696139", "0.69455993", "0.6924713", "0.69230866", "0.6911605", "0.6906432", "0.6901243", "0.68978745", "0.6875125", "0.6869964", "0.6845813", "0.6843883", "0.6816841", "0.6809254", "0.68085915", "0.6801305", "0.67783886", "0.6776816", "0.67730576", "0.6740447", "0.6740048", "0.6738916", "0.6725304", "0.67252636", "0.6722562", "0.6718608", "0.67178833", "0.6707596", "0.6705684", "0.6705254", "0.67017585", "0.66826814", "0.66823673", "0.6678114", "0.6677972", "0.6677972", "0.6677972", "0.66558474", "0.6643998", "0.66393596", "0.6635312", "0.66235673", "0.6601361", "0.6598241", "0.65898615", "0.6586722", "0.6584285", "0.6583741" ]
0.8456597
1
NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.
func (page *StorageInsightListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/StorageInsightListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { sc = page.Response().Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } next, err := page.fn(ctx, page.silr) if err != nil { return err } page.silr = next return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (iter *ProductResultValueIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductResultValueIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ProductResultValuePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductResultValuePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.prv)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.prv = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter * ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ConfigurationListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (page * ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ConfigurationListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.clr)\n if err != nil {\n return err\n }\n page.clr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (iter * DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/DatabaseListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (iter * ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ServerListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (page * DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/DatabaseListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.dlr)\n if err != nil {\n return err\n }\n page.dlr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (page * ServerListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ServerListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.slr)\n if err != nil {\n return err\n }\n page.slr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (page * MaintenanceWindowListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/MaintenanceWindowListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.mwlr)\n if err != nil {\n return err\n }\n page.mwlr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (page *ExemptionListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ExemptionListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.elr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.elr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *ProductResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *PermissionGetResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/PermissionGetResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter * MaintenanceWindowListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/MaintenanceWindowListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (iter *OdataProductResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OdataProductResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *PermissionGetResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/PermissionGetResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.pgr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.pgr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *OdataProductResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OdataProductResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.opr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.opr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *ExemptionListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ExemptionListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *MonitoredResourceListResponsePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MonitoredResourceListResponsePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.mrlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.mrlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *ListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *VirtualMachineListResultPageClient) NextWithContext(ctx context.Context) (err error) {\n\treturn page.vmlrp.NextWithContext(ctx)\n}", "func (page *ProductResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.pr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.pr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *ResourceSkusResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ResourceSkusResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *AvailableSkusResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/AvailableSkusResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationsIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationsIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ClassicAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ClassicAdministratorListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.calr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.calr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *ServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServiceProviderListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.lr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.lr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter * FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/FirewallRuleListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.lr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.lr = next\n\treturn nil\n}", "func (page *MonitorResourceListResponsePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MonitorResourceListResponsePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.mrlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.mrlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *MonitorResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MonitorResourceListResponseIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *EndpointHealthDataListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/EndpointHealthDataListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *MonitoredResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MonitoredResourceListResponseIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ListSasTokensResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListSasTokensResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *EndpointHealthDataListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/EndpointHealthDataListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.ehdlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.ehdlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page * FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/FirewallRuleListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.frlr)\n if err != nil {\n return err\n }\n page.frlr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (iter *DataSourceListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/DataSourceListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (p *SyncMapsPaginator) NextWithContext(context context.Context) bool {\n\toptions := p.options\n\n\tif options == nil {\n\t\toptions = &SyncMapsPageOptions{}\n\t}\n\n\tif p.CurrentPage() != nil {\n\t\tnextPage := p.CurrentPage().Meta.NextPageURL\n\n\t\tif nextPage == nil {\n\t\t\treturn false\n\t\t}\n\n\t\tparsedURL, err := url.Parse(*nextPage)\n\t\tif err != nil {\n\t\t\tp.Page.Error = err\n\t\t\treturn false\n\t\t}\n\n\t\toptions.PageToken = utils.String(parsedURL.Query().Get(\"PageToken\"))\n\n\t\tpage, pageErr := strconv.Atoi(parsedURL.Query().Get(\"Page\"))\n\t\tif pageErr != nil {\n\t\t\tp.Page.Error = pageErr\n\t\t\treturn false\n\t\t}\n\t\toptions.Page = utils.Int(page)\n\n\t\tpageSize, pageSizeErr := strconv.Atoi(parsedURL.Query().Get(\"PageSize\"))\n\t\tif pageSizeErr != nil {\n\t\t\tp.Page.Error = pageSizeErr\n\t\t\treturn false\n\t\t}\n\t\toptions.PageSize = utils.Int(pageSize)\n\t}\n\n\tresp, err := p.Page.client.PageWithContext(context, options)\n\tp.Page.CurrentPage = resp\n\tp.Page.Error = err\n\n\tif p.Page.Error == nil {\n\t\tp.SyncMaps = append(p.SyncMaps, resp.SyncMaps...)\n\t}\n\n\treturn p.Page.Error == nil\n}", "func (iter *DataLakeAnalyticsAccountListDataLakeStoreResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/DataLakeAnalyticsAccountListDataLakeStoreResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServiceProviderListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.splr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.splr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *OrderListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OrderListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *StorageInsightListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/StorageInsightListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.silr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.silr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *SQLServerListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SQLServerListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *DataSourceListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/DataSourceListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.dslr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.dslr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *ListPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.l)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.l = next\n\treturn nil\n}", "func (iter *AccountsIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/AccountsIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ClassicAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ClassicAdministratorListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *SingleSignOnResourceListResponsePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SingleSignOnResourceListResponsePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.ssorlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.ssorlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *ComputePolicyListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ComputePolicyListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *AvailableSkusResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/AvailableSkusResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.asr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.asr = next\n\treturn nil\n}", "func (page *VMResourcesListResponsePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VMResourcesListResponsePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.vrlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.vrlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *QuotaListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/QuotaListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *TaskListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/TaskListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *StorageInsightListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/StorageInsightListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *StorageInsightListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/StorageInsightListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *SingleSignOnResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SingleSignOnResourceListResponseIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *VMResourcesListResponseIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VMResourcesListResponseIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ResourceSkusResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ResourceSkusResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.rsr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.rsr = next\n\treturn nil\n}", "func (page *OperationsPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationsPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.o)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.o = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/JobResponseListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.jrlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.jrlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/JobResponseListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *MonitoringTagRulesListResponseIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MonitoringTagRulesListResponseIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ServiceListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServiceListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServiceListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *RegistrationAssignmentListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RegistrationAssignmentListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ComputePolicyListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ComputePolicyListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.cplr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.cplr = next\n\treturn nil\n}", "func (iter *DataPolicyManifestListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/DataPolicyManifestListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *LocationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/LocationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServiceListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.slr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.slr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *ProviderOperationsMetadataListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProviderOperationsMetadataListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.pomlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.pomlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *RegistrationDefinitionListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/RegistrationDefinitionListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *DataLakeAnalyticsAccountListDataLakeStoreResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/DataLakeAnalyticsAccountListDataLakeStoreResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.dlaaldlsr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.dlaaldlsr = next\n\treturn nil\n}", "func (p *ShortCodesPaginator) NextWithContext(context context.Context) bool {\n\toptions := p.options\n\n\tif options == nil {\n\t\toptions = &ShortCodesPageOptions{}\n\t}\n\n\tif p.CurrentPage() != nil {\n\t\tnextPage := p.CurrentPage().Meta.NextPageURL\n\n\t\tif nextPage == nil {\n\t\t\treturn false\n\t\t}\n\n\t\tparsedURL, err := url.Parse(*nextPage)\n\t\tif err != nil {\n\t\t\tp.Page.Error = err\n\t\t\treturn false\n\t\t}\n\n\t\toptions.PageToken = utils.String(parsedURL.Query().Get(\"PageToken\"))\n\n\t\tpage, pageErr := strconv.Atoi(parsedURL.Query().Get(\"Page\"))\n\t\tif pageErr != nil {\n\t\t\tp.Page.Error = pageErr\n\t\t\treturn false\n\t\t}\n\t\toptions.Page = utils.Int(page)\n\n\t\tpageSize, pageSizeErr := strconv.Atoi(parsedURL.Query().Get(\"PageSize\"))\n\t\tif pageSizeErr != nil {\n\t\t\tp.Page.Error = pageSizeErr\n\t\t\treturn false\n\t\t}\n\t\toptions.PageSize = utils.Int(pageSize)\n\t}\n\n\tresp, err := p.Page.client.PageWithContext(context, options)\n\tp.Page.CurrentPage = resp\n\tp.Page.Error = err\n\n\tif p.Page.Error == nil {\n\t\tp.ShortCodes = append(p.ShortCodes, resp.ShortCodes...)\n\t}\n\n\treturn p.Page.Error == nil\n}", "func (page *MonitoringTagRulesListResponsePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MonitoringTagRulesListResponsePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.mtrlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.mtrlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *ProviderOperationsMetadataListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProviderOperationsMetadataListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.olr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.olr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.olr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.olr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.olr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.olr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.olr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.olr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OperationListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.olr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.olr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *UsageAggregationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/UsageAggregationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *MachineListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MachineListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *CreatorListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CreatorListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *SQLServerListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SQLServerListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.sslr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.sslr = next\n\treturn nil\n}", "func (page *MachineListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MachineListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.mlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.mlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *LocationListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/LocationListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.llr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.llr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *SQLServerRegistrationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SQLServerRegistrationListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}" ]
[ "0.72891104", "0.728577", "0.71793556", "0.7162696", "0.7130337", "0.71031123", "0.7038733", "0.69585425", "0.6931297", "0.68788147", "0.68631166", "0.68566597", "0.684711", "0.68182707", "0.67772037", "0.67724097", "0.67658776", "0.67185414", "0.67185414", "0.66746306", "0.66376764", "0.66331756", "0.6616402", "0.6565806", "0.65579283", "0.65569603", "0.6553935", "0.65514535", "0.65453553", "0.65445817", "0.6543596", "0.6538923", "0.65217155", "0.6518633", "0.6514493", "0.6513857", "0.6506637", "0.6498288", "0.6487906", "0.6480835", "0.64714384", "0.64705634", "0.6463431", "0.64206797", "0.64190817", "0.64184695", "0.6417977", "0.6411371", "0.6406071", "0.63944143", "0.6392231", "0.6389534", "0.63798195", "0.63765246", "0.6375266", "0.6367334", "0.6367334", "0.6344851", "0.6343237", "0.633201", "0.633201", "0.633201", "0.63179964", "0.6312111", "0.6311858", "0.63000154", "0.62986547", "0.62927914", "0.62686354", "0.6267097", "0.6248476", "0.6248373", "0.62447304", "0.6243286", "0.6243286", "0.6243286", "0.6243286", "0.6243286", "0.6243286", "0.6243286", "0.624248", "0.6237497", "0.62370384", "0.6234581", "0.62322694", "0.6229782", "0.6223075", "0.62220395", "0.62220395", "0.62220395", "0.62220395", "0.62220395", "0.6218897", "0.6204275", "0.61957765", "0.61950076", "0.61920017", "0.61915076", "0.61913913", "0.6189393" ]
0.6331372
62
Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned. Deprecated: Use NextWithContext() instead.
func (page *StorageInsightListResultPage) Next() error { return page.NextWithContext(context.Background()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (page *ListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *ListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *AppListResultPage) Next() error {\n\tnext, err := page.fn(page.alr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.alr = next\n\treturn nil\n}", "func (iter *VaultListResultIterator) Next() error {\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr := iter.page.Next()\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ServiceProviderListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *ProductResultValuePage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *AppListResultIterator) Next() error {\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr := iter.page.Next()\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ResourceListResultIterator) Next() error {\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr := iter.page.Next()\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ProductResultValuePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductResultValuePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.prv)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.prv = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *ListPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *DevicesQueryResultIterator) Next() error {\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr := iter.page.Next()\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *ResourceListResultPage) Next() error {\n\tnext, err := page.fn(page.rlr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.rlr = next\n\treturn nil\n}", "func (page *ExemptionListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *ProductResultValueIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func (iter *ProductResultValueIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductResultValueIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *DevicesQueryResultPage) Next() error {\n\tnext, err := page.fn(page.dqr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.dqr = next\n\treturn nil\n}", "func (page *VaultListResultPage) Next() error {\n\tnext, err := page.fn(page.vlr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.vlr = next\n\treturn nil\n}", "func (page * ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ConfigurationListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.clr)\n if err != nil {\n return err\n }\n page.clr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (page * ConfigurationListResultPage) Next() error {\n return page.NextWithContext(context.Background())\n }", "func (iter * DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/DatabaseListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (page * DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/DatabaseListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.dlr)\n if err != nil {\n return err\n }\n page.dlr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (iter * ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ConfigurationListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (iter *AppCollectionListResultIterator) Next() error {\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr := iter.page.Next()\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *DataSourceListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (result *Result) Next(txn Transaction) ([]byte, error) {\n\tif !result.HasNext() {\n\t\treturn nil, errors.New(\"no more values\")\n\t}\n\tif result.index == len(result.pageValues) {\n\t\terr := result.getNextPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result.Next(txn)\n\t}\n\tionBinary := result.pageValues[result.index].IonBinary\n\tresult.index++\n\treturn ionBinary, nil\n}", "func (page *ServiceListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter * ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ServerListResultIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "func (page *EndpointHealthDataListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *ListResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func (iter *ListResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func (page *OperationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OperationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OperationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OperationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OperationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OperationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OperationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page * ServerListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/ServerListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.slr)\n if err != nil {\n return err\n }\n page.slr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (iter *ServiceProviderListResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func (p *Context) Next() {\n\tif p.index >= uint8(len(p.handlers)) {\n\t\treturn\n\t}\n\th := p.handlers[p.index]\n\tp.index++\n\tlog.Debugf(\"call %s\", FuncName(h))\n\th(p)\n}", "func (iter *DeletedVaultListResultIterator) Next() error {\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr := iter.page.Next()\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *LocationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *ProductResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *CampaignsListResultIterator) Next() error {\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr := iter.page.Next()\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *EndpointHealthDataListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/EndpointHealthDataListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.ehdlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.ehdlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *CampaignsListResultPage) Next() error {\n\tnext, err := page.fn(page.clr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.clr = next\n\treturn nil\n}", "func (page *ProviderOperationsMetadataListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OdataProductResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *VirtualMachineListResultPageClient) NextWithContext(ctx context.Context) (err error) {\n\treturn page.vmlrp.NextWithContext(ctx)\n}", "func (page *SasTokenInformationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (s *server) Next() Data {\n\tpage := s.row / s.pageSize\n\tif page != s.currentPage {\n\t\ts.currentPage = page\n\t\ts.getPage(page)\n\t}\n\tif s.row > s.maxRow || s.data == nil {\n\t\treturn nil\n\t}\n\tif len(s.data) == 0 {\n\t\treturn nil\n\t}\n\tretval := s.data[s.row%s.pageSize].(map[string]interface{})\n\ts.row++\n\treturn retval\n}", "func (page *AppCollectionListResultPage) Next() error {\n\tnext, err := page.fn(page.aclr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.aclr = next\n\treturn nil\n}", "func (page *ServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServiceProviderListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.splr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.splr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *ResourceSkusResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *OdataProductResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OdataProductResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.opr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.opr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Context) Next() {\n\tif c.index >= c.HandlerContext.count {\n\t\treturn\n\t}\n\thandle := c.HandlerContext.handlers[c.index]\n\tc.index++\n\thandle(c)\n}", "func (c *Context) Next() {\n\tc.index++ // 这一行不能忽略,对每个next 调用,都必须加 1\n\ts := len(c.handlers)\n\tfor ; c.index < s; c.index++ {\n\t\tc.handlers[c.index](c)\n\t}\n}", "func (page *ExemptionListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ExemptionListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.elr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.elr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *EndpointHealthDataListResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}", "func (page * MaintenanceWindowListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/MaintenanceWindowListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.mwlr)\n if err != nil {\n return err\n }\n page.mwlr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (c *Context) Next() {\n\t// Call the next handler only if there is one and the response hasn't been written.\n\tif !c.Written() && c.index < len(c.handlersStack.Handlers)-1 {\n\t\tc.index++\n\t\tc.handlersStack.Handlers[c.index](c)\n\t}\n}", "func (page *ServiceLocationListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *ListSasTokensResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *PermissionGetResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (c *Context) Next() {\n\tc.index++\n\tif n := int8(len(c.handlers)); c.index < n {\n\t\tc.handlers[c.index](c)\n\t}\n}", "func (page * DatabaseListResultPage) Next() error {\n return page.NextWithContext(context.Background())\n }", "func (page *SQLServerListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *MonitoredResourceListResponsePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MonitoredResourceListResponsePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.mrlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.mrlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *JobResponseListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *ProductResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProductResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *MonitoredResourceListResponsePage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (c *Context) Next() {\n\tc.index++\n\tfor c.index < int8(len(c.handlers)) {\n\t\tif c.IsAborted() {\n\t\t\tbreak\n\t\t}\n\t\t(c.handlers)[c.index](c)\n\t\tc.index++\n\t}\n}", "func (page * ServerListResultPage) Next() error {\n return page.NextWithContext(context.Background())\n }", "func (iter *ListIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (c *Context) Next() {\n\t// Call the next handler only if there is one and the response hasn't been written.\n\tif !c.written && c.index < len(c.handlersStack)-1 {\n\t\tc.index++\n\t\tc.handlersStack[c.index](c)\n\t}\n}", "func (page *ClassicAdministratorListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *OdataProductResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/OdataProductResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter * ConfigurationListResultIterator) Next() error {\n return iter.NextWithContext(context.Background())\n }", "func (page *ClassicAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ClassicAdministratorListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.calr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.calr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (middleware Middleware) Next(context *Context) {\n\tif next := middleware.next; next != nil {\n\t\tnext.Handler(context, next)\n\t}\n}", "func (iter *ServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServiceProviderListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *DataSourceListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/DataSourceListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.dslr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.dslr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (iter *EndpointHealthDataListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/EndpointHealthDataListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (page *DeletedVaultListResultPage) Next() error {\n\tnext, err := page.fn(page.dvlr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.dvlr = next\n\treturn nil\n}", "func (this *Iter) Next() (interface{}, *Error) {\n\n\tif this.index > len(*this.list)-2 {\n\t\tif (this.nextPageQuery == nil) { return nil, MakeError(ErrorParse, nil, errors.New(\"At last item\")) }\n\t\tif err := this.nextPage(); err != nil { return nil, err }\n\t\tthis.index = -1\n\t}\n\t\n\tthis.index++\n\titem := (*this.list)[this.index]\n\t\n\treturn item, nil\n}", "func (page *AvailableSkusResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page * FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/FirewallRuleListResultPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.frlr)\n if err != nil {\n return err\n }\n page.frlr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "func (page *MachineListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *StorageInsightListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/StorageInsightListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.silr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.silr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *StorageContainerListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.lr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.lr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page *VMResourcesListResponsePage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VMResourcesListResponsePage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.vrlr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.vrlr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (page * MaintenanceWindowListResultPage) Next() error {\n return page.NextWithContext(context.Background())\n }", "func (rl *ResourceList) next() error {\n\tif rl.Page == rl.NumPages-1 {\n\t\treturn errors.New(\"no more new pages\")\n\t}\n\treturn common.SendGetRequest(rl.NextPageURI, *rl.act, rl)\n}", "func (page *ComputePolicyListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "func (it *ObjectPageIterator) Next() (Object, error) {\n\tretryCt := 0\n\n\tselect {\n\tcase <-it.ctx.Done():\n\t\t// If iterator has been closed\n\t\treturn nil, it.ctx.Err()\n\tdefault:\n\t\tif it.cursor < len(it.page) {\n\t\t\treturn it.returnPageNext()\n\t\t} else if it.cursor > 0 && it.q.Marker == \"\" {\n\t\t\t// no new page, lets return\n\t\t\treturn nil, iterator.Done\n\t\t}\n\t\tfor {\n\t\t\tresp, err := it.s.List(it.ctx, it.q)\n\t\t\tif err == nil {\n\t\t\t\tit.page = resp.Objects\n\t\t\t\tit.cursor = 0\n\t\t\t\tit.q.Marker = resp.NextMarker\n\t\t\t\tif len(it.page) == 0 {\n\t\t\t\t\treturn nil, iterator.Done\n\t\t\t\t}\n\t\t\t\treturn it.returnPageNext()\n\t\t\t} else if err == iterator.Done {\n\t\t\t\treturn nil, err\n\t\t\t} else if err == context.Canceled || err == context.DeadlineExceeded {\n\t\t\t\t// Return to user\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif retryCt < 5 {\n\t\t\t\tBackoff(retryCt)\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tretryCt++\n\t\t}\n\t}\n}", "func (iter *ListSasTokensResultIterator) Next() error {\n\treturn iter.NextWithContext(context.Background())\n}" ]
[ "0.67826414", "0.67826414", "0.6556164", "0.65189093", "0.6498138", "0.6485476", "0.6464541", "0.64626366", "0.6434035", "0.63337326", "0.6321719", "0.6305559", "0.6293143", "0.6281074", "0.6266391", "0.62606376", "0.6207439", "0.61982787", "0.6196518", "0.61219203", "0.6115256", "0.6115057", "0.6111341", "0.60890895", "0.60749334", "0.607221", "0.6049857", "0.60412246", "0.60005146", "0.60005146", "0.59886044", "0.59886044", "0.59886044", "0.59886044", "0.59886044", "0.59886044", "0.59886044", "0.5978402", "0.5963367", "0.5949953", "0.59460163", "0.5925806", "0.59154445", "0.590249", "0.5901649", "0.5896064", "0.588569", "0.5881808", "0.5873117", "0.58729744", "0.58474785", "0.58406836", "0.5839341", "0.58302546", "0.5823214", "0.58197486", "0.5818378", "0.5817034", "0.58023435", "0.58020526", "0.57999897", "0.5799532", "0.57863724", "0.5784546", "0.57825154", "0.5776087", "0.5769596", "0.5768526", "0.57684183", "0.5765763", "0.5765136", "0.5758373", "0.57513", "0.57454866", "0.5744107", "0.57429147", "0.5735055", "0.57323164", "0.57311463", "0.5715586", "0.57120466", "0.5711984", "0.57112306", "0.57106495", "0.57030874", "0.56938696", "0.5689912", "0.56872565", "0.56861234", "0.5677741", "0.5677146", "0.5675644", "0.5672668", "0.5670618", "0.56646734", "0.56640476", "0.56640476", "0.5661851", "0.5658506" ]
0.62821656
13
NotDone returns true if the page enumeration should be started or is not yet complete.
func (page StorageInsightListResultPage) NotDone() bool { return !page.silr.IsEmpty() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (page EndpointHealthDataListResultPage) NotDone() bool {\n\treturn !page.ehdlr.IsEmpty()\n}", "func (page DefinitionListResultPage) NotDone() bool {\n\treturn !page.dlr.IsEmpty()\n}", "func (page OperationsPage) NotDone() bool {\n\treturn !page.o.IsEmpty()\n}", "func (page AccountsPage) NotDone() bool {\n\treturn !page.a.IsEmpty()\n}", "func (page RegisteredAsnListResultPage) NotDone() bool {\n\treturn !page.ralr.IsEmpty()\n}", "func (page AppListResultPage) NotDone() bool {\n\treturn !page.alr.IsEmpty()\n}", "func (page MachineExtensionsListResultPage) NotDone() bool {\n\treturn !page.melr.IsEmpty()\n}", "func (page UsageAggregationListResultPage) NotDone() bool {\n\treturn !page.ualr.IsEmpty()\n}", "func (page ResourceListResultPage) NotDone() bool {\n\treturn !page.rlr.IsEmpty()\n}", "func (page ExportTaskListResultPage) NotDone() bool {\n\treturn !page.etlr.IsEmpty()\n}", "func (page ExemptionListResultPage) NotDone() bool {\n\treturn !page.elr.IsEmpty()\n}", "func (page MachineListResultPage) NotDone() bool {\n\treturn !page.mlr.IsEmpty()\n}", "func (page MonitoredResourceListResponsePage) NotDone() bool {\n\treturn !page.mrlr.IsEmpty()\n}", "func (page PeerAsnListResultPage) NotDone() bool {\n\treturn !page.palr.IsEmpty()\n}", "func (page ListResultPage) NotDone() bool {\n\treturn !page.lr.IsEmpty()\n}", "func (page ListResultPage) NotDone() bool {\n\treturn !page.lr.IsEmpty()\n}", "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "func (page ImportTaskListResultPage) NotDone() bool {\n\treturn !page.itlr.IsEmpty()\n}", "func (page OperationListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "func (page OperationListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "func (page OperationListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "func (page CampaignsListResultPage) NotDone() bool {\n\treturn !page.clr.IsEmpty()\n}", "func (page ClassicAdministratorListResultPage) NotDone() bool {\n\treturn !page.calr.IsEmpty()\n}", "func (page ProviderOperationsMetadataListResultPage) NotDone() bool {\n\treturn !page.pomlr.IsEmpty()\n}", "func (page RoleDefinitionListResultPage) NotDone() bool {\n\treturn !page.rdlr.IsEmpty()\n}", "func (page AssignmentListResultPage) NotDone() bool {\n\treturn !page.alr.IsEmpty()\n}", "func (page StorageAccountInformationListResultPage) NotDone() bool {\n\treturn !page.sailr.IsEmpty()\n}", "func (page ListPage) NotDone() bool {\n\treturn !page.l.IsEmpty()\n}", "func (page RegistrationAssignmentListPage) NotDone() bool {\n\treturn !page.ral.IsEmpty()\n}", "func (page VaultListResultPage) NotDone() bool {\n\treturn !page.vlr.IsEmpty()\n}", "func (page ComputePolicyListResultPage) NotDone() bool {\n\treturn !page.cplr.IsEmpty()\n}", "func (page TaskListPage) NotDone() bool {\n\treturn !page.tl.IsEmpty()\n}", "func (page IotHubDescriptionListResultPage) NotDone() bool {\n\treturn !page.ihdlr.IsEmpty()\n}", "func (page MonitorResourceListResponsePage) NotDone() bool {\n\treturn !page.mrlr.IsEmpty()\n}", "func (page DatabaseListResultPage) NotDone() bool {\n return !page.dlr.IsEmpty()\n }", "func (page DataSourceListResultPage) NotDone() bool {\n\treturn !page.dslr.IsEmpty()\n}", "func (page RoleEligibilityScheduleListResultPage) NotDone() bool {\n\treturn !page.reslr.IsEmpty()\n}", "func (page DataPolicyManifestListResultPage) NotDone() bool {\n\treturn !page.dpmlr.IsEmpty()\n}", "func (page LocationListResultPage) NotDone() bool {\n\treturn !page.llr.IsEmpty()\n}", "func (page ServiceListResultPage) NotDone() bool {\n\treturn !page.slr.IsEmpty()\n}", "func (page NamespaceListResultPage) NotDone() bool {\n\treturn !page.nlr.IsEmpty()\n}", "func (page RegistrationDefinitionListPage) NotDone() bool {\n\treturn !page.rdl.IsEmpty()\n}", "func (page SharedAccessAuthorizationRuleListResultPage) NotDone() bool {\n\treturn !page.saarlr.IsEmpty()\n}", "func (page StorageContainerListResultPage) NotDone() bool {\n\treturn !page.sclr.IsEmpty()\n}", "func (page RoleAssignmentScheduleListResultPage) NotDone() bool {\n\treturn !page.raslr.IsEmpty()\n}", "func (page PrivateCloudListPage) NotDone() bool {\n\treturn !page.pcl.IsEmpty()\n}", "func (page ResourceProviderOperationCollectionPage) NotDone() bool {\n\treturn !page.rpoc.IsEmpty()\n}", "func (page ServiceProviderListResultPage) NotDone() bool {\n\treturn !page.splr.IsEmpty()\n}", "func (page AppCollectionListResultPage) NotDone() bool {\n\treturn !page.aclr.IsEmpty()\n}", "func (page FirewallRuleListResultPage) NotDone() bool {\n\treturn !page.frlr.IsEmpty()\n}", "func (page PermissionGetResultPage) NotDone() bool {\n\treturn !page.pgr.IsEmpty()\n}", "func (page MaintenanceWindowListResultPage) NotDone() bool {\n return !page.mwlr.IsEmpty()\n }", "func (page RoleManagementPolicyListResultPage) NotDone() bool {\n\treturn !page.rmplr.IsEmpty()\n}", "func (page ConfigurationListResultPage) NotDone() bool {\n return !page.clr.IsEmpty()\n }", "func (page RoleEligibilityScheduleRequestListResultPage) NotDone() bool {\n\treturn !page.resrlr.IsEmpty()\n}", "func (page RoleAssignmentListResultPage) NotDone() bool {\n\treturn !page.ralr.IsEmpty()\n}", "func (page SingleSignOnResourceListResponsePage) NotDone() bool {\n\treturn !page.ssorlr.IsEmpty()\n}", "func (page OrderListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "func (page RoleAssignmentScheduleRequestListResultPage) NotDone() bool {\n\treturn !page.rasrlr.IsEmpty()\n}", "func (page ServiceListPage) NotDone() bool {\n\treturn !page.sl.IsEmpty()\n}", "func (page QuotaListPage) NotDone() bool {\n\treturn !page.ql.IsEmpty()\n}", "func (page RoleAssignmentScheduleInstanceListResultPage) NotDone() bool {\n\treturn !page.rasilr.IsEmpty()\n}", "func (page EligibleChildResourcesListResultPage) NotDone() bool {\n\treturn !page.ecrlr.IsEmpty()\n}", "func (page SasTokenInformationListResultPage) NotDone() bool {\n\treturn !page.stilr.IsEmpty()\n}", "func (page AvailableSkusResultPage) NotDone() bool {\n\treturn !page.asr.IsEmpty()\n}", "func (page DeletedVaultListResultPage) NotDone() bool {\n\treturn !page.dvlr.IsEmpty()\n}", "func (page DevicesQueryResultPage) NotDone() bool {\n\treturn !page.dqr.IsEmpty()\n}", "func (page RoleEligibilityScheduleInstanceListResultPage) NotDone() bool {\n\treturn !page.resilr.IsEmpty()\n}", "func (page ConsumerGroupListResultPage) NotDone() bool {\n\treturn !page.cglr.IsEmpty()\n}", "func (page IotHubSkuDescriptionListResultPage) NotDone() bool {\n\treturn !page.ihsdlr.IsEmpty()\n}", "func (page ResourceSkusResultPage) NotDone() bool {\n\treturn !page.rsr.IsEmpty()\n}", "func (page ServiceLocationListResultPage) NotDone() bool {\n\treturn !page.sllr.IsEmpty()\n}", "func (page ServerListResultPage) NotDone() bool {\n return !page.slr.IsEmpty()\n }", "func (page RegisteredPrefixListResultPage) NotDone() bool {\n\treturn !page.rplr.IsEmpty()\n}", "func (page JobResponseListResultPage) NotDone() bool {\n\treturn !page.jrlr.IsEmpty()\n}", "func (page MonitoringTagRulesListResponsePage) NotDone() bool {\n\treturn !page.mtrlr.IsEmpty()\n}", "func (iter TaskListIterator) NotDone() bool {\n\treturn iter.page.NotDone() && iter.i < len(iter.page.Values())\n}", "func (page DataLakeAnalyticsAccountListResultPage) NotDone() bool {\n\treturn !page.dlaalr.IsEmpty()\n}", "func (page DataLakeAnalyticsAccountListResultPage) NotDone() bool {\n\treturn !page.dlaalr.IsEmpty()\n}", "func (page ProductResultPage) NotDone() bool {\n\treturn !page.pr.IsEmpty()\n}", "func (page DataLakeStoreAccountInformationListResultPage) NotDone() bool {\n\treturn !page.dlsailr.IsEmpty()\n}", "func (page FirewallRuleListResultPage) NotDone() bool {\n return !page.frlr.IsEmpty()\n }", "func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {\n\treturn !page.sasarlr.IsEmpty()\n}", "func (page SetDefinitionListResultPage) NotDone() bool {\n\treturn !page.sdlr.IsEmpty()\n}", "func (page VMResourcesListResponsePage) NotDone() bool {\n\treturn !page.vrlr.IsEmpty()\n}", "func (page ClusterListResultPage) NotDone() bool {\n\treturn !page.clr.IsEmpty()\n}", "func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool {\n\treturn !page.ihqmilr.IsEmpty()\n}", "func (page MemberCollectionPage) NotDone() bool {\n\treturn !page.mc.IsEmpty()\n}", "func (page JobResourceListPage) NotDone() bool {\n\treturn !page.jrl.IsEmpty()\n}", "func (page OdataProductResultPage) NotDone() bool {\n\treturn !page.opr.IsEmpty()\n}", "func (page ProjectListPage) NotDone() bool {\n\treturn !page.pl.IsEmpty()\n}", "func (page RoleManagementPolicyAssignmentListResultPage) NotDone() bool {\n\treturn !page.rmpalr.IsEmpty()\n}", "func (page TransactionNodeCollectionPage) NotDone() bool {\n\treturn !page.tnc.IsEmpty()\n}" ]
[ "0.8315418", "0.83018917", "0.82990164", "0.82743245", "0.82205695", "0.81844425", "0.81694674", "0.816587", "0.8165365", "0.81606287", "0.81604695", "0.8159641", "0.8126249", "0.8122022", "0.81184214", "0.81184214", "0.8112929", "0.8112929", "0.8112929", "0.8112929", "0.8112929", "0.8112929", "0.8112929", "0.81113285", "0.8107669", "0.8107669", "0.8107669", "0.8107288", "0.8090513", "0.8077779", "0.807593", "0.80696845", "0.8064535", "0.8062808", "0.8062475", "0.8056662", "0.8049706", "0.80468243", "0.80396473", "0.80317646", "0.80309165", "0.80112493", "0.80091184", "0.8006027", "0.799394", "0.79902864", "0.79821455", "0.79787755", "0.79783845", "0.7973814", "0.7962868", "0.7956511", "0.79524684", "0.7944058", "0.7941532", "0.7935897", "0.7933967", "0.79292154", "0.7929031", "0.79285455", "0.7926804", "0.79250336", "0.7922105", "0.79178876", "0.7912839", "0.79117405", "0.7911081", "0.7905561", "0.7895349", "0.7886069", "0.7885973", "0.788493", "0.78778213", "0.7873145", "0.7859912", "0.7859671", "0.78575337", "0.7857418", "0.7847785", "0.7833705", "0.7818908", "0.781825", "0.7817123", "0.7815921", "0.7815921", "0.7813924", "0.78120196", "0.78032905", "0.7802882", "0.78018504", "0.7800494", "0.77972925", "0.7788519", "0.7786745", "0.7786583", "0.7781411", "0.77748406", "0.7758642", "0.7758625" ]
0.8267647
4
Response returns the raw server response from the last page request.
func (page StorageInsightListResultPage) Response() StorageInsightListResult { return page.silr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (pl PageList) Response() *http.Response {\n\treturn pl.rawResponse\n}", "func (pbcir PageBlobsCopyIncrementalResponse) Response() *http.Response {\n\treturn pbcir.rawResponse\n}", "func (pbcpr PageBlobsClearPagesResponse) Response() *http.Response {\n\treturn pbcpr.rawResponse\n}", "func (pbupr PageBlobsUploadPagesResponse) Response() *http.Response {\n\treturn pbupr.rawResponse\n}", "func (pbusnr PageBlobsUpdateSequenceNumberResponse) Response() *http.Response {\n\treturn pbusnr.rawResponse\n}", "func (pbcr PageBlobsCreateResponse) Response() *http.Response {\n\treturn pbcr.rawResponse\n}", "func (bl BlockList) Response() *http.Response {\n\treturn bl.rawResponse\n}", "func (pbrr PageBlobsResizeResponse) Response() *http.Response {\n\treturn pbrr.rawResponse\n}", "func (bur BlobsUndeleteResponse) Response() *http.Response {\n\treturn bur.rawResponse\n}", "func (b *BaseHandler) Response() http.ResponseWriter {\n\treturn b.getResponse()\n}", "func (bcsr BlobsCreateSnapshotResponse) Response() *http.Response {\n\treturn bcsr.rawResponse\n}", "func (brlr BlobsReleaseLeaseResponse) Response() *http.Response {\n\treturn brlr.rawResponse\n}", "func (si SignedIdentifiers) Response() *http.Response {\n\treturn si.rawResponse\n}", "func (lcr ListContainersResponse) Response() *http.Response {\n\treturn lcr.rawResponse\n}", "func (dr downloadResponse) Response() *http.Response {\n\treturn dr.rawResponse\n}", "func (brlr BlobsRenewLeaseResponse) Response() *http.Response {\n\treturn brlr.rawResponse\n}", "func (abcr AppendBlobsCreateResponse) Response() *http.Response {\n\treturn abcr.rawResponse\n}", "func (ababr AppendBlobsAppendBlockResponse) Response() *http.Response {\n\treturn ababr.rawResponse\n}", "func (bblr BlobsBreakLeaseResponse) Response() *http.Response {\n\treturn bblr.rawResponse\n}", "func (bbur BlockBlobsUploadResponse) Response() *http.Response {\n\treturn bbur.rawResponse\n}", "func (bclr BlobsChangeLeaseResponse) Response() *http.Response {\n\treturn bclr.rawResponse\n}", "func (o *ServiceInstanceLastOperationGetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header RetryAfter\n\n\tretryAfter := o.RetryAfter\n\tif retryAfter != \"\" {\n\t\trw.Header().Set(\"RetryAfter\", retryAfter)\n\t}\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}", "func (cdr ContainersDeleteResponse) Response() *http.Response {\n\treturn cdr.rawResponse\n}", "func (lpr LeasePathResponse) Response() *http.Response {\n\treturn lpr.rawResponse\n}", "func (crlr ContainersReleaseLeaseResponse) Response() *http.Response {\n\treturn crlr.rawResponse\n}", "func (balr BlobsAcquireLeaseResponse) Response() *http.Response {\n\treturn balr.rawResponse\n}", "func (p *AlertsClientGetAllPager) PageResponse() AlertsClientGetAllResponse {\n\treturn p.current\n}", "func WritePageResponse(w http.ResponseWriter, data interface{}, r *http.Request, p Page) error {\n\tif p.PrevPageExists() {\n\t\tp.PrevURL = p.Prev().SetQueryParams(r.URL).String()\n\t}\n\tif p.NextPageExists() {\n\t\tp.NextURL = p.Next().SetQueryParams(r.URL).String()\n\t}\n\n\tenv := map[string]interface{}{\n\t\t\"meta\": map[string]interface{}{\n\t\t\t\"code\": http.StatusOK,\n\t\t},\n\t\t\"data\": data,\n\t\t\"pagination\": p,\n\t}\n\treturn jsonResponse(w, env)\n}", "func (bshhr BlobsSetHTTPHeadersResponse) Response() *http.Response {\n\treturn bshhr.rawResponse\n}", "func (bstr BlobsSetTierResponse) Response() *http.Response {\n\treturn bstr.rawResponse\n}", "func (cclr ContainersChangeLeaseResponse) Response() *http.Response {\n\treturn cclr.rawResponse\n}", "func (bbsbr BlockBlobsStageBlockResponse) Response() *http.Response {\n\treturn bbsbr.rawResponse\n}", "func (lbhr ListBlobsHierarchyResponse) Response() *http.Response {\n\treturn lbhr.rawResponse\n}", "func (bdr BlobsDeleteResponse) Response() *http.Response {\n\treturn bdr.rawResponse\n}", "func (cblr ContainersBreakLeaseResponse) Response() *http.Response {\n\treturn cblr.rawResponse\n}", "func (sss StorageServiceStats) Response() *http.Response {\n\treturn sss.rawResponse\n}", "func (crlr ContainersRenewLeaseResponse) Response() *http.Response {\n\treturn crlr.rawResponse\n}", "func (o *ServiceInstanceLastOperationGetDefault) 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}", "func (bscfur BlobsStartCopyFromURLResponse) Response() *http.Response {\n\treturn bscfur.rawResponse\n}", "func (cfr CreateFilesystemResponse) Response() *http.Response {\n\treturn cfr.rawResponse\n}", "func (csapr ContainersSetAccessPolicyResponse) Response() *http.Response {\n\treturn csapr.rawResponse\n}", "func (p *RouteTablesClientListAllPager) PageResponse() RouteTablesClientListAllResponse {\n\treturn p.current\n}", "func (p *ReservationClientListAllPager) PageResponse() ReservationClientListAllResponse {\n\treturn p.current\n}", "func (bsmr BlobsSetMetadataResponse) Response() *http.Response {\n\treturn bsmr.rawResponse\n}", "func (iter OperationsIterator) Response() Operations {\n\treturn iter.page.Response()\n}", "func (iter OrderListIterator) Response() OrderList {\n\treturn iter.page.Response()\n}", "func (upr UpdatePathResponse) Response() *http.Response {\n\treturn upr.rawResponse\n}", "func Responses(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer Default.Sync()\n\t\tvar written int64\n\t\tvar status = -1\n\n\t\twp := writerProxy{\n\t\t\th: func() http.Header {\n\t\t\t\treturn w.Header()\n\t\t\t},\n\t\t\tw: func(bytes []byte) (int, error) {\n\t\t\t\tbw, err := w.Write(bytes)\n\t\t\t\twritten += int64(bw)\n\t\t\t\treturn bw, err\n\t\t\t},\n\t\t\twh: func(code int) {\n\t\t\t\tstatus = code\n\t\t\t\tw.WriteHeader(code)\n\t\t\t},\n\t\t}\n\n\t\tstart := time.Now()\n\t\tnext.ServeHTTP(wp, r)\n\t\tduration := time.Now().Sub(start)\n\n\t\t// Use default status.\n\t\tif status == -1 {\n\t\t\tstatus = 200\n\t\t}\n\n\t\tlogResponse(r.Method, r.URL.String(), status, written, duration)\n\t})\n}", "func (bbcblr BlockBlobsCommitBlockListResponse) Response() *http.Response {\n\treturn bbcblr.rawResponse\n}", "func (p *RoutesClientListPager) PageResponse() RoutesClientListResponse {\n\treturn p.current\n}", "func (p *ManagementClientGetActiveSessionsPager) PageResponse() ManagementClientGetActiveSessionsResponse {\n\treturn p.current\n}", "func (p *ReservationClientListRevisionsPager) PageResponse() ReservationClientListRevisionsResponse {\n\treturn p.current\n}", "func (p *PoolsClientListPager) PageResponse() PoolsClientListResponse {\n\treturn p.current\n}", "func (calr ContainersAcquireLeaseResponse) Response() *http.Response {\n\treturn calr.rawResponse\n}", "func (lbfr ListBlobsFlatResponse) Response() *http.Response {\n\treturn lbfr.rawResponse\n}", "func (p *ManagementClientDisconnectActiveSessionsPager) PageResponse() ManagementClientDisconnectActiveSessionsResponse {\n\treturn p.current\n}", "func (ccr ContainersCreateResponse) Response() *http.Response {\n\treturn ccr.rawResponse\n}", "func (bgpr BlobsGetPropertiesResponse) Response() *http.Response {\n\treturn bgpr.rawResponse\n}", "func (b *BaseHandler) getResponse() http.ResponseWriter {\n\treturn b.response\n}", "func (s *Server) Response(body string) string {\n\treturn \"HTTP/1.1 200 OK\\r\\n\" +\n\t\t\"Content-Length: \" + strconv.Itoa(len(body)) + lineBreaker +\n\t\t\"Content-Type: text/html\\r\\n\" +\n\t\t\"Connection: close\\r\\n\" +\n\t\tlineBreaker + body\n}", "func (p *LinkedServerListPager) PageResponse() LinkedServerListResponse {\n\treturn p.current\n}", "func (cpr CreatePathResponse) Response() *http.Response {\n\treturn cpr.rawResponse\n}", "func (rpr ReadPathResponse) Response() *http.Response {\n\treturn rpr.rawResponse\n}", "func (dfr DeleteFilesystemResponse) Response() *http.Response {\n\treturn dfr.rawResponse\n}", "func (page OperationsPage) Response() Operations {\n\treturn page.o\n}", "func (bacfur BlobsAbortCopyFromURLResponse) Response() *http.Response {\n\treturn bacfur.rawResponse\n}", "func (p *ApplicationGatewaysClientListAllPager) PageResponse() ApplicationGatewaysClientListAllResponse {\n\treturn p.current\n}", "func (iter ServerListResultIterator) Response() ServerListResult {\n return iter.page.Response()\n }", "func (response ListPipelinesResponse) HTTPResponse() *http.Response {\n\treturn response.RawResponse\n}", "func (p *AppsClientListPager) PageResponse() AppsClientListResponse {\n\treturn p.current\n}", "func (iter ListIterator) Response() List {\n\treturn iter.page.Response()\n}", "func (p *FlowLogsClientListPager) PageResponse() FlowLogsClientListResponse {\n\treturn p.current\n}", "func (csmr ContainersSetMetadataResponse) Response() *http.Response {\n\treturn csmr.rawResponse\n}", "func (cgpr ContainersGetPropertiesResponse) Response() *http.Response {\n\treturn cgpr.rawResponse\n}", "func (p *RouteTablesClientListPager) PageResponse() RouteTablesClientListResponse {\n\treturn p.current\n}", "func (iter TaskListIterator) Response() TaskList {\n\treturn iter.page.Response()\n}", "func (dpr DeletePathResponse) Response() *http.Response {\n\treturn dpr.rawResponse\n}", "func (o *ArtifactListerPartialContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Next\n\n\tnext := o.Next\n\tif next != \"\" {\n\t\trw.Header().Set(\"Next\", next)\n\t}\n\n\t// response header Previous\n\n\tprevious := o.Previous\n\tif previous != \"\" {\n\t\trw.Header().Set(\"Previous\", previous)\n\t}\n\n\t// response header RemainingRecords\n\n\tremainingRecords := swag.FormatUint64(o.RemainingRecords)\n\tif remainingRecords != \"\" {\n\t\trw.Header().Set(\"RemainingRecords\", remainingRecords)\n\t}\n\n\t// response header TotalRecords\n\n\ttotalRecords := swag.FormatUint64(o.TotalRecords)\n\tif totalRecords != \"\" {\n\t\trw.Header().Set(\"TotalRecords\", totalRecords)\n\t}\n\n\trw.WriteHeader(206)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make([]*weles.ArtifactInfo, 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}", "func (p *ManagementClientGetBastionShareableLinkPager) PageResponse() ManagementClientGetBastionShareableLinkResponse {\n\treturn p.current\n}", "func (p *VirtualNetworksClientListAllPager) PageResponse() VirtualNetworksClientListAllResponse {\n\treturn p.current\n}", "func (p *OperationsListPager) PageResponse() OperationsListResponse {\n\treturn p.current\n}", "func (p *OperationsListPager) PageResponse() OperationsListResponse {\n\treturn p.current\n}", "func (p *OperationsListPager) PageResponse() OperationsListResponse {\n\treturn p.current\n}", "func (iter OperationListIterator) Response() OperationList {\n\treturn iter.page.Response()\n}", "func (iter OperationListIterator) Response() OperationList {\n\treturn iter.page.Response()\n}", "func (iter OperationListIterator) Response() OperationList {\n\treturn iter.page.Response()\n}", "func (dr DownloadResponse) Response() *http.Response {\n\treturn dr.dr.Response()\n}", "func (p *InterfacesClientListAllPager) PageResponse() InterfacesClientListAllResponse {\n\treturn p.current\n}", "func (iter QuotaListIterator) Response() QuotaList {\n\treturn iter.page.Response()\n}", "func (iter PrivateCloudListIterator) Response() PrivateCloudList {\n\treturn iter.page.Response()\n}", "func (p *SmartGroupsClientGetAllPager) PageResponse() SmartGroupsClientGetAllResponse {\n\treturn p.current\n}", "func (gppr GetPathPropertiesResponse) Response() *http.Response {\n\treturn gppr.rawResponse\n}", "func (p *VirtualWansClientListPager) PageResponse() VirtualWansClientListResponse {\n\treturn p.current\n}", "func (page ServerListResultPage) Response() ServerListResult {\n return page.slr\n }", "func (cl *APIClient) RequestNextResponsePage(rr *R.Response) (*R.Response, error) {\n\tmycmd := cl.toUpperCaseKeys(rr.GetCommand())\n\tif _, ok := mycmd[\"LAST\"]; ok {\n\t\treturn nil, errors.New(\"Parameter LAST in use. Please remove it to avoid issues in requestNextPage\")\n\t}\n\tfirst := 0\n\tif v, ok := mycmd[\"FIRST\"]; ok {\n\t\tfirst, _ = fmt.Sscan(\"%s\", v)\n\t}\n\ttotal := rr.GetRecordsTotalCount()\n\tlimit := rr.GetRecordsLimitation()\n\tfirst += limit\n\tif first < total {\n\t\tmycmd[\"FIRST\"] = fmt.Sprintf(\"%d\", first)\n\t\tmycmd[\"LIMIT\"] = fmt.Sprintf(\"%d\", limit)\n\t\treturn cl.Request(mycmd), nil\n\t}\n\treturn nil, errors.New(\"Could not find further existing pages\")\n}", "func (iter VMResourcesListResponseIterator) Response() VMResourcesListResponse {\n\treturn iter.page.Response()\n}", "func (p *P2SVPNGatewaysClientListPager) PageResponse() P2SVPNGatewaysClientListResponse {\n\treturn p.current\n}", "func (response ListBatchInstancesResponse) HTTPResponse() *http.Response {\n\treturn response.RawResponse\n}", "func (p *FileSharesClientListPager) PageResponse() FileSharesClientListResponse {\n\treturn p.current\n}", "func (p *HubRouteTablesClientListPager) PageResponse() HubRouteTablesClientListResponse {\n\treturn p.current\n}", "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}" ]
[ "0.7152825", "0.6988708", "0.6846365", "0.6735078", "0.65995663", "0.633469", "0.63318527", "0.63217014", "0.62835306", "0.6281629", "0.6234478", "0.6225371", "0.62236917", "0.62086654", "0.617455", "0.61545783", "0.61418515", "0.61391413", "0.6127459", "0.609929", "0.6090572", "0.60891986", "0.6062124", "0.6047994", "0.60471755", "0.6044305", "0.6032144", "0.6030253", "0.60300547", "0.60223216", "0.6013413", "0.60097474", "0.60095435", "0.6002005", "0.599272", "0.5980507", "0.5954163", "0.5949233", "0.5945626", "0.59391683", "0.59363407", "0.59278023", "0.5921352", "0.59179103", "0.5911672", "0.5901132", "0.589899", "0.58865356", "0.5883034", "0.5881915", "0.58817816", "0.58703846", "0.58623105", "0.5858975", "0.5856571", "0.58497685", "0.58460647", "0.5840336", "0.5833904", "0.583201", "0.582968", "0.5822061", "0.58201134", "0.58109003", "0.5809613", "0.58025265", "0.5799737", "0.5798601", "0.579037", "0.5781486", "0.5777205", "0.577689", "0.5770703", "0.57658905", "0.57507455", "0.5749598", "0.57475555", "0.57419086", "0.57413733", "0.5737293", "0.57370555", "0.57370555", "0.57370555", "0.57369", "0.57369", "0.57369", "0.5733603", "0.57328236", "0.57302976", "0.5729266", "0.5728599", "0.5726558", "0.57259643", "0.57251877", "0.57248783", "0.5719684", "0.57191736", "0.5711424", "0.5710941", "0.5710339", "0.56989336" ]
0.0
-1
Values returns the slice of values for the current page or nil if there are no values.
func (page StorageInsightListResultPage) Values() []StorageInsight { if page.silr.IsEmpty() { return nil } return *page.silr.Value }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (pb *PageBuffer) Values() interface{} {\n offset := pb.pageOffset(pb.page_no)\n return pb.buffer.Slice(offset, offset + pb.idx).Interface()\n}", "func (page ListPage) Values() []Response {\n\tif page.l.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.l.Value\n}", "func (page StorageAccountInformationListResultPage) Values() []StorageAccountInformation {\n\tif page.sailr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sailr.Value\n}", "func (page PrivateCloudListPage) Values() []PrivateCloud {\n\tif page.pcl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.pcl.Value\n}", "func (page AccountsPage) Values() []Account {\n\tif page.a.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.a.Value\n}", "func (page VaultListResultPage) Values() []Vault {\n\tif page.vlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.vlr.Value\n}", "func (page ExemptionListResultPage) Values() []Exemption {\n\tif page.elr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.elr.Value\n}", "func (page UsageAggregationListResultPage) Values() []UsageAggregation {\n\tif page.ualr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ualr.Value\n}", "func (page StorageContainerListResultPage) Values() []StorageContainer {\n\tif page.sclr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sclr.Value\n}", "func (page QuotaListPage) Values() []Quota {\n\tif page.ql.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ql.Value\n}", "func (page ListResultPage) Values() []Model {\n\tif page.lr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.lr.Value\n}", "func (page SasTokenInformationListResultPage) Values() []SasTokenInformation {\n\tif page.stilr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.stilr.Value\n}", "func (page CampaignsListResultPage) Values() []CampaignListResult {\n\tif page.clr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.clr.Value\n}", "func (page ProviderOperationsMetadataListResultPage) Values() []ProviderOperationsMetadata {\n\tif page.pomlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.pomlr.Value\n}", "func (page DataLakeStoreAccountInformationListResultPage) Values() []DataLakeStoreAccountInformation {\n\tif page.dlsailr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dlsailr.Value\n}", "func (page DefinitionListResultPage) Values() []Definition {\n\tif page.dlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dlr.Value\n}", "func (page MemberCollectionPage) Values() []Member {\n\tif page.mc.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.mc.Value\n}", "func (page ProductResultValuePage) Values() []Product {\n\tif page.prv.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.prv.Value\n}", "func (page ServiceProviderListResultPage) Values() []ServiceProvider {\n\tif page.splr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.splr.Value\n}", "func (page AvailableSkusResultPage) Values() []SkuInformation {\n\tif page.asr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.asr.Value\n}", "func (page EndpointHealthDataListResultPage) Values() []EndpointHealthData {\n\tif page.ehdlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ehdlr.Value\n}", "func (page ProductResultPage) Values() []Product {\n\tif page.pr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.pr.Values\n}", "func (page DataLakeAnalyticsAccountListResultPage) Values() []DataLakeAnalyticsAccountBasic {\n\tif page.dlaalr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dlaalr.Value\n}", "func (page PermissionGetResultPage) Values() []Permission {\n\tif page.pgr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.pgr.Value\n}", "func (page ProjectListPage) Values() []Project {\n\tif page.pl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.pl.Value\n}", "func (page AppCollectionListResultPage) Values() []AppCollection {\n\tif page.aclr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.aclr.Value\n}", "func (page RegistrationAssignmentListPage) Values() []RegistrationAssignment {\n\tif page.ral.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ral.Value\n}", "func (page DatabaseListResultPage) Values() []Database {\n if page.dlr.IsEmpty() {\n return nil\n }\n return *page.dlr.Value\n }", "func (page ResourceListResultPage) Values() []Resource {\n\tif page.rlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.rlr.Value\n}", "func (page AssignmentListResultPage) Values() []Assignment {\n\tif page.alr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.alr.Value\n}", "func (page DataLakeAnalyticsAccountListResultPage) Values() []DataLakeAnalyticsAccount {\n\tif page.dlaalr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dlaalr.Value\n}", "func (page OperationsPage) Values() []OperationDetail {\n\tif page.o.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.o.Value\n}", "func (page LocationListResultPage) Values() []Location {\n\tif page.llr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.llr.Value\n}", "func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo {\n\tif page.ihqmilr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ihqmilr.Value\n}", "func (page MonitoredResourceListResponsePage) Values() []MonitoredResource {\n\tif page.mrlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.mrlr.Value\n}", "func (page ServiceListPage) Values() []Service {\n\tif page.sl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sl.Value\n}", "func (page DataPolicyManifestListResultPage) Values() []DataPolicyManifest {\n\tif page.dpmlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dpmlr.Value\n}", "func (page RegisteredAsnListResultPage) Values() []RegisteredAsn {\n\tif page.ralr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ralr.Value\n}", "func (page OrderListPage) Values() []OrderResponse {\n\tif page.ol.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ol.Value\n}", "func (page DevicesQueryResultPage) Values() []DeviceQueryResult {\n\tif page.dqr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dqr.Value\n}", "func (page ServiceLocationListResultPage) Values() []ServiceLocation {\n\tif page.sllr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sllr.Value\n}", "func (page VMResourcesListResponsePage) Values() []VMResources {\n\tif page.vrlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.vrlr.Value\n}", "func (page PeerAsnListResultPage) Values() []PeerAsn {\n\tif page.palr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.palr.Value\n}", "func (page ListSasTokensResultPage) Values() []SasTokenInfo {\n\tif page.lstr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.lstr.Value\n}", "func (page ComputePolicyListResultPage) Values() []ComputePolicy {\n\tif page.cplr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.cplr.Value\n}", "func (page RegistrationDefinitionListPage) Values() []RegistrationDefinition {\n\tif page.rdl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.rdl.Value\n}", "func (page SingleSignOnResourceListResponsePage) Values() []SingleSignOnResource {\n\tif page.ssorlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ssorlr.Value\n}", "func (page ClassicAdministratorListResultPage) Values() []ClassicAdministrator {\n\tif page.calr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.calr.Value\n}", "func (page ExportTaskListResultPage) Values() []ExportTaskResult {\n\tif page.etlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.etlr.Value\n}", "func (page ConsortiumMemberCollectionPage) Values() []ConsortiumMember {\n\tif page.cmc.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.cmc.Value\n}", "func (page ListResultPage) Values() []ResourceType {\n\tif page.lr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.lr.Value\n}", "func (page AppListResultPage) Values() []App {\n\tif page.alr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.alr.Value\n}", "func (page ResourceSkusResultPage) Values() []ResourceSku {\n\tif page.rsr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.rsr.Value\n}", "func (page OdataProductResultPage) Values() []Product {\n\tif page.opr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.opr.Values\n}", "func (page ServiceListResultPage) Values() []Service {\n\tif page.slr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.slr.Value\n}", "func (page ClusterListPage) Values() []Cluster {\n\tif page.cl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.cl.Value\n}", "func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription {\n\tif page.ihsdlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ihsdlr.Value\n}", "func (page DataSourceListResultPage) Values() []DataSource {\n\tif page.dslr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dslr.Value\n}", "func (page DataLakeAnalyticsAccountListDataLakeStoreResultPage) Values() []DataLakeStoreAccountInfo {\n\tif page.dlaaldlsr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dlaaldlsr.Value\n}", "func (page MaintenanceWindowListResultPage) Values() []MaintenanceWindow {\n if page.mwlr.IsEmpty() {\n return nil\n }\n return *page.mwlr.Value\n }", "func (page ServiceSkuListPage) Values() []AvailableServiceSku {\n\tif page.ssl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ssl.Value\n}", "func (page JobResponseListResultPage) Values() []JobResponse {\n\tif page.jrlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.jrlr.Value\n}", "func (page ConfigurationListResultPage) Values() []Configuration {\n if page.clr.IsEmpty() {\n return nil\n }\n return *page.clr.Value\n }", "func (page DeletedVaultListResultPage) Values() []DeletedVault {\n\tif page.dvlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dvlr.Value\n}", "func (page MachineListResultPage) Values() []Machine {\n\tif page.mlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.mlr.Value\n}", "func (c *AdapterMemory) Values(ctx context.Context) ([]interface{}, error) {\n\treturn c.data.Values()\n}", "func (h *Heap) GetValues() []interface{} {\n\tif h.size > 0 {\n\t\treturn h.values[1:]\n\t}\n\treturn []interface{}{}\n}", "func (page SQLServerRegistrationListResultPage) Values() []SQLServerRegistration {\n\tif page.ssrlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ssrlr.Value\n}", "func (page MonitorResourceListResponsePage) Values() []MonitorResource {\n\tif page.mrlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.mrlr.Value\n}", "func (page DataLakeAnalyticsAccountListStorageAccountsResultPage) Values() []StorageAccountInfo {\n\tif page.dlaalsar.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dlaalsar.Value\n}", "func (page ServerListResultPage) Values() []Server {\n if page.slr.IsEmpty() {\n return nil\n }\n return *page.slr.Value\n }", "func (page ListBlobContainersResultPage) Values() []BlobContainer {\n\tif page.lbcr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.lbcr.Value\n}", "func (o *InlineObject794) GetValues() AnyOfobject {\n\tif o == nil || o.Values == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret\n\t}\n\treturn *o.Values\n}", "func (page TaskListPage) Values() []ProjectTask {\n\tif page.tl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.tl.Value\n}", "func (page OperationListPage) Values() []OperationResponse {\n\tif page.ol.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ol.Value\n}", "func (page NamespaceListResultPage) Values() []NamespaceResource {\n\tif page.nlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.nlr.Value\n}", "func (page IotHubDescriptionListResultPage) Values() []IotHubDescription {\n\tif page.ihdlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ihdlr.Value\n}", "func (page ClusterListResultPage) Values() []Cluster {\n\tif page.clr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.clr.Value\n}", "func (page ImportTaskListResultPage) Values() []ImportTaskResult {\n\tif page.itlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.itlr.Value\n}", "func (d *adapterMemoryData) Values() ([]interface{}, error) {\n\td.mu.RLock()\n\tvar (\n\t\tindex = 0\n\t\tvalues = make([]interface{}, len(d.data))\n\t)\n\tfor _, v := range d.data {\n\t\tif !v.IsExpired() {\n\t\t\tvalues[index] = v.v\n\t\t\tindex++\n\t\t}\n\t}\n\td.mu.RUnlock()\n\treturn values, nil\n}", "func (page MachineExtensionsListResultPage) Values() []MachineExtension {\n\tif page.melr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.melr.Value\n}", "func (page RoleEligibilityScheduleListResultPage) Values() []RoleEligibilitySchedule {\n\tif page.reslr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.reslr.Value\n}", "func (page JobResourceListPage) Values() []JobResource {\n\tif page.jrl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.jrl.Value\n}", "func (page SQLServerListResultPage) Values() []SQLServer {\n\tif page.sslr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sslr.Value\n}", "func (page TransactionNodeCollectionPage) Values() []TransactionNode {\n\tif page.tnc.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.tnc.Value\n}", "func (page OperationListResultPage) Values() []OperationResult {\n\tif page.olr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.olr.Value\n}", "func (s *Store) Values() []interface{} {\n\ts.access.RLock()\n\tdefer s.access.RUnlock()\n\n\tcpy := make([]interface{}, len(s.data))\n\ti := 0\n\tfor _, value := range s.data {\n\t\tcpy[i] = value\n\t\ti++\n\t}\n\treturn cpy\n}", "func (s SExp) Value() []Value {\n\treturn s.values\n}", "func (page RoleEligibilityScheduleInstanceListResultPage) Values() []RoleEligibilityScheduleInstance {\n\tif page.resilr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.resilr.Value\n}", "func (page ServiceCountryListResultPage) Values() []ServiceCountry {\n\tif page.sclr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sclr.Value\n}", "func (page EligibleChildResourcesListResultPage) Values() []EligibleChildResource {\n\tif page.ecrlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.ecrlr.Value\n}", "func (page RoleDefinitionListResultPage) Values() []RoleDefinition {\n\tif page.rdlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.rdlr.Value\n}", "func (page MonitoringTagRulesListResponsePage) Values() []MonitoringTagRules {\n\tif page.mtrlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.mtrlr.Value\n}", "func (c *Scratch) Values() map[string]any {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\treturn c.values\n}", "func (page CreatorListPage) Values() []Creator {\n\tif page.cl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.cl.Value\n}", "func (page ConsumerGroupListResultPage) Values() []ConsumerGroupResource {\n\tif page.cglr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.cglr.Value\n}", "func (o *InlineObject985) GetValues() AnyOfobject {\n\tif o == nil || o.Values == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret\n\t}\n\treturn *o.Values\n}", "func (page RoleManagementPolicyAssignmentListResultPage) Values() []RoleManagementPolicyAssignment {\n\tif page.rmpalr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.rmpalr.Value\n}", "func (e *Extractor) Values() (out []interface{}, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := reflect.ValueOf(e.StructAddr).Elem()\n\tfields := e.fields(s)\n\n\tfor _, field := range fields {\n\t\tout = append(out, field.value.Interface())\n\n\t}\n\n\treturn\n}" ]
[ "0.7654567", "0.7346644", "0.73363185", "0.72265273", "0.7211247", "0.71350276", "0.7070794", "0.70651084", "0.70329046", "0.7027498", "0.6998242", "0.6979039", "0.69377184", "0.6936967", "0.69369626", "0.69220424", "0.69169164", "0.69056356", "0.6904654", "0.6867419", "0.68581486", "0.6840296", "0.68090004", "0.6735298", "0.6733434", "0.6720803", "0.67188466", "0.670275", "0.6701074", "0.6699351", "0.6683409", "0.6683153", "0.6677967", "0.6649444", "0.6599922", "0.6593081", "0.6589023", "0.65816295", "0.65722156", "0.6565171", "0.65622246", "0.6556477", "0.6543768", "0.65285796", "0.65136", "0.6507266", "0.6507061", "0.6505059", "0.64783907", "0.6470208", "0.64651895", "0.6462357", "0.6457406", "0.6453835", "0.64510286", "0.6449606", "0.64426994", "0.6432797", "0.64079344", "0.640417", "0.63832784", "0.63707566", "0.63629526", "0.6362465", "0.6359395", "0.63575685", "0.635278", "0.63511527", "0.63494146", "0.6343068", "0.63306147", "0.6329132", "0.6327599", "0.63189995", "0.6307736", "0.63048005", "0.6296581", "0.62926346", "0.62643397", "0.6263826", "0.62637484", "0.62631637", "0.6261933", "0.62541485", "0.62401986", "0.62307864", "0.62201697", "0.61934996", "0.6188392", "0.6146272", "0.614226", "0.6131348", "0.61294526", "0.61273915", "0.6113571", "0.6110442", "0.60836047", "0.6080018", "0.6077042" ]
0.737646
1
Creates a new instance of the StorageInsightListResultPage type.
func NewStorageInsightListResultPage(getNextPage func(context.Context, StorageInsightListResult) (StorageInsightListResult, error)) StorageInsightListResultPage { return StorageInsightListResultPage{fn: getNextPage} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewStorageInsightListResultPage(cur StorageInsightListResult, getNextPage func(context.Context, StorageInsightListResult) (StorageInsightListResult, error)) StorageInsightListResultPage {\n\treturn StorageInsightListResultPage{\n\t\tfn: getNextPage,\n\t\tsilr: cur,\n\t}\n}", "func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {\n\treturn ListResultPage{fn: getNextPage}\n}", "func NewStorageContainerListResultPage(getNextPage func(context.Context, StorageContainerListResult) (StorageContainerListResult, error)) StorageContainerListResultPage {\n\treturn StorageContainerListResultPage{fn: getNextPage}\n}", "func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {\n\treturn ListResultPage{\n\t\tfn: getNextPage,\n\t\tlr: cur,\n\t}\n}", "func NewStorageAccountInformationListResultPage(getNextPage func(context.Context, StorageAccountInformationListResult) (StorageAccountInformationListResult, error)) StorageAccountInformationListResultPage {\n\treturn StorageAccountInformationListResultPage{fn: getNextPage}\n}", "func NewMaintenanceWindowListResultPage (getNextPage func(context.Context, MaintenanceWindowListResult) (MaintenanceWindowListResult, error)) MaintenanceWindowListResultPage {\n return MaintenanceWindowListResultPage{fn: getNextPage}\n }", "func NewDatabaseListResultPage (getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage {\n return DatabaseListResultPage{fn: getNextPage}\n }", "func NewServerListResultPage (getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {\n return ServerListResultPage{fn: getNextPage}\n }", "func NewConfigurationListResultPage (getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage {\n return ConfigurationListResultPage{fn: getNextPage}\n }", "func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{fn: getNextPage}\n}", "func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{fn: getNextPage}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {\n\treturn OperationListResultPage{\n\t\tfn: getNextPage,\n\t\tolr: cur,\n\t}\n}", "func NewDefinitionListResultPage(cur DefinitionListResult, getNextPage func(context.Context, DefinitionListResult) (DefinitionListResult, error)) DefinitionListResultPage {\n\treturn DefinitionListResultPage{\n\t\tfn: getNextPage,\n\t\tdlr: cur,\n\t}\n}", "func NewListPage(getNextPage func(context.Context, List) (List, error)) ListPage {\n\treturn ListPage{fn: getNextPage}\n}", "func NewSetDefinitionListResultPage(cur SetDefinitionListResult, getNextPage func(context.Context, SetDefinitionListResult) (SetDefinitionListResult, error)) SetDefinitionListResultPage {\n\treturn SetDefinitionListResultPage{\n\t\tfn: getNextPage,\n\t\tsdlr: cur,\n\t}\n}", "func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage {\n\treturn ServiceListResultPage{\n\t\tfn: getNextPage,\n\t\tslr: cur,\n\t}\n}", "func NewExemptionListResultPage(cur ExemptionListResult, getNextPage func(context.Context, ExemptionListResult) (ExemptionListResult, error)) ExemptionListResultPage {\n\treturn ExemptionListResultPage{\n\t\tfn: getNextPage,\n\t\telr: cur,\n\t}\n}", "func NewOperationListPage(getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage {\n\treturn OperationListPage{fn: getNextPage}\n}", "func NewOperationListPage(getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage {\n\treturn OperationListPage{fn: getNextPage}\n}", "func NewOperationListPage(getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage {\n\treturn OperationListPage{fn: getNextPage}\n}", "func NewMachineListResultPage(cur MachineListResult, getNextPage func(context.Context, MachineListResult) (MachineListResult, error)) MachineListResultPage {\n\treturn MachineListResultPage{\n\t\tfn: getNextPage,\n\t\tmlr: cur,\n\t}\n}", "func NewDataSourceListResultPage(cur DataSourceListResult, getNextPage func(context.Context, DataSourceListResult) (DataSourceListResult, error)) DataSourceListResultPage {\n\treturn DataSourceListResultPage{\n\t\tfn: getNextPage,\n\t\tdslr: cur,\n\t}\n}", "func NewComputePolicyListResultPage(getNextPage func(context.Context, ComputePolicyListResult) (ComputePolicyListResult, error)) ComputePolicyListResultPage {\n\treturn ComputePolicyListResultPage{fn: getNextPage}\n}", "func NewSQLServerListResultPage(getNextPage func(context.Context, SQLServerListResult) (SQLServerListResult, error)) SQLServerListResultPage {\n\treturn SQLServerListResultPage{fn: getNextPage}\n}", "func NewStorageInsightListResultIterator(page StorageInsightListResultPage) StorageInsightListResultIterator {\n\treturn StorageInsightListResultIterator{page: page}\n}", "func NewStorageInsightListResultIterator(page StorageInsightListResultPage) StorageInsightListResultIterator {\n\treturn StorageInsightListResultIterator{page: page}\n}", "func NewClusterListResultPage(cur ClusterListResult, getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage {\n\treturn ClusterListResultPage{\n\t\tfn: getNextPage,\n\t\tclr: cur,\n\t}\n}", "func (page *StorageInsightListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func (page *StorageInsightListResultPage) Next() error {\n\treturn page.NextWithContext(context.Background())\n}", "func NewFirewallRuleListResultPage (getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {\n return FirewallRuleListResultPage{fn: getNextPage}\n }", "func (client *ScriptExecutionsClient) NewListPager(resourceGroupName string, privateCloudName string, options *ScriptExecutionsClientListOptions) *runtime.Pager[ScriptExecutionsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ScriptExecutionsClientListResponse]{\n\t\tMore: func(page ScriptExecutionsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ScriptExecutionsClientListResponse) (ScriptExecutionsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, privateCloudName, 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 ScriptExecutionsClientListResponse{}, 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 ScriptExecutionsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ScriptExecutionsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewEndpointHealthDataListResultPage(cur EndpointHealthDataListResult, getNextPage func(context.Context, EndpointHealthDataListResult) (EndpointHealthDataListResult, error)) EndpointHealthDataListResultPage {\n\treturn EndpointHealthDataListResultPage{\n\t\tfn: getNextPage,\n\t\tehdlr: cur,\n\t}\n}", "func NewLocationListResultPage(cur LocationListResult, getNextPage func(context.Context, LocationListResult) (LocationListResult, error)) LocationListResultPage {\n\treturn LocationListResultPage{\n\t\tfn: getNextPage,\n\t\tllr: cur,\n\t}\n}", "func NewNamespaceListResultPage(getNextPage func(context.Context, NamespaceListResult) (NamespaceListResult, error)) NamespaceListResultPage {\n\treturn NamespaceListResultPage{fn: getNextPage}\n}", "func NewServiceProviderListResultPage(cur ServiceProviderListResult, getNextPage func(context.Context, ServiceProviderListResult) (ServiceProviderListResult, error)) ServiceProviderListResultPage {\n\treturn ServiceProviderListResultPage{\n\t\tfn: getNextPage,\n\t\tsplr: cur,\n\t}\n}", "func (client *ReplicationProtectionContainersClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationProtectionContainersClientListOptions) *runtime.Pager[ReplicationProtectionContainersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ReplicationProtectionContainersClientListResponse]{\n\t\tMore: func(page ReplicationProtectionContainersClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ReplicationProtectionContainersClientListResponse) (ReplicationProtectionContainersClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ReplicationProtectionContainersClientListResponse{}, 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 ReplicationProtectionContainersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ReplicationProtectionContainersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewQuotaListPage(getNextPage func(context.Context, QuotaList) (QuotaList, error)) QuotaListPage {\n\treturn QuotaListPage{fn: getNextPage}\n}", "func NewSasTokenInformationListResultPage(getNextPage func(context.Context, SasTokenInformationListResult) (SasTokenInformationListResult, error)) SasTokenInformationListResultPage {\n\treturn SasTokenInformationListResultPage{fn: getNextPage}\n}", "func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage {\n\treturn MonitorResourceListResponsePage{\n\t\tfn: getNextPage,\n\t\tmrlr: cur,\n\t}\n}", "func NewPaginatedList(page, perPage, total int) *PaginatedList {\r\n\tif perPage < 1 {\r\n\t\tperPage = 100\r\n\t}\r\n\tpageCount := -1\r\n\tif total >= 0 {\r\n\t\tpageCount = (total + perPage - 1) / perPage\r\n\r\n\t}\r\n\tif page < 1 {\r\n\t\tpage = 1\r\n\t}\r\n\r\n\treturn &PaginatedList{\r\n\t\tPage: page,\r\n\t\tPerPage: perPage,\r\n\t\tTotalCount: total,\r\n\t\tPageCount: pageCount,\r\n\t}\r\n}", "func NewServiceListPage(getNextPage func(context.Context, ServiceList) (ServiceList, error)) ServiceListPage {\n\treturn ServiceListPage{fn: getNextPage}\n}", "func (client *Client) NewListPager(resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *ClientListOptions) *runtime.Pager[ClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ClientListResponse]{\n\t\tMore: func(page ClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, resourceType, resourceName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func (client *CloudServicesClient) NewListPager(resourceGroupName string, options *CloudServicesClientListOptions) *runtime.Pager[CloudServicesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CloudServicesClientListResponse]{\n\t\tMore: func(page CloudServicesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CloudServicesClientListResponse) (CloudServicesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CloudServicesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.pl.Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CloudServicesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CloudServicesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func (client *IPAllocationsClient) NewListPager(options *IPAllocationsClientListOptions) *runtime.Pager[IPAllocationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[IPAllocationsClientListResponse]{\n\t\tMore: func(page IPAllocationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *IPAllocationsClientListResponse) (IPAllocationsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn IPAllocationsClientListResponse{}, 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 IPAllocationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn IPAllocationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func (client *SapMonitorsClient) NewListPager(options *SapMonitorsClientListOptions) *runtime.Pager[SapMonitorsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SapMonitorsClientListResponse]{\n\t\tMore: func(page SapMonitorsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SapMonitorsClientListResponse) (SapMonitorsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SapMonitorsClientListResponse{}, 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 SapMonitorsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SapMonitorsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewDataPolicyManifestListResultPage(cur DataPolicyManifestListResult, getNextPage func(context.Context, DataPolicyManifestListResult) (DataPolicyManifestListResult, error)) DataPolicyManifestListResultPage {\n\treturn DataPolicyManifestListResultPage{\n\t\tfn: getNextPage,\n\t\tdpmlr: cur,\n\t}\n}", "func New(isupport *isupport.ISupport) *List {\n\treturn &List{\n\t\tisupport: isupport,\n\t\tusers: make([]*User, 0, 64),\n\t\tindex: make(map[string]*User, 64),\n\t\tautosort: true,\n\t}\n}", "func NewServicePrefixListResultPage(cur ServicePrefixListResult, getNextPage func(context.Context, ServicePrefixListResult) (ServicePrefixListResult, error)) ServicePrefixListResultPage {\n\treturn ServicePrefixListResultPage{\n\t\tfn: getNextPage,\n\t\tsplr: cur,\n\t}\n}", "func (client *AgentsClient) NewListPager(resourceGroupName string, storageMoverName string, options *AgentsClientListOptions) *runtime.Pager[AgentsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[AgentsClientListResponse]{\n\t\tMore: func(page AgentsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *AgentsClientListResponse) (AgentsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, storageMoverName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn AgentsClientListResponse{}, 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 AgentsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn AgentsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewDataLakeStoreAccountInformationListResultPage(getNextPage func(context.Context, DataLakeStoreAccountInformationListResult) (DataLakeStoreAccountInformationListResult, error)) DataLakeStoreAccountInformationListResultPage {\n\treturn DataLakeStoreAccountInformationListResultPage{fn: getNextPage}\n}", "func NewMachineExtensionsListResultPage(cur MachineExtensionsListResult, getNextPage func(context.Context, MachineExtensionsListResult) (MachineExtensionsListResult, error)) MachineExtensionsListResultPage {\n\treturn MachineExtensionsListResultPage{\n\t\tfn: getNextPage,\n\t\tmelr: cur,\n\t}\n}", "func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, name string, options *MachineExtensionsClientListOptions) *runtime.Pager[MachineExtensionsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[MachineExtensionsClientListResponse]{\n\t\tMore: func(page MachineExtensionsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *MachineExtensionsClientListResponse) (MachineExtensionsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, name, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn MachineExtensionsClientListResponse{}, 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 MachineExtensionsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn MachineExtensionsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func New(size int) *List {\n\treturn &List{data: make([]string, size)}\n}", "func New() *List {\n return &List{size:0}\n}", "func NewIotHubQuotaMetricInfoListResultPage(cur IotHubQuotaMetricInfoListResult, getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage {\n\treturn IotHubQuotaMetricInfoListResultPage{\n\t\tfn: getNextPage,\n\t\tihqmilr: cur,\n\t}\n}", "func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage {\n\treturn MonitoredResourceListResponsePage{\n\t\tfn: getNextPage,\n\t\tmrlr: cur,\n\t}\n}", "func (client *RegistrationDefinitionsClient) NewListPager(scope string, options *RegistrationDefinitionsClientListOptions) *runtime.Pager[RegistrationDefinitionsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[RegistrationDefinitionsClientListResponse]{\n\t\tMore: func(page RegistrationDefinitionsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *RegistrationDefinitionsClientListResponse) (RegistrationDefinitionsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, scope, 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 RegistrationDefinitionsClientListResponse{}, 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 RegistrationDefinitionsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn RegistrationDefinitionsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewAssignmentListResultPage(cur AssignmentListResult, getNextPage func(context.Context, AssignmentListResult) (AssignmentListResult, error)) AssignmentListResultPage {\n\treturn AssignmentListResultPage{\n\t\tfn: getNextPage,\n\t\talr: cur,\n\t}\n}", "func NewList(storage storageInterface) *List {\n\treturn &List{storage: storage}\n}", "func NewRoleDefinitionListResultPage(cur RoleDefinitionListResult, getNextPage func(context.Context, RoleDefinitionListResult) (RoleDefinitionListResult, error)) RoleDefinitionListResultPage {\n\treturn RoleDefinitionListResultPage{\n\t\tfn: getNextPage,\n\t\trdlr: cur,\n\t}\n}", "func (client *SourceControlConfigurationsClient) NewListPager(resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, options *SourceControlConfigurationsClientListOptions) *runtime.Pager[SourceControlConfigurationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SourceControlConfigurationsClientListResponse]{\n\t\tMore: func(page SourceControlConfigurationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SourceControlConfigurationsClientListResponse) (SourceControlConfigurationsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SourceControlConfigurationsClientListResponse{}, 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 SourceControlConfigurationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SourceControlConfigurationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewIotHubDescriptionListResultPage(cur IotHubDescriptionListResult, getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage {\n\treturn IotHubDescriptionListResultPage{\n\t\tfn: getNextPage,\n\t\tihdlr: cur,\n\t}\n}", "func (client *WebhooksClient) NewListPager(resourceGroupName string, registryName string, options *WebhooksClientListOptions) *runtime.Pager[WebhooksClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[WebhooksClientListResponse]{\n\t\tMore: func(page WebhooksClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *WebhooksClientListResponse) (WebhooksClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn WebhooksClientListResponse{}, 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 WebhooksClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn WebhooksClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func (client *ManagedInstancesClient) NewListPager(options *ManagedInstancesClientListOptions) *runtime.Pager[ManagedInstancesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ManagedInstancesClientListResponse]{\n\t\tMore: func(page ManagedInstancesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ManagedInstancesClientListResponse) (ManagedInstancesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ManagedInstancesClientListResponse{}, 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 ManagedInstancesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ManagedInstancesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewPagination(list interface{}, total int, pageSize int, pageNumber int) (p *Pagination, err error) {\n\tif pageSize <= 0 {\n\t\treturn nil, errors.New(\"PageSize Should Not Less than 0\")\n\t}\n\tif pageNumber <= 0 {\n\t\treturn nil, errors.New(\"PageNumber Should Not Less than 0\")\n\t}\n\n\tp = &Pagination{list, total, pageSize, pageNumber, false, false}\n\n\tp.IsFirst = p.isFirst()\n\tp.IsLast = p.isLast()\n\n\tif p.PageNumber > p.TotalPages() {\n\t\tp.PageNumber = p.TotalPages()\n\t}\n\treturn p, nil\n}", "func (client *VirtualMachinesClient) NewListPager(options *VirtualMachinesClientListOptions) *runtime.Pager[VirtualMachinesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListResponse]{\n\t\tMore: func(page VirtualMachinesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *VirtualMachinesClientListResponse) (VirtualMachinesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualMachinesClientListResponse{}, 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 VirtualMachinesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn VirtualMachinesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func NewTaskListPage(getNextPage func(context.Context, TaskList) (TaskList, error)) TaskListPage {\n\treturn TaskListPage{fn: getNextPage}\n}", "func CreatePaginated(p *Page, array interface{}, count ...int) (*Paginated, error) {\n\tresultv := reflect.ValueOf(array)\n\tif resultv.Kind() != reflect.Ptr || resultv.Elem().Kind() != reflect.Slice && resultv.Kind() != reflect.Array {\n\t\treturn nil, fmt.Errorf(\"unable to create Paginated, 'array' arg must be a Slice or Array, %v\", resultv.Kind())\n\t}\n\n\tarr := resultv.Elem()\n\tl := arr.Len()\n\tc := l\n\n\tif len(count) > 0 {\n\t\tc = count[0]\n\t}\n\n\tif p == nil {\n\t\tp = &Page{1, l, nil}\n\t}\n\n\treturn &Paginated{\n\t\tItems: arr.Interface(),\n\t\tPaginatedBase: &PaginatedBase{\n\t\t\tItemsCount: l,\n\t\t\tTotalPages: int(math.Ceil(float64(c) / float64(p.Size))),\n\t\t\tTotalCount: c,\n\t\t\tSize: p.Size,\n\t\t\tPage: p.Page,\n\t\t},\n\t}, nil\n}", "func NewServiceLocationListResultPage(cur ServiceLocationListResult, getNextPage func(context.Context, ServiceLocationListResult) (ServiceLocationListResult, error)) ServiceLocationListResultPage {\n\treturn ServiceLocationListResultPage{\n\t\tfn: getNextPage,\n\t\tsllr: cur,\n\t}\n}", "func (client *VendorNetworkFunctionsClient) NewListPager(locationName string, vendorName string, options *VendorNetworkFunctionsClientListOptions) *runtime.Pager[VendorNetworkFunctionsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[VendorNetworkFunctionsClientListResponse]{\n\t\tMore: func(page VendorNetworkFunctionsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *VendorNetworkFunctionsClientListResponse) (VendorNetworkFunctionsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, locationName, vendorName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn VendorNetworkFunctionsClientListResponse{}, 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 VendorNetworkFunctionsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn VendorNetworkFunctionsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func (client *LiveOutputsClient) NewListPager(resourceGroupName string, accountName string, liveEventName string, options *LiveOutputsClientListOptions) *runtime.Pager[LiveOutputsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[LiveOutputsClientListResponse]{\n\t\tMore: func(page LiveOutputsClientListResponse) bool {\n\t\t\treturn page.ODataNextLink != nil && len(*page.ODataNextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *LiveOutputsClientListResponse) (LiveOutputsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.ODataNextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn LiveOutputsClientListResponse{}, 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 LiveOutputsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn LiveOutputsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func (client *ReplicationsClient) NewListPager(resourceGroupName string, registryName string, options *ReplicationsClientListOptions) *runtime.Pager[ReplicationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ReplicationsClientListResponse]{\n\t\tMore: func(page ReplicationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ReplicationsClientListResponse) (ReplicationsClientListResponse, error) {\n\t\t\tctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, \"ReplicationsClient.NewListPager\")\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ReplicationsClientListResponse{}, 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 ReplicationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ReplicationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t\tTracer: client.internal.Tracer(),\n\t})\n}", "func NewProviderOperationsMetadataListResultPage(cur ProviderOperationsMetadataListResult, getNextPage func(context.Context, ProviderOperationsMetadataListResult) (ProviderOperationsMetadataListResult, error)) ProviderOperationsMetadataListResultPage {\n\treturn ProviderOperationsMetadataListResultPage{\n\t\tfn: getNextPage,\n\t\tpomlr: cur,\n\t}\n}", "func New(numberOfItems, itemsPerPage, currentPage int) *Pagination {\n\tif currentPage == 0 {\n\t\tcurrentPage = 1\n\t}\n\n\tn := int(math.Ceil(float64(numberOfItems) / float64(itemsPerPage)))\n\tif currentPage > n {\n\t\tcurrentPage = n\n\t}\n\n\treturn &Pagination{\n\t\titemsPerPage: itemsPerPage,\n\t\tnumberOfItems: numberOfItems,\n\t\tcurrentPage: currentPage,\n\t}\n}", "func NewCreatorListPage(cur CreatorList, getNextPage func(context.Context, CreatorList) (CreatorList, error)) CreatorListPage {\n\treturn CreatorListPage{\n\t\tfn: getNextPage,\n\t\tcl: cur,\n\t}\n}", "func ExampleOperationsClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armsearch.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewOperationsClient().NewListPager(nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.OperationListResult = armsearch.OperationListResult{\n\t\t// \tValue: []*armsearch.Operation{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/operations/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Lists all of the available operations of the Microsoft.Search provider.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"List all available operations\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/register/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Registers the subscription for the search resource provider and enables the creation of search services.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Register the Search Resource Provider\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates or updates the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Set Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Reads the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/start/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Starts the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Start Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/stop/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Stops the search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Stop Search Service\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/listAdminKeys/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Reads the admin keys.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Admin Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/regenerateAdminKey/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Regenerates the admin key.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Regenerate Admin Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/listQueryKeys/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of query API keys for the given Azure Search service.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Query Keys\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"API Keys\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/createQueryKey/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates the query key.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Query Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Search Services\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/deleteQueryKey/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes the query key.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Query Key\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"API Keys\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/checkNameAvailability/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Checks availability of the service name.\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Check Service Name Availability\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Service Name Availability\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/diagnosticSettings/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Gets the diganostic setting read for the resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Diagnostic Setting\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Diagnostic Settings\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/diagnosticSettings/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates or updates the diganostic setting for the resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Set Diagnostic Setting\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Diagnostic Settings\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/metricDefinitions/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Gets the available metrics for the search service\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Read search service metric definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"The metric definitions for the search service\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/logDefinitions/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Gets the available logs for the search service\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Read search service log definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"The log definition for the search service\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/validate/action\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Validates a private endpoint connection create call from NRP side\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Validate Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates a private endpoint connection proxy with the specified parameters or updates the properties or tags for the specified private endpoint connection proxy\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of private endpoint connection proxies or gets the properties for the specified private endpoint connection proxy\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnectionProxies/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes an existing private endpoint connection proxy\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection Proxy\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnections/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates a private endpoint connections with the specified parameters or updates the properties or tags for the specified private endpoint connections\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Private Endpoint Connection\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnections/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of private endpoint connections or gets the properties for the specified private endpoint connections\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Private Endpoint Connection\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/privateEndpointConnections/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes an existing private endpoint connections\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Private Endpoint Connection\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Private Endpoint Connection\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/write\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Creates a new shared private link resource with the specified parameters or updates the properties for the specified shared private link resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Create Shared Private Link Resource\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Returns the list of shared private link resources or gets the properties for the specified shared private link resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Shared Private Link Resource\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/delete\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Deletes an existing shared private link resource\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Shared Private Link Resource\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.Search/searchServices/sharedPrivateLinkResources/operationStatuses/read\"),\n\t\t// \t\t\tDisplay: &armsearch.OperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Get the details of a long running shared private link resource operation\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Operation Status\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft Search\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Shared Private Link Resource\"),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func ExampleStorageInsightConfigsClient_NewListByWorkspacePager() {\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 := armoperationalinsights.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewStorageInsightConfigsClient().NewListByWorkspacePager(\"OIAutoRest5123\", \"aztest5048\", nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.StorageInsightListResult = armoperationalinsights.StorageInsightListResult{\n\t\t// }\n\t}\n}", "func ExampleLogProfilesClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armmonitor.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewLogProfilesClient().NewListPager(nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.LogProfileCollection = armmonitor.LogProfileCollection{\n\t\t// \tValue: []*armmonitor.LogProfileResource{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"default\"),\n\t\t// \t\t\tType: to.Ptr(\"\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default\"),\n\t\t// \t\t\tLocation: to.Ptr(\"\"),\n\t\t// \t\t\tProperties: &armmonitor.LogProfileProperties{\n\t\t// \t\t\t\tCategories: []*string{\n\t\t// \t\t\t\t\tto.Ptr(\"Delete\"),\n\t\t// \t\t\t\t\tto.Ptr(\"Write\"),\n\t\t// \t\t\t\t\tto.Ptr(\"Action\")},\n\t\t// \t\t\t\t\tLocations: []*string{\n\t\t// \t\t\t\t\t\tto.Ptr(\"global\")},\n\t\t// \t\t\t\t\t\tRetentionPolicy: &armmonitor.RetentionPolicy{\n\t\t// \t\t\t\t\t\t\tDays: to.Ptr[int32](3),\n\t\t// \t\t\t\t\t\t\tEnabled: to.Ptr(true),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\tServiceBusRuleID: to.Ptr(\"\"),\n\t\t// \t\t\t\t\t\tStorageAccountID: to.Ptr(\"/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\t{\n\t\t// \t\t\t\t\tName: to.Ptr(\"default2\"),\n\t\t// \t\t\t\t\tType: to.Ptr(\"\"),\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default2\"),\n\t\t// \t\t\t\t\tLocation: to.Ptr(\"\"),\n\t\t// \t\t\t\t\tProperties: &armmonitor.LogProfileProperties{\n\t\t// \t\t\t\t\t\tCategories: []*string{\n\t\t// \t\t\t\t\t\t\tto.Ptr(\"Delete\"),\n\t\t// \t\t\t\t\t\t\tto.Ptr(\"Write\"),\n\t\t// \t\t\t\t\t\t\tto.Ptr(\"Action\")},\n\t\t// \t\t\t\t\t\t\tLocations: []*string{\n\t\t// \t\t\t\t\t\t\t\tto.Ptr(\"global\")},\n\t\t// \t\t\t\t\t\t\t\tRetentionPolicy: &armmonitor.RetentionPolicy{\n\t\t// \t\t\t\t\t\t\t\t\tDays: to.Ptr[int32](15),\n\t\t// \t\t\t\t\t\t\t\t\tEnabled: to.Ptr(true),\n\t\t// \t\t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\t\t\tServiceBusRuleID: to.Ptr(\"\"),\n\t\t// \t\t\t\t\t\t\t\tStorageAccountID: to.Ptr(\"/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8165\"),\n\t\t// \t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t}},\n\t\t// \t\t\t\t}\n\t}\n}", "func NewJobResponseListResultPage(cur JobResponseListResult, getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage {\n\treturn JobResponseListResultPage{\n\t\tfn: getNextPage,\n\t\tjrlr: cur,\n\t}\n}", "func (s *PagesService) List(ctx context.Context, limit, offset int) ([]*Page, *http.Response, error) {\n\tif limit < 1 {\n\t\treturn nil, nil, fmt.Errorf(\"limit must be above 0, but %d is not\", limit)\n\t}\n\tif limit > 500 {\n\t\treturn nil, nil, fmt.Errorf(\"limit must be 500 or below, but %d is not\", limit)\n\t}\n\tu := fmt.Sprintf(\"v1/pages?limit=%d&offset=%d\", limit, offset)\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\tvar pages []*Page\n\tresp, err := s.client.Do(ctx, req, &pages)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn pages, resp, nil\n}", "func (client *ManagedClustersClient) NewListPager(options *ManagedClustersClientListOptions) *runtime.Pager[ManagedClustersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListResponse]{\n\t\tMore: func(page ManagedClustersClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ManagedClustersClientListResponse) (ManagedClustersClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ManagedClustersClientListResponse{}, 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 ManagedClustersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ManagedClustersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "func New() *List {\n\treturn &List{size: 0}\n}", "func (p *StoragesClientListPager) PageResponse() StoragesClientListResponse {\n\treturn p.current\n}", "func NewConsumerGroupListResultPage(getNextPage func(context.Context, ConsumerGroupListResult) (ConsumerGroupListResult, error)) ConsumerGroupListResultPage {\n\treturn ConsumerGroupListResultPage{fn: getNextPage}\n}", "func NewPermissionGetResultPage(cur PermissionGetResult, getNextPage func(context.Context, PermissionGetResult) (PermissionGetResult, error)) PermissionGetResultPage {\n\treturn PermissionGetResultPage{\n\t\tfn: getNextPage,\n\t\tpgr: cur,\n\t}\n}", "func List(c *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {\n\tq, err := gophercloud.BuildQueryString(&opts)\n\tif err != nil {\n\t\treturn pagination.Pager{Err: err}\n\t}\n\tu := rootURL(c) + q.String()\n\treturn pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page {\n\t\treturn PoolPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "func NewRoleManagementPolicyListResultPage(cur RoleManagementPolicyListResult, getNextPage func(context.Context, RoleManagementPolicyListResult) (RoleManagementPolicyListResult, error)) RoleManagementPolicyListResultPage {\n\treturn RoleManagementPolicyListResultPage{\n\t\tfn: getNextPage,\n\t\trmplr: cur,\n\t}\n}", "func NewSingleSignOnResourceListResponsePage(cur SingleSignOnResourceListResponse, getNextPage func(context.Context, SingleSignOnResourceListResponse) (SingleSignOnResourceListResponse, error)) SingleSignOnResourceListResponsePage {\n\treturn SingleSignOnResourceListResponsePage{\n\t\tfn: getNextPage,\n\t\tssorlr: cur,\n\t}\n}", "func ExampleVaultsClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armkeyvault.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewVaultsClient().NewListPager(&armkeyvault.VaultsClientListOptions{Top: to.Ptr[int32](1)})\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.ResourceListResult = armkeyvault.ResourceListResult{\n\t\t// \tValue: []*armkeyvault.Resource{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"sample-vault\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.KeyVault/vaults\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault\"),\n\t\t// \t\t\tLocation: to.Ptr(\"westus\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func NewVMResourcesListResponsePage(cur VMResourcesListResponse, getNextPage func(context.Context, VMResourcesListResponse) (VMResourcesListResponse, error)) VMResourcesListResponsePage {\n\treturn VMResourcesListResponsePage{\n\t\tfn: getNextPage,\n\t\tvrlr: cur,\n\t}\n}", "func NewLogsListRequestPage() *LogsListRequestPage {\n\tthis := LogsListRequestPage{}\n\tvar limit int32 = 10\n\tthis.Limit = &limit\n\treturn &this\n}", "func NewRegistrationDefinitionListPage(cur RegistrationDefinitionList, getNextPage func(context.Context, RegistrationDefinitionList) (RegistrationDefinitionList, error)) RegistrationDefinitionListPage {\n\treturn RegistrationDefinitionListPage{\n\t\tfn: getNextPage,\n\t\trdl: cur,\n\t}\n}", "func NewOperationsPage(cur Operations, getNextPage func(context.Context, Operations) (Operations, error)) OperationsPage {\n\treturn OperationsPage{\n\t\tfn: getNextPage,\n\t\to: cur,\n\t}\n}", "func NewServiceOperationListPage(getNextPage func(context.Context, ServiceOperationList) (ServiceOperationList, error)) ServiceOperationListPage {\n\treturn ServiceOperationListPage{fn: getNextPage}\n}", "func NewRegisteredPrefixListResultPage(cur RegisteredPrefixListResult, getNextPage func(context.Context, RegisteredPrefixListResult) (RegisteredPrefixListResult, error)) RegisteredPrefixListResultPage {\n\treturn RegisteredPrefixListResultPage{\n\t\tfn: getNextPage,\n\t\trplr: cur,\n\t}\n}", "func (client *TagRulesClient) NewListPager(resourceGroupName string, monitorName string, options *TagRulesClientListOptions) *runtime.Pager[TagRulesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[TagRulesClientListResponse]{\n\t\tMore: func(page TagRulesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *TagRulesClientListResponse) (TagRulesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, monitorName, 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 TagRulesClientListResponse{}, 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 TagRulesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn TagRulesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}" ]
[ "0.78558266", "0.655044", "0.6509133", "0.64060587", "0.62307954", "0.62178105", "0.61889404", "0.613995", "0.61256045", "0.60363054", "0.60363054", "0.60053426", "0.60053426", "0.60053426", "0.60053426", "0.60053426", "0.6002534", "0.5744752", "0.5715291", "0.57136095", "0.56262815", "0.55676717", "0.55676717", "0.55676717", "0.55483675", "0.5543428", "0.55106467", "0.5493605", "0.54365385", "0.54365385", "0.5404626", "0.5403635", "0.5403635", "0.53821063", "0.5380662", "0.5341411", "0.53218174", "0.5292111", "0.52884716", "0.5268294", "0.5182055", "0.51540184", "0.5128646", "0.5128516", "0.51256144", "0.5119409", "0.5094897", "0.5084849", "0.5073405", "0.50664175", "0.50548923", "0.50542414", "0.5051841", "0.5050363", "0.50426424", "0.5029662", "0.5028855", "0.50269276", "0.5021008", "0.5020815", "0.5012684", "0.5000472", "0.49982083", "0.4982081", "0.49757725", "0.49738413", "0.49614468", "0.49547875", "0.49531978", "0.49444863", "0.49436054", "0.4922943", "0.4912548", "0.4908026", "0.4896373", "0.4868531", "0.48581442", "0.48434505", "0.48424068", "0.48275357", "0.48187563", "0.48168507", "0.48065588", "0.480213", "0.48012927", "0.47996062", "0.47994024", "0.4796641", "0.47914362", "0.47827226", "0.47796112", "0.47711787", "0.47682267", "0.47679827", "0.47668695", "0.47667712", "0.4766005", "0.4753501", "0.47491884", "0.47474113" ]
0.78939867
0
Result returns the result of the asynchronous operation. If the operation has not completed it will return an error.
func (future *WorkspacesGetSearchResultsFuture) Result(client WorkspacesClient) (srr SearchResultsResponse, err error) { var done bool done, err = future.Done(client) if err != nil { err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesGetSearchResultsFuture", "Result", future.Response(), "Polling failure") return } if !done { err = azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesGetSearchResultsFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if srr.Response.Response, err = future.GetResult(sender); err == nil && srr.Response.Response.StatusCode != http.StatusNoContent { srr, err = client.GetSearchResultsResponder(srr.Response.Response) if err != nil { err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesGetSearchResultsFuture", "Result", srr.Response.Response, "Failure responding to request") } } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Task) Result() (interface{}, error) {\n\t<-*t.Done\n\treturn t.value, t.err\n}", "func (asyncResult *asyncResult) get() interface{} {\n\t<-asyncResult.done\n\treturn asyncResult.result\n}", "func (future *JobsDeleteFuture) Result(client JobsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"databox.JobsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"databox.JobsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (future *ReservationUpdateFuture) Result(client Client) (r Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"reservations.ReservationUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"reservations.ReservationUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent {\n\t\tr, err = client.UpdateResponder(r.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"reservations.ReservationUpdateFuture\", \"Result\", r.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (m *DirectoryAudit) GetResult()(*OperationResult) {\n return m.result\n}", "func (future *DeleteFuture) Result(client Client) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"account.DeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"account.DeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (gw *md5Work) Result() interface{} {\n\treturn gw.data\n}", "func (f Future) GetResult(sender autorest.Sender) (*http.Response, error) {\n\tif f.pt.finalGetURL() == \"\" {\n\t\t// we can end up in this situation if the async operation returns a 200\n\t\t// with no polling URLs. in that case return the response which should\n\t\t// contain the JSON payload (only do this for successful terminal cases).\n\t\tif lr := f.pt.latestResponse(); lr != nil && f.pt.hasSucceeded() {\n\t\t\treturn lr, nil\n\t\t}\n\t\treturn nil, autorest.NewError(\"Future\", \"GetResult\", \"missing URL for retrieving result\")\n\t}\n\treq, err := http.NewRequest(http.MethodGet, f.pt.finalGetURL(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := sender.Do(req)\n\tif err == nil && resp.Body != nil {\n\t\t// copy the body and close it so callers don't have to\n\t\tdefer resp.Body.Close()\n\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn resp, err\n\t\t}\n\t\tresp.Body = ioutil.NopCloser(bytes.NewReader(b))\n\t}\n\treturn resp, err\n}", "func (future *UpdateFuture) Result(client Client) (dlaa DataLakeAnalyticsAccount, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"account.UpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"account.UpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif dlaa.Response.Response, err = future.GetResult(sender); err == nil && dlaa.Response.Response.StatusCode != http.StatusNoContent {\n\t\tdlaa, err = client.UpdateResponder(dlaa.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"account.UpdateFuture\", \"Result\", dlaa.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (s *ShellTask) Result() any {\n\treturn nil\n}", "func (p *promise) Result() interface{} {\n\tres := p.result.Load()\n\n\tif res != nil {\n\t\t// if the result represents an error return nil\n\t\tif _, ok := res.(error); ok {\n\t\t\treturn nil\n\t\t}\n\n\t\t// if the delivery was == nil, then we use nilResult to indicate\n\t\t// and now we need to translate it back to nil\n\t\tif res == nilResult {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn res\n}", "func (a *Applier) GetResultAsync(logIndex LogIndex) (<-chan CommandResult, error) {\n\ta.mutex.Lock()\n\tdefer a.mutex.Unlock()\n\n\tif logIndex > a.cachedIndexOfLastEntry {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"FATAL: logIndex=%v is > indexOfLastEntry=%v\",\n\t\t\tlogIndex, a.cachedIndexOfLastEntry,\n\t\t)\n\t}\n\tif logIndex <= a.cachedCommitIndex {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"FATAL: logIndex=%v is <= cachedCommitIndex=%v\",\n\t\t\tlogIndex, a.cachedCommitIndex,\n\t\t)\n\t}\n\tif logIndex <= a.highestRegisteredIndex {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"FATAL: logIndex=%v is <= highestRegisteredIndex=%v\",\n\t\t\tlogIndex,\n\t\t\ta.highestRegisteredIndex,\n\t\t)\n\t}\n\n\tcrc := make(chan CommandResult, 1)\n\n\ta.listeners[logIndex] = crc\n\ta.highestRegisteredIndex = logIndex\n\n\treturn crc, nil\n}", "func (future *AccountsDeleteFutureType) Result(client AccountsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"account.AccountsDeleteFutureType\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"account.AccountsDeleteFutureType\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (obj *transformOperation) Result() VariableName {\n\treturn obj.result\n}", "func asCompletedAsyncResult(result interface{}) *asyncResult {\n\tasync := newAsyncResult()\n\tasync.complete(result)\n\treturn async\n}", "func (future *JobsUpdateFuture) Result(client JobsClient) (jr JobResource, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"databox.JobsUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"databox.JobsUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif jr.Response.Response, err = future.GetResult(sender); err == nil && jr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tjr, err = client.UpdateResponder(jr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"databox.JobsUpdateFuture\", \"Result\", jr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (future *ServicesDeleteFuture) Result(client ServicesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"datamigration.ServicesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"datamigration.ServicesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (future *DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.DatabasesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.DatabasesDeleteFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "func (future VaultsPurgeDeletedFuture) Result(client VaultsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\treturn\n\t}\n\tif !done {\n\t\treturn ar, autorest.NewError(\"keyvault.VaultsPurgeDeletedFuture\", \"Result\", \"asynchronous operation has not completed\")\n\t}\n\tif future.PollingMethod() == azure.PollingLocation {\n\t\tar, err = client.PurgeDeletedResponder(future.Response())\n\t\treturn\n\t}\n\tvar resp *http.Response\n\tresp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif err != nil {\n\t\treturn\n\t}\n\tar, err = client.PurgeDeletedResponder(resp)\n\treturn\n}", "func (m *Message) getResult() Result {\n\treturn Result{\n\t\tLastInsertID: m.getUint64(),\n\t\tRowsAffected: m.getUint64(),\n\t}\n}", "func (future *AccountsUpdateFutureType) Result(client AccountsClient) (dlaa DataLakeAnalyticsAccount, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"account.AccountsUpdateFutureType\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"account.AccountsUpdateFutureType\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif dlaa.Response.Response, err = future.GetResult(sender); err == nil && dlaa.Response.Response.StatusCode != http.StatusNoContent {\n\t\tdlaa, err = client.UpdateResponder(dlaa.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"account.AccountsUpdateFutureType\", \"Result\", dlaa.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (r *Request) Result(result Result) error {\n\tr.resultPayload = result\n\tr.requestChan <- r\n\trr := <-r.returnChan\n\treturn rr.finalize()\n}", "func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.ClustersDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"avs.ClustersDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (p *NOV) GetResult() int {\n\treturn p.result\n}", "func (future *PrivateCloudsDeleteFuture) Result(client PrivateCloudsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.PrivateCloudsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"avs.PrivateCloudsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (future *JobsCreateFuture) Result(client JobsClient) (jr JobResource, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"databox.JobsCreateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"databox.JobsCreateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif jr.Response.Response, err = future.GetResult(sender); err == nil && jr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tjr, err = client.CreateResponder(jr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"databox.JobsCreateFuture\", \"Result\", jr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (future *ServicesStartFuture) Result(client ServicesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"datamigration.ServicesStartFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"datamigration.ServicesStartFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func AwaitResult(c net.Conn) (*rmake.FinalBuildResult, error) {\n\tvar gobint interface{}\n\tvar fbr *rmake.FinalBuildResult\n\n\tdec := gob.NewDecoder(c)\n\n\t// Wait till we have what we want\n\tfor fbr == nil {\n\t\t// Decode some data\n\t\terr := dec.Decode(&gobint)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\t//return nil, err // I don't think we want to simply die...\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// Found some data, grab the type...\n\t\tswitch message := gobint.(type) {\n\t\tcase *rmake.BuildStatus:\n\t\t\tfmt.Println(\"Build Status\")\n\t\t\tPrintBuildStatus(message) // Doesn't work for some reason\n\t\tcase *rmake.FinalBuildResult:\n\t\t\tfmt.Println(\"Final Build Result\")\n\t\t\tfbr = message\n\t\tcase *rmake.BuilderResult:\n\t\t\tfmt.Println(\"Got builder result.\")\n\t\t\tfmt.Printf(\"Got %d files back.\", len(message.Results))\n\t\tcase *rmake.JobFinishedMessage:\n\t\t\tfmt.Println(\"I SHOULDNT BE GETTING THIS.\")\n\t\t\tfmt.Println(message.Stdout)\n\t\tdefault:\n\t\t\tfmt.Println(\"Unknown Type.\")\n\t\t\tfmt.Println(reflect.TypeOf(message))\n\t\t}\n\t}\n\n\treturn fbr, nil\n}", "func (future *ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersDeleteFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "func (m *MockRunner) Result() interface{} {\n\targs := m.MethodCalled(\"Result\")\n\n\treturn args.Get(0)\n}", "func (future *CreateFuture) Result(client Client) (dlaa DataLakeAnalyticsAccount, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"account.CreateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"account.CreateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif dlaa.Response.Response, err = future.GetResult(sender); err == nil && dlaa.Response.Response.StatusCode != http.StatusNoContent {\n\t\tdlaa, err = client.CreateResponder(dlaa.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"account.CreateFuture\", \"Result\", dlaa.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (future *ClustersUpdateFuture) Result(client ClustersClient) (c Cluster, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.ClustersUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"avs.ClustersUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {\n\t\tc, err = client.UpdateResponder(c.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"avs.ClustersUpdateFuture\", \"Result\", c.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (f *future) result() (loader.PluginInstance, error) {\n\treturn f.instance, f.err\n}", "func (future *ServicesUpdateFuture) Result(client ServicesClient) (s Service, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"datamigration.ServicesUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"datamigration.ServicesUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {\n\t\ts, err = client.UpdateResponder(s.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"datamigration.ServicesUpdateFuture\", \"Result\", s.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (s *StreamCombiner) Result() []byte {\n\treturn s.result\n}", "func (future *PrivateCloudsUpdateFuture) Result(client PrivateCloudsClient) (pc PrivateCloud, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.PrivateCloudsUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"avs.PrivateCloudsUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif pc.Response.Response, err = future.GetResult(sender); err == nil && pc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tpc, err = client.UpdateResponder(pc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"avs.PrivateCloudsUpdateFuture\", \"Result\", pc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (ar *AppendResult) GetResult(ctx context.Context) (int64, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn NoStreamOffset, ctx.Err()\n\tcase <-ar.Ready():\n\t\tfull, err := ar.FullResponse(ctx)\n\t\toffset := NoStreamOffset\n\t\tif full != nil {\n\t\t\tif result := full.GetAppendResult(); result != nil {\n\t\t\t\tif off := result.GetOffset(); off != nil {\n\t\t\t\t\toffset = off.GetValue()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn offset, err\n\t}\n}", "func (o *SnapmirrorCreateResponseResult) Result() SnapmirrorCreateResponseResultResult {\n\tvar r SnapmirrorCreateResponseResultResult\n\tif o.ResultPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.ResultPtr\n\treturn r\n}", "func (b *Backtest) Result() (err error) {\n\n\treturn\n}", "func (f *Fortio) Result() []byte {\n\treturn f.result\n}", "func (rw *ReadWrite) ValueResult() Value {\n\tif rw.GetBool() {\n\t\treturn rw.GetVal()\n\t}\n\treturn nil\n}", "func (l *RemoteProvider) GetResult(tokenVal string, resultID uuid.UUID) (*MesheryResult, error) {\n\tif !l.Capabilities.IsSupported(PersistResult) {\n\t\tlogrus.Error(\"operation not available\")\n\t\treturn nil, ErrInvalidCapability(\"PersistResult\", l.ProviderName)\n\t}\n\n\tep, _ := l.Capabilities.GetEndpointForFeature(PersistResult)\n\n\tlogrus.Infof(\"attempting to fetch result from cloud for id: %s\", resultID)\n\n\tremoteProviderURL, _ := url.Parse(fmt.Sprintf(\"%s%s/%s\", l.RemoteProviderURL, ep, resultID.String()))\n\tlogrus.Debugf(\"constructed result url: %s\", remoteProviderURL.String())\n\tcReq, _ := http.NewRequest(http.MethodGet, remoteProviderURL.String(), nil)\n\n\t// tokenString, err := l.GetToken(req)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\tresp, err := l.DoRequest(cReq, tokenVal)\n\tif err != nil {\n\t\tlogrus.Errorf(\"unable to get results: %v\", err)\n\t\treturn nil, ErrFetch(err, \"Perf Result \"+resultID.String(), resp.StatusCode)\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\tbdr, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, ErrDataRead(err, \"Perf Result \"+resultID.String())\n\t}\n\n\tif resp.StatusCode == http.StatusOK {\n\t\tlogrus.Infof(\"result successfully retrieved from remote provider\")\n\t\tres := &MesheryResult{}\n\t\terr = json.Unmarshal(bdr, res)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"unable to unmarshal meshery result: %v\", err)\n\t\t\treturn nil, ErrUnmarshal(err, \"Perf Result \"+resultID.String())\n\t\t}\n\t\treturn res, nil\n\t}\n\tlogrus.Errorf(\"error while fetching result: %s\", bdr)\n\treturn nil, ErrFetch(err, fmt.Sprint(bdr), resp.StatusCode)\n}", "func (future *ServersStartFuture) Result(client ServersClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersStartFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersStartFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "func (future *AccountsCreateFutureType) Result(client AccountsClient) (dlaa DataLakeAnalyticsAccount, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"account.AccountsCreateFutureType\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"account.AccountsCreateFutureType\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif dlaa.Response.Response, err = future.GetResult(sender); err == nil && dlaa.Response.Response.StatusCode != http.StatusNoContent {\n\t\tdlaa, err = client.CreateResponder(dlaa.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"account.AccountsCreateFutureType\", \"Result\", dlaa.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (future *OpenShiftManagedClustersDeleteFuture) Result(client OpenShiftManagedClustersClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"containerservice.OpenShiftManagedClustersDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"containerservice.OpenShiftManagedClustersDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (future *ReservationMergeFuture) Result(client Client) (lr ListResponse, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"reservations.ReservationMergeFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"reservations.ReservationMergeFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif lr.Response.Response, err = future.GetResult(sender); err == nil && lr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tlr, err = client.MergeResponder(lr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"reservations.ReservationMergeFuture\", \"Result\", lr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (future *ServicesCreateOrUpdateFuture) Result(client ServicesClient) (s Service, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"datamigration.ServicesCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"datamigration.ServicesCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {\n\t\ts, err = client.CreateOrUpdateResponder(s.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"datamigration.ServicesCreateOrUpdateFuture\", \"Result\", s.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (a *RequestServiceApiService) GetResultExecute(r ApiGetResultRequest) (*os.File, *_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RequestServiceApiService.GetResult\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/requests/{uuid}/result\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"uuid\"+\"}\", _neturl.PathEscape(parameterToString(r.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\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.authorization != nil {\n\t\tlocalVarHeaderParams[\"Authorization\"] = parameterToString(*r.authorization, \"\")\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, executionError\n}", "func (_TestABI *TestABICaller) GetResult(opts *bind.CallOpts) ([]*big.Int, error) {\n\tvar (\n\t\tret0 = new([]*big.Int)\n\t)\n\tout := ret0\n\terr := _TestABI.contract.Call(opts, out, \"getResult\")\n\treturn *ret0, err\n}", "func (future *ServicesStopFuture) Result(client ServicesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"datamigration.ServicesStopFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"datamigration.ServicesStopFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (e *dockerExec) Result(ctx context.Context) (reflow.Result, error) {\n\tstate, err := e.getState()\n\tif err != nil {\n\t\treturn reflow.Result{}, err\n\t}\n\tif state != execComplete {\n\t\treturn reflow.Result{}, errors.Errorf(\"result %v: %s\", e.id, errExecNotComplete)\n\t}\n\treturn e.Manifest.Result, nil\n}", "func (future *ClustersCreateOrUpdateFuture) Result(client ClustersClient) (c Cluster, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.ClustersCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"avs.ClustersCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {\n\t\tc, err = client.CreateOrUpdateResponder(c.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"avs.ClustersCreateOrUpdateFuture\", \"Result\", c.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (qr *QueryResponse) Result() QueryResult {\n\tif len(qr.ResultList) == 0 {\n\t\treturn nil\n\t}\n\treturn qr.ResultList[0]\n}", "func (future *PrivateCloudsCreateOrUpdateFuture) Result(client PrivateCloudsClient) (pc PrivateCloud, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.PrivateCloudsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"avs.PrivateCloudsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif pc.Response.Response, err = future.GetResult(sender); err == nil && pc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tpc, err = client.CreateOrUpdateResponder(pc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"avs.PrivateCloudsCreateOrUpdateFuture\", \"Result\", pc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.DatabasesCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.DatabasesCreateOrUpdateFuture\")\n return\n }\n sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {\n d, err = client.CreateOrUpdateResponder(d.Response.Response)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.DatabasesCreateOrUpdateFuture\", \"Result\", d.Response.Response, \"Failure responding to request\")\n }\n }\n return\n }", "func (d Dispatcher) ExecResult(id string, hash string) (interface{}, error) {\n\te, err := d.GetBC().FindExec(id, hash)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn e.GetResult(), nil\n}", "func (future *NamespacesDeleteFuture) Result(client NamespacesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"eventhub.NamespacesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"eventhub.NamespacesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (r FutureResult) Receive() (*interface{}, error) {\n\tres, err := ReceiveFuture(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar result interface{}\n\t// Unmarshal result as a string.\n\terr = json.Unmarshal(res, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "func (_TestABI *TestABISession) GetResult() ([]*big.Int, error) {\n\treturn _TestABI.Contract.GetResult(&_TestABI.CallOpts)\n}", "func (cb *RedisBackend) GetResult(taskID string) (*message.CeleryResultMessage, error) {\n\tconn := cb.Get()\n\tdefer conn.Close()\n\tval, err := conn.Do(\"GET\", fmt.Sprintf(\"celery-task-meta-%s\", taskID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif val == nil {\n\t\treturn nil, fmt.Errorf(\"result not available\")\n\t}\n\tvar resultMessage message.CeleryResultMessage\n\terr = json.Unmarshal(val.([]byte), &resultMessage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resultMessage, nil\n}", "func (r *CasSet) Result() *CasSetResult {\n\tif r.result != nil {\n\t\treturn r.result\n\t}\n\treturn nil\n}", "func (_TestABI *TestABICallerSession) GetResult() ([]*big.Int, error) {\n\treturn _TestABI.Contract.GetResult(&_TestABI.CallOpts)\n}", "func (future *NamespacesCreateOrUpdateFuture) Result(client NamespacesClient) (nr NamespaceResource, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"eventhub.NamespacesCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"eventhub.NamespacesCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif nr.Response.Response, err = future.GetResult(sender); err == nil && nr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tnr, err = client.CreateOrUpdateResponder(nr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"eventhub.NamespacesCreateOrUpdateFuture\", \"Result\", nr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (future *SplitFuture) Result(client Client) (lr ListResponse, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"reservations.SplitFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"reservations.SplitFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif lr.Response.Response, err = future.GetResult(sender); err == nil && lr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tlr, err = client.SplitResponder(lr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"reservations.SplitFuture\", \"Result\", lr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (t *Task) SendResult(res interface{}) (interface{}, error) {\n\tpar := map[string]interface{}{\n\t\t\"taskid\": t.taskId,\n\t\t\"result\": res,\n\t}\n\treturn t.nc.Exec(\"task.result\", par)\n}", "func (p *PDS) GetResult() int {\n\treturn p.result\n}", "func (future *MaintenanceWindowsDeleteFuture) Result(client MaintenanceWindowsClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.MaintenanceWindowsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.MaintenanceWindowsDeleteFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "func (future *ServersUpdateFuture) Result(client ServersClient) (s Server, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersUpdateFuture\")\n return\n }\n sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {\n s, err = client.UpdateResponder(s.Response.Response)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersUpdateFuture\", \"Result\", s.Response.Response, \"Failure responding to request\")\n }\n }\n return\n }", "func (o *DeferredResultVoid) GetResult() map[string]interface{} {\n\tif o == nil || o.Result == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Result\n}", "func (s *Server) Result(ctx context.Context, req *ResultRequest) (*ResultResponse, error) {\n\t// check authorization and get runner hash\n\trunnerHash, err := s.isAuthorized(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// make sure runner is allowed to update this execution\n\tvar exec *execution.Execution\n\troute := fmt.Sprintf(\"custom/%s/%s/%s\", executionmodule.QuerierRoute, executionmodule.QueryGet, req.ExecutionHash)\n\tif err := s.rpc.QueryJSON(route, nil, &exec); err != nil {\n\t\treturn nil, err\n\t}\n\tif !exec.ExecutorHash.Equal(runnerHash) {\n\t\treturn nil, fmt.Errorf(\"this runner (%q) is not authorized to submit the result of this execution, the executor should be %q\", runnerHash, exec.ExecutorHash)\n\t}\n\n\t// update execution\n\tacc, err := s.rpc.GetAccount()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstart, ok := s.execInProgress.Load(req.ExecutionHash.String())\n\tif !ok {\n\t\ts.logger.Error(fmt.Sprintf(\"execution %q should be in memory\", req.ExecutionHash.String()))\n\t\tstart = time.Now().UnixNano()\n\t}\n\tmsg := executionmodule.MsgUpdate{\n\t\tExecutor: acc.GetAddress(),\n\t\tHash: req.ExecutionHash,\n\t\tStart: start.(int64),\n\t\tStop: time.Now().UnixNano(),\n\t}\n\tswitch result := req.Result.(type) {\n\tcase *ResultRequest_Outputs:\n\t\tmsg.Result = &executionmodule.MsgUpdateOutputs{\n\t\t\tOutputs: result.Outputs,\n\t\t}\n\tcase *ResultRequest_Error:\n\t\tmsg.Result = &executionmodule.MsgUpdateError{\n\t\t\tError: result.Error,\n\t\t}\n\t}\n\tif _, err := s.rpc.BuildAndBroadcastMsg(msg); err != nil {\n\t\treturn nil, err\n\t}\n\ts.execInProgress.Delete(req.ExecutionHash.String())\n\treturn &ResultResponse{}, nil\n}", "func (r *Result) Error() string {\n return r.data.Error\n}", "func (future *ConfigurationsUpdateFuture) Result(client ConfigurationsClient) (c Configuration, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ConfigurationsUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ConfigurationsUpdateFuture\")\n return\n }\n sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {\n c, err = client.UpdateResponder(c.Response.Response)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ConfigurationsUpdateFuture\", \"Result\", c.Response.Response, \"Failure responding to request\")\n }\n }\n return\n }", "func (fm *FinalizingMember) Result() *Result {\n\treturn &Result{\n\t\tGroup: fm.group,\n\t\tGroupPublicKey: fm.groupPublicKey, // nil if threshold not satisfied\n\t\tGroupPrivateKeyShare: fm.groupPrivateKeyShare,\n\t\tgroupPublicKeySharesChannel: fm.groupPublicKeySharesChannel,\n\t}\n}", "func (p *promise) RawResult() interface{} {\n\tres := p.result.Load()\n\tif res == nilResult {\n\t\tres = nil\n\t}\n\n\treturn res\n}", "func (r AWSEKS) Result() result.Result {\n\t// TODO David: This needs to be worked out. Store the result instead of in-line return.\n\treturn result.Result{}\n}", "func (future *ServersStopFuture) Result(client ServersClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersStopFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersStopFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "func (future *ServersRestartFuture) Result(client ServersClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersRestartFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersRestartFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "func (iter OperationListResultIterator) Value() OperationResult {\n\tif !iter.page.NotDone() {\n\t\treturn OperationResult{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "func (o *SnapmirrorResyncResponseResult) ResultOperationId() string {\n\tvar r string\n\tif o.ResultOperationIdPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.ResultOperationIdPtr\n\treturn r\n}", "func (obj *standard) Result() string {\n\treturn obj.res\n}", "func (client *VirtualMachineScaleSetsClientMock) WaitForAsyncOperationResult(ctx context.Context, future *azure.Future) (*http.Response, error) {\n\treturn &http.Response{StatusCode: http.StatusOK}, nil\n}", "func (t *Task) invoke(ctx context.Context, resch chan TaskResult) {\n\tresult := &TaskResult{\n\t\tindex: t.index,\n\t\tName: t.name,\n\t\tDone: true,\n\t}\n\tparams := []reflect.Value{}\n\n\tgo func() {\n\t\tres := t.valueOf.Call(params)\n\t\tswitch t.returnType {\n\t\tcase TaskReturnErrorOnly:\n\t\t\tif v := res[0].Interface(); v != nil {\n\t\t\t\terr, ok := v.(error)\n\t\t\t\tif !ok {\n\t\t\t\t\tresult.Error = fmt.Errorf(\"value is not an error\")\n\t\t\t\t}\n\t\t\t\tresult.Error = err\n\t\t\t}\n\t\tcase TaskReturnResultOnly:\n\t\t\tresult.Result = res[0].Interface()\n\t\tcase TaskReturnResultAndError:\n\t\t\tresult.Result = res[0].Interface()\n\t\t\tif v := res[1].Interface(); v != nil {\n\t\t\t\terr, ok := v.(error)\n\t\t\t\tif !ok {\n\t\t\t\t\tresult.Error = fmt.Errorf(\"value is not an error\")\n\t\t\t\t}\n\t\t\t\tresult.Error = err\n\t\t\t}\n\t\tdefault:\n\t\t\tresult.Error = fmt.Errorf(\"invalid function return type (%d)\", t.returnType)\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\tcase resch <- *result:\n\t\t}\n\t}()\n}", "func (future *OpenShiftManagedClustersUpdateTagsFuture) Result(client OpenShiftManagedClustersClient) (osmc v20180930preview.OpenShiftManagedCluster, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"containerservice.OpenShiftManagedClustersUpdateTagsFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"containerservice.OpenShiftManagedClustersUpdateTagsFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif osmc.Response.Response, err = future.GetResult(sender); err == nil && osmc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tosmc, err = client.UpdateTagsResponder(osmc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"containerservice.OpenShiftManagedClustersUpdateTagsFuture\", \"Result\", osmc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "func (o *DeferredResultVoid) GetResultOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Result == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Result, true\n}", "func (f *BatchFuture) Results() (uint64, error) {\n\t<-f.waitCh\n\treturn f.index, f.err\n}", "func (p *Player) Result() *Result {\n\treturn resultByID(p.Int(\"result\"))\n}", "func (resp Response) Result() string {\n\treturn string(resp.Body)\n}", "func (future *SubAccountDeleteFuture) result(client SubAccountClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"logz.SubAccountDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"logz.SubAccountDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (rw *ReadWrite) PutResult(v Value) *ReadWrite {\n\trw.PutBool(true) // no error\n\tif v == nil {\n\t\treturn rw.PutBool(false)\n\t}\n\treturn rw.PutBool(true).PutVal(v)\n}", "func (future *ServersCreateFuture) Result(client ServersClient) (s Server, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersCreateFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersCreateFuture\")\n return\n }\n sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {\n s, err = client.CreateResponder(s.Response.Response)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersCreateFuture\", \"Result\", s.Response.Response, \"Failure responding to request\")\n }\n }\n return\n }", "func (future *MonitorsDeleteFuture) result(client MonitorsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"logz.MonitorsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"logz.MonitorsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "func (cmd *StatusCmdReal) Result() (string, error) {\n\treturn cmd.statusCmd.Result()\n}", "func (azc *azureZonesClient) Result(ctx context.Context, future azureautorest.FutureAPI, futureType string) (result interface{}, err error) {\n\t_, _, done := tele.StartSpanWithLogger(ctx, \"privatedns.azureZonesClient.Result\")\n\tdefer done()\n\n\tif future == nil {\n\t\treturn nil, errors.Errorf(\"cannot get result from nil future\")\n\t}\n\n\tswitch futureType {\n\tcase infrav1.PutFuture:\n\t\t// Marshal and Unmarshal the future to put it into the correct future type so we can access the Result function.\n\t\t// Unfortunately the FutureAPI can't be casted directly to PrivateZonesCreateOrUpdateFuture because it is a azureautorest.Future, which doesn't implement the Result function. See PR #1686 for discussion on alternatives.\n\t\t// It was converted back to a generic azureautorest.Future from the CAPZ infrav1.Future type stored in Status: https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/azure/converters/futures.go#L49.\n\t\tvar createFuture *privatedns.PrivateZonesCreateOrUpdateFuture\n\t\tjsonData, err := future.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to marshal future\")\n\t\t}\n\t\tif err := json.Unmarshal(jsonData, &createFuture); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to unmarshal future data\")\n\t\t}\n\t\treturn createFuture.Result(azc.privatezones)\n\n\tcase infrav1.DeleteFuture:\n\t\t// Delete does not return a result private dns zone.\n\t\treturn nil, nil\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unknown future type %q\", futureType)\n\t}\n}", "func (task *Task) AggregateResult(_ context.Context, nodes node.List) (userdata.ProcessResult, error) {\n\t// There is following common scenarios when supernodes response:\n\t// 1. Secondary node and primary node both response userdata validation result error\n\t// 2. Secondary node response userdata validation result success and primary node provide further processing result\n\t// 3. Some node fail to response, or not in the 2 case above, then we need to aggregate result and consider what happen\n\n\t// This part is for case 1 or 2 above, and we trust the primary node so we use its response\n\tfor _, node := range nodes {\n\t\tnode := node\n\t\tif node.IsPrimary() {\n\t\t\tresult := node.Result\n\t\t\tif result == nil {\n\t\t\t\treturn userdata.ProcessResult{}, errors.Errorf(\"Primary node have empty result\")\n\t\t\t}\n\t\t\treturn *result, nil\n\t\t}\n\t}\n\n\treturn userdata.ProcessResult{}, errors.Errorf(\"failed to Aggregate Result\")\n}", "func (_IOrakuruCore *IOrakuruCoreTransactor) SubmitResult(opts *bind.TransactOpts, _requestId [32]byte, _result string) (*types.Transaction, error) {\n\treturn _IOrakuruCore.contract.Transact(opts, \"submitResult\", _requestId, _result)\n}", "func (o *ExportPolicyCreateResponseResult) Result() ExportPolicyCreateResponseResultResult {\n\tvar r ExportPolicyCreateResponseResultResult\n\tif o.ResultPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.ResultPtr\n\treturn r\n}", "func (promise *Promise) Await() (interface{}, error) {\n\tpromise.wg.Wait()\n\treturn promise.result, promise.err\n}", "func (wc *WebClient) CallResult(message string) {\n\twc.SendMessage(\"R\" + message)\n}", "func (c *SearchCall) Result(result string) *SearchCall {\n\tc.urlParams_.Set(\"result\", result)\n\treturn c\n}", "func (future *OpenShiftManagedClustersCreateOrUpdateFuture) Result(client OpenShiftManagedClustersClient) (osmc v20180930preview.OpenShiftManagedCluster, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"containerservice.OpenShiftManagedClustersCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"containerservice.OpenShiftManagedClustersCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif osmc.Response.Response, err = future.GetResult(sender); err == nil && osmc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tosmc, err = client.CreateOrUpdateResponder(osmc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"containerservice.OpenShiftManagedClustersCreateOrUpdateFuture\", \"Result\", osmc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}" ]
[ "0.68970007", "0.6268892", "0.6189259", "0.61383504", "0.6067694", "0.60657936", "0.60342884", "0.59804076", "0.5958696", "0.59358656", "0.5925878", "0.5925864", "0.5890074", "0.5798286", "0.57893986", "0.5785197", "0.5746792", "0.57451844", "0.57304114", "0.57121587", "0.56919926", "0.56706506", "0.5659731", "0.5651371", "0.56395", "0.5633731", "0.56331563", "0.563295", "0.5631323", "0.5631034", "0.56269795", "0.5608631", "0.5575997", "0.5574674", "0.55670816", "0.5552891", "0.55261093", "0.5517293", "0.5516574", "0.55096895", "0.55077136", "0.5492814", "0.54856205", "0.54819244", "0.54817617", "0.54496217", "0.5430257", "0.54296535", "0.542217", "0.54220134", "0.5421125", "0.54179657", "0.54130286", "0.5412486", "0.5409767", "0.54085284", "0.5404653", "0.53877234", "0.5380622", "0.5378296", "0.53716725", "0.53489614", "0.53447896", "0.5343116", "0.53394026", "0.5332109", "0.5329716", "0.5328759", "0.53251636", "0.5323417", "0.5310882", "0.53016025", "0.52924687", "0.52903724", "0.52844745", "0.52832925", "0.5264958", "0.5262346", "0.5261348", "0.5253398", "0.52314484", "0.51981205", "0.5187897", "0.51761836", "0.516821", "0.51598376", "0.5141882", "0.51396567", "0.512985", "0.51219565", "0.5111032", "0.51106626", "0.5109876", "0.50963223", "0.50923455", "0.5091409", "0.5089917", "0.5089237", "0.50874996", "0.5085052" ]
0.5439072
46
DefaultConf returns a cache config with some defaults
func DefaultConf() Conf { return Conf{Type: "memory", Options: map[string]string{"memory_limit": "10240", "ttl": "86400"}} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultConfig() Config {\n\treturn Config{\n\t\tCache: CacheConfig{\n\t\t\tType: FILE,\n\t\t\tExpiration: 10,\n\t\t},\n\t}\n}", "func defaultConfig() interface{} {\n\treturn &conf{\n\t\tPools: make(map[string]poolConfig),\n\t\tLabelNode: false,\n\t\tTaintNode: false,\n\t}\n}", "func defaultConfig() interface{} {\n\treturn &config{\n\t\tPools: make(pools),\n\t\tConfDirPath: \"/etc/cmk\",\n\t}\n}", "func ConfigDefault() Config {\n\tc := Config{\n\t\tCache: true,\n\t\tCacheRefresh: 3,\n\t\tCachePath: \"./.hpy\",\n\t\tMotd: true,\n\t\tMotdPath: \"/tmp/hpy.json\",\n\t\tLogging: true,\n\t\tLoggingPath: \"/var/log/hpy.log\",\n\t\tIgnoreLogging: false,\n\t\tDebug: false,\n\t}\n\treturn c\n}", "func DefaultConf() *Conf {\n\treturn &Conf{\n\t\tDeduplicationScope: 0x3DA3358B4DC173,\n\t}\n}", "func defaultConfig() Config {\n\treturn Config{\n\t\tConfFileOptions: defaultFileOptions(),\n\t}\n}", "func (c *ConfHolder) Default() []byte {\n\treturn nil\n}", "func configDefault(config ...Config) Config {\n\t// Return default config if nothing provided\n\tif len(config) < 1 {\n\t\treturn ConfigDefault\n\t}\n\n\t// Override default config\n\tcfg := config[0]\n\n\t// Set default values\n\n\tif cfg.Next == nil {\n\t\tcfg.Next = ConfigDefault.Next\n\t}\n\n\tif cfg.Lifetime.Nanoseconds() == 0 {\n\t\tcfg.Lifetime = ConfigDefault.Lifetime\n\t}\n\n\tif cfg.KeyHeader == \"\" {\n\t\tcfg.KeyHeader = ConfigDefault.KeyHeader\n\t}\n\tif cfg.KeyHeaderValidate == nil {\n\t\tcfg.KeyHeaderValidate = ConfigDefault.KeyHeaderValidate\n\t}\n\n\tif cfg.KeepResponseHeaders != nil && len(cfg.KeepResponseHeaders) == 0 {\n\t\tcfg.KeepResponseHeaders = ConfigDefault.KeepResponseHeaders\n\t}\n\n\tif cfg.Lock == nil {\n\t\tcfg.Lock = NewMemoryLock()\n\t}\n\n\tif cfg.Storage == nil {\n\t\tcfg.Storage = memory.New(memory.Config{\n\t\t\tGCInterval: cfg.Lifetime / 2, // Half the lifetime interval\n\t\t})\n\t}\n\n\treturn cfg\n}", "func Default() *Config {\n\treturn &defaultConfig\n}", "func DefaultConfig() *Config { return &Config{BaseConfig{MinFees: defaultMinimumFees}} }", "func defaultConfig() *config {\n\treturn &config{}\n}", "func DefaultTimedCacheConfig() *TimedCacheConfig {\n\tc := new(TimedCacheConfig)\n\tc.Comparator = defaultTimedCacheEquivalencyFunc\n\treturn c\n}", "func Default() *Config {\n\tconf := &Config{\n\t\tProtocol: \"tcp\",\n\t\tAddr: \"0.0.0.0:25565\",\n\t\tHosts: []HostConfig{\n\t\t\t{\n\t\t\t\tName: \"Server-1\",\n\t\t\t\tAddr: \"localhost:25580\",\n\t\t\t},\n\t\t},\n\t\tLogConfig: LogConfig{\n\t\t\tLogConnections: true,\n\t\t\tLogDisconnect: false,\n\t\t},\n\t\tHealthCheckTime: 5,\n\t\tUDPTimeout: 3000,\n\t\tSaveConfigOnClose: false,\n\t\tInterfaces: []string{},\n\t}\n\tconf.fillFlags()\n\treturn conf\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tRedisURI: \"redis://127.0.0.1:6379\",\n\t\tGCP: &GCPConfig{\n\t\t\tProjectID: \"\",\n\t\t\tServiceAccountFile: \"\",\n\t\t},\n\t}\n}", "func Default() *Config {\n\treturn &Config{\n\t\tEnv: &Env{Region: region, Zone: zone, DeployEnv: deployEnv, Host: host},\n\t\tDiscovery: &naming.Config{Region: region, Zone: zone, Env: deployEnv, Host: host},\n\t}\n}", "func Default() *Config {\n\treturn &Config{\n\t\tEnv: &Env{Region: region, Zone: zone, DeployEnv: deployEnv, Host: host, Weight: weight},\n\t\tDiscovery: &naming.Config{Region: region, Zone: zone, Env: deployEnv, Host: host},\n\t\tHTTPServer: &HTTPServer{\n\t\t\tNetwork: \"tcp\",\n\t\t\tAddr: \"3111\",\n\t\t\tReadTimeout: xtime.Duration(time.Second),\n\t\t\tWriteTimeout: xtime.Duration(time.Second),\n\t\t},\n\t\tRPCClient: &RPCClient{Dial: xtime.Duration(time.Second), Timeout: xtime.Duration(time.Second)},\n\t\tRPCServer: &RPCServer{\n\t\t\tNetwork: \"tcp\",\n\t\t\tAddr: \"3119\",\n\t\t\tTimeout: xtime.Duration(time.Second),\n\t\t\tIdleTimeout: xtime.Duration(time.Second * 60),\n\t\t\tMaxLifeTime: xtime.Duration(time.Hour * 2),\n\t\t\tForceCloseWait: xtime.Duration(time.Second * 20),\n\t\t\tKeepAliveInterval: xtime.Duration(time.Second * 60),\n\t\t\tKeepAliveTimeout: xtime.Duration(time.Second * 20),\n\t\t},\n\t\tBackoff: &Backoff{MaxDelay: 300, BaseDelay: 3, Factor: 1.8, Jitter: 1.3},\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tAddr: DefaultAddr,\n\t\tDirPath: DefaultDirPath,\n\t\tBlockSize: DefaultBlockSize,\n\t\tRwMethod: storage.FileIO,\n\t\tIdxMode: KeyValueMemMode,\n\t\tMaxKeySize: DefaultMaxKeySize,\n\t\tMaxValueSize: DefaultMaxValueSize,\n\t\tSync: false,\n\t\tReclaimThreshold: DefaultReclaimThreshold,\n\t\tSingleReclaimThreshold: DefaultSingleReclaimThreshold,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tDir: DefaultConfDir,\n\t\tTimeout: xtime.Duration(\"1s\"),\n\t\tEnable: false,\n\t\tMysql: ConfDataSourceMysql{\n\t\t\tEnable: false,\n\t\t\tDsn: \"127.0.0.1:6379\",\n\t\t},\n\t\tEtcd: ConfDataSourceEtcd{\n\t\t\tEnable: false,\n\t\t\tSecure: false,\n\t\t\tEndPoints: []string{\"127.0.0.1:2379\"},\n\t\t},\n\t}\n}", "func defaultConfig() *config {\n\treturn &config{\n\t\tOperations: operations{\n\t\t\tResize: resize{\n\t\t\t\tRaw: *resizeDefaults(),\n\t\t\t},\n\t\t\tFlip: flip{\n\t\t\t\tRaw: *flipDefaults(),\n\t\t\t},\n\t\t\tBlur: blur{\n\t\t\t\tRaw: *blurDefaults(),\n\t\t\t},\n\t\t\tRotate: rotate{\n\t\t\t\tRaw: *rotateDefaults(),\n\t\t\t},\n\t\t\tCrop: crop{\n\t\t\t\tRaw: *cropDefaults(),\n\t\t\t},\n\t\t\tLabel: label{\n\t\t\t\tRaw: *labelDefaults(),\n\t\t\t},\n\t\t},\n\t\tExport: export{\n\t\t\tRaw: *exportDefaults(),\n\t\t},\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tBaseConfig: BaseConfig{\n\t\t\tMinGasPrices: defaultMinGasPrices,\n\t\t\tQueryGasLimit: 0,\n\t\t\tInterBlockCache: true,\n\t\t\tPruning: pruningtypes.PruningOptionDefault,\n\t\t\tPruningKeepRecent: \"0\",\n\t\t\tPruningInterval: \"0\",\n\t\t\tMinRetainBlocks: 0,\n\t\t\tIndexEvents: make([]string, 0),\n\t\t\tIAVLCacheSize: 781250,\n\t\t\tIAVLDisableFastNode: false,\n\t\t\tAppDBBackend: \"\",\n\t\t},\n\t\tTelemetry: telemetry.Config{\n\t\t\tEnabled: false,\n\t\t\tGlobalLabels: [][]string{},\n\t\t},\n\t\tAPI: APIConfig{\n\t\t\tEnable: false,\n\t\t\tSwagger: false,\n\t\t\tAddress: DefaultAPIAddress,\n\t\t\tMaxOpenConnections: 1000,\n\t\t\tRPCReadTimeout: 10,\n\t\t\tRPCMaxBodyBytes: 1000000,\n\t\t},\n\t\tGRPC: GRPCConfig{\n\t\t\tEnable: true,\n\t\t\tAddress: DefaultGRPCAddress,\n\t\t\tMaxRecvMsgSize: DefaultGRPCMaxRecvMsgSize,\n\t\t\tMaxSendMsgSize: DefaultGRPCMaxSendMsgSize,\n\t\t},\n\t\tGRPCWeb: GRPCWebConfig{\n\t\t\tEnable: true,\n\t\t},\n\t\tStateSync: StateSyncConfig{\n\t\t\tSnapshotInterval: 0,\n\t\t\tSnapshotKeepRecent: 2,\n\t\t},\n\t\tStreaming: StreamingConfig{\n\t\t\tABCI: ABCIListenerConfig{\n\t\t\t\tKeys: []string{},\n\t\t\t\tStopNodeOnErr: true,\n\t\t\t},\n\t\t},\n\t\tMempool: MempoolConfig{\n\t\t\tMaxTxs: 5_000,\n\t\t},\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tBaseConfig: defaultBaseConfig(),\n\t\tP2P: p2pConfig.DefaultConfig(),\n\t\tAPI: apiConfig.DefaultConfig(),\n\t\tCONSENSUS: consensusConfig.DefaultConfig(),\n\t\tHARE: hareConfig.DefaultConfig(),\n\t\tTIME: timeConfig.DefaultConfig(),\n\t}\n}", "func DefaultConfig() *Config {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tconf := &Config{\n\t\tBuild: version.Version,\n\t\tDatacenter: DefaultDC,\n\t\tNodeName: hostname,\n\t\tRPCAddr: DefaultRPCAddr,\n\t\tRaftConfig: raft.DefaultConfig(),\n\t\tSerfLANConfig: lib.SerfDefaultConfig(),\n\t\tSerfWANConfig: lib.SerfDefaultConfig(),\n\t\tSerfFloodInterval: 60 * time.Second,\n\t\tReconcileInterval: 60 * time.Second,\n\t\tProtocolVersion: ProtocolVersion2Compatible,\n\t\tACLPolicyTTL: 30 * time.Second,\n\t\tACLTokenTTL: 30 * time.Second,\n\t\tACLDefaultPolicy: \"allow\",\n\t\tACLDownPolicy: \"extend-cache\",\n\t\tACLReplicationRate: 1,\n\t\tACLReplicationBurst: 5,\n\t\tACLReplicationApplyLimit: 100, // ops / sec\n\t\tTombstoneTTL: 15 * time.Minute,\n\t\tTombstoneTTLGranularity: 30 * time.Second,\n\t\tSessionTTLMin: 10 * time.Second,\n\n\t\t// These are tuned to provide a total throughput of 128 updates\n\t\t// per second. If you update these, you should update the client-\n\t\t// side SyncCoordinateRateTarget parameter accordingly.\n\t\tCoordinateUpdatePeriod: 5 * time.Second,\n\t\tCoordinateUpdateBatchSize: 128,\n\t\tCoordinateUpdateMaxBatches: 5,\n\n\t\tRPCRate: rate.Inf,\n\t\tRPCMaxBurst: 1000,\n\n\t\tTLSMinVersion: \"tls10\",\n\n\t\t// TODO (slackpad) - Until #3744 is done, we need to keep these\n\t\t// in sync with agent/config/default.go.\n\t\tAutopilotConfig: &autopilot.Config{\n\t\t\tCleanupDeadServers: true,\n\t\t\tLastContactThreshold: 200 * time.Millisecond,\n\t\t\tMaxTrailingLogs: 250,\n\t\t\tServerStabilizationTime: 10 * time.Second,\n\t\t},\n\n\t\tCAConfig: &structs.CAConfiguration{\n\t\t\tProvider: \"consul\",\n\t\t\tConfig: map[string]interface{}{\n\t\t\t\t\"RotationPeriod\": \"2160h\",\n\t\t\t\t\"LeafCertTTL\": \"72h\",\n\t\t\t},\n\t\t},\n\n\t\tServerHealthInterval: 2 * time.Second,\n\t\tAutopilotInterval: 10 * time.Second,\n\t}\n\n\t// Increase our reap interval to 3 days instead of 24h.\n\tconf.SerfLANConfig.ReconnectTimeout = 3 * 24 * time.Hour\n\tconf.SerfWANConfig.ReconnectTimeout = 3 * 24 * time.Hour\n\n\t// WAN Serf should use the WAN timing, since we are using it\n\t// to communicate between DC's\n\tconf.SerfWANConfig.MemberlistConfig = memberlist.DefaultWANConfig()\n\n\t// Ensure we don't have port conflicts\n\tconf.SerfLANConfig.MemberlistConfig.BindPort = DefaultLANSerfPort\n\tconf.SerfWANConfig.MemberlistConfig.BindPort = DefaultWANSerfPort\n\n\t// Raft protocol version 3 only works with other Consul servers running\n\t// 0.8.0 or later.\n\tconf.RaftConfig.ProtocolVersion = 3\n\n\t// Disable shutdown on removal\n\tconf.RaftConfig.ShutdownOnRemove = false\n\n\t// Check every 5 seconds to see if there are enough new entries for a snapshot, can be overridden\n\tconf.RaftConfig.SnapshotInterval = 30 * time.Second\n\n\t// Snapshots are created every 16384 entries by default, can be overridden\n\tconf.RaftConfig.SnapshotThreshold = 16384\n\n\treturn conf\n}", "func DefaultConfig(scale cachescale.Func) IndexConfig {\n\treturn IndexConfig{\n\t\tCaches: IndexCacheConfig{\n\t\t\tForklessCausePairs: scale.I(20000),\n\t\t\tHighestBeforeSeqSize: scale.U(160 * 1024),\n\t\t\tLowestAfterSeqSize: scale.U(160 * 1024),\n\t\t},\n\t}\n}", "func DefaultConfig() Config {\n\treturn MemoryConstrainedDefaults()\n}", "func Default() *Configuration {\n\treturn &Configuration{\n\t\tSplitMax: defaultSplitMax,\n\t\tPeekMax: defaultPeekMax,\n\t\tStringMax: defaultStringMax,\n\t\tDisableTransforms: []string{},\n\t\tDisableInterpolators: []string{},\n\t}\n}", "func configDefault(config ...Config) Config {\n\t// Return default config if nothing provided\n\tif len(config) < 1 {\n\t\treturn ConfigDefault\n\t}\n\n\t// Override default config\n\tcfg := config[0]\n\n\t// Set default values\n\tif cfg.Host == \"\" {\n\t\tcfg.Host = ConfigDefault.Host\n\t}\n\tif cfg.Port <= 0 {\n\t\tcfg.Port = ConfigDefault.Port\n\t}\n\tif cfg.Database == \"\" {\n\t\tcfg.Database = ConfigDefault.Database\n\t}\n\tif cfg.Table == \"\" {\n\t\tcfg.Table = ConfigDefault.Table\n\t}\n\tif int(cfg.GCInterval.Seconds()) <= 0 {\n\t\tcfg.GCInterval = ConfigDefault.GCInterval\n\t}\n\treturn cfg\n}", "func Default() *Config {\n\treturn &Config{\n\t\tEnv: &Env{DeployEnv: deployEnv, Host: host, Weight: weight},\n\t\tTCPServer: &TCPServer{\n\t\t\tNetwork: \"tcp\",\n\t\t\tAddr: \"3119\",\n\t\t\tReadTimeout: xtime.Duration(time.Second),\n\t\t\tWriteTimeout: xtime.Duration(time.Second),\n\t\t},\n\t\tHTTPServer: &HTTPServer{\n\t\t\tNetwork: \"tcp\",\n\t\t\tAddr: \"3111\",\n\t\t\tReadTimeout: xtime.Duration(time.Second),\n\t\t\tWriteTimeout: xtime.Duration(time.Second),\n\t\t},\n\t\tBucket: &Bucket{\n\t\t\tSize: 32,\n\t\t\tChannel: 1024,\n\t\t\tRoom: 1024,\n\t\t\tRoutineAmount: 32,\n\t\t\tRoutineSize: 1024,\n\t\t},\n\t\tRPCClient: &RPCClient{Dial: xtime.Duration(time.Second), Timeout: xtime.Duration(time.Second), SrvAddr: \":3119\"},\n\t\tRPCServer: &RPCServer{\n\t\t\tNetwork: \"tcp\",\n\t\t\tAddr: \"3119\",\n\t\t\tTimeout: xtime.Duration(time.Second),\n\t\t\tIdleTimeout: xtime.Duration(time.Second * 60),\n\t\t\tMaxLifeTime: xtime.Duration(time.Hour * 2),\n\t\t\tForceCloseWait: xtime.Duration(time.Second * 20),\n\t\t\tKeepAliveInterval: xtime.Duration(time.Second * 60),\n\t\t\tKeepAliveTimeout: xtime.Duration(time.Second * 20),\n\t\t},\n\t}\n}", "func NewDefaultConfigCache() *ConfigCache {\n\treturn &ConfigCache{\n\t\tlimit: DefaultCacheLimit,\n\t\tttl: DefaultCacheTTL,\n\t\tcache: cmap.New(),\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tBlockSize: 64,\n\t\tNumReplicas: 2,\n\t\tNumTapestry: 2,\n\t\tZkAddr: \"localhost:2181\",\n\t}\n}", "func DefaultConfig(hostname string) *Config {\n\treturn &Config{\n\t\thostname,\n\t\t8, // 8 vnodes\n\t\tsha1.New, // SHA1\n\t\ttime.Duration(5 * time.Second),\n\t\ttime.Duration(15 * time.Second),\n\t\t8, // 8 successors\n\t\tnil, // No delegate\n\t\t160, // 160bit hash function\n\t\t\"\",\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tShowOurLogs: true,\n\t\tDeliverLogs: defaultDeliver,\n\t\tBackoffCap: defaultBackoffCap,\n\t\tBackoffGranularity: defaultBackoffGranularity,\n\t\tTickInterval: defaultTickInterval,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tN: 10,\n\t\tRoundDuration: 10 * time.Second,\n\t\tWakeupDelta: 10 * time.Second,\n\t\tExpectedLeaders: 5,\n\t\tLimitIterations: 5,\n\t\tLimitConcurrent: 5,\n\t\tHdist: 20,\n\t}\n}", "func (cfg *Config) Default() error {\n\tcfg.MetricTTL = DefaultMetricTTL\n\tcfg.MetricType = DefaultMetricType\n\treturn nil\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tAppName: pkg.Name(),\n\t\tLogPath: \"/tmp/log\",\n\t\tFlowRules: make([]*flow.Rule, 0),\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tBuffered: true,\n\t\tDepth: 10,\n\t}\n}", "func DefaultRedisConfiguration() map[string]string {\n\treturn map[string]string{\"redis.conf\": redisConfContent}\n}", "func (f *factory) DefaultConfig() interface{} {\n\treturn f.newDefaultCfg()\n}", "func configDefault(config ...Config) Config {\n\t// Return default config if nothing provided\n\tif len(config) < 1 {\n\t\treturn ConfigDefault\n\t}\n\n\t// Override default config\n\tcfg := config[0]\n\n\t// Set default values\n\tif int(cfg.Duration.Seconds()) > 0 {\n\t\tlog.Warn(\"[LIMITER] Duration is deprecated, please use Expiration\")\n\t\tcfg.Expiration = cfg.Duration\n\t}\n\tif cfg.Key != nil {\n\t\tlog.Warn(\"[LIMITER] Key is deprecated, please us KeyGenerator\")\n\t\tcfg.KeyGenerator = cfg.Key\n\t}\n\tif cfg.Store != nil {\n\t\tlog.Warn(\"[LIMITER] Store is deprecated, please use Storage\")\n\t\tcfg.Storage = cfg.Store\n\t}\n\tif cfg.Next == nil {\n\t\tcfg.Next = ConfigDefault.Next\n\t}\n\tif cfg.Max <= 0 {\n\t\tcfg.Max = ConfigDefault.Max\n\t}\n\tif int(cfg.Expiration.Seconds()) <= 0 {\n\t\tcfg.Expiration = ConfigDefault.Expiration\n\t}\n\tif cfg.KeyGenerator == nil {\n\t\tcfg.KeyGenerator = ConfigDefault.KeyGenerator\n\t}\n\tif cfg.LimitReached == nil {\n\t\tcfg.LimitReached = ConfigDefault.LimitReached\n\t}\n\tif cfg.LimiterMiddleware == nil {\n\t\tcfg.LimiterMiddleware = ConfigDefault.LimiterMiddleware\n\t}\n\treturn cfg\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tObservability: DefaultObservability(),\n\t\tWorkerHasher: DefaultHasher,\n\t\tWorkerCount: 1,\n\t\tMaxItemRetries: 10,\n\t\tWorkerQueueSize: 2000,\n\t\tLeaderElectionEnabled: true,\n\t\tDelayResolution: time.Millisecond * 250,\n\t\tDelayQueueSize: 1000,\n\t\tMaxReconcileTime: time.Second * 10,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tK8sClient: nil,\n\t\tLogger: nil,\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tLogLevel: \"debug\",\n\t\tLogFormat: \"text\",\n\n\t\tDatabaseDriver: \"boltdb\",\n\t\tDatabasePath: \"db/eremetic.db\",\n\n\t\tName: \"Eremetic\",\n\t\tUser: \"root\",\n\t\tCheckpoint: true,\n\t\tFailoverTimeout: 2592000.0,\n\t\tQueueSize: 100,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tK8sClient: nil,\n\t\tLogger: nil,\n\t\tVaultClient: nil,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tResource: nil,\n\n\t\t// Settings.\n\t\tName: \"\",\n\t}\n}", "func DefaultConfiguration() Configuration {\n\tconf := Configuration{\n\t\tMaxIdleConnPerHost: 200,\n\t\tDisableCompression: false,\n\t\tDisableKeepAlive: false,\n\t\tUseHTTP2: false,\n\t\tTimeout: 3 * time.Second,\n\t\tMethod: http.MethodGet,\n\t}\n\n\treturn conf\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tContractQueryGasLimit: DefaultContractQueryGasLimit,\n\t\tContractDebugMode: DefaultContractDebugMode,\n\t\tWriteVMMemoryCacheSize: DefaultWriteVMMemoryCacheSize,\n\t\tReadVMMemoryCacheSize: DefaultReadVMMemoryCacheSize,\n\t\tNumReadVMs: DefaultNumReadVM,\n\t}\n}", "func DefaultDialConfig() DialConfig {\n\tnewConfig := DialConfig{\n\t\tAddr: \"127.0.0.1:6379\",\n\t}\n\n\treturn newConfig\n}", "func DefaultConfig() Config {\n\tnewConfig := Config{\n\t\t// Dependencies.\n\t\tFactoryCollection: factory.MustNewCollection(),\n\t\tLog: log.New(log.DefaultConfig()),\n\t\tStorageCollection: storage.MustNewCollection(),\n\t}\n\n\treturn newConfig\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tHeartbeat: defaultHeartbeat,\n\t\tLocale: defaultLocale,\n\t\tDefaultLoggerLevel: zerolog.ErrorLevel,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tBackOff: nil,\n\t\tFramework: nil,\n\t\tInformer: nil,\n\t\tLogger: nil,\n\t\tTPR: nil,\n\t}\n}", "func Default() *AAAConfig {\n\treturn defaultStbConfig\n}", "func DefaultConfConfig() cmd.ConfConfig {\n\treturn cmd.ConfConfig{\n\t\tDir: \".textile\",\n\t\tName: \"config\",\n\t\tType: \"yaml\",\n\t\tEnvPrefix: \"BUCK\",\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tNetwork: DefaultNetwork,\n\t\tRPCListen: \"localhost:11010\",\n\t\tRESTListen: \"localhost:8081\",\n\t\tServer: &loopServerConfig{\n\t\t\tNoTLS: false,\n\t\t},\n\t\tLoopDir: LoopDirBase,\n\t\tConfigFile: defaultConfigFile,\n\t\tDataDir: LoopDirBase,\n\t\tDatabaseBackend: DatabaseBackendSqlite,\n\t\tSqlite: &loopdb.SqliteConfig{\n\t\t\tDatabaseFileName: defaultSqliteDatabasePath,\n\t\t},\n\t\tLogDir: defaultLogDir,\n\t\tMaxLogFiles: defaultMaxLogFiles,\n\t\tMaxLogFileSize: defaultMaxLogFileSize,\n\t\tDebugLevel: defaultLogLevel,\n\t\tTLSCertPath: DefaultTLSCertPath,\n\t\tTLSKeyPath: DefaultTLSKeyPath,\n\t\tTLSValidity: DefaultAutogenValidity,\n\t\tMacaroonPath: DefaultMacaroonPath,\n\t\tMaxLSATCost: lsat.DefaultMaxCostSats,\n\t\tMaxLSATFee: lsat.DefaultMaxRoutingFeeSats,\n\t\tLoopOutMaxParts: defaultLoopOutMaxParts,\n\t\tTotalPaymentTimeout: defaultTotalPaymentTimeout,\n\t\tMaxPaymentRetries: defaultMaxPaymentRetries,\n\t\tEnableExperimental: false,\n\t\tLnd: &lndConfig{\n\t\t\tHost: \"localhost:10009\",\n\t\t\tMacaroonPath: DefaultLndMacaroonPath,\n\t\t},\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tRateLimit: map[notification.DestType]*RateConfig{\n\t\t\tnotification.DestTypeSMS: {\n\t\t\t\tPerSecond: 1,\n\t\t\t\tBatch: 5 * time.Second,\n\t\t\t},\n\t\t\tnotification.DestTypeVoice: {\n\t\t\t\tPerSecond: 1,\n\t\t\t\tBatch: 5 * time.Second,\n\t\t\t},\n\t\t},\n\t}\n}", "func DefaultConfig() Config {\n\tvar config Config\n\tconfig.DB.DSN = DefaultDSN\n\treturn config\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tLager: lager.NewLogLager(nil),\n\t\tPool: new(gob.Pool),\n\t}\n}", "func NewDefault() Configuration {\n\tcfg := Configuration{\n\t\tEnableSyslog: false,\n\t\tEnableSSL: false,\n\t\tHttpRequestTimeout: 5,\n\t\tConnectTimeout: 5,\n\t\tClientTimeout: 50,\n\t\tClientFinTimeout: 50,\n\t\tServerTimeout: 50,\n\t\tTunnelTimeout: 3600,\n\t\tHttpKeepAliveTimeout: 60,\n\t}\n\n\treturn cfg\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\tPUCT: 1.0,\n\t}\n}", "func (c *Config) setDefault() {\r\n\tif len(c.ZookeeperAddrs) == 0 {\r\n\t\tc.ZookeeperAddrs = configZookeeperAddrs\r\n\t}\r\n\tif c.ZookeeperTimeout < 1*time.Second {\r\n\t\tc.ZookeeperTimeout = configZookeeperTimeout\r\n\t}\r\n\tif len(c.ZookeeperPitchforkRoot) == 0 {\r\n\t\tc.ZookeeperPitchforkRoot = configZookeeperPitchforkRoot\r\n\t}\r\n\tif len(c.ZookeeperStoreRoot) == 0 {\r\n\t\tc.ZookeeperStoreRoot = configZookeeperStoreRoot\r\n\t}\r\n\tif len(c.ZookeeperVolumeRoot) == 0 {\r\n\t\tc.ZookeeperVolumeRoot = configZookeeperVolumeRoot\r\n\t}\r\n\tif c.GetInterval == 0 {\r\n\t\tc.GetInterval = configGetInterval\r\n\t}\r\n\tif c.HeadInterval == 0 {\r\n\t\tc.HeadInterval = configHeadInterval\r\n\t}\r\n}", "func defaultOptions() interface{} {\n\treturn &options{\n\t\tconfFile: \"\",\n\t\tconfDir: \"/etc/cmk\",\n\t\tcreateNodeLabel: defaultConfig().(*conf).LabelNode,\n\t\tcreateNodeTaint: defaultConfig().(*conf).TaintNode,\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tZapConfig: zap.NewProductionConfig(),\n\t}\n}", "func Default() *Config {\n\trootDir := \"/\"\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\trootDir = `C:\\`\n\t}\n\treturn &Config{\n\t\tFile: File{\n\t\t\tProxyNetwork: \"unix\",\n\t\t\tProxyAddress: filepath.Join(client.Namespace(), \"acme-lsp.rpc\"),\n\t\t\tAcmeNetwork: \"unix\",\n\t\t\tAcmeAddress: filepath.Join(client.Namespace(), \"acme\"),\n\t\t\tWorkspaceDirectories: nil,\n\t\t\tRootDirectory: rootDir,\n\t\t\tFormatOnPut: true,\n\t\t\tCodeActionsOnPut: []protocol.CodeActionKind{\n\t\t\t\tprotocol.SourceOrganizeImports,\n\t\t\t},\n\t\t\tServers: nil,\n\t\t\tFilenameHandlers: nil,\n\t\t},\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tFileSystem: nil,\n\t\tK8sClient: nil,\n\t\tLogger: nil,\n\n\t\t// Settings.\n\t\tFlag: nil,\n\t\tViper: nil,\n\t}\n}", "func createDefaultConfig() component.Config {\n\treturn &Config{\n\t\tScraperControllerSettings: scraperhelper.ScraperControllerSettings{\n\t\t\tCollectionInterval: defaultCollectionInterval,\n\t\t\tTimeout: defaultTimeout,\n\t\t},\n\t\tEndpoint: defaultEndpoint,\n\t\tVersion: defaultVersion,\n\t\tCommunity: defaultCommunity,\n\t\tSecurityLevel: defaultSecurityLevel,\n\t\tAuthType: defaultAuthType,\n\t\tPrivacyType: defaultPrivacyType,\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tApiAddress: \"http://api.bosh-lite.com\",\n\t\tUsername: \"admin\",\n\t\tPassword: \"admin\",\n\t\tToken: \"\",\n\t\tSkipSslValidation: false,\n\t\tHttpClient: http.DefaultClient,\n\t\tUserAgent: \"SM-CF-client/1.0\",\n\t}\n}", "func DefaultConfig() *Config {\n\tconfig := new(Config)\n\tconfig.URL = MktmpioURL\n\treturn config\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tSFCRenderer: defaultSFCRenderer,\n\t}\n}", "func DefaultConfig() *config.Config {\n\treturn &config.Config{\n\t\tDebug: config.Debug{\n\t\t\tAddr: \"127.0.0.1:9174\",\n\t\t},\n\t\tService: config.Service{\n\t\t\tName: \"notifications\",\n\t\t},\n\t\tNotifications: config.Notifications{\n\t\t\tSMTP: config.SMTP{\n\t\t\t\tHost: \"127.0.0.1\",\n\t\t\t\tPort: \"1025\",\n\t\t\t\tSender: \"[email protected]\",\n\t\t\t},\n\t\t\tEvents: config.Events{\n\t\t\t\tEndpoint: \"127.0.0.1:9233\",\n\t\t\t\tCluster: \"ocis-cluster\",\n\t\t\t\tConsumerGroup: \"notifications\",\n\t\t\t},\n\t\t\tRevaGateway: \"127.0.0.1:9142\",\n\t\t},\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tPort: 5000,\n\t\tHapHome: \"/HOME/hapadm\",\n\t\tClusterID: \"default-name\",\n\t\tSudo: true,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{make(map[string]string), DefaultBasicAuthRealm, 0, nil}\n}", "func loadDefault() (*Config, error) {\n\tcfg := Config{}\n\n\t// App\n\tcfg.App.ServerPort = 8080\n\tcfg.App.LogLevel = LogLevel.Debug\n\n\t// Providers\n\t// Provider 1\n\tamazon := ProviderConfig{Name: \"amazon\"}\n\t// Provider 2\n\tsendgrid := ProviderConfig{Name: \"sendgrid\"}\n\n\t// Mail\n\tcfg.Mailer.Providers[0] = amazon\n\tcfg.Mailer.Providers[1] = sendgrid\n\n\treturn &cfg, nil\n}", "func (store *ConfigurationStore) Default() {\n\tstore.defaultImpl()\n\tvar temp any = store\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tMaxRetries: defaultMaxRetries,\n\t\tInitialBackoff: defaultInitialBackoff,\n\t\tMaxBackoff: defaultMaxBackoff,\n\t\tBackoffFactor: defaultBackoffFactor,\n\t\tMaxMessages: defaultMaxMessages,\n\t}\n}", "func defaultConfig() *ApplicationConfig {\n\tconf := &ApplicationConfig{\n\t\tLogLevel: \"info\",\n\t\tHideArchived: true,\n\t\tDefaultMetadata: []string{\"Author\", \"Published At\", \"Language\", \"Ipfs\", \"Class\", \"Title\"},\n\t\tAutoComplete: true,\n\t\tAutoCompleteMaxResults: 20,\n\t\tEnableFullTextSearch: true,\n\t\tColors: defaultColors(),\n\t\tShortcuts: defaultShortcuts(),\n\t}\n\treturn conf\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tinjectString: defaultInject,\n\t\tconfigString: defaultConfig,\n\t\tappProfile: newAppProfile(),\n\t\tactivateES: false,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tConfigurers: nil,\n\t\tFileSystem: afero.NewMemMapFs(),\n\t\tLogger: nil,\n\n\t\t// Settings.\n\t\tHelmBinaryPath: \"\",\n\t\tOrganisation: \"\",\n\t\tPassword: \"\",\n\t\tRegistry: \"\",\n\t\tUsername: \"\",\n\t}\n}", "func DefaultOpts() Options {\n\treturn Options{\n\t\tCacheSize: 1024,\n\t\tTTLInterval: time.Second,\n\t\tWriteRetries: 5,\n\t}\n}", "func createDefaultConfig() component.Config {\n\treturn &Config{}\n}", "func createDefaultConfig() component.Config {\n\treturn &Config{}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tAddress: \"127.0.0.1:8080\",\n\t\tScheme: \"http\",\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Duration(5 * time.Second),\n\t\t},\n\t}\n}", "func NewDefault() *Config {\n\tvv := defaultConfig\n\treturn &vv\n}", "func NewDefault() *Config {\n\tvv := defaultConfig\n\treturn &vv\n}", "func DefaultConfig() Config {\n\tnewConfig := Config{\n\t\t// Dependencies.\n\t\tFactoryCollection: factory.MustNewCollection(),\n\t\tLog: log.New(log.DefaultConfig()),\n\t\tStorageCollection: storage.MustNewCollection(),\n\n\t\t// Settings.\n\t\tMaxSignals: 5,\n\t}\n\n\treturn newConfig\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tLogLevel: \"debug\",\n\t\tLogFormat: \"text\",\n\n\t\tDatabase: DatabaseConfig{\n\t\t\tHost: \"127.0.0.1\",\n\t\t\tPort: 3306,\n\t\t\tName: \"fusion\",\n\t\t\tUser: \"fusion\",\n\t\t\tPassword: \"password\",\n\t\t},\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tNats: \"nats://192.168.168.195:4222\",\n\t\tKafka: \"\",\n\t\tQscNames: DefaultQscConfig(),\n\t}\n}", "func DefaultConfig() Configuration {\n\tvar cfg Configuration\n\tSetDefaults(&cfg)\n\treturn cfg\n}", "func DefaultServerConfiguration(bindAddr string) *Configuration {\n\treturn &Configuration{\n\t\tHostAddr: bindAddr,\n\t\tRedisHostAddr: \"localhost:6379\",\n\t\tSendAcknowledgement: false,\n\t\tAcceptMessageEncoding: ENCODING_TYPE_JSON,\n\t\tBroadcastMessagesLimit: 100,\n\t\tMaxThreadPoolConcurrency: 50000,\n\t\tLogLevel: ErrorLevel,\n\t\tLoggerReportCaller: false,\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tSMTPBindAddr: \"0.0.0.0:1025\",\n\t\tHTTPBindAddr: \"0.0.0.0:8025\",\n\t\tHostname: \"mailhog.example\",\n\t\tMongoURI: \"127.0.0.1:27017\",\n\t\tMongoDatabase: \"mailhog\",\n\t\tPostgresURI: \"postgres://127.0.0.1:5432/mailhog\",\n\t\tMongoColl: \"messages\",\n\t\tStorageType: \"memory\",\n\t\tMessageChan: make(chan *data.Message),\n\t\tOutgoingSMTP: make(map[string]*OutgoingSMTP),\n\t}\n}", "func Default() *Config {\n\tvar trusted []string\n\tif home, err := paths.HomeDir(); err == nil {\n\t\ttrusted = append(trusted, home)\n\t}\n\treturn &Config{\n\t\tTrustedPaths: trusted,\n\t\tAlwaysLoadHome: true,\n\t}\n}", "func defaultConfig() *config {\n\treturn &config{\n\t\tPermission: 0777,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tValueModifiers: nil,\n\n\t\t// Settings.\n\t\tIgnoreFields: nil,\n\t\tSelectFields: nil,\n\t}\n}", "func DefaultConfig(authToken string, hosts ...string) *Config {\n\treturn &Config{\n\t\tAuthToken: authToken,\n\t\tHosts: hosts,\n\t\tPort: \"10001\",\n\t\tScheme: \"https\",\n\t\tTimeout: 15 * time.Second,\n\n\t\tPoolDecayDuration: 30 * time.Minute,\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tBaseConfig: DefaultBaseConfig(),\n\t\tEth: DefaultEthConfig(),\n\t\tHuron: DefaultHuronConfig(),\n\t\tRaft: DefaultRaftConfig(),\n\t}\n}", "func (t *xfconfTable) getDefaultConfig() (map[string]map[string]interface{}, error) {\n\tresults := make(map[string]map[string]interface{}, 0)\n\n\tdefaultDirs := getDefaultXfconfDirs()\n\tfor _, dir := range defaultDirs {\n\t\tdefaultConfig, err := t.getConfigFromDirectory(dir)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting config from default directory %s: %w\", dir, err)\n\t\t}\n\t\tmaps.Copy(results, defaultConfig)\n\t}\n\n\treturn results, nil\n}", "func DefaultConfig() *Config {\n\tconfig := &Config{\n\t\tOwnerProcName: \"\",\n\t\tOwnerReleaseInterval: 1 * time.Second,\n\t\tOwnerReleaseTimeout: 5 * time.Minute,\n\t\tSourcePattern: \"/tmp/rotate/source\",\n\t\tTempStorage: \"/tmp/rotate/tmp\",\n\t\tArchiveStorage: \"/tmp/rotate/archive\",\n\t\tFinalizeCommands: []string{},\n\t}\n\treturn config\n}", "func DefaultConfig() *Config {\n\tc := &Config{}\n\tif _, err := toml.Decode(defaultConfig, c); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := c.Validate(); err != nil {\n\t\tpanic(err)\n\t}\n\treturn c\n}", "func DefaultConfig() *Config {\n\tcfg := &Config{\n\t\tuserHost: \"sms.yunpian.com\",\n\t\tsignHost: \"sms.yunpian.com\",\n\t\ttplHost: \"sms.yunpian.com\",\n\t\tsmsHost: \"sms.yunpian.com\",\n\t\tvoiceHost: \"voice.yunpian.com\",\n\t\tflowHost: \"flow.yunpian.com\",\n\t}\n\treturn cfg.WithUseSSL(true).WithHTTPClient(defaultHTTPClient())\n}", "func NewDefaultConfig() *Config {\n\treturn &Config{\n\t\tProxyConnectTimeout: \"60s\",\n\t\tProxyReadTimeout: \"60s\",\n\t\tClientMaxBodySize: \"1m\",\n\t\tMainServerNamesHashMaxSize: \"512\",\n\t}\n}", "func DefaultConfiguration() Configuration {\n\treturn Configuration{\n\t\t\tDescribeCaller: true,\n\t}\n}", "func DefaultConfig() *Config {\n\treturn &Config{\n\t\tDatabase: \"payments\",\n\t\tCollection: \"payments\",\n\t\tExpiryTimeInMinutes: \"90\",\n\t\tRefundBatchSize: 20,\n\t}\n}", "func DefaultConfig() Config {\n\treturn Config{\n\t\t// Dependencies.\n\t\tLogger: nil,\n\n\t\t// Settings.\n\t\tFlag: nil,\n\t\tViper: nil,\n\n\t\tDescription: \"\",\n\t\tGitCommit: \"\",\n\t\tName: \"\",\n\t\tSource: \"\",\n\t}\n}" ]
[ "0.7666072", "0.7510478", "0.7498842", "0.73078674", "0.7225894", "0.71726584", "0.71381", "0.709985", "0.7095821", "0.69901216", "0.69873285", "0.6978777", "0.69634485", "0.69540167", "0.68868035", "0.6876168", "0.68401194", "0.68181145", "0.68101496", "0.67957246", "0.6773012", "0.6759464", "0.67511857", "0.6748216", "0.6721755", "0.6721747", "0.67050695", "0.66983736", "0.6671163", "0.66513586", "0.6644176", "0.66354364", "0.6626955", "0.66231745", "0.6622805", "0.6620543", "0.6608887", "0.65951014", "0.65945256", "0.6590094", "0.6585613", "0.6562747", "0.6549049", "0.6539983", "0.6531414", "0.6530235", "0.6529481", "0.65239084", "0.6504527", "0.65022457", "0.6475802", "0.6475203", "0.6455396", "0.6450777", "0.6448707", "0.6442465", "0.6441697", "0.6439", "0.6435199", "0.64325714", "0.64268774", "0.6426002", "0.6422515", "0.6409833", "0.640317", "0.64009684", "0.63975567", "0.6383177", "0.63812256", "0.63668066", "0.6363814", "0.63618356", "0.636097", "0.63449997", "0.6337623", "0.6334614", "0.63281363", "0.63281363", "0.63223135", "0.63222903", "0.63222903", "0.6316693", "0.631584", "0.63157475", "0.63152367", "0.63104445", "0.6308126", "0.6300407", "0.62971973", "0.6294644", "0.6281629", "0.6280626", "0.62673867", "0.626591", "0.62612927", "0.62551355", "0.6253345", "0.6252324", "0.62504584", "0.6249283" ]
0.7408363
3
IsValid checks the cache configuration is valid
func (c Conf) IsValid() (bool, string) { for _, t := range validCacheTypes { if c.Type == t { return true, "" } } return false, "invalid cache type" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *BuildCache) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (m *JwtCacheConfig) Validate() error {\n\treturn m.validate(false)\n}", "func (c *CacheConfig) Validate() error {\n\tif c.FailureCache.TTL <= 0 {\n\t\treturn errors.Errorf(\"failure_cache.ttl must be > 0\")\n\t}\n\n\tif c.SuccessCache.MaxCapacity <= 0 {\n\t\treturn errors.Errorf(\"success_cache.capacity.max must be > 0\")\n\t}\n\tif c.FailureCache.MaxCapacity <= 0 {\n\t\treturn errors.Errorf(\"failure_cache.capacity.max must be > 0\")\n\t}\n\n\tif c.SuccessCache.MaxCapacity < c.SuccessCache.InitialCapacity {\n\t\treturn errors.Errorf(\"success_cache.capacity.max must be >= success_cache.capacity.initial\")\n\t}\n\tif c.FailureCache.MaxCapacity < c.FailureCache.InitialCapacity {\n\t\treturn errors.Errorf(\"failure_cache.capacity.max must be >= failure_cache.capacity.initial\")\n\t}\n\n\treturn nil\n}", "func (m *Cache) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif m.GetTtl() == nil {\n\t\treturn CacheValidationError{\n\t\t\tfield: \"Ttl\",\n\t\t\treason: \"value is required\",\n\t\t}\n\t}\n\n\tif d := m.GetTtl(); d != nil {\n\t\tdur, err := ptypes.Duration(d)\n\t\tif err != nil {\n\t\t\treturn CacheValidationError{\n\t\t\t\tfield: \"Ttl\",\n\t\t\t\treason: \"value is not a valid duration\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\n\t\tgte := time.Duration(0*time.Second + 0*time.Nanosecond)\n\n\t\tif dur < gte {\n\t\t\treturn CacheValidationError{\n\t\t\t\tfield: \"Ttl\",\n\t\t\t\treason: \"value must be greater than or equal to 0s\",\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// no validation rules for MaxEntries\n\n\treturn nil\n}", "func (c *CacheTime) IsValid() bool {\n\t// Cache not initialized\n\tif c.CreationTime.IsZero() {\n\t\treturn false\n\t}\n\t// Is cache still valid\n\tif time.Now().Sub(c.CreationTime) < c.CacheValidity {\n\t\treturn true\n\t}\n\treturn false\n}", "func (f *metricCache) isValid() bool {\n\treturn f.metrics != nil && time.Since(f.built) < f.ttl\n}", "func (c *Config) IsValid() bool {\n\tif len(c.GithubAccessToken) != 40 {\n\t\treturn false\n\t}\n\tif len(c.GitName) == 0 {\n\t\treturn false\n\t}\n\tif len(c.GitEmail) == 0 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (c *Config) IsValid() error {\n\tif len(c.NetworkServices) == 0 {\n\t\treturn errors.New(\"no network services are specified\")\n\t}\n\tif c.Name == \"\" {\n\t\treturn errors.New(\"no cleint name specified\")\n\t}\n\tif c.ConnectTo.String() == \"\" {\n\t\treturn errors.New(\"no NSMGr ConnectTO URL are sepecified\")\n\t}\n\treturn nil\n}", "func (fc FSLocalCache) validate() error {\n\n\tif fc.ReleasedInstanceCacheTTLSec > 600 {\n\t\treturn errors.New(\"invalid fsLocalCache.releasedInstanceCacheTTLSec value, should <= 600\")\n\t}\n\n\tif fc.PublishedStrategyCacheTTLSec > 600 {\n\t\treturn errors.New(\"invalid fsLocalCache.publishedStrategyCacheTTLSec value, should <= 600\")\n\t}\n\n\treturn nil\n}", "func validateCache() {\n\tticker := time.NewTicker(5 * time.Minute)\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\n\t\t}\n\t}\n}", "func (p *PCache) IsValid(kind string, meta *api.ObjectMeta) bool {\n\tif obj := p.Get(kind, meta); obj != nil {\n\t\tp.RLock()\n\t\tvalidateFn := p.kindOptsMap[kind].Validator\n\t\tp.RUnlock()\n\t\tvalid, _ := validateFn(obj)\n\t\treturn valid\n\t}\n\treturn false\n}", "func (c *Settings) Validate() error {\n\tif c.URL == \"\" {\n\t\treturn fmt.Errorf(\"validate settings: missing url\")\n\t}\n\tif len(c.Username) == 0 {\n\t\treturn errors.New(\"validate settings: missing username\")\n\t}\n\tif len(c.Password) == 0 {\n\t\treturn errors.New(\"validate settings: missing password\")\n\t}\n\tif c.VisibilityCache {\n\t\tif time.Minute > c.CacheExpiration {\n\t\t\treturn errors.New(\"validate settings: if cache is enabled, cache_expiration should be at least 1 minute\")\n\t\t}\n\t}\n\treturn nil\n}", "func (m *NetworkDnscacheSettings) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCacheEntryLimit(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateClusterTimeout(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDNSTimeout(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEagerRefresh(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTestpingDelta(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMaxNoerror(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMaxNxdomain(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMaxOther(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMaxServfail(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMinNoerror(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMinNxdomain(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMinOther(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTTLMinServfail(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}", "func (c Config) IsValid() bool {\n\tif c.Port == \"\" || c.DSN == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (cc *ClusterConfig) Validate() error {\n\t// TODO(felix): complete validates\n\tif cc.CacheType != types.CacheTypeRedisCluster {\n\t\treturn ValidateStandalone(cc.Servers)\n\t}\n\treturn nil\n}", "func (cfg *NetworkServiceConfig) IsValid() error {\n\tif cfg.Mechanism == \"\" {\n\t\treturn errors.New(\"invalid mechanism specified\")\n\t}\n\tswitch cfg.Mechanism {\n\tcase memif.MECHANISM:\n\t\t// Verify folder for memif file exists and writable.\n\t\t//TODO: Add support of this validation.\n\tcase kernel.MECHANISM:\n\t\t// Verify interface name\n\t\tif len(cfg.Path) > 1 {\n\t\t\treturn errors.New(\"invalid client interface name specified\")\n\t\t}\n\t\tif len(cfg.Path[0]) > 15 {\n\t\t\treturn errors.New(\"interface part cannot exceed 15 characters\")\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Config) Valid() error {\n\tif len(c.Servers) == 0 {\n\t\treturn fmt.Errorf(\"No servers in config\")\n\t}\n\tfor _, s := range c.Servers {\n\t\terr := s.Valid()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Config) IsValid() bool {\n\t_, latErr := strconv.ParseFloat(c.Latitude, 10)\n\t_, lonErr := strconv.ParseFloat(c.Longitude, 10)\n\treturn c.APIKey != \"\" && c.BaseUrl != \"\" && latErr == nil && lonErr == nil\n}", "func (c ConfigVersion) IsValid() bool {\n\treturn c != 0 && c <= V3\n}", "func (c *Config) IsValid() bool {\n\tif c.DiffType == \"schema\" || c.DiffType == \"data\" {\n\t\treturn c.Source != \"\" && c.Target != \"\"\n\t} else if c.DiffType == \"md\" || c.DiffType == \"wiki\" || c.DiffType == \"sql\" {\n\t\treturn c.Source != \"\"\n\t}\n\treturn false\n}", "func (c Config) Validate() error {\n\tif len(c.Project) == 0 {\n\t\treturn errors.New(\"missing project in configuration\")\n\t}\n\tif len(c.Bucket) == 0 {\n\t\treturn errors.New(\"missing bucket in configuration\")\n\t}\n\tif len(c.LastMigrationObjectName) == 0 {\n\t\treturn errors.New(\"missing state name in configuration\")\n\t}\n\treturn nil\n}", "func (cfg frozenConfig) Valid(data []byte) bool {\n ok, _ := encoder.Valid(data)\n return ok\n}", "func (c Config) Validate() error {\n\tif len(c.ClientID) == 0 {\n\t\treturn fmt.Errorf(\"error: ClientID missing\")\n\t}\n\n\tif c.VodID < 1 {\n\t\treturn fmt.Errorf(\"error: VodID missing\")\n\t}\n\n\ttimePattern := `\\d+ \\d+ \\d+`\n\ttimeRegex := regexp.MustCompile(timePattern)\n\tif c.StartTime != \"start\" && !timeRegex.MatchString(c.StartTime) {\n\t\treturn fmt.Errorf(\"error: StartTime must be 'start' or in format '%s'; got '%s'\", timePattern, c.StartTime)\n\t}\n\tif c.EndTime == \"\" && c.Length == \"\" {\n\t\treturn errors.New(\"error: must specify either EndTime or Length\")\n\t}\n\tif c.Length == \"\" && c.EndTime != \"end\" && !timeRegex.MatchString(c.EndTime) {\n\t\treturn fmt.Errorf(\"error: EndTime must be 'end' or in format '%s'; got '%s'\", timePattern, c.EndTime)\n\t}\n\tif c.EndTime == \"\" && c.Length != \"full\" && !timeRegex.MatchString(c.Length) {\n\t\treturn fmt.Errorf(\"error: Length must be 'full' or in format '%s'; got '%s'\", timePattern, c.Length)\n\t}\n\n\tqualityPattern := `\\d{3,4}p[36]0`\n\tqualityRegex := regexp.MustCompile(qualityPattern)\n\tif c.Quality != \"best\" && c.Quality != \"chunked\" && !qualityRegex.MatchString(c.Quality) {\n\t\treturn fmt.Errorf(\"error: Quality must be 'best', 'chunked', or in format '%s'; got '%s'\", qualityPattern, c.Quality)\n\t}\n\n\tif c.FilePrefix != \"\" && !isValidFilename(c.FilePrefix) {\n\t\treturn fmt.Errorf(\"error: FilePrefix contains invalid characters; got '%s'\", c.FilePrefix)\n\t}\n\n\tif c.Workers < 1 {\n\t\treturn fmt.Errorf(\"error: Worker must be an integer greater than 0; got '%d'\", c.Workers)\n\t}\n\n\treturn nil\n}", "func (sc *StoreConfig) Valid() bool {\n\treturn sc.Clock != nil && sc.Transport != nil &&\n\t\tsc.RaftTickInterval != 0 && sc.RaftHeartbeatIntervalTicks > 0 &&\n\t\tsc.RaftElectionTimeoutTicks > 0 && sc.ScanInterval >= 0 &&\n\t\tsc.AmbientCtx.Tracer != nil\n}", "func (cfg Config) Validate() error {\n\tvar errs []string\n\tif cfg.Releaser == nil {\n\t\terrs = append(errs, \"releaser not supplied\")\n\t}\n\tif cfg.History == nil {\n\t\terrs = append(errs, \"history DB not supplied\")\n\t}\n\tif len(errs) > 0 {\n\t\treturn errors.New(\"invalid: \" + strings.Join(errs, \"; \"))\n\t}\n\treturn nil\n}", "func (iter *dbCacheIterator) Valid() bool {\n\treturn iter.currentIter != nil\n}", "func (config *Config) IsValid() bool {\n\tif config.Basic.Enabled && config.OAuth2.Enabled {\n\t\treturn false\n\t}\n\n\tif config.Basic.Enabled && config.X509.Enabled {\n\t\treturn false\n\t}\n\n\tif config.OAuth2.Enabled && config.X509.Enabled {\n\t\treturn false\n\t}\n\n\tif !config.Basic.Enabled && !config.OAuth2.Enabled && !config.X509.Enabled {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (c *Config) valid() error {\n\tif c.Score == nil {\n\t\treturn errors.New(\"Expected Score to not be nil\")\n\t}\n\tif c.Sampler == nil {\n\t\treturn errors.New(\"Expected Sampler to not be nil\")\n\t}\n\treturn nil\n}", "func (s Settings) Validate() (valid bool) {\n\tvalid = true\n\n\tif s.Database != nil {\n\t\tif !s.Database.ValidateDatabase() {\n\t\t\tvalid = false\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tvalid = false\n\t\treturn\n\t}\n\n\tswitch \"\" {\n\tcase s.LogsFile:\n\tcase s.SecretKey:\n\t\tvalid = false\n\t\treturn\n\t}\n\n\tswitch 0 {\n\tcase s.Port:\n\tcase s.MaxElementsPerPagination:\n\t\tvalid = false\n\t}\n\n\tif _, err := url.ParseRequestURI(s.Host); err != nil {\n\t\tvalid = false\n\t\treturn\n\t}\n\n\tif _, err := url.ParseRequestURI(s.Assets); err != nil {\n\t\tvalid = false\n\t\treturn\n\t}\n\n\treturn\n}", "func (s *ServerConfig) Valid() error {\n\tif len(s.Auth) < 1 && s.Mode != \"single\" {\n\t\treturn ErrNoAuth\n\t}\n\treturn nil\n}", "func (cfg *Config) Validate() error {\n\tif cfg.MetricTTL <= 0 {\n\t\treturn errors.New(\"disk.metric_ttl is invalid\")\n\t}\n\n\tif cfg.MetricType.String() == \"\" {\n\t\treturn errors.New(\"disk.metric_type is invalid\")\n\t}\n\treturn nil\n}", "func (g *Google) ValidConfig() bool {\n\treturn g.AccountFileJSON != \"\" && g.ProjectID != \"\" && g.Zone != \"\"\n}", "func (c Config) Validate() error {\n\tif c.ApplicationID != \"\" && c.AlgoliaAPIKey == \"\" {\n\t\treturn errors.New(\"API key must not be empty if indexer is enabled\")\n\t}\n\tif c.ApplicationID != \"\" && c.AlgoliaSearchKey == \"\" {\n\t\treturn errors.New(\"Search key must not be empty if indexer is enabled\")\n\t}\n\tif c.ApplicationID != \"\" && c.IndexName == \"\" {\n\t\treturn errors.New(\"Index name must not be empty if indexer is enabled\")\n\t}\n\treturn nil\n}", "func ValidCacheDuration(duration string) bool {\n\telements := strings.Split(duration, \" \")\n\tseenDuration := false\n\n\tfor _, element := range elements {\n\t\tif element == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif statusCodeRegex.MatchString(element) {\n\t\t\tif seenDuration {\n\t\t\t\treturn false // code after duration\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif durationRegex.MatchString(element) {\n\t\t\tseenDuration = true\n\t\t}\n\t}\n\treturn seenDuration\n}", "func (c Config) Validate() error {\n\tif c.PublicKeyPath == \"\" {\n\t\treturn errors.New(\"Public Key Path is required\")\n\t}\n\n\treturn nil\n}", "func (config Configuration) Valid() error {\n\tif config.Issuer == \"\" {\n\t\treturn errors.New(\"authproxy/oidc: issuer is empty\")\n\t}\n\tif config.AuthorizationEndpoint == \"\" {\n\t\treturn errors.New(\"authproxy/oidc: authorization_endpoint is empty\")\n\t}\n\tif config.JWKSURI == \"\" {\n\t\treturn errors.New(\"authproxy/oidc: jwks_uri is empty\")\n\t}\n\tif len(config.ResponseTypesSupported) == 0 {\n\t\treturn errors.New(\"authproxy/oidc: response_types_supported is empty\")\n\t}\n\tif len(config.SubjectTypesSupported) == 0 {\n\t\treturn errors.New(\"authproxy/oidc: subject_types_supported is empty\")\n\t}\n\tif len(config.IDTokenSigningAlgValuesSupported) == 0 {\n\t\treturn errors.New(\"authproxy/oidc: id_token_signing_alg_values_supported is empty\")\n\t}\n\n\treturn nil\n}", "func (c *RegistryConfig) CheckValidity() error {\n\tif !registryArray.Has(c.Type) {\n\t\treturn jerrors.Errorf(ErrIllegalConf+\"registry type %s\", c.Type)\n\t}\n\n\tif len(c.Addr) == 0 {\n\t\treturn jerrors.Errorf(ErrIllegalConf+\"registry addr %s\", c.Addr)\n\t}\n\n\tif c.KeepaliveTimeout < 0 {\n\t\treturn jerrors.Errorf(ErrIllegalConf+\"keepalive timeout %d\", c.KeepaliveTimeout)\n\t}\n\n\tif len(c.Root) == 0 {\n\t\treturn jerrors.Errorf(ErrIllegalConf+\"root %s\", c.Root)\n\t}\n\n\tif len(c.NodeID) == 0 {\n\t\treturn jerrors.Errorf(ErrIllegalConf+\"node id %s\", c.NodeID)\n\t}\n\n\tif c.codec = rpc.GetCodecType(c.Codec); c.codec == rpc.CodecUnknown {\n\t\treturn jerrors.Errorf(ErrIllegalConf+\"codec type %s\", c.Codec)\n\t}\n\n\treturn nil\n}", "func (m *LolLobbyInventoryCacheEntry) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (c Config) IsValid() bool {\n\treturn c.RandomTemperature > 0 && c.NumSimulation > 0\n}", "func (m *CustconfOriginPullCacheExtension) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (session ClientSession) Valid() error {\n\tif time.Now().Unix() > session.ExpiresAt {\n\t\treturn errors.New(\"invalid session, session has expired\")\n\t}\n\n\treturn nil\n}", "func (o *Config) IsValid() *AppError {\n\tif err := o.ServiceSettings.isValid(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (v *Live) Validate(channel bcgo.Channel, cache bcgo.Cache, network bcgo.Network, hash []byte, block *bcgo.Block) error {\n\texpected := os.Getenv(bcgo.LIVE_FLAG)\n\treturn bcgo.Iterate(channel.Name(), hash, block, cache, network, func(h []byte, b *bcgo.Block) error {\n\t\tfor _, entry := range b.Entry {\n\t\t\tvar flag string\n\t\t\tif meta := entry.Record.Meta; meta != nil {\n\t\t\t\tflag = meta[bcgo.LIVE_FLAG]\n\t\t\t}\n\t\t\tif flag != expected {\n\t\t\t\treturn ErrDifferentLiveFlag{Expected: expected, Actual: flag}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "func (c Config) Validate() error {\n\tif c.ResetSeconds <= 0 {\n\t\treturn errors.New(\"ResetSeconds must be positive\")\n\t}\n\tif c.StreakBreakSeconds <= 0 {\n\t\treturn errors.New(\"StreakBreakSeconds must be positive\")\n\t}\n\tif c.Wheels == nil {\n\t\treturn errors.New(\"wheels cannot be null\")\n\t}\n\tif err := c.Wheels.Validate(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to validate wheels\")\n\t}\n\treturn nil\n}", "func (m *RetrieveUserInfoCacheStatusResponse) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLastUpdatedAt(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateNamespace(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}", "func (cfg *HTTPConfig) Valid() error {\n\t// TODO: more validation, for example, the file existence\n\tif cfg.Schema != \"https\" && cfg.Schema != \"http\" {\n\t\treturn fmt.Errorf(\"invalid schema '%s', only 'http' and 'https' are supported \", cfg.Schema)\n\t}\n\n\treturn nil\n}", "func (cfg *Config) Validate() error {\n\tif cfg.Key == \"\" {\n\t\treturn errors.New(\"missing DigitalOcean access key\")\n\t}\n\n\treturn nil\n}", "func (s *IndicesClearCacheService) Validate() error {\n\treturn nil\n}", "func (c Config) Validate() error {\n\tif c.Host == \"\" {\n\t\treturn errors.New(\"cadence host is required\")\n\t}\n\n\tif c.Port == 0 {\n\t\treturn errors.New(\"cadence port is required\")\n\t}\n\n\tif c.Domain == \"\" {\n\t\treturn errors.New(\"cadence domain is required\")\n\t}\n\n\treturn nil\n}", "func (instanceKey *InstanceKey) IsValid() bool {\n\tif instanceKey.Hostname == \"_\" {\n\t\treturn false\n\t}\n\tif instanceKey.IsDetached() {\n\t\treturn false\n\t}\n\treturn len(instanceKey.Hostname) > 0 && instanceKey.Port > 0\n}", "func (c *CRLConfig) Validate() error {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\tif c.CacheDuration != nil && c.CacheDuration.Duration < 0 {\n\t\treturn errors.New(\"crl.cacheDuration must be greater than or equal to 0\")\n\t}\n\n\tif c.RenewPeriod != nil && c.RenewPeriod.Duration < 0 {\n\t\treturn errors.New(\"crl.renewPeriod must be greater than or equal to 0\")\n\t}\n\n\tif c.RenewPeriod != nil && c.CacheDuration != nil &&\n\t\tc.RenewPeriod.Duration > c.CacheDuration.Duration {\n\t\treturn errors.New(\"crl.cacheDuration must be greater than or equal to crl.renewPeriod\")\n\t}\n\n\treturn nil\n}", "func (q BucketQuota) IsValid() bool {\n\tif q.Quota > 0 {\n\t\treturn q.Type.IsValid()\n\t}\n\t// Empty configs are valid.\n\treturn true\n}", "func (a *Azure) ValidConfig() bool {\n\treturn a.SubscriptionID != \"\" && a.ClientID != \"\" && a.ClientSecret != \"\" && a.TenantID != \"\"\n}", "func (c *Config) validate() error {\n\tif len(c.Port) == 0 {\n\t\treturn errors.New(\"missing port\")\n\t}\n\n\terr := c.BackendServerConfigs.validate()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"invalid backend servers configuration\")\n\t}\n\n\treturn nil\n}", "func ValidateAPIServerWatchCache(config *imports.APIServerWatchCacheConfiguration, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tif config.DefaultSize != nil && *config.DefaultSize < 0 {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"defaultSize\"), *config.DefaultSize, \"The default watch cache size cannot be negative\"))\n\t}\n\n\tfor i, resource := range config.Resources {\n\t\tpath := fldPath.Child(\"resources\").Index(i)\n\t\tif len(resource.ApiGroup) == 0 {\n\t\t\tallErrs = append(allErrs, field.Invalid(path.Child(\"apiGroup\"), \"\", \"The API Group of the watch cache resource cannot be empty\"))\n\t\t}\n\t\tif len(resource.Resource) == 0 {\n\t\t\tallErrs = append(allErrs, field.Invalid(path.Child(\"resource\"), \"\", \"The name of the watch cache resource cannot be empty\"))\n\t\t}\n\t\tif resource.Size < 0 {\n\t\t\tallErrs = append(allErrs, field.Invalid(path.Child(\"size\"), resource.Size, \"The size of the watch cache resource cannot be negative\"))\n\t\t}\n\t}\n\n\treturn allErrs\n}", "func (cc *Config) Validate() error {\n\tif len(cc.BrokerList) == 0 {\n\t\treturn ErrConfigNoBrokers\n\t}\n\n\tif cc.ReadTimeout < time.Millisecond {\n\t\treturn ErrConfigInvalidReadTimeout\n\t}\n\n\tif cc.WriteTimeout < time.Millisecond {\n\t\treturn ErrConfigInvalidWriteTimeout\n\t}\n\n\tif cc.ConnectTimeout < time.Millisecond {\n\t\treturn ErrConfigInvalidConnectTimeout\n\t}\n\n\tif cc.KeepAliveTimeout < time.Millisecond {\n\t\treturn ErrConfigInvalidKeepAliveTimeout\n\t}\n\n\tif cc.FetchSize < 1 {\n\t\treturn ErrConfigInvalidFetchSize\n\t}\n\n\tif cc.MetadataRetries < 0 {\n\t\treturn ErrConfigInvalidMetadataRetries\n\t}\n\n\tif cc.MetadataBackoff < time.Millisecond {\n\t\treturn ErrConfigInvalidMetadataBackoff\n\t}\n\n\tif cc.MetadataTTL < time.Millisecond {\n\t\treturn ErrConfigInvalidMetadataTTL\n\t}\n\n\tif cc.CommitOffsetRetries < 0 {\n\t\treturn ErrConfigInvalidCommitOffsetRetries\n\t}\n\n\tif cc.CommitOffsetBackoff < time.Millisecond {\n\t\treturn ErrConfigInvalidCommitOffsetBackoff\n\t}\n\n\tif cc.ConsumerMetadataRetries < 0 {\n\t\treturn ErrConfigInvalidConsumerMetadataRetries\n\t}\n\n\tif cc.ConsumerMetadataBackoff < time.Millisecond {\n\t\treturn ErrConfigInvalidConsumerMetadataBackoff\n\t}\n\n\tif cc.ClientID == \"\" {\n\t\treturn ErrConfigEmptyClientID\n\t}\n\n\treturn nil\n}", "func (mgc Config) Validate() error {\n\tif mgc.User == \"\" {\n\t\treturn errors.New(\"Config.User is required\")\n\t}\n\tif mgc.Password == \"\" {\n\t\treturn errors.New(\"Config.Password is required\")\n\t}\n\tif mgc.AuthDB == \"\" {\n\t\treturn errors.New(\"Config.AuthDB is required\")\n\t}\n\tif mgc.Host == \"\" {\n\t\treturn errors.New(\"Config.Host is required\")\n\t}\n\tif mgc.DB == \"\" {\n\t\treturn errors.New(\"Config.DB is required\")\n\t}\n\treturn nil\n}", "func (ct *Chronicle) IsValid() (err error) {\n\tif utils.IsSet(ct.Aspectratio) {\n\t\tif _, _, err = parseAspectRatio(ct.Aspectratio); err != nil {\n\t\t\treturn templateErr(ct, err)\n\t\t}\n\t}\n\n\tif !utils.IsSet(ct.Description) {\n\t\treturn templateErrf(ct, \"Missing description\")\n\t}\n\n\tif err = ct.hasValidFlags(); err != nil {\n\t\treturn templateErr(ct, err)\n\t}\n\n\tif err = ct.Parameters.IsValid(); err != nil {\n\t\treturn templateErr(ct, err)\n\t}\n\n\tif err = ct.Canvas.IsValid(); err != nil {\n\t\treturn templateErr(ct, err)\n\t}\n\n\tif err = ct.Content.IsValid(&ct.Parameters, &ct.Canvas); err != nil {\n\t\treturn templateErr(ct, err)\n\t}\n\n\treturn nil\n}", "func (c *Config) Validate() {\n\tif c.Global.TempDir == \"\" {\n\t\tc.Global.TempDir = \"/tmp/\"\n\t} else if !strings.HasSuffix(c.Global.TempDir, \"/\") {\n\t\tc.Global.TempDir += \"/\"\n\t}\n\tif c.Imessage.QueueSize < 20 {\n\t\tc.Imessage.QueueSize = 20\n\t}\n}", "func (m *Config) Validate() error {\n\treturn m.validate(false)\n}", "func (c *Config) Validate() error {\n\tif !c.Enabled {\n\t\treturn nil\n\t}\n\tif c.RefreshInterval == 0 {\n\t\treturn fmt.Errorf(\"git config is enabled but refresh interval is set to 0 (disabled)\")\n\t}\n\n\treturn c.Repository.Validate()\n}", "func (c *Google3Config) Validate() error {\n\treturn nil\n}", "func (s *TrafficOpsSessionThreadsafe) CRConfigValid(crc *tc.CRConfig, cdn string) error {\n\tif crc == nil {\n\t\treturn errors.New(\"CRConfig is nil\")\n\t}\n\tif crc.Stats.CDNName == nil {\n\t\treturn errors.New(\"CRConfig.Stats.CDN missing\")\n\t}\n\tif crc.Stats.DateUnixSeconds == nil {\n\t\treturn errors.New(\"CRConfig.Stats.Date missing\")\n\t}\n\n\t// Note this intentionally takes intended CDN, rather than trusting\n\t// crc.Stats\n\tlastCrc, lastCrcTime, lastCrcStats := s.lastCRConfig.Get(cdn)\n\n\tif lastCrc == nil {\n\t\treturn nil\n\t}\n\tif lastCrcStats.DateUnixSeconds == nil {\n\t\tlog.Warnln(\"TrafficOpsSessionThreadsafe.CRConfigValid returning no error, but last CRConfig Date was missing!\")\n\t\treturn nil\n\t}\n\tif lastCrcStats.CDNName == nil {\n\t\tlog.Warnln(\"TrafficOpsSessionThreadsafe.CRConfigValid returning no error, but last CRConfig CDN was missing!\")\n\t\treturn nil\n\t}\n\tif *lastCrcStats.CDNName != *crc.Stats.CDNName {\n\t\treturn errors.New(\"CRConfig.Stats.CDN \" + *crc.Stats.CDNName + \" different than last received CRConfig.Stats.CDNName \" + *lastCrcStats.CDNName + \" received at \" + lastCrcTime.Format(time.RFC3339Nano))\n\t}\n\tif *lastCrcStats.DateUnixSeconds > *crc.Stats.DateUnixSeconds {\n\t\treturn errors.New(\"CRConfig.Stats.Date \" + strconv.FormatInt(*crc.Stats.DateUnixSeconds, 10) + \" older than last received CRConfig.Stats.Date \" + strconv.FormatInt(*lastCrcStats.DateUnixSeconds, 10) + \" received at \" + lastCrcTime.Format(time.RFC3339Nano))\n\t}\n\treturn nil\n}", "func (config *Config) valid() error {\n\t// check minlevel validation\n\tif \"\" != config.MinLevel && !LevelFromString(config.MinLevel).valid() {\n\t\treturn ErrConfigBadAttributes\n\t}\n\n\t// check filters len\n\tif len(config.Filters) < 1 {\n\t\treturn ErrConfigFiltersNotFound\n\t}\n\n\t// check filter one by one\n\tfor _, filter := range config.Filters {\n\t\tif \"\" == filter.Levels {\n\t\t\treturn ErrConfigLevelsNotFound\n\t\t}\n\n\t\tif (file{}) != filter.File {\n\t\t\t// seem not needed now\n\t\t\t//if \"\" == filter.File.Path {\n\t\t\t//return ErrConfigFilePathNotFound\n\t\t\t//}\n\t\t} else if (rotateFile{}) != filter.RotateFile {\n\t\t\tif \"\" == filter.RotateFile.Path {\n\t\t\t\treturn ErrConfigFilePathNotFound\n\t\t\t}\n\n\t\t\tif \"\" == filter.RotateFile.Type {\n\t\t\t\treturn ErrConfigFileRotateTypeNotFound\n\t\t\t}\n\t\t} else if (socket{}) != filter.Socket {\n\t\t\tif \"\" == filter.Socket.Address {\n\t\t\t\treturn ErrConfigSocketAddressNotFound\n\t\t\t}\n\n\t\t\tif \"\" == filter.Socket.Network {\n\t\t\t\treturn ErrConfigSocketNetworkNotFound\n\t\t\t}\n\t\t} else {\n\t\t\treturn ErrConfigMissingFilterType\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *Metadata) Valid() bool {\n\tif m.ProbeCC == \"\" {\n\t\treturn false\n\t}\n\tif m.ProbeASN == \"\" {\n\t\treturn false\n\t}\n\tif m.Platform == \"\" {\n\t\treturn false\n\t}\n\tif m.SoftwareName == \"\" {\n\t\treturn false\n\t}\n\tif m.SoftwareVersion == \"\" {\n\t\treturn false\n\t}\n\tif len(m.SupportedTests) < 1 {\n\t\treturn false\n\t}\n\tswitch m.Platform {\n\tcase \"ios\", \"android\":\n\t\tif m.DeviceToken == \"\" {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (c *hostNameFormatConfig) IsValid(name string) bool {\n\tfor _, validator := range c.validators {\n\t\tif !validator.IsValid(name) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (cfg *Config) Validate() error {\n\tif len(cfg.Key) == 0 {\n\t\treturn trace.BadParameter(`etcd: missing \"prefix\" parameter`)\n\t}\n\t// Make sure the prefix starts with a '/'.\n\tif cfg.Key[0] != '/' {\n\t\tcfg.Key = \"/\" + cfg.Key\n\t}\n\tif len(cfg.Nodes) == 0 {\n\t\treturn trace.BadParameter(`etcd: missing \"peers\" parameter`)\n\t}\n\tif !cfg.Insecure {\n\t\tif cfg.TLSCAFile == \"\" {\n\t\t\treturn trace.BadParameter(`etcd: missing \"tls_ca_file\" parameter`)\n\t\t}\n\t}\n\tif cfg.BufferSize == 0 {\n\t\tcfg.BufferSize = backend.DefaultBufferCapacity\n\t}\n\tif cfg.DialTimeout == 0 {\n\t\tcfg.DialTimeout = apidefaults.DefaultIOTimeout\n\t}\n\tif cfg.PasswordFile != \"\" {\n\t\tout, err := os.ReadFile(cfg.PasswordFile)\n\t\tif err != nil {\n\t\t\treturn trace.ConvertSystemError(err)\n\t\t}\n\t\t// trim newlines as passwords in files tend to have newlines\n\t\tcfg.Password = strings.TrimSpace(string(out))\n\t}\n\n\tif cfg.ClientPoolSize < 1 {\n\t\tcfg.ClientPoolSize = defaultClientPoolSize\n\t}\n\treturn nil\n}", "func (c Config) Validate() error {\n\treturn validation.ValidateStruct(&c,\n\t\tvalidation.Field(\n\t\t\t&c.Database,\n\t\t),\n\t)\n}", "func checkConfig(url string, zoom, minzoom, cc int) {\n\t// ensure a URL is provided\n\tif url == \"\" {\n\t\tfmt.Printf(\"No cache URL specified!\\n\" +\n\t\t\t\"Use `--url` to specify the cache URL.\\n\" +\n\t\t\t\"Use `--help` to learn more.\\n\")\n\t\tos.Exit(1)\n\t}\n\n\t// ensure proper URL\n\t_, err := liburl.Parse(url)\n\tif err != nil {\n\t\tfmt.Printf(\"Invalid cache URL provided. \" +\n\t\t\t\"Must be a valid HTTP/HTTPS URL.\\n\")\n\t\tos.Exit(1)\n\t}\n\n\t// ensure valid max zoom level\n\tif zoom < 0 {\n\t\tfmt.Printf(\"Provided max zoom level must be 0 or greater!\\n\")\n\t\tos.Exit(1)\n\t}\n\n\t// ensure valid minimum zoom level\n\tif minzoom < 0 {\n\t\tfmt.Printf(\"Provided minimum zoom level must be 0 or greater!\\n\")\n\t\tos.Exit(1)\n\t}\n\n\t// ensure valid concurrency level\n\tif cc < 1 {\n\t\tfmt.Printf(\"Invalid concurrency level: %d. \"+\n\t\t\t\"Must be at least 1.\\n\", cc)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"Config OK. URL: %s, Max zoom: %d, \"+\n\t\t\"Min zoom: %d, Concurrency: %d\\n\\n\", url, zoom, minzoom, cc)\n}", "func (sc *StartupConfig) Validate() (bool, error) {\n\tif sc.Meta == nil {\n\t\treturn false, fmt.Errorf(\"meta object is nil\")\n\t}\n\n\tif sc.Server == nil {\n\t\t//return false, fmt.Errorf(\"Server is nil\")\n\t}\n\n\tif sc.Database == nil {\n\t\treturn false, fmt.Errorf(\"database object is nil\")\n\t}\n\n\tif sc.Session == nil {\n\t\treturn false, fmt.Errorf(\"session object is nil\")\n\t}\n\n\tif sc.Crypto == nil {\n\t\treturn false, fmt.Errorf(\"crypto object is nil\")\n\t}\n\n\tif sc.Secrets == nil {\n\t\treturn false, fmt.Errorf(\"secrets object is nil\")\n\t}\n\n\tif sc.Capsul == nil {\n\t\treturn false, fmt.Errorf(\"capsul object is nil\")\n\t}\n\n\tif sc.CustomCapsul == nil {\n\t\treturn false, fmt.Errorf(\"custom capsul object is nil\")\n\t}\n\n\tif sc.Create == nil {\n\t\treturn false, fmt.Errorf(\"create object is nil\")\n\t}\n\n\treturn true, nil\n}", "func (cfg fromCFN) validate() error {\n\tif cfg.isEmpty() {\n\t\treturn nil\n\t}\n\tif len(aws.StringValue(cfg.Name)) == 0 {\n\t\treturn errors.New(\"name cannot be an empty string\")\n\t}\n\treturn nil\n}", "func (c *Config) Validate() error {\n\treturn nil\n}", "func (c *Config) Validate() error {\n\treturn nil\n}", "func (c *Config) Validate() error {\n\treturn nil\n}", "func (cfg Config) Validate() error {\n\treturn validation.ValidateStruct(\n\t\t&cfg,\n\t\tvalidation.Field(&cfg.NodeID, validation.Required),\n\t\tvalidation.Field(&cfg.ListenAddr, validation.Required, is.Host),\n\t\tvalidation.Field(&cfg.DataDir, validation.Required),\n\t\tvalidation.Field(&cfg.CompactionEnabled, validation.Required),\n\t\tvalidation.Field(&cfg.Peers),\n\t)\n}", "func (e JwtCacheConfigValidationError) Key() bool { return e.key }", "func (spr *StakingPriceRecord) Validate(c *config.Config, dbht int64) bool {\n\tnet, _ := common.LoadConfigNetwork(c)\n\tif !common.NetworkActive(net, dbht) {\n\t\treturn false\n\t}\n\n\t// Validate there are no 0's\n\tfor k, v := range spr.Assets {\n\t\tif v == 0 {\n\t\t\tfmt.Println(\"[error]:\", k, v)\n\t\t\treturn false\n\t\t}\n\t}\n\t// Only enforce on version 2 and forward, checking valid FCT address\n\tif !ValidFCTAddress(spr.CoinbaseAddress) {\n\t\treturn false\n\t}\n\n\tif int64(spr.Dbht) != dbht {\n\t\treturn false // DBHeight is not reported correctly\n\t}\n\n\t// Validate all the Assets exists\n\tswitch spr.Version {\n\tcase 5:\n\t\treturn spr.Assets.ContainsExactly(common.AssetsV5)\n\tdefault:\n\t\treturn false\n\t}\n}", "func (cfg *HATrackerConfig) Validate() error {\n\tif cfg.UpdateTimeoutJitterMax < 0 {\n\t\treturn errNegativeUpdateTimeoutJitterMax\n\t}\n\n\tminFailureTimeout := cfg.UpdateTimeout + cfg.UpdateTimeoutJitterMax + time.Second\n\tif cfg.FailoverTimeout < minFailureTimeout {\n\t\treturn fmt.Errorf(errInvalidFailoverTimeout, cfg.FailoverTimeout, minFailureTimeout)\n\t}\n\n\treturn nil\n}", "func (c *Config) Validate() error {\n\t// TODO(felix): complete validates\n\treturn nil\n}", "func (c *Config) Validate() error {\n\t// Resolve symlinks.\n\tfor i, p := range c.Paths {\n\t\tif evalPath, err := filepath.EvalSymlinks(p); err == nil {\n\t\t\tc.Paths[i] = evalPath\n\t\t}\n\t}\n\t// Sort and deduplicate.\n\tsort.Strings(c.Paths)\n\tc.Paths = deduplicate(c.Paths)\n\n\tvar errs multierror.Errors\n\tvar err error\n\nnextHash:\n\tfor _, ht := range c.HashTypes {\n\t\tht = HashType(strings.ToLower(string(ht)))\n\t\tfor _, validHash := range validHashes {\n\t\t\tif ht == validHash {\n\t\t\t\tcontinue nextHash\n\t\t\t}\n\t\t}\n\t\terrs = append(errs, errors.Errorf(\"invalid hash_types value '%v'\", ht))\n\t}\n\n\tc.MaxFileSizeBytes, err = humanize.ParseBytes(c.MaxFileSize)\n\tif err != nil {\n\t\terrs = append(errs, errors.Wrap(err, \"invalid max_file_size value\"))\n\t} else if c.MaxFileSizeBytes <= 0 {\n\t\terrs = append(errs, errors.Errorf(\"max_file_size value (%v) must be positive\", c.MaxFileSize))\n\t}\n\n\tc.ScanRateBytesPerSec, err = humanize.ParseBytes(c.ScanRatePerSec)\n\tif err != nil {\n\t\terrs = append(errs, errors.Wrap(err, \"invalid scan_rate_per_sec value\"))\n\t}\n\treturn errs.Err()\n}", "func (c *Config) Validate() bool {\n\tswitch c.Ops {\n\tcase 0, 1, 2, 4, 8:\n\t\treturn true\n\t}\n\treturn false\n}", "func (c *chainConfig) validate() error {\n\tswitch {\n\tcase c.NodeUrl == \"\":\n\t\treturn errors.New(\"empty node url\")\n\tcase c.BlockQueryDepth < 1 || c.BlockQueryDepth > 1000:\n\t\treturn errors.New(\"block query depth out of range\")\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (a AuthorizationConfig) validate() error {\n\tif a.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (c configuration) Validate() error {\n\tvar errs error\n\n\terrs = errors.Append(errs, c.Auth.Validate())\n\terrs = errors.Append(errs, c.Config.Validate())\n\n\tif c.Environment == \"\" {\n\t\terrs = errors.Append(errs, errors.New(\"environment is required\"))\n\t}\n\n\t// TODO: this config is only used here, so the validation is here too. Either the config or the validation should be moved somewhere else.\n\tif c.Distribution.PKE.Amazon.GlobalRegion == \"\" {\n\t\terrs = errors.Append(errs, errors.New(\"pke amazon global region is required\"))\n\t}\n\n\treturn errs\n}", "func (c *config) Validate() []error {\n\tvar errs []error\n\tif value, err := validateProvider(c.Provider); err != nil {\n\t\terrs = append(errs, err)\n\t} else {\n\t\tc.Provider = value\n\t}\n\tif value, err := validateAccountName(c.AccountName); err != nil {\n\t\terrs = append(errs, err)\n\t} else {\n\t\tc.AccountName = value\n\t}\n\tif value, err := validateAccountSecret(c.AccountSecret); err != nil {\n\t\terrs = append(errs, err)\n\t} else {\n\t\tc.AccountSecret = value\n\t}\n\tif value, err := validateDNSContent(c.DNSContent); err != nil {\n\t\terrs = append(errs, err)\n\t} else {\n\t\tc.DNSContent = value\n\t}\n\tif value, err := validateDockerLabel(c.DockerLabel); err != nil {\n\t\terrs = append(errs, err)\n\t} else {\n\t\tc.DockerLabel = value\n\t}\n\tif value, err := validateStore(c.Store); err != nil {\n\t\terrs = append(errs, err)\n\t} else {\n\t\tc.Store = value\n\t}\n\tif value, err := validateDataDirectory(c.DataDirectory); err != nil {\n\t\terrs = append(errs, err)\n\t} else {\n\t\tc.DataDirectory = value\n\t}\n\treturn errs\n}", "func (cfg config) Validate() {\n\tif v, exists := cfg[\"tls_min_version\"]; exists {\n\t\tvar t tlsMinVersionOption\n\t\terr := t.Set(fmt.Sprintf(\"%v\", v))\n\t\tif err == nil {\n\t\t\tnewVal := fmt.Sprintf(\"%v\", t.Get())\n\t\t\tif newVal != \"0\" {\n\t\t\t\tcfg[\"tls_min_version\"] = newVal\n\t\t\t} else {\n\t\t\t\tdelete(cfg, \"tls_min_version\")\n\t\t\t}\n\t\t} else {\n\t\t\tlogFatal(\"failed parsing tls_min_version %+v\", v)\n\t\t}\n\t}\n\tif v, exists := cfg[\"log_level\"]; exists {\n\t\tvar t lg.LogLevel\n\t\terr := t.Set(fmt.Sprintf(\"%v\", v))\n\t\tif err == nil {\n\t\t\tcfg[\"log_level\"] = t\n\t\t} else {\n\t\t\tlogFatal(\"failed parsing log_level %+v\", v)\n\t\t}\n\t}\n}", "func (o *OAuth2Config) IsValid() bool {\n\treturn o.TokenURL != \"\" && o.AuthURL != \"\" && len(o.Scopes) != 0\n}", "func (c *configuration) validateConfig() error {\n\tif c.Provider == \"\" {\n\t\treturn errors.New(msgConfigNoProvider)\n\t}\n\n\tif len(c.Servers) == 0 {\n\t\treturn errors.New(msgConfigNoServers)\n\t}\n\n\tfor i, srv := range c.Servers {\n\t\tif srv.FabricIface == \"\" {\n\t\t\treturn errors.Errorf(\n\t\t\t\tmsgConfigServerNoIface+\" for I/O service %d\", i)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c Config) Validate() error {\n\treturn validation.ValidateStruct(&c,\n\t\tvalidation.Field(&c.AppMode, validation.Required),\n\t\tvalidation.Field(&c.AppName, validation.Required),\n\t\tvalidation.Field(&c.DBType, validation.Required),\n\t\tvalidation.Field(&c.DSN, validation.Required),\n\t\tvalidation.Field(&c.JWTSigningKey, validation.Required),\n\t\tvalidation.Field(&c.JWTExpiration, validation.Required),\n\t\tvalidation.Field(&c.MailSmtphost, validation.Required),\n\t\tvalidation.Field(&c.MailSmtpport, validation.Required),\n\t\tvalidation.Field(&c.MailUsername, validation.Required),\n\t\tvalidation.Field(&c.MailPassword, validation.Required),\n\t\tvalidation.Field(&c.AppFqdn, validation.Required),\n\t\tvalidation.Field(&c.HttpEntrypoint, validation.Required),\n\t\tvalidation.Field(&c.WebservName, validation.Required),\n\t\tvalidation.Field(&c.GoogleCredentialFile, validation.Required),\n\t\tvalidation.Field(&c.GoogleRedirectPath, validation.Required),\n\t\tvalidation.Field(&c.AppSecretKey, validation.Required),\n\t\tvalidation.Field(&c.BizName, validation.Required),\n\t\tvalidation.Field(&c.BizShortname, validation.Required),\n\t\tvalidation.Field(&c.BizEmail, validation.Required),\n\t\tvalidation.Field(&c.BizPhone),\n\t\tvalidation.Field(&c.BizPhone2),\n\t\tvalidation.Field(&c.BizLogo, validation.Required),\n\t)\n}", "func (cfg *Config) Validate() error {\n\tif len(cfg.Scrapers) == 0 {\n\t\treturn errors.New(\"must specify at least one scraper\")\n\t}\n\treturn nil\n}", "func (c Config) Validate() error {\n\t// Check DbConfig\n\tif err := c.Db.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"error verifying db config: %s\", err.Error())\n\t}\n\n\t// Check AuthConfig\n\tif err := c.Auth.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"error verifying auth config: %s\", err.Error())\n\t}\n\n\t// All good\n\treturn nil\n}", "func (c *Config) validate() error {\n\tif c.iface == \"\" {\n\t\treturn errors.New(\"the iface must be set\")\n\t}\n\tif c.protocal != \"\" && c.protocal != \"tcp\" && c.protocal != \"udp\" {\n\t\treturn errors.New(\"the protocl must be set to tcp or udp or both\")\n\t}\n\treturn nil\n}", "func (config StorageConfigStruct) Validate() error {\n\treturn nil\n}", "func (c *Config) Validate() error {\n\tif c.Address == \"\" {\n\t\treturn errors.New(\"the address of mockserver is required\")\n\t}\n\treturn nil\n}", "func (m VolumeStoreMode) Valid() bool {\n\tif m.IsLocal() && m.IsRemote() {\n\t\treturn false\n\t}\n\n\t// local store\n\tif m.IsLocal() {\n\t\tif m.CentralCreateDelete() {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\t// remote store\n\tif m.IsRemote() {\n\t\tif m.UseLocalMeta() {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *MetaConfig) ValidPath(path string) bool {\n\tswitch c.StorageType {\n\tcase Local:\n\t\treturn c.ValidFilePath(path)\n\tcase S3:\n\t\treturn strings.HasPrefix(path, \"s3://\")\n\t}\n\treturn false\n}", "func (c *Config) Validate() error {\n\tvar errs []error\n\n\tif len(c.Hosts) == 0 {\n\t\terrs = append(errs, fmt.Errorf(\"missing hosts\"))\n\t}\n\tif c.Port == \"\" {\n\t\terrs = append(errs, fmt.Errorf(\"missing port\"))\n\t}\n\n\treturn apierrors.NewAggregate(errs)\n}", "func (c *AwsCredentials) IsValid() error {\n\tif c.AccessKeyId == \"\" {\n\t\treturn fmt.Errorf(\"AccessKeyId is empty\")\n\t}\n\tif c.SecretAccessKey == \"\" {\n\t\treturn fmt.Errorf(\"SecretAccessKey is empty\")\n\t}\n\tif c.SessionToken == \"\" {\n\t\treturn fmt.Errorf(\"SessionToken is empty\")\n\t}\n\treturn nil\n}", "func (cfg *Config) Validate() error {\n\tif cfg.MaxCompactionParallelism < 1 {\n\t\treturn errors.New(\"max compaction parallelism must be >= 1\")\n\t}\n\tif cfg.RetentionEnabled && cfg.ApplyRetentionInterval != 0 && cfg.ApplyRetentionInterval%cfg.CompactionInterval != 0 {\n\t\treturn errors.New(\"interval for applying retention should either be set to a 0 or a multiple of compaction interval\")\n\t}\n\n\tif err := shipper_storage.ValidateSharedStoreKeyPrefix(cfg.SharedStoreKeyPrefix); err != nil {\n\t\treturn err\n\t}\n\n\tif cfg.DeletionMode != \"\" {\n\t\tlevel.Warn(util_log.Logger).Log(\"msg\", \"boltdb.shipper.compactor.deletion-mode has been deprecated and will be ignored. This has been moved to the deletion_mode per tenant configuration.\")\n\t}\n\n\treturn nil\n}", "func (c *Config) Validate() error {\n\tif c.Addr == \"\" {\n\t\treturn fmt.Errorf(\"Address of the curator can not be empty\")\n\t}\n\treturn nil\n}" ]
[ "0.7334379", "0.73106605", "0.71156335", "0.69770676", "0.6912331", "0.6789894", "0.66050184", "0.6414094", "0.63609535", "0.63579315", "0.63561", "0.63447815", "0.62871134", "0.62272954", "0.62238055", "0.61652154", "0.61517376", "0.60553706", "0.5991886", "0.59730834", "0.59684455", "0.5936148", "0.5935412", "0.5934023", "0.5930458", "0.59272265", "0.5925605", "0.58646405", "0.58277583", "0.5827109", "0.5778469", "0.5766766", "0.57546043", "0.57521594", "0.5744452", "0.5733098", "0.5712154", "0.57073545", "0.5703033", "0.569915", "0.56752276", "0.56725174", "0.56585646", "0.5649816", "0.564013", "0.5633729", "0.56330794", "0.5630968", "0.5617824", "0.5606645", "0.55842304", "0.55792344", "0.55786365", "0.5561337", "0.55587924", "0.5558168", "0.5555849", "0.55505496", "0.5548268", "0.554784", "0.55200136", "0.551486", "0.55138355", "0.55097944", "0.55065215", "0.5497391", "0.5492428", "0.5483009", "0.5477814", "0.5466656", "0.5460714", "0.5458814", "0.5458814", "0.5458814", "0.54479134", "0.5447123", "0.5435411", "0.5433464", "0.543168", "0.54303545", "0.54255545", "0.5425049", "0.5415664", "0.5406729", "0.54063284", "0.5402303", "0.5395854", "0.53945845", "0.538521", "0.53825", "0.5373872", "0.53718287", "0.537163", "0.53670263", "0.5363491", "0.5357737", "0.53575593", "0.53567773", "0.5356646", "0.53554904" ]
0.73390514
0
mergeIfMergable checks if obj implements our Mergable psuedointerface and calls obj.Merge(src) if it does. The Mergable psuedointerface is defined as: "x.Merge(src) operates on a nonpointer x, accepts src of the same type as x, and returns another object of the same type as x" Note that the requirement .Merge must not operate on a pointer type is unlike most go methods. Mergable is not a real go interface, it's more of a "psuedointerface". See explanation on copyIfCopyable. In practice, Mergable means an object can have custom merge behaviors. Often this is used for combining lists, like bind_mounts or devices.
func mergeIfMergable(obj reflect.Value, src reflect.Value) (reflect.Value, bool) { var out reflect.Value // Look for the .WithDefaults method. meth, ok := obj.Type().MethodByName("Merge") if !ok { return out, false } // Verify the signature matches our Mergable psuedointerface: // - two inputs (the receiver), and one output // - input types match output type exactly (disallow the usual pointer receiver semantics) if meth.Type.NumIn() != 2 || meth.Type.NumOut() != 1 { return out, false } if meth.Type.In(0) != meth.Type.In(1) || meth.Type.In(0) != meth.Type.Out(0) { return out, false } // Psuedointerface matches, call the .Merge method. out = meth.Func.Call([]reflect.Value{obj, src})[0] return out, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Merge(base, overrides interface{}) error {\n\tbaseBytes, err := json.Marshal(base)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\toverrideBytes, err := json.Marshal(overrides)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\tpatchMeta, err := strategicpatch.NewPatchMetaFromStruct(base)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to produce patch meta from struct\")\n\t}\n\tpatch, err := strategicpatch.CreateThreeWayMergePatch(overrideBytes, overrideBytes, baseBytes, patchMeta, true)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to create three way merge patch\")\n\t}\n\n\tmerged, err := strategicpatch.StrategicMergePatchUsingLookupPatchMeta(baseBytes, patch, patchMeta)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to apply patch\")\n\t}\n\n\tvalueOfBase := reflect.Indirect(reflect.ValueOf(base))\n\tinto := reflect.New(valueOfBase.Type())\n\tif err := json.Unmarshal(merged, into.Interface()); err != nil {\n\t\treturn err\n\t}\n\tif !valueOfBase.CanSet() {\n\t\treturn errors.New(\"unable to set unmarshalled value into base object\")\n\t}\n\tvalueOfBase.Set(reflect.Indirect(into))\n\treturn nil\n}", "func Merge(object interface{}, overwriteObject interface{}) {\n\tobjectPointerUnsafe := unsafe.Pointer(&object)\n\toverwriteObjectPointerUnsafe := unsafe.Pointer(&overwriteObject)\n\n\tmerge(object, overwriteObject, objectPointerUnsafe, overwriteObjectPointerUnsafe)\n}", "func UnionMerge[T any](obj T, src T) T {\n\tname := fmt.Sprintf(\"%T\", obj)\n\n\tvObj := reflect.ValueOf(obj)\n\tvSrc := reflect.ValueOf(src)\n\n\t// obj must have the same type as src.\n\tassertTypeMatch(vObj, vSrc)\n\n\tif vObj.Kind() != reflect.Struct {\n\t\tpanic(\"UnionMerge must only be called on struct types\")\n\t}\n\n\treturn unionMerge(vObj, vSrc, name).Interface().(T)\n}", "func Merge[T any](obj T, src T) T {\n\tname := fmt.Sprintf(\"%T\", obj)\n\n\tvObj := reflect.ValueOf(obj)\n\tvSrc := reflect.ValueOf(src)\n\n\t// obj must have the same type as src.\n\tassertTypeMatch(vObj, vSrc)\n\n\treturn merge(vObj, vSrc, name).Interface().(T)\n}", "func merge(obj reflect.Value, src reflect.Value, name string) reflect.Value {\n\t// fmt.Printf(\"merge(%T, %T, %v)\\n\", obj.Interface(), src.Interface(), name)\n\tassertTypeMatch(obj, src)\n\n\t// Always handle pointers first.\n\tif obj.Kind() == reflect.Ptr {\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t} else if src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t}\n\t\tout := reflect.New(obj.Elem().Type())\n\t\tout.Elem().Set(merge(obj.Elem(), src.Elem(), name))\n\t\treturn out.Convert(obj.Type())\n\t}\n\n\t// Next handle interfaces.\n\tif obj.Kind() == reflect.Interface {\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t} else if src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t}\n\t\treturn merge(obj.Elem(), src.Elem(), name)\n\t}\n\n\t// Handle the `T Mergable[T]` pseudointerface\n\tif out, ok := mergeIfMergable(obj, src); ok {\n\t\treturn out\n\t}\n\n\tswitch obj.Kind() {\n\tcase reflect.Struct:\n\t\t// Recurse into each field of the struct.\n\t\tout := reflect.New(obj.Type()).Elem()\n\t\tfor i := 0; i < src.NumField(); i++ {\n\t\t\tstructField := src.Type().Field(i)\n\t\t\tfieldName := fmt.Sprintf(\"%v.%v\", name, structField.Name)\n\t\t\tx := merge(obj.Field(i), src.Field(i), fieldName)\n\t\t\tout.Field(i).Set(x)\n\t\t}\n\t\treturn out.Convert(obj.Type())\n\n\tcase reflect.Map:\n\t\t// Handle unallocated maps on either input.\n\t\tif src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t} else if obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t}\n\t\t// allocate a new map\n\t\ttyp := reflect.MapOf(obj.Type().Key(), obj.Type().Elem())\n\t\tout := reflect.MakeMap(typ)\n\t\t// Iterate through keys and objects in obj.\n\t\titer := obj.MapRange()\n\t\tfor iter.Next() {\n\t\t\tkey := iter.Key()\n\t\t\tobjVal := iter.Value()\n\t\t\tif srcVal := src.MapIndex(key); srcVal.IsValid() {\n\t\t\t\t// Key present in both maps.\n\t\t\t\tout.SetMapIndex(key, merge(objVal, srcVal, name))\n\t\t\t} else {\n\t\t\t\t// Key is unique to obj.\n\t\t\t\tout.SetMapIndex(key, cpy(objVal))\n\t\t\t}\n\t\t}\n\t\t// Check for keys only present in src.\n\t\titer = src.MapRange()\n\t\tfor iter.Next() {\n\t\t\tkey := iter.Key()\n\t\t\tsrcVal := iter.Value()\n\t\t\tif objVal := obj.MapIndex(key); !objVal.IsValid() {\n\t\t\t\t// Key is unique to src.\n\t\t\t\tout.SetMapIndex(key, cpy(srcVal))\n\t\t\t}\n\t\t}\n\t\treturn out.Convert(obj.Type())\n\n\tcase reflect.Slice:\n\t\t// Slices are not merged by default. If obj is nil we copy the src.\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t}\n\t\treturn cpy(obj)\n\n\t// Assert that none of the \"complex\" kinds are present.\n\tcase reflect.Array,\n\t\treflect.Chan,\n\t\treflect.Func,\n\t\treflect.UnsafePointer,\n\t\t// We already handled Ptr and Interface.\n\t\treflect.Ptr,\n\t\treflect.Interface:\n\t\tpanic(fmt.Sprintf(\"unable to fill %T with %T at %v\", obj.Interface(), src.Interface(), name))\n\n\tdefault:\n\t\t// Simple kinds just get copied.\n\t\treturn cpy(obj)\n\t}\n}", "func Merge(target, source interface{}, opt *Options) error {\n\tvT := reflect.ValueOf(target)\n\tvS := reflect.ValueOf(source)\n\n\tif target != nil && vT.Type() == valType {\n\t\tvT = vT.Interface().(reflect.Value)\n\t}\n\tif source != nil && vS.Type() == valType {\n\t\tvS = vS.Interface().(reflect.Value)\n\t}\n\n\tif vT.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"target must be a pointer\")\n\t}\n\n\tif !reflect.Indirect(vT).IsValid() {\n\t\treturn errors.New(\"target can not be zero value\")\n\t}\n\n\t// use defaults if none are provided\n\tif opt == nil {\n\t\topt = NewOptions()\n\t}\n\n\tif opt.mergeFuncs == nil {\n\t\treturn errors.New(\"invalid options, use NewOptions() to generate and then modify as needed\")\n\t}\n\n\t//make a copy here so if there is an error mid way, the target stays in tact\n\tcp := vT.Elem()\n\n\tmerged, err := merge(cp, reflect.Indirect(vS), opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !isSettable(vT.Elem(), merged) {\n\t\treturn fmt.Errorf(\"Merge failed: expected merged result to be %v but got %v\",\n\t\t\tvT.Elem().Type(), merged.Type())\n\t}\n\n\tvT.Elem().Set(merged)\n\treturn nil\n}", "func Merge(original interface{}, update interface{}) (merged interface{}, err error) {\n\n\tif original == nil {\n\t\treturn update, nil\n\t}\n\n\tif update == nil {\n\t\treturn original, nil\n\t}\n\n\t// call the recursive merge\n\treturn merge(original, update)\n}", "func Merge(orig, v interface{}, defaults bool) {\n\tvv := reflect.ValueOf(v).Elem()\n\tif !vv.IsValid() {\n\t\treturn\n\t}\n\tvorig := reflect.ValueOf(orig).Elem()\n\tfor i := 0; i < vorig.NumField(); i++ {\n\t\tfield := vv.Field(i)\n\t\tif defaults {\n\t\t\tfield = vorig.Field(i)\n\t\t}\n\t\tvar empty bool\n\t\tswitch field.Type().Kind() {\n\t\tcase reflect.Struct:\n\t\t\tempty = true // TODO: merge structs recursively\n\t\tcase reflect.Chan, reflect.Func, reflect.Slice, reflect.Map:\n\t\t\tempty = field.IsNil()\n\t\tdefault:\n\t\t\tempty = field.Interface() == reflect.Zero(field.Type()).Interface()\n\t\t}\n\t\tif !empty {\n\t\t\tvorig.Field(i).Set(vv.Field(i))\n\t\t}\n\t}\n}", "func Merge(dest interface{}, source interface{}) error {\n\topts := make([]func(*mergo.Config), 0)\n\n\t// lists are always overridden - we don't append merged lists since it generally makes things more complicated\n\topts = append(opts, mergo.WithOverride)\n\n\terr := mergo.Merge(dest, source, opts...)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "func (a Annotation) Merge(other schema.Annotation) schema.Annotation {\n\tvar ant Annotation\n\tswitch other := other.(type) {\n\tcase Annotation:\n\t\tant = other\n\tcase *Annotation:\n\t\tif other != nil {\n\t\t\tant = *other\n\t\t}\n\tdefault:\n\t\treturn a\n\t}\n\tif tag := ant.StructTag; tag != \"\" {\n\t\ta.StructTag = tag\n\t}\n\treturn a\n}", "func (b *BaseImpl) Merge() {\n\tb.Flatten()\n}", "func (obj object) Merge(other Object) (Object, bool) {\n\treturn obj.MergeWith(other, func(v1, v2 *Term) (*Term, bool) {\n\t\tobj1, ok1 := v1.Value.(Object)\n\t\tobj2, ok2 := v2.Value.(Object)\n\t\tif !ok1 || !ok2 {\n\t\t\treturn nil, true\n\t\t}\n\t\tobj3, ok := obj1.Merge(obj2)\n\t\tif !ok {\n\t\t\treturn nil, true\n\t\t}\n\t\treturn NewTerm(obj3), false\n\t})\n}", "func (i *interactor) Merge(commitlike string) (bool, error) {\n\treturn i.MergeWithStrategy(commitlike, \"merge\")\n}", "func (p1 Pages) MergeByLanguageInterface(in any) (any, error) {\n\tif in == nil {\n\t\treturn p1, nil\n\t}\n\tp2, ok := in.(Pages)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%T cannot be merged by language\", in)\n\t}\n\treturn p1.MergeByLanguage(p2), nil\n}", "func (pc ParseContext) Merge(o ParseContext) {\n\tfor k, vs := range o.Args {\n\t\tpc.Args[k] = append(pc.Args[k], vs...)\n\t}\n\n\tfor k, vs := range o.Opts {\n\t\tpc.Opts[k] = append(pc.Opts[k], vs...)\n\t}\n}", "func (me *Sac) Merge(i interface{}) *Sac {\n\n\tswitch reflect.TypeOf(i).Kind() {\n\tcase reflect.Struct:\n\t\tif s, ok := i.(Sac); ok {\n\t\t\tme.Merge(s.Data)\n\t\t} else {\n\t\t\tme.Merge(structs.Map(i))\n\t\t}\n\tcase reflect.Map:\n\t\tm := i.(map[string]interface{})\n\t\tfor key, val := range m {\n\t\t\tif _, exists := me.Data[key]; exists {\n\t\t\t\tpanic(\"Merge field already exists:\" + key)\n\t\t\t} else {\n\t\t\t\tme.Data[key] = val\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tpanic(\"Can't merge something that is not struct or map\")\n\t}\n\n\treturn me\n}", "func (m *Empty) Merge(overrides *Empty) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n}", "func (inj *Injector) Merge(i *Injector, override bool) error {\n\tfor name, v := range i.data {\n\t\tif _, ok := inj.data[name]; ok && !override {\n\t\t\treturn ErrInjectorSetTwicePointer(v)\n\t\t}\n\t\tinj.data[name] = v\n\t}\n\treturn nil\n}", "func (c *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error {\n\to, _ := oa.(*Aggregator)\n\tif o == nil {\n\t\treturn aggregator.NewInconsistentAggregatorError(c, oa)\n\t}\n\n\tc.samples = combine(c.samples, o.samples)\n\treturn nil\n}", "func merge(dst, src any, opts ...func(*mergeConfig)) error {\n\tif dst == nil || src == nil {\n\t\t// Nothing available to merge if dst or src are nil.\n\t\t// This can occur early on in reconciliation when the\n\t\t// status subresource has not been set yet.\n\t\treturn nil\n\t}\n\n\tconfig := &mergeConfig{}\n\n\tfor _, opt := range opts {\n\t\topt(config)\n\t}\n\n\tdstMap, ok := dst.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedDstObject)\n\t}\n\n\tsrcMap, ok := src.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedSrcObject)\n\t}\n\n\treturn mergo.Merge(&dstMap, filter(srcMap, config.srcfilter...), config.mergeOptions...)\n}", "func (h HyperparameterV0) Merge(other interface{}) interface{} {\n\t// Never merge partial hyperparameters.\n\treturn h\n}", "func (mdl *Model) Merge(model std.Model) error {\n\treturn nil\n}", "func (m *Mob) Merge(mob *Mob) {\n\tassignIfNotZero := func(target interface{}, value interface{}) {\n\t\ttargetValue := reflect.ValueOf(target).Elem()\n\t\tvalueValue := reflect.ValueOf(value)\n\n\t\tif valueValue.Kind() == reflect.Ptr {\n\t\t\tvalueValue = valueValue.Elem()\n\t\t}\n\n\t\tif valueValue.Interface() != reflect.Zero(valueValue.Type()).Interface() {\n\t\t\ttargetValue.Set(valueValue)\n\t\t}\n\t}\n\n\tassignIfNotZero(&m.Species, mob.Species)\n\tassignIfNotZero(&m.SpawnX, mob.SpawnX)\n\tassignIfNotZero(&m.SpawnY, mob.SpawnY)\n\tassignIfNotZero(&m.MoveSpeed, mob.MoveSpeed)\n\tassignIfNotZero(&m.FindCount, mob.FindCount)\n\tassignIfNotZero(&m.FindInterval, mob.FindInterval)\n\tassignIfNotZero(&m.MoveInterval, mob.MoveInterval)\n\tassignIfNotZero(&m.Level, mob.Level)\n\tassignIfNotZero(&m.MaxHP, mob.MaxHP)\n}", "func (s *CommandLineSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (a *AttributeDefinition) Merge(other *AttributeDefinition) *AttributeDefinition {\n\tif other == nil {\n\t\treturn a\n\t}\n\tif a == nil {\n\t\treturn other\n\t}\n\tleft := a.Type.(Object)\n\tright := other.Type.(Object)\n\tif left == nil || right == nil {\n\t\tpanic(\"cannot merge non object attributes\") // bug\n\t}\n\tfor n, v := range right {\n\t\tleft[n] = v\n\t}\n\treturn a\n}", "func Merge(dits []Iterator, cb func([]*Meta) error) error {\n\treturn mergeByKey(dits, metaInputID, cb)\n}", "func Merge(dataA *interface{}, dataB *interface{}, arrayAppend bool) {\n\tmergeRecursive(dataA, dataB, arrayAppend, nil, \"\")\n}", "func MetaMerge(a, b map[string]interface{}) map[string]interface{} {\n\tfor k, v := range b {\n\t\t// don't over-write\n\t\tif _, ok := a[k]; !ok {\n\t\t\ta[k] = v\n\t\t}\n\t}\n\treturn a\n}", "func merge(original interface{}, update interface{}) (merged interface{}, err error) {\n\n\tlogger.Info(\"Merging\", \"original\", original, \"update\", update)\n\n\tswitch O := original.(type) {\n\n\tcase map[string]interface{}:\n\t\tU, ok := update.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"update is not mS like original\")\n\t\t}\n\t\tlogger.Info(\"mS entering\")\n\t\tfor key, val := range U {\n\t\t\tlogger.Debug(\"in merge mS-U\", \"key\", key, \"val\", val, \"curr\", O[key])\n\t\t\tif curr, exists := O[key]; exists {\n\t\t\t\ttmp, err := merge(curr, val)\n\t\t\t\tlogger.Debug(\"after merge mS\", \"tmp\", tmp, \"err\", err)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"in merge mS\")\n\t\t\t\t}\n\t\t\t\tO[key] = tmp\n\t\t\t} else {\n\t\t\t\tO[key] = val\n\t\t\t}\n\t\t}\n\t\tlogger.Info(\"mS returning\", \"O\", O)\n\t\treturn O, nil\n\n\tcase []interface{}:\n\t\tU, ok := update.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"update is not aI like original\")\n\t\t}\n\t\t// logger.Warn(\"O\", \"data\", O)\n\t\t// logger.Warn(\"U\", \"data\", U)\n\n\t\tlogger.Info(\"aI entering\")\n\t\t// turn update into map\n\t\tUM := map[string]interface{}{}\n\t\tfor i, elem := range U {\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\t\t\t\tUM[name.(string)] = E\n\n\t\t\tcase string:\n\t\t\t\tUM[E] = E\n\n\t\t\tdefault:\n\t\t\t\tlogger.Error(\"original unknown elem type in aI\", \"i\", i, \"elem\", elem)\n\t\t\t\treturn nil, errors.New(\"original unknown elem type in aI\")\n\t\t\t}\n\t\t}\n\n\t\tfor i, elem := range O {\n\t\t\t// logger.Crit(\"O-loop\", \"i\", i, \"elem\", elem)\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tiname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\n\t\t\t\tname := iname.(string)\n\t\t\t\t// logger.Error(\"Name\", \"name\", name)\n\n\t\t\t\tcurr, exists := UM[name]\n\t\t\t\tif exists {\n\t\t\t\t\ttmp, err := merge(elem, curr)\n\t\t\t\t\t// this is correct, the var names curr and elem are backwards...\n\t\t\t\t\t// busy fixing a bug\n\t\t\t\t\t// logger.Crit(\"merging with existing element\", \"key\", name, \"val\", curr, \"curr\", elem)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, errors.Wrap(err, \"in merge MS\")\n\t\t\t\t\t}\n\t\t\t\t\tO[i] = tmp\n\t\t\t\t\tdelete(UM, name)\n\t\t\t\t}\n\t\t\tcase string:\n\t\t\t\t_, exists := UM[E]\n\t\t\t\tif exists {\n\t\t\t\t\tdelete(UM, E)\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tlogger.Error(\"original unknown elem type in aI\", \"i\", i, \"elem\", elem)\n\t\t\t\treturn nil, errors.New(\"original unknown elem type in aI\")\n\t\t\t}\n\t\t}\n\t\t// merge\n\t\tlogger.Info(\"aI\")\n\n\t\t// turn back into array\n\t\tOA := []interface{}{}\n\t\tfor _, val := range O {\n\t\t\tOA = append(OA, val)\n\t\t}\n\t\tfor _, elem := range U {\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\t\t\t\t_, exists := UM[name.(string)]\n\t\t\t\tif exists {\n\t\t\t\t\tOA = append(OA, elem)\n\t\t\t\t}\n\n\t\t\tcase string:\n\t\t\t\t_, exists := UM[E]\n\t\t\t\tif exists {\n\t\t\t\t\tOA = append(OA, elem)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// logger.Error(\"OA\", \"data\", OA)\n\n\t\tlogger.Info(\"aI returning\", \"OA\", OA)\n\t\treturn OA, nil\n\n\tcase string:\n\t\treturn update, nil\n\n\tdefault:\n\t\treturn nil, errors.New(\"unmergable original\" + fmt.Sprintf(\"%t, %+v\", original, original))\n\n\t}\n\n\tlogger.Crit(\"Shouldn't get here (end of merge function)\")\n\treturn nil, errors.New(\"PANIC, should not get here\")\n}", "func mergeConditional(newVal, originalVal interface{}, merge bool) (interface{}, error) {\n\tif !merge || util.IsValueNilOrDefault(originalVal) {\n\t\treturn newVal, nil\n\t}\n\tnewS, err := yaml.Marshal(newVal)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif util.IsYAMLEmpty(string(newS)) {\n\t\treturn originalVal, nil\n\t}\n\toriginalS, err := yaml.Marshal(originalVal)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif util.IsYAMLEmpty(string(originalS)) {\n\t\treturn newVal, nil\n\t}\n\n\tmergedS, err := util.OverlayYAML(string(originalS), string(newS))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif util.IsMap(originalVal) {\n\t\t// For JSON compatibility\n\t\tout := make(map[string]interface{})\n\t\tif err := yaml.Unmarshal([]byte(mergedS), &out); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn out, nil\n\t}\n\t// For scalars and slices, copy the type\n\tout := originalVal\n\tif err := yaml.Unmarshal([]byte(mergedS), &out); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "func (m *Merge) Merge(data interface{}, s *Sources) ([]MergedMeta, error) {\n\t// all types of data & sources must be the same\n\tif err := m.checkDataTypes(data, s); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := m.mergeSources(data, s.Sources()); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m.mergedMeta, nil\n}", "func unionMerge(obj reflect.Value, src reflect.Value, name string) reflect.Value {\n\tout := reflect.New(obj.Type()).Elem()\n\n\tmergeField := func(i int) {\n\t\tstructField := obj.Type().Field(i)\n\t\tfieldName := fmt.Sprintf(\"%v.%v\", name, structField.Name)\n\t\tx := merge(obj.Field(i), src.Field(i), fieldName)\n\t\tout.Field(i).Set(x)\n\t}\n\n\t// Iterate through all the fields of the struct once, identifying union members and merging\n\t// the non-union members.\n\tobjHasMember := -1\n\tsrcHasMember := -1\n\tfor i := 0; i < src.NumField(); i++ {\n\t\tif _, ok := obj.Type().Field(i).Tag.Lookup(\"union\"); ok {\n\t\t\t// Union member, remember it for later.\n\t\t\tif !obj.Field(i).IsZero() {\n\t\t\t\tobjHasMember = i\n\t\t\t}\n\t\t\tif !src.Field(i).IsZero() {\n\t\t\t\tsrcHasMember = i\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Non-union member, merge it normally.\n\t\tmergeField(i)\n\t}\n\tif objHasMember > -1 {\n\t\t// When obj has a union member, we can only merge that union member.\n\t\tmergeField(objHasMember)\n\t} else if srcHasMember > -1 {\n\t\t// Otherwise we merge whatever the src has defined.\n\t\tmergeField(srcHasMember)\n\t}\n\treturn out.Convert(obj.Type())\n}", "func (p *ErrorHandlingPolicy) Merge(src ErrorHandlingPolicy) {\n\tif p.IgnoreFileErrors == nil && src.IgnoreFileErrors != nil {\n\t\tp.IgnoreFileErrors = newBool(*src.IgnoreFileErrors)\n\t}\n\n\tif p.IgnoreDirectoryErrors == nil && src.IgnoreDirectoryErrors != nil {\n\t\tp.IgnoreDirectoryErrors = newBool(*src.IgnoreDirectoryErrors)\n\t}\n}", "func (a *API) Merge(other API) {\n\tif a.Short == \"\" {\n\t\ta.Short = other.Short\n\t}\n\n\tif a.Long == \"\" {\n\t\ta.Long = other.Long\n\t}\n\n\ta.Operations = append(a.Operations, other.Operations...)\n}", "func (m Metaitems) Merge(items Metaitems, strategy MetadataStrategy) Metaitems {\nOUTER:\n\tfor _, newItem := range items {\n\t\tfor _, oldItem := range m {\n\t\t\tif oldItem.Source == newItem.Source {\n\t\t\t\tif oldItem.Metadata != nil {\n\t\t\t\t\toldItem.Metadata = oldItem.Metadata.Merge(newItem.Metadata, strategy)\n\t\t\t\t}\n\t\t\t\tcontinue OUTER\n\t\t\t}\n\t\t}\n\n\t\tm = append(m, newItem)\n\t}\n\n\treturn m\n}", "func (obj object) MergeWith(other Object, conflictResolver func(v1, v2 *Term) (*Term, bool)) (Object, bool) {\n\tresult := NewObject()\n\tstop := obj.Until(func(k, v *Term) bool {\n\t\tv2 := other.Get(k)\n\t\t// The key didn't exist in other, keep the original value\n\t\tif v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t\treturn false\n\t\t}\n\n\t\t// The key exists in both, resolve the conflict if possible\n\t\tmerged, stop := conflictResolver(v, v2)\n\t\tif !stop {\n\t\t\tresult.Insert(k, merged)\n\t\t}\n\t\treturn stop\n\t})\n\n\tif stop {\n\t\treturn nil, false\n\t}\n\n\t// Copy in any values from other for keys that don't exist in obj\n\tother.Foreach(func(k, v *Term) {\n\t\tif v2 := obj.Get(k); v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t}\n\t})\n\treturn result, true\n}", "func Merge(dst, src map[string]interface{}) (interface{}, error) {\n\treturn merge(dst, src)\n}", "func (m *Simple) Merge(overrides *Simple) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n\tm.Str = overrides.Str\n\n\tm.Byt = overrides.Byt\n\n\tm.TestUint32 = overrides.TestUint32\n\n\tm.TestUint64 = overrides.TestUint64\n\n\tm.TestBool = overrides.TestBool\n\n\tm.DoubleTest = overrides.DoubleTest\n\n\tm.FloatTest = overrides.FloatTest\n\n\tm.Int32Test = overrides.Int32Test\n\n\tm.Int64Test = overrides.Int64Test\n\n\tm.Sint32Test = overrides.Sint32Test\n\n\tm.Sint64Test = overrides.Sint64Test\n\n\tm.Fixed32Test = overrides.Fixed32Test\n\n\tm.Fixed64Test = overrides.Fixed64Test\n\n\tm.Sfixed32Test = overrides.Sfixed32Test\n\n\tm.Sfixed64Test = overrides.Sfixed64Test\n\n\tm.StrSkipped = overrides.StrSkipped\n\n\tm.IntSkipped = overrides.IntSkipped\n\n\tif overrides.StrOptional != nil {\n\t\tv := overrides.GetStrOptional()\n\t\tm.StrOptional = &v\n\t}\n\n\tif overrides.TestUint32Optional != nil {\n\t\tv := overrides.GetTestUint32Optional()\n\t\tm.TestUint32Optional = &v\n\t}\n\n\tif overrides.TestUint64Optional != nil {\n\t\tv := overrides.GetTestUint64Optional()\n\t\tm.TestUint64Optional = &v\n\t}\n\n\tif overrides.TestBoolOptional != nil {\n\t\tv := overrides.GetTestBoolOptional()\n\t\tm.TestBoolOptional = &v\n\t}\n\n\tif overrides.DoubleTestOptional != nil {\n\t\tv := overrides.GetDoubleTestOptional()\n\t\tm.DoubleTestOptional = &v\n\t}\n\n\tif overrides.FloatTestOptional != nil {\n\t\tv := overrides.GetFloatTestOptional()\n\t\tm.FloatTestOptional = &v\n\t}\n\n\tif overrides.Int32TestOptional != nil {\n\t\tv := overrides.GetInt32TestOptional()\n\t\tm.Int32TestOptional = &v\n\t}\n\n\tif overrides.Int64TestOptional != nil {\n\t\tv := overrides.GetInt64TestOptional()\n\t\tm.Int64TestOptional = &v\n\t}\n\n\tif overrides.Sint32TestOptional != nil {\n\t\tv := overrides.GetSint32TestOptional()\n\t\tm.Sint32TestOptional = &v\n\t}\n\n\tif overrides.Sint64TestOptional != nil {\n\t\tv := overrides.GetSint64TestOptional()\n\t\tm.Sint64TestOptional = &v\n\t}\n\n\tif overrides.Fixed32TestOptional != nil {\n\t\tv := overrides.GetFixed32TestOptional()\n\t\tm.Fixed32TestOptional = &v\n\t}\n\n\tif overrides.Fixed64TestOptional != nil {\n\t\tv := overrides.GetFixed64TestOptional()\n\t\tm.Fixed64TestOptional = &v\n\t}\n\n\tif overrides.Sfixed32TestOptional != nil {\n\t\tv := overrides.GetSfixed32TestOptional()\n\t\tm.Sfixed32TestOptional = &v\n\t}\n\n\tif overrides.Sfixed64TestOptional != nil {\n\t\tv := overrides.GetSfixed64TestOptional()\n\t\tm.Sfixed64TestOptional = &v\n\t}\n\n\tif overrides.StrSkippedOptional != nil {\n\t\tv := overrides.GetStrSkippedOptional()\n\t\tm.StrSkippedOptional = &v\n\t}\n\n\tif overrides.IntSkippedOptional != nil {\n\t\tv := overrides.GetIntSkippedOptional()\n\t\tm.IntSkippedOptional = &v\n\t}\n\n}", "func merge(dest *config, src config) {\n\tmergo.Merge(dest, src, mergo.WithOverride)\n}", "func (p *YamlPlugin) MergeWith(instance string, extended *YamlPluginTasksObjects) (merged *YamlPlugin) {\n\tmerged = new(YamlPlugin)\n\t*merged = *p\n\tp.instancesDetails[instance] = extended\n\tmerged.instancesDetails = nil\n\n\t// Add extended task flags for inexistent in source.\n\tfor taskType, taskList := range extended.Tasks {\n\t\tif srcList, found := p.Tasks[taskType]; found {\n\t\t\tfor taskName, task := range taskList {\n\t\t\t\tif _, foundTask := srcList[taskName]; !foundTask {\n\t\t\t\t\tif srcList == nil {\n\t\t\t\t\t\tsrcList = make(map[string]YamlFlag)\n\t\t\t\t\t}\n\t\t\t\t\ttask.extentSource = true\n\t\t\t\t\tsrcList[taskName] = task\n\t\t\t\t\tmerged.Tasks[taskType] = srcList\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Add extended object flags for inexistent in source.\n\tfor objectType, object := range extended.Objects {\n\t\tif srcObject, found := p.Objects[objectType]; found {\n\t\t\tfor flagName, flag := range object.Flags {\n\t\t\t\tif _, foundFlag := srcObject.Flags[flagName]; !foundFlag {\n\t\t\t\t\tif srcObject.Flags == nil {\n\t\t\t\t\t\tsrcObject.Flags = make(map[string]YamlFlag)\n\t\t\t\t\t}\n\t\t\t\t\tflag.extentSource = true\n\t\t\t\t\tsrcObject.Flags[flagName] = flag\n\t\t\t\t\tmerged.Objects[objectType] = srcObject\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Add extended object group of flags for inexistent in source.\n\t\t\tfor groupName, group := range object.Groups {\n\t\t\t\tif srcGroup, foundGroup := srcObject.Groups[groupName]; !foundGroup {\n\t\t\t\t\tif srcObject.Groups == nil {\n\t\t\t\t\t\tsrcObject.Groups = make(map[string]YamlObjectGroup)\n\t\t\t\t\t}\n\t\t\t\t\tfor flag_name, flag := range group.Flags {\n\t\t\t\t\t\tflag.extentSource = true\n\t\t\t\t\t\tgroup.Flags[flag_name] = flag\n\t\t\t\t\t}\n\t\t\t\t\tsrcObject.Groups[groupName] = group\n\t\t\t\t\tmerged.Objects[objectType] = srcObject\n\t\t\t\t} else {\n\t\t\t\t\tfor flagName, flag := range group.Flags {\n\t\t\t\t\t\tif _, foundFlag := srcGroup.Flags[flagName]; !foundFlag {\n\t\t\t\t\t\t\tif srcObject.Flags == nil {\n\t\t\t\t\t\t\t\tsrcObject.Flags = make(map[string]YamlFlag)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tflag.extentSource = true\n\t\t\t\t\t\t\tsrcGroup.Flags[flagName] = flag\n\t\t\t\t\t\t\tsrcObject.Groups[groupName] = srcGroup\n\t\t\t\t\t\t\tmerged.Objects[objectType] = srcObject\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn\n}", "func (i *interactor) MergeWithStrategy(commitlike, mergeStrategy string, opts ...MergeOpt) (bool, error) {\n\ti.logger.Infof(\"Merging %q using the %q strategy\", commitlike, mergeStrategy)\n\tswitch mergeStrategy {\n\tcase \"merge\":\n\t\treturn i.mergeMerge(commitlike, opts...)\n\tcase \"squash\":\n\t\treturn i.squashMerge(commitlike)\n\tcase \"rebase\":\n\t\treturn i.mergeRebase(commitlike)\n\tcase \"ifNecessary\":\n\t\treturn i.mergeIfNecessary(commitlike, opts...)\n\tdefault:\n\t\treturn false, fmt.Errorf(\"merge strategy %q is not supported\", mergeStrategy)\n\t}\n}", "func (s *MapSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func unmergeable(a, b types.Value) bool {\n\tif a != nil && b != nil {\n\t\taKind, bKind := a.Type().Kind(), b.Type().Kind()\n\t\treturn aKind != bKind || types.IsPrimitiveKind(aKind) || types.IsPrimitiveKind(bKind)\n\t}\n\treturn true\n}", "func (j *JobScaling) Merge(b *JobScaling) *JobScaling {\n\tconfig := *j\n\n\tif b.Enabled {\n\t\tconfig.Enabled = b.Enabled\n\t}\n\n\tif b.ConsulToken != \"\" {\n\t\tconfig.ConsulToken = b.ConsulToken\n\t}\n\n\tif b.ConsulKeyLocation != \"\" {\n\t\tconfig.ConsulKeyLocation = b.ConsulKeyLocation\n\t}\n\n\treturn &config\n}", "func (s *Storage) Merge(ctx context.Context,\n\tconv types.UnboxConversationInfo, uid gregor1.UID, msgs []chat1.MessageUnboxed) (res MergeResult, err Error) {\n\tvar ierr error\n\tdefer s.Trace(ctx, &ierr, \"Merge\")()\n\tdefer func() { ierr = s.castInternalError(err) }()\n\treturn s.MergeHelper(ctx, conv, uid, msgs, nil)\n}", "func (c *Aggregator) Merge(oa export.Aggregator, desc *metric.Descriptor) error {\n\to, _ := oa.(*Aggregator)\n\tif o == nil {\n\t\treturn aggregator.NewInconsistentAggregatorError(c, oa)\n\t}\n\tc.value.AddNumber(desc.NumberKind(), o.value)\n\treturn nil\n}", "func (jobImpl *JobImpl) DeltaMerge(\n\tdeltaMerge base.DeltaMerge,\n\tattribute string,\n\tdelta interface{},\n) (bool, error) {\n\tmerged, err := jobImpl.GameObjectImpl.DeltaMerge(\n\t\tdeltaMerge,\n\t\tattribute,\n\t\tdelta,\n\t)\n\tif merged || err != nil {\n\t\treturn merged, err\n\t}\n\n\tstardashDeltaMerge, ok := deltaMerge.(DeltaMerge)\n\tif !ok {\n\t\treturn false, errors.New(\n\t\t\t\"deltaMerge is not the expected type of: \" +\n\t\t\t\t\"'stardash.impl.DeltaMerge'\",\n\t\t)\n\t}\n\n\tswitch attribute {\n\tcase \"carryLimit\":\n\t\tjobImpl.carryLimitImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"damage\":\n\t\tjobImpl.damageImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"energy\":\n\t\tjobImpl.energyImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"moves\":\n\t\tjobImpl.movesImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"range\":\n\t\tjobImpl.rangeImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"shield\":\n\t\tjobImpl.shieldImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"title\":\n\t\tjobImpl.titleImpl = stardashDeltaMerge.String(delta)\n\t\treturn true, nil\n\tcase \"unitCost\":\n\t\tjobImpl.unitCostImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\t}\n\n\treturn false, nil // no errors in delta merging\n}", "func (f *First) Merge(ctx *sql.Context, buffer, partial sql.Row) error {\n\treturn nil\n}", "func GenMergePatch(originalObj interface{}, modifiedObj interface{}) ([]byte, error) {\n\toriginalBytes, err := json.Marshal(originalObj)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal original object: %w\", err)\n\t}\n\tmodifiedBytes, err := json.Marshal(modifiedObj)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal modified object: %w\", err)\n\t}\n\tpatchBytes, err := jsonpatch.CreateMergePatch(originalBytes, modifiedBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create a merge patch: %w\", err)\n\t}\n\n\t// It's unnecessary to patch.\n\tif string(patchBytes) == \"{}\" {\n\t\treturn nil, nil\n\t}\n\n\treturn patchBytes, nil\n}", "func (oldStruct *object) merge(newStruct object) {\n\tif newStruct.ID != 0 {\n\t\toldStruct.ID = newStruct.ID\n\t}\n\n\tif newStruct.Name != \"\" {\n\t\toldStruct.Name = newStruct.Name\n\t}\n\n\tif newStruct.Value != \"\" {\n\t\toldStruct.Value = newStruct.Value\n\t}\n}", "func (c *Component) Merge(other *Component) *Component {\n\tr := &Component{\n\t\tPath: other.Path,\n\t\tName: mergeStr(c.Name, other.Name),\n\t\tApp: mergeStr(c.App, other.App),\n\t\tKind: mergeStr(c.Kind, other.Kind),\n\t\tIgnore: mergeBool(c.Ignore, other.Ignore),\n\t\tDocker: mergeDocker(c.Docker, other.Docker),\n\t\tECS: mergeECS(c.ECS, other.ECS),\n\t\tToolchain: mergeToolchain(c.Toolchain, other.Toolchain),\n\t\tRules: mergeRules(c.Rules, other.Rules),\n\t\tExports: mergeExports(c.Exports, other.Exports),\n\t\tEnvironment: mergeStringsMap(c.Environment, other.Environment),\n\t}\n\treturn r\n}", "func (r Rule) Merge(o Rule) Rule {\n\tcopy := r\n\tcopy.Launch = map[ExecName]*types.Any{}\n\tfor k, v := range r.Launch {\n\t\tvar c types.Any\n\t\tif v != nil {\n\t\t\tc = *v\n\t\t}\n\t\tcopy.Launch[k] = &c\n\t}\n\n\tif r.Key != o.Key {\n\t\treturn copy\n\t}\n\tfor k, v := range o.Launch {\n\t\tvar c types.Any\n\t\tif v != nil {\n\t\t\tc = *v\n\t\t}\n\t\tcopy.Launch[k] = &c\n\t}\n\treturn copy\n}", "func (p *parser) merge() {\n\tif p.cur+1 >= len(p.src) {\n\t\treturn\n\t}\n\tp.src = append(p.src[:p.cur], p.src[p.cur+1:]...)\n}", "func (l *UDPServersLoadBalancer) Mergeable(loadBalancer *UDPServersLoadBalancer) bool {\n\tsavedServers := l.Servers\n\tdefer func() {\n\t\tl.Servers = savedServers\n\t}()\n\tl.Servers = nil\n\n\tsavedServersLB := loadBalancer.Servers\n\tdefer func() {\n\t\tloadBalancer.Servers = savedServersLB\n\t}()\n\tloadBalancer.Servers = nil\n\n\treturn reflect.DeepEqual(l, loadBalancer)\n}", "func AddOrMerge(mtes []MetricFilter, mf2 MetricFilter) []MetricFilter {\n\tfor i, mf1 := range mtes {\n\t\tif mf1.ShouldMerge(mf2) {\n\t\t\tmtes[i] = mf1.MergeWith(mf2)\n\t\t\treturn mtes\n\t\t}\n\t}\n\treturn append(mtes, mf2)\n}", "func (m Meta) Merge(other Change) (otherx, cx Change) {\n\tif m.Change != nil {\n\t\tother, m.Change = m.Change.Merge(other)\n\t}\n\treturn other, m\n}", "func merge(dst interface{}, src interface{}) (interface{}, error) {\n\tswitch dstType := dst.(type) {\n\tcase []interface{}:\n\t\tsrcSlice, ok := src.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%w: []interface{} with %T\", errCannotMerge, src)\n\t\t}\n\n\t\treturn append(dstType, srcSlice...), nil\n\tcase map[string]interface{}:\n\t\tsrcMap, ok := src.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%w: map[string]interface{} with %T\", errCannotMerge, src)\n\t\t}\n\n\t\tfor key, value := range srcMap {\n\t\t\tdstType[key] = value\n\t\t}\n\n\t\treturn dstType, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%w: unsupported type %T\", errCannotMerge, dst)\n\t}\n}", "func (dst *Worker) Merge(src Worker) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Command != \"\" {\n\t\tdst.Command = src.Command\n\t}\n\tif len(src.Commands) > 0 {\n\t\tdst.Commands = strings.Unique(append(dst.Commands, src.Commands...))\n\t}\n\tif src.Replicas != 0 {\n\t\tdst.Replicas = src.Replicas\n\t}\n\tif src.LivenessProbe != \"\" {\n\t\tdst.LivenessProbe = src.LivenessProbe\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Resources != nil && dst.Resources == nil {\n\t\tdst.Resources = new(Resources)\n\t}\n\tdst.Resources.Merge(src.Resources)\n}", "func MergeRawExtension(base *runtime.RawExtension, patch *runtime.RawExtension) (*runtime.RawExtension, error) {\n\tpatchParameter, err := util.RawExtension2Map(patch)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to convert patch parameters to map\")\n\t}\n\tbaseParameter, err := util.RawExtension2Map(base)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to convert base parameters to map\")\n\t}\n\tif baseParameter == nil {\n\t\tbaseParameter = make(map[string]interface{})\n\t}\n\terr = mergo.Merge(&baseParameter, patchParameter, mergo.WithOverride)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to do merge with override\")\n\t}\n\tbs, err := json.Marshal(baseParameter)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to marshal merged properties\")\n\t}\n\treturn &runtime.RawExtension{Raw: bs}, nil\n}", "func Merge(mimeType string, r1, r2 interface{}) (interface{}, error) {\n\tm, ok := SupportedMergers[mimeType]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"no report merger bound with mime type %s\", mimeType)\n\t}\n\n\treturn m(r1, r2)\n}", "func (p *StringBuilder) Merge(builder *StringBuilder) {\n\tif builder == nil {\n\t\treturn\n\t}\n\tp.buffer = append(p.buffer, builder.buffer...)\n}", "func(t *TargImp) Merge(other Target) (Target, os.Error) {\n\tx := other.(*TargImp)\n\tif x.Name() != t.Name() {\n\t\treturn nil, os.NewError(\"cannot merge targets with different names\")\n\t}\n\t\n\tfor y := 0; y < x.dependlen; y++ {\n\t\tif !t.isDependent(x.dependencies[y]) {\n\t\t\tt.dependencies[t.dependlen] = x.dependencies[y]\n\t\t\tt.dependlen++\n\t\t}\n\t}\n\t\n\treturn t, nil\n}", "func (t TagSet) Merge(more TagSet) TagSet {\n\tmerged := t[:]\n\treturn append(merged, more...)\n}", "func (d UserData) MergeWith(other m.UserData) {\n\td.ModelData.MergeWith(other.Underlying())\n}", "func (mb *MutableBag) Merge(bag *MutableBag) {\n\tfor k, v := range bag.values {\n\t\t// the input bags cannot override values already in the destination bag\n\t\tif !mb.Contains(k) {\n\t\t\tmb.values[k] = copyValue(v)\n\t\t}\n\t}\n}", "func (p *UploadPolicy) Merge(src UploadPolicy, def *UploadPolicyDefinition, si snapshot.SourceInfo) {\n\tmergeOptionalInt(&p.MaxParallelSnapshots, src.MaxParallelSnapshots, &def.MaxParallelSnapshots, si)\n\tmergeOptionalInt(&p.MaxParallelFileReads, src.MaxParallelFileReads, &def.MaxParallelFileReads, si)\n\tmergeOptionalInt64(&p.ParallelUploadAboveSize, src.ParallelUploadAboveSize, &def.ParallelUploadAboveSize, si)\n}", "func (dst *PostgreSQL) Merge(src *PostgreSQL) {\n\tif dst == nil || src == nil {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Version != \"\" {\n\t\tdst.Version = src.Version\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Fixtures != nil {\n\t\tdst.Fixtures = src.Fixtures\n\t}\n\tif src.OwnName != nil {\n\t\tdst.OwnName = src.OwnName\n\t}\n\n\tif src.DataBus != nil && dst.DataBus == nil {\n\t\tdst.DataBus = new(DataBus)\n\t}\n\tdst.DataBus.Merge(src.DataBus)\n}", "func (def *Definition) Merge(w window.Span, v interface{}, prev window.State) error {\n\tf := merger.Cons()\n\tif def.g.merger != nil {\n\t\tf = merger.Fold(def.g.merger)\n\t}\n\treturn def.g.window.Merge(w, v, prev, f)\n}", "func (methods MethodMap) Merge(source MethodMap) MethodMap {\n\tfor signature, fn := range source {\n\t\tif fn != nil {\n\t\t\tmethods[signature] = fn\n\t\t}\n\t}\n\treturn methods\n}", "func (mb *MutableBag) Merge(bags ...*MutableBag) error {\n\t// first step is to make sure there are no redundant definitions of the same attribute\n\tkeys := make(map[string]bool)\n\tfor _, bag := range bags {\n\t\tif bag == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor k := range bag.values {\n\t\t\tif keys[k] {\n\t\t\t\treturn fmt.Errorf(\"conflicting value for attribute %s\", k)\n\t\t\t}\n\t\t\tkeys[k] = true\n\t\t}\n\t}\n\n\t// now that we know there are no conflicting definitions, do the actual merging...\n\tfor _, bag := range bags {\n\t\tif bag == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor k, v := range bag.values {\n\t\t\tmb.values[k] = copyValue(v)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (b *Buffer) Merge(bs ...Buffer) {\n\tfor _, buf := range bs {\n\t\tfor p, v := range buf.CellMap {\n\t\t\tb.Set(p.X, p.Y, v)\n\t\t}\n\t\tb.SetArea(b.Area.Union(buf.Area))\n\t}\n}", "func (o LookupBranchResultOutput) Merged() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupBranchResult) bool { return v.Merged }).(pulumi.BoolOutput)\n}", "func mergePlugins(defaultPlugins, customPlugins *v1beta3.Plugins) *v1beta3.Plugins {\n\tif customPlugins == nil {\n\t\treturn defaultPlugins\n\t}\n\n\tdefaultPlugins.MultiPoint = mergePluginSet(defaultPlugins.MultiPoint, customPlugins.MultiPoint)\n\tdefaultPlugins.QueueSort = mergePluginSet(defaultPlugins.QueueSort, customPlugins.QueueSort)\n\tdefaultPlugins.PreFilter = mergePluginSet(defaultPlugins.PreFilter, customPlugins.PreFilter)\n\tdefaultPlugins.Filter = mergePluginSet(defaultPlugins.Filter, customPlugins.Filter)\n\tdefaultPlugins.PostFilter = mergePluginSet(defaultPlugins.PostFilter, customPlugins.PostFilter)\n\tdefaultPlugins.PreScore = mergePluginSet(defaultPlugins.PreScore, customPlugins.PreScore)\n\tdefaultPlugins.Score = mergePluginSet(defaultPlugins.Score, customPlugins.Score)\n\tdefaultPlugins.Reserve = mergePluginSet(defaultPlugins.Reserve, customPlugins.Reserve)\n\tdefaultPlugins.Permit = mergePluginSet(defaultPlugins.Permit, customPlugins.Permit)\n\tdefaultPlugins.PreBind = mergePluginSet(defaultPlugins.PreBind, customPlugins.PreBind)\n\tdefaultPlugins.Bind = mergePluginSet(defaultPlugins.Bind, customPlugins.Bind)\n\tdefaultPlugins.PostBind = mergePluginSet(defaultPlugins.PostBind, customPlugins.PostBind)\n\treturn defaultPlugins\n}", "func (b Binding) Merge(b2 Binding) Binding {\n\n\tresult := Binding{}\n\n\tfor k, v := range b {\n\t\tresult[k] = v\n\t}\n\n\tfor k, v := range b2 {\n\t\tresult[k] = v\n\t}\n\n\treturn result\n}", "func (bml BitmapLayers) Merge() (BitmapLayer, error) {\n\tout := BitmapLayer{}\n\tif len(bml) != 2 {\n\t\treturn out, fmt.Errorf(\"merge requires exactly two input segments\")\n\t}\n\n\tleft, right := bml[0], bml[1]\n\n\tadditions := left.Additions.Clone()\n\tadditions.Or(right.Additions)\n\tadditions.AndNot(right.Deletions)\n\n\tdeletions := left.Deletions.Clone()\n\tdeletions.AndNot(right.Additions)\n\tdeletions.Or(right.Deletions)\n\n\tout.Additions = Condense(additions)\n\tout.Deletions = Condense(deletions)\n\treturn out, nil\n}", "func Merge(arr []interface{}, comp goutils.TypeComparator, low, mid, high int)(){\n if low == high {\n return\n }\n n1 := mid - low + 1;\n n2 := high - mid;\n L := make([]interface{}, n1)\n R := make([]interface{}, n2)\n // Copy data to temp arrays Left[] and Right[]\n for i := 0; i < n1; i++{\n L[i] = arr[low + i]\n }\n for j := 0; j < n2; j++ {\n R[j] = arr[mid+1+j]\n }\n // Merge the temp arrays back into arr[low..high]\n i := 0 // Initial index of first subarray\n j := 0 // Initial index of second subarray\n k := low // Initial index of merged subarray\n for i < n1 && j < n2 {\n if comp(L[i], R[j]) == -1 || comp(L[i], R[j]) == 0 {\n arr[k] = L[i]\n i+=1\n } else{\n arr[k] = R[j]\n j+=1\n }\n k+=1\n }\n // Copy the remaining elements of L[], if there are any\n for i < n1 {\n arr[k] = L[i];\n i+=1\n k+=1\n }\n // Copy the remaining elements of R[], if there are any\n for j < n2 {\n arr[k] = R[j];\n j+=1\n k+=1\n }\n}", "func (m *NestedEmpty) Merge(overrides *NestedEmpty) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n\tif overrides.Nested != nil {\n\t\tm.Nested = overrides.Nested\n\t}\n\n}", "func withMergeOptions(opts ...func(*mergo.Config)) func(*mergeConfig) {\n\treturn func(config *mergeConfig) {\n\t\tconfig.mergeOptions = opts\n\t}\n}", "func (bm tsidbitmap) Merge(other tsidbitmap) (tsidbitmap, bool) {\n\tfor len(bm) < len(other) {\n\t\tbm = append(bm, 0)\n\t}\n\tdirty := false\n\tfor i, v := range other {\n\t\tdirty = dirty || (bm[i]|v != bm[i])\n\t\tbm[i] |= v\n\t}\n\treturn bm, dirty\n}", "func (unitImpl *UnitImpl) DeltaMerge(\n\tdeltaMerge base.DeltaMerge,\n\tattribute string,\n\tdelta interface{},\n) (bool, error) {\n\tmerged, err := unitImpl.GameObjectImpl.DeltaMerge(\n\t\tdeltaMerge,\n\t\tattribute,\n\t\tdelta,\n\t)\n\tif merged || err != nil {\n\t\treturn merged, err\n\t}\n\n\tstardashDeltaMerge, ok := deltaMerge.(DeltaMerge)\n\tif !ok {\n\t\treturn false, errors.New(\n\t\t\t\"deltaMerge is not the expected type of: \" +\n\t\t\t\t\"'stardash.impl.DeltaMerge'\",\n\t\t)\n\t}\n\n\tswitch attribute {\n\tcase \"acted\":\n\t\tunitImpl.actedImpl = stardashDeltaMerge.Boolean(delta)\n\t\treturn true, nil\n\tcase \"dashX\":\n\t\tunitImpl.dashXImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"dashY\":\n\t\tunitImpl.dashYImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"energy\":\n\t\tunitImpl.energyImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"genarium\":\n\t\tunitImpl.genariumImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"isBusy\":\n\t\tunitImpl.isBusyImpl = stardashDeltaMerge.Boolean(delta)\n\t\treturn true, nil\n\tcase \"job\":\n\t\tunitImpl.jobImpl = stardashDeltaMerge.Job(delta)\n\t\treturn true, nil\n\tcase \"legendarium\":\n\t\tunitImpl.legendariumImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"moves\":\n\t\tunitImpl.movesImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"mythicite\":\n\t\tunitImpl.mythiciteImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"owner\":\n\t\tunitImpl.ownerImpl = stardashDeltaMerge.Player(delta)\n\t\treturn true, nil\n\tcase \"protector\":\n\t\tunitImpl.protectorImpl = stardashDeltaMerge.Unit(delta)\n\t\treturn true, nil\n\tcase \"rarium\":\n\t\tunitImpl.rariumImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"shield\":\n\t\tunitImpl.shieldImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"x\":\n\t\tunitImpl.xImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"y\":\n\t\tunitImpl.yImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\t}\n\n\treturn false, nil // no errors in delta merging\n}", "func (a *AudioMeta) Merge(b *AudioMeta) {\n\tif len(a.Title) == 0 {\n\t\ta.Title = b.Title\n\t}\n\n\tif len(a.Artist) == 0 {\n\t\ta.Artist = b.Artist\n\t}\n\n\tif len(a.Album) == 0 {\n\t\ta.Album = b.Album\n\t}\n\n\tif a.Track != b.Track && a.Track == 0 {\n\t\ta.Track = b.Track\n\t}\n\n\tif a.TotalTracks != b.TotalTracks && a.TotalTracks == 0 {\n\t\ta.TotalTracks = b.TotalTracks\n\t}\n\n\tif a.Year != b.Year && a.Year == 0 {\n\t\ta.Year = b.Year\n\t}\n\n\tif len(a.AlbumArtist) == 0 {\n\t\ta.AlbumArtist = b.AlbumArtist\n\t}\n\n\tif len(a.Genre) == 0 {\n\t\ta.Genre = b.Genre\n\t}\n\n\tif a.Duration != b.Duration && a.Duration == 0 {\n\t\ta.Duration = b.Duration\n\t}\n\n\tif a.CoverBufer == nil {\n\t\ta.CoverBufer = b.CoverBufer\n\t}\n}", "func (c ConversionFuncs) Merge(other ConversionFuncs) ConversionFuncs {\n\tmerged := NewConversionFuncs()\n\tfor k, v := range c.untyped {\n\t\tmerged.untyped[k] = v\n\t}\n\tfor k, v := range other.untyped {\n\t\tmerged.untyped[k] = v\n\t}\n\treturn merged\n}", "func Merge(transformers ...Transformer) Transformer {\n\treturn merged(transformers)\n}", "func (m *Nested) Merge(overrides *Nested) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n\tif overrides.Simple != nil {\n\t\tm.Simple = overrides.Simple\n\t}\n\n\tif overrides.OtherSimple != nil {\n\t\tm.OtherSimple = overrides.OtherSimple\n\t}\n\n\tm.Test = overrides.Test\n\n\tif overrides.Empty != nil {\n\t\tm.Empty = overrides.Empty\n\t}\n\n\tm.Hello = overrides.Hello\n\n\tif overrides.Details != nil {\n\t\tm.Details = overrides.Details\n\t}\n\n\tif overrides.Skipper != nil {\n\t\tm.Skipper = overrides.Skipper\n\t}\n\n\tif overrides.X != nil {\n\t\tm.X = overrides.X\n\t}\n\n\tif overrides.Initial != nil {\n\t\tm.Initial = overrides.Initial\n\t}\n\n\tif overrides.SimpleMap != nil {\n\t\tm.SimpleMap = overrides.SimpleMap\n\t}\n\n\tm.RepeatedPrimitive = overrides.RepeatedPrimitive\n\n\tif overrides.RepeatedExternal != nil {\n\t\tm.RepeatedExternal = overrides.RepeatedExternal\n\t}\n\n\tif overrides.MapExternal != nil {\n\t\tm.MapExternal = overrides.MapExternal\n\t}\n\n\tif overrides.TestOneOf != nil {\n\t\tm.TestOneOf = overrides.TestOneOf\n\t}\n\n}", "func (m Metadata) Merge(other Metadata) Metadata {\n\tresult := m.Copy()\n\tfor k, v := range other {\n\t\tresult[k] = v // other takes precedence\n\t}\n\treturn result\n}", "func Merge(datas interfaces.Sortable) interfaces.Sortable {\n\tmergeSort(datas, 0, datas.Len()-1)\n\treturn datas\n}", "func (r *Record) mergeObjects(other *Record) {\n\tdebug.Assert(r.Name == other.Name, r.Name+\" vs \"+other.Name)\n\tif r.Key == nil && other.Key != nil {\n\t\tr.Key = other.Key\n\t}\n\tr.Objects = append(r.Objects, other.Objects...)\n}", "func (m *Metadata) Merge(src proto.Message) {\n\tmetadata, ok := src.(*Metadata)\n\tif !ok {\n\t\treturn\n\t}\n\t*m = *metadata\n\t// Manually clone expiry timestamp as proto.Clone\n\t// cannot cope with values that contain unexported\n\t// attributes (as time.Time does)\n\tif metadata.Expires != nil {\n\t\texpires := *metadata.Expires\n\t\tm.Expires = &expires\n\t}\n\tif len(metadata.Labels) != 0 {\n\t\tm.Labels = make(map[string]string)\n\t\tfor k, v := range metadata.Labels {\n\t\t\tm.Labels[k] = v\n\t\t}\n\t}\n}", "func (_m *mockGeneratedMerger) XXX_Merge(src Message) {\n\t_m.Called(src)\n}", "func (s *YAMLFileSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (c *Catalog) Merge(other *Catalog) {\n\tif other == nil {\n\t\treturn\n\t}\n\tif other.Paths != nil {\n\t\tc.Paths = append(c.Paths, other.Paths...)\n\t}\n\tif other.Stats != nil {\n\t\tstats, _ := c.GetStats()\n\t\tstats.Merge(other.Stats)\n\t}\n\tif other.Cameras != nil {\n\t\tc.Cameras = c.Cameras.Merge(other.Cameras)\n\t}\n\tif other.Lenses != nil {\n\t\tc.Lenses = c.Lenses.Merge(other.Lenses)\n\t}\n\tif other.Photos != nil {\n\t\tc.Photos = append(c.Photos, other.Photos...)\n\t}\n\tif other.Collections != nil {\n\t\tc.Collections = append(c.Collections, other.Collections...)\n\t}\n\tif other.CollectionTree != nil && c.CollectionTree == nil {\n\t\tc.CollectionTree = other.CollectionTree\n\t}\n}", "func (s *EnvironmentSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (c *Aggregator) Merge(oa export.Aggregator, desc *metric.Descriptor) error {\n\to, _ := oa.(*Aggregator)\n\tif o == nil {\n\t\treturn aggregator.NewInconsistentAggregatorError(c, oa)\n\t}\n\n\tc.state.sum.AddNumber(desc.NumberKind(), o.state.sum)\n\tc.state.count += o.state.count\n\n\tfor i := 0; i < len(c.state.bucketCounts); i++ {\n\t\tc.state.bucketCounts[i] += o.state.bucketCounts[i]\n\t}\n\treturn nil\n}", "func (cl *ConfigLocks) Merge(c2 *ConfigLocks) {\n\tcl.Bits |= c2.Bits\n\tfor t := range c2.Tags {\n\t\tcl.Tags[t] = struct{}{}\n\t}\n}", "func (mr *MockBuilderMockRecorder) Merge(other interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Merge\", reflect.TypeOf((*MockBuilder)(nil).Merge), other)\n}", "func (s *SQLOperations) Merge(ops SQLOperations) {\n\tfor _, slice := range ops {\n\t\tif len(slice.Statement) > 0 {\n\t\t\ts.Add(slice)\n\t\t}\n\t}\n}", "func (self *Map) Merge(other interface{}) int {\n\tself.lock()\n\tdefer self.unlock()\n\n\tvar count int\n\n\tfor k, v := range M(other).MapNative() {\n\t\tself.set(k, v)\n\t\tcount += 1\n\t}\n\n\treturn count\n}", "func (c *Cell) Merge(hcells, vcells int) {\n\tc.HMerge = hcells\n\tc.VMerge = vcells\n}", "func (b *Bag) Merge(from *Bag) {\n\tb.Add(from.Items()...)\n}", "func (o *FontOptions) Merge(other *FontOptions) {\n\tC.cairo_font_options_merge(o.native, other.native)\n}" ]
[ "0.63448185", "0.6267773", "0.6140983", "0.613874", "0.60395026", "0.5968534", "0.59616023", "0.5842724", "0.5833583", "0.5756367", "0.5755883", "0.57342535", "0.57138795", "0.5703477", "0.56583714", "0.56253576", "0.5622741", "0.5607596", "0.5589633", "0.5552276", "0.5525904", "0.55015165", "0.5485872", "0.5471877", "0.5465349", "0.5459197", "0.5447447", "0.54367363", "0.5416885", "0.5415304", "0.53980315", "0.5396654", "0.53752625", "0.5368831", "0.5363086", "0.5356847", "0.53161913", "0.52977973", "0.5295035", "0.5290097", "0.5287564", "0.52864975", "0.5275961", "0.52527714", "0.5247972", "0.5246349", "0.5240241", "0.52335024", "0.52331966", "0.52232784", "0.5220687", "0.5209142", "0.5197048", "0.5195641", "0.51911545", "0.5186691", "0.5173696", "0.516888", "0.5168496", "0.5155291", "0.5143967", "0.51425195", "0.5118247", "0.5118008", "0.5114639", "0.51119554", "0.51118326", "0.5109999", "0.5108616", "0.5105122", "0.5100252", "0.5091211", "0.50769114", "0.50729114", "0.5065094", "0.5058772", "0.50524235", "0.5044985", "0.5040958", "0.50356454", "0.5017998", "0.5017185", "0.501443", "0.5013045", "0.5005246", "0.50017834", "0.49952492", "0.49941298", "0.49939787", "0.49873754", "0.49660555", "0.49637353", "0.49571088", "0.4955337", "0.495196", "0.49499574", "0.49456018", "0.49265465", "0.49223912", "0.49180984" ]
0.849694
0
Merge will recurse through two objects of the same type and return a merged version (a clean copy). The default behavior for merging maps is to include keys from both src and obj, while the default behavior for slices is to use one or the other. This is analgous to how json.Unmarshal treats maps and slices. However, the default merging behavior for an object can be overwritten by implementing the Mergable interface. An example of this is BindMountsConfig. Example usage: config, err := expconf.ParseAnyExperimentConfigYAML(bytes) var cluster_default_storage expconf.CheckpointStorage = ... // Use the cluster checkpoint storage if the user did not specify one. config.RawCheckpointStorage = schemas.Merge( config.RawCheckpointStorage, &cluster_default_storage )
func Merge[T any](obj T, src T) T { name := fmt.Sprintf("%T", obj) vObj := reflect.ValueOf(obj) vSrc := reflect.ValueOf(src) // obj must have the same type as src. assertTypeMatch(vObj, vSrc) return merge(vObj, vSrc, name).Interface().(T) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Merge(base, overrides interface{}) error {\n\tbaseBytes, err := json.Marshal(base)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\toverrideBytes, err := json.Marshal(overrides)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\tpatchMeta, err := strategicpatch.NewPatchMetaFromStruct(base)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to produce patch meta from struct\")\n\t}\n\tpatch, err := strategicpatch.CreateThreeWayMergePatch(overrideBytes, overrideBytes, baseBytes, patchMeta, true)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to create three way merge patch\")\n\t}\n\n\tmerged, err := strategicpatch.StrategicMergePatchUsingLookupPatchMeta(baseBytes, patch, patchMeta)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to apply patch\")\n\t}\n\n\tvalueOfBase := reflect.Indirect(reflect.ValueOf(base))\n\tinto := reflect.New(valueOfBase.Type())\n\tif err := json.Unmarshal(merged, into.Interface()); err != nil {\n\t\treturn err\n\t}\n\tif !valueOfBase.CanSet() {\n\t\treturn errors.New(\"unable to set unmarshalled value into base object\")\n\t}\n\tvalueOfBase.Set(reflect.Indirect(into))\n\treturn nil\n}", "func (c *DogStatsDConfig) Merge(o *DogStatsDConfig) *DogStatsDConfig {\n\tif c == nil {\n\t\tif o == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn o.Copy()\n\t}\n\n\tif o == nil {\n\t\treturn c.Copy()\n\t}\n\n\tr := c.Copy()\n\n\tif o.Address != nil {\n\t\tr.Address = StringCopy(o.Address)\n\t}\n\n\tif o.Period != nil {\n\t\tr.Period = TimeDurationCopy(o.Period)\n\t}\n\n\treturn r\n}", "func (conf *RegistryConfig) Merge(other *RegistryConfig) {\n\tif other == nil {\n\t\treturn\n\t}\n\n\tif other.ID != \"\" {\n\t\tconf.ID = other.ID\n\t}\n\n\tif other.Addr != \"\" {\n\t\tconf.Addr = other.Addr\n\t}\n\n\tif other.Provider != \"\" {\n\t\tconf.Provider = other.Provider\n\t}\n\n\tconf.Repo.Merge(other.Repo)\n\n\tif other.Config != nil {\n\t\tif conf.Config == nil {\n\t\t\tconf.Config = make(map[string]interface{})\n\t\t}\n\t\tfor k, v := range other.Config {\n\t\t\tconf.Config[k] = v\n\t\t}\n\t}\n}", "func (c *TelemetryConfig) Merge(o *TelemetryConfig) *TelemetryConfig {\n\tif c == nil {\n\t\tif o == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn o.Copy()\n\t}\n\n\tif o == nil {\n\t\treturn c.Copy()\n\t}\n\n\tr := c.Copy()\n\n\tif o.MetricsPrefix != nil {\n\t\tr.MetricsPrefix = StringCopy(o.MetricsPrefix)\n\t}\n\n\tif o.Stdout != nil {\n\t\tr.Stdout = o.Stdout.Copy()\n\t}\n\n\tif o.DogStatsD != nil {\n\t\tr.DogStatsD = o.DogStatsD.Copy()\n\t}\n\n\tif o.Prometheus != nil {\n\t\tr.Prometheus = o.Prometheus.Copy()\n\t}\n\n\treturn r\n}", "func (cfg Config) Merge(override Config) Config {\n\tmerged := Config{\n\t\tID: cfg.ID,\n\t\tName: cfg.Name,\n\t\tDiscoveryImpl: cfg.DiscoveryImpl,\n\t\tDiscoveryFlagsByImpl: map[string]map[string]string{},\n\t\tTabletFQDNTmplStr: cfg.TabletFQDNTmplStr,\n\t\tVtSQLFlags: map[string]string{},\n\t\tVtctldFlags: map[string]string{},\n\t\tBackupReadPoolConfig: cfg.BackupReadPoolConfig.merge(override.BackupReadPoolConfig),\n\t\tSchemaReadPoolConfig: cfg.SchemaReadPoolConfig.merge(override.SchemaReadPoolConfig),\n\t\tTopoReadPoolConfig: cfg.TopoReadPoolConfig.merge(override.TopoReadPoolConfig),\n\t\tTopoRWPoolConfig: cfg.TopoRWPoolConfig.merge(override.TopoRWPoolConfig),\n\t\tWorkflowReadPoolConfig: cfg.WorkflowReadPoolConfig.merge(override.WorkflowReadPoolConfig),\n\t\tEmergencyFailoverPoolConfig: cfg.EmergencyFailoverPoolConfig.merge(override.EmergencyFailoverPoolConfig),\n\t\tFailoverPoolConfig: cfg.FailoverPoolConfig.merge(override.FailoverPoolConfig),\n\t\tSchemaCacheConfig: mergeCacheConfigs(cfg.SchemaCacheConfig, override.SchemaCacheConfig),\n\t}\n\n\tif override.ID != \"\" {\n\t\tmerged.ID = override.ID\n\t}\n\n\tif override.Name != \"\" {\n\t\tmerged.Name = override.Name\n\t}\n\n\tif override.DiscoveryImpl != \"\" {\n\t\tmerged.DiscoveryImpl = override.DiscoveryImpl\n\t}\n\n\tif override.TabletFQDNTmplStr != \"\" {\n\t\tmerged.TabletFQDNTmplStr = override.TabletFQDNTmplStr\n\t}\n\n\t// first, the default flags\n\tmerged.DiscoveryFlagsByImpl.Merge(cfg.DiscoveryFlagsByImpl)\n\t// then, apply any overrides\n\tmerged.DiscoveryFlagsByImpl.Merge(override.DiscoveryFlagsByImpl)\n\n\tmergeStringMap(merged.VtSQLFlags, cfg.VtSQLFlags)\n\tmergeStringMap(merged.VtSQLFlags, override.VtSQLFlags)\n\n\tmergeStringMap(merged.VtctldFlags, cfg.VtctldFlags)\n\tmergeStringMap(merged.VtctldFlags, override.VtctldFlags)\n\n\treturn merged\n}", "func Merge(dest interface{}, source interface{}) error {\n\topts := make([]func(*mergo.Config), 0)\n\n\t// lists are always overridden - we don't append merged lists since it generally makes things more complicated\n\topts = append(opts, mergo.WithOverride)\n\n\terr := mergo.Merge(dest, source, opts...)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "func (c *Config) Merge(b *Config) *Config {\n\tresult := *c\n\n\tif b.LogLevel != \"\" {\n\t\tresult.LogLevel = b.LogLevel\n\t}\n\tif b.BindAddr != \"\" {\n\t\tresult.BindAddr = b.BindAddr\n\t}\n\tif b.EnableDebug {\n\t\tresult.EnableDebug = true\n\t}\n\t\n\t// Apply the server config\n\tif result.Server == nil && b.Server != nil {\n\t\tserver := *b.Server\n\t\tresult.Server = &server\n\t} else if b.Server != nil {\n\t\tresult.Server = result.Server.Merge(b.Server)\n\t}\n\n\t// Apply the ports config\n\tif result.Ports == nil && b.Ports != nil {\n\t\tports := *b.Ports\n\t\tresult.Ports = &ports\n\t} else if b.Ports != nil {\n\t\tresult.Ports = result.Ports.Merge(b.Ports)\n\t}\n\n\t// Apply the address config\n\tif result.Addresses == nil && b.Addresses != nil {\n\t\taddrs := *b.Addresses\n\t\tresult.Addresses = &addrs\n\t} else if b.Addresses != nil {\n\t\tresult.Addresses = result.Addresses.Merge(b.Addresses)\n\t}\n\t\n\treturn &result\n}", "func (c *DedupConfig) Merge(o *DedupConfig) *DedupConfig {\n\tif c == nil {\n\t\tif o == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn o.Copy()\n\t}\n\n\tif o == nil {\n\t\treturn c.Copy()\n\t}\n\n\tr := c.Copy()\n\n\tif o.Enabled != nil {\n\t\tr.Enabled = o.Enabled\n\t}\n\n\tif o.MaxStale != nil {\n\t\tr.MaxStale = o.MaxStale\n\t}\n\n\tif o.Prefix != nil {\n\t\tr.Prefix = o.Prefix\n\t}\n\n\tif o.TTL != nil {\n\t\tr.TTL = o.TTL\n\t}\n\n\tif o.BlockQueryWaitTime != nil {\n\t\tr.BlockQueryWaitTime = o.BlockQueryWaitTime\n\t}\n\n\treturn r\n}", "func Merge(dst, src map[string]interface{}) (interface{}, error) {\n\treturn merge(dst, src)\n}", "func (c *StdoutConfig) Merge(o *StdoutConfig) *StdoutConfig {\n\tif c == nil {\n\t\tif o == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn o.Copy()\n\t}\n\n\tif o == nil {\n\t\treturn c.Copy()\n\t}\n\n\tr := c.Copy()\n\n\tif o.Period != nil {\n\t\tr.Period = TimeDurationCopy(o.Period)\n\t}\n\n\tif o.PrettyPrint != nil {\n\t\tr.PrettyPrint = BoolCopy(o.PrettyPrint)\n\t}\n\n\tif o.DoNotPrintTime != nil {\n\t\tr.DoNotPrintTime = BoolCopy(o.DoNotPrintTime)\n\t}\n\n\treturn r\n}", "func (c *Config) Merge(b *Config) *Config {\n\tconfig := *c\n\n\tif b.Nomad != \"\" {\n\t\tconfig.Nomad = b.Nomad\n\t}\n\n\tif b.Consul != \"\" {\n\t\tconfig.Consul = b.Consul\n\t}\n\n\tif b.LogLevel != \"\" {\n\t\tconfig.LogLevel = b.LogLevel\n\t}\n\n\tif b.ScalingInterval > 0 {\n\t\tconfig.ScalingInterval = b.ScalingInterval\n\t}\n\n\tif b.Region != \"\" {\n\t\tconfig.Region = b.Region\n\t}\n\n\t// Apply the ClusterScaling config\n\tif config.ClusterScaling == nil && b.ClusterScaling != nil {\n\t\tclusterScaling := *b.ClusterScaling\n\t\tconfig.ClusterScaling = &clusterScaling\n\t} else if b.ClusterScaling != nil {\n\t\tconfig.ClusterScaling = config.ClusterScaling.Merge(b.ClusterScaling)\n\t}\n\n\t// Apply the JobScaling config\n\tif config.JobScaling == nil && b.JobScaling != nil {\n\t\tjobScaling := *b.JobScaling\n\t\tconfig.JobScaling = &jobScaling\n\t} else if b.JobScaling != nil {\n\t\tconfig.JobScaling = config.JobScaling.Merge(b.JobScaling)\n\t}\n\n\t// Apply the Telemetry config\n\tif config.Telemetry == nil && b.Telemetry != nil {\n\t\ttelemetry := *b.Telemetry\n\t\tconfig.Telemetry = &telemetry\n\t} else if b.Telemetry != nil {\n\t\tconfig.Telemetry = config.Telemetry.Merge(b.Telemetry)\n\t}\n\n\t// Apply the Notification config\n\tif config.Notification == nil && b.Notification != nil {\n\t\tnotification := *b.Notification\n\t\tconfig.Notification = &notification\n\t} else if b.Notification != nil {\n\t\tconfig.Notification = config.Notification.Merge(b.Notification)\n\t}\n\n\treturn &config\n}", "func (c *ResolverConfig) Merge(in *ResolverConfig) *ResolverConfig {\n\tres := *c\n\tif in.Logger != nil {\n\t\tres.Logger = in.Logger\n\t}\n\tif in.Model != nil {\n\t\tres.Model = in.Model\n\t}\n\tif in.SecretResolver != nil {\n\t\tres.SecretResolver = in.SecretResolver\n\t}\n\tif in.PolicyResolver != nil {\n\t\tres.PolicyResolver = in.PolicyResolver\n\t}\n\treturn &res\n}", "func (c *PrometheusConfig) Merge(o *PrometheusConfig) *PrometheusConfig {\n\tif c == nil {\n\t\tif o == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn o.Copy()\n\t}\n\n\tif o == nil {\n\t\treturn c.Copy()\n\t}\n\n\tr := c.Copy()\n\n\tif o.Port != nil {\n\t\tr.Port = UintCopy(o.Port)\n\t}\n\n\tif o.CachePeriod != nil {\n\t\tr.CachePeriod = TimeDurationCopy(o.CachePeriod)\n\t}\n\n\treturn r\n}", "func (conf *ThrapConfig) Merge(other *ThrapConfig) {\n\tif other == nil {\n\t\treturn\n\t}\n\n\tif other.VCS != nil {\n\t\tfor k, v := range other.VCS {\n\t\t\tif cv, ok := conf.VCS[k]; ok {\n\t\t\t\tcv.Merge(v)\n\t\t\t} else {\n\t\t\t\tconf.VCS[k] = other.VCS[k]\n\t\t\t}\n\t\t}\n\t}\n\n\tif other.Orchestrator != nil {\n\t\tfor k, v := range other.Orchestrator {\n\t\t\tif cv, ok := conf.Orchestrator[k]; ok {\n\t\t\t\tcv.Merge(v)\n\t\t\t} else {\n\t\t\t\tconf.Orchestrator[k] = other.Orchestrator[k]\n\t\t\t}\n\t\t}\n\t}\n\n\tif other.Registry != nil {\n\t\tfor k, v := range other.Registry {\n\t\t\tif cv, ok := conf.Registry[k]; ok {\n\t\t\t\tcv.Merge(v)\n\t\t\t} else {\n\t\t\t\tconf.Registry[k] = other.Registry[k]\n\t\t\t}\n\t\t}\n\t}\n\n\tif other.Secrets != nil {\n\t\tfor k, v := range other.Secrets {\n\t\t\tif cv, ok := conf.Secrets[k]; ok {\n\t\t\t\tcv.Merge(v)\n\t\t\t} else {\n\t\t\t\tconf.Secrets[k] = other.Secrets[k]\n\t\t\t}\n\t\t}\n\t}\n\n}", "func (config *Config) Merge(newconfig Config) {\n\tif newconfig.Kubeconfig != \"\" {\n\t\tkubeconfig := newconfig.Kubeconfig\n\t\tcwd, err := os.Getwd()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif kubeconfig[0] != '/' {\n\t\t\tkubeconfig = filepath.Join(cwd, kubeconfig)\n\t\t}\n\n\t\tconfig.Kubeconfig = kubeconfig\n\t}\n\tif newconfig.Context != \"\" {\n\t\tconfig.Context = newconfig.Context\n\t}\n\tif newconfig.Namespace != \"\" {\n\t\tconfig.Namespace = newconfig.Namespace\n\t}\n\tif newconfig.Command != \"\" {\n\t\tconfig.Command = newconfig.Command\n\t}\n\n\tfor k, v := range newconfig.Environment {\n\t\tif config.Environment == nil {\n\t\t\tconfig.Environment = make(map[string]string)\n\t\t}\n\n\t\tconfig.Environment[k] = v\n\t}\n}", "func merge(dest *config, src config) {\n\tmergo.Merge(dest, src, mergo.WithOverride)\n}", "func Merge(dst, src []byte) ([]byte, error) {\n\tvar dstM, srcM map[string]interface{}\n\tif len(dst) == 0 {\n\t\tdstM = make(map[string]interface{})\n\t} else {\n\t\terr := json.Unmarshal(dst, &dstM)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\terr := json.Unmarshal(src, &srcM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = applyValues(dstM, srcM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.Marshal(dstM)\n}", "func Merge(original interface{}, update interface{}) (merged interface{}, err error) {\n\n\tif original == nil {\n\t\treturn update, nil\n\t}\n\n\tif update == nil {\n\t\treturn original, nil\n\t}\n\n\t// call the recursive merge\n\treturn merge(original, update)\n}", "func (conf *OrchestratorConfig) Merge(other *OrchestratorConfig) {\n\tif other == nil {\n\t\treturn\n\t}\n\n\tif other.ID != \"\" {\n\t\tconf.ID = other.ID\n\t}\n\n\tif other.Addr != \"\" {\n\t\tconf.Addr = other.Addr\n\t}\n}", "func merge(dst, src any, opts ...func(*mergeConfig)) error {\n\tif dst == nil || src == nil {\n\t\t// Nothing available to merge if dst or src are nil.\n\t\t// This can occur early on in reconciliation when the\n\t\t// status subresource has not been set yet.\n\t\treturn nil\n\t}\n\n\tconfig := &mergeConfig{}\n\n\tfor _, opt := range opts {\n\t\topt(config)\n\t}\n\n\tdstMap, ok := dst.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedDstObject)\n\t}\n\n\tsrcMap, ok := src.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedSrcObject)\n\t}\n\n\treturn mergo.Merge(&dstMap, filter(srcMap, config.srcfilter...), config.mergeOptions...)\n}", "func (cc *CredsConfig) Merge(other *CredsConfig) {\n\tif other == nil {\n\t\treturn\n\t}\n\tcc.Registry = merge(cc.Registry, other.Registry)\n\tcc.VCS = merge(cc.VCS, other.VCS)\n\tcc.Secrets = merge(cc.Secrets, other.Secrets)\n\tcc.Orchestrator = merge(cc.Orchestrator, other.Orchestrator)\n}", "func (c Config) Merge(defaults Config) Config {\n\tret := Config{ClientID: wdef(c.ClientID, defaults.ClientID),\n\t\tClientSecret: wdef(c.ClientSecret, defaults.ClientSecret),\n\t\tCallbackURL: wdef(c.CallbackURL, defaults.CallbackURL)}\n\tret.ServerProfile = c.ServerProfile.Merge(defaults.ServerProfile)\n\treturn ret\n}", "func (c *ConfigureOpener) Merge(other ConfigureOpener) {\n\tif c.ErrorThresholdPercentage == 0 {\n\t\tc.ErrorThresholdPercentage = other.ErrorThresholdPercentage\n\t}\n\tif c.RequestVolumeThreshold == 0 {\n\t\tc.RequestVolumeThreshold = other.RequestVolumeThreshold\n\t}\n\tif c.Now == nil {\n\t\tc.Now = other.Now\n\t}\n\tif c.RollingDuration == 0 {\n\t\tc.RollingDuration = other.RollingDuration\n\t}\n\tif c.NumBuckets == 0 {\n\t\tc.NumBuckets = other.NumBuckets\n\t}\n}", "func (c Sessions) Merge(cfg []Sessions) (config Sessions) {\n\n\tif len(cfg) > 0 {\n\t\tconfig = cfg[0]\n\t\tmergo.Merge(&config, c)\n\t} else {\n\t\t_default := c\n\t\tconfig = _default\n\t}\n\n\treturn\n}", "func (a *ServerConfig) Merge(b *ServerConfig) *ServerConfig {\n\tresult := *a\n\n\tif b.Enabled {\n\t\tresult.Enabled = true\n\t}\n\n\treturn &result\n}", "func (c *Config) Merge(newConfig *Config) {\n\tif newConfig.SitePath != \"\" {\n\t\tc.SitePath = newConfig.SitePath\n\t}\n\n\tif newConfig.TmpDir != \"\" {\n\t\tc.TmpDir = newConfig.TmpDir\n\t}\n\n\tif newConfig.ApplicationName != \"\" {\n\t\tc.ApplicationName = newConfig.ApplicationName\n\t}\n\n\tif newConfig.ConfigFilePath != \"\" {\n\t\tc.ConfigFilePath = newConfig.ConfigFilePath\n\t}\n\n\tif newConfig.GitPath != \"\" {\n\t\tc.GitPath = newConfig.GitPath\n\t}\n\tc.CanEdit = newConfig.CanEdit\n}", "func Merge(target, source interface{}, opt *Options) error {\n\tvT := reflect.ValueOf(target)\n\tvS := reflect.ValueOf(source)\n\n\tif target != nil && vT.Type() == valType {\n\t\tvT = vT.Interface().(reflect.Value)\n\t}\n\tif source != nil && vS.Type() == valType {\n\t\tvS = vS.Interface().(reflect.Value)\n\t}\n\n\tif vT.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"target must be a pointer\")\n\t}\n\n\tif !reflect.Indirect(vT).IsValid() {\n\t\treturn errors.New(\"target can not be zero value\")\n\t}\n\n\t// use defaults if none are provided\n\tif opt == nil {\n\t\topt = NewOptions()\n\t}\n\n\tif opt.mergeFuncs == nil {\n\t\treturn errors.New(\"invalid options, use NewOptions() to generate and then modify as needed\")\n\t}\n\n\t//make a copy here so if there is an error mid way, the target stays in tact\n\tcp := vT.Elem()\n\n\tmerged, err := merge(cp, reflect.Indirect(vS), opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !isSettable(vT.Elem(), merged) {\n\t\treturn fmt.Errorf(\"Merge failed: expected merged result to be %v but got %v\",\n\t\t\tvT.Elem().Type(), merged.Type())\n\t}\n\n\tvT.Elem().Set(merged)\n\treturn nil\n}", "func (t *Telemetry) Merge(b *Telemetry) *Telemetry {\n\tconfig := *t\n\n\tif b.StatsdAddress != \"\" {\n\t\tconfig.StatsdAddress = b.StatsdAddress\n\t}\n\n\treturn &config\n}", "func (config *Config) Merge(conf2 *Config) {\n\tconfig.Delay = setInt(config.Delay, conf2.Delay)\n\tconfig.Domains = setStringSlice([]*string(config.Domains), []*string(conf2.Domains))\n\tconfig.DynamodbTableName = setString(config.DynamodbTableName, conf2.DynamodbTableName)\n\tconfig.Email = setString(config.Email, conf2.Email)\n\tconfig.Fortios = setBool(config.Fortios, conf2.Fortios)\n\tconfig.FortiosAdminServerCert = setBool(config.FortiosAdminServerCert, conf2.FortiosAdminServerCert)\n\tconfig.FortiosBaseURL = setString(config.FortiosBaseURL, conf2.FortiosBaseURL)\n\tconfig.FortiosSslSSHProfiles = setStringSlice(config.FortiosSslSSHProfiles, conf2.FortiosSslSSHProfiles)\n\tconfig.Local = setBool(config.Local, conf2.Local)\n\tconfig.OutputLocation = setString(config.OutputLocation, conf2.OutputLocation)\n\tconfig.Prefix = setString(config.Prefix, conf2.Prefix)\n}", "func (a *API) Merge(other API) {\n\tif a.Short == \"\" {\n\t\ta.Short = other.Short\n\t}\n\n\tif a.Long == \"\" {\n\t\ta.Long = other.Long\n\t}\n\n\ta.Operations = append(a.Operations, other.Operations...)\n}", "func (cfg *Config) Merge(add *Config) {\n\tC.al_merge_config_into((*C.ALLEGRO_CONFIG)(cfg), (*C.ALLEGRO_CONFIG)(add))\n}", "func mergeIfMergable(obj reflect.Value, src reflect.Value) (reflect.Value, bool) {\n\tvar out reflect.Value\n\n\t// Look for the .WithDefaults method.\n\tmeth, ok := obj.Type().MethodByName(\"Merge\")\n\tif !ok {\n\t\treturn out, false\n\t}\n\n\t// Verify the signature matches our Mergable psuedointerface:\n\t// - two inputs (the receiver), and one output\n\t// - input types match output type exactly (disallow the usual pointer receiver semantics)\n\tif meth.Type.NumIn() != 2 || meth.Type.NumOut() != 1 {\n\t\treturn out, false\n\t}\n\tif meth.Type.In(0) != meth.Type.In(1) || meth.Type.In(0) != meth.Type.Out(0) {\n\t\treturn out, false\n\t}\n\n\t// Psuedointerface matches, call the .Merge method.\n\tout = meth.Func.Call([]reflect.Value{obj, src})[0]\n\n\treturn out, true\n}", "func (obj *JSONObject) Merge(s2 JSONObject) {\n\ttmp := *obj\n\n\tfor k, v := range s2 {\n\t\ttmp[k] = v\n\t}\n\n\t*obj = tmp\n}", "func (c *VaultConfig) Merge(o *VaultConfig) *VaultConfig {\n\tif c == nil {\n\t\tif o == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn o.Copy()\n\t}\n\n\tif o == nil {\n\t\treturn c.Copy()\n\t}\n\n\tr := c.Copy()\n\n\tif o.Address != nil {\n\t\tr.Address = o.Address\n\t}\n\n\tif o.Enabled != nil {\n\t\tr.Enabled = o.Enabled\n\t}\n\n\tif o.Namespace != nil {\n\t\tr.Namespace = o.Namespace\n\t}\n\n\tif o.RenewToken != nil {\n\t\tr.RenewToken = o.RenewToken\n\t}\n\n\tif o.Retry != nil {\n\t\tr.Retry = r.Retry.Merge(o.Retry)\n\t}\n\n\tif o.SSL != nil {\n\t\tr.SSL = r.SSL.Merge(o.SSL)\n\t}\n\n\tif o.Token != nil {\n\t\tr.Token = o.Token\n\t}\n\n\tif o.VaultAgentTokenFile != nil {\n\t\tr.VaultAgentTokenFile = o.VaultAgentTokenFile\n\t}\n\n\tif o.Transport != nil {\n\t\tr.Transport = r.Transport.Merge(o.Transport)\n\t}\n\n\tif o.UnwrapToken != nil {\n\t\tr.UnwrapToken = o.UnwrapToken\n\t}\n\n\tif o.DefaultLeaseDuration != nil {\n\t\tr.DefaultLeaseDuration = o.DefaultLeaseDuration\n\t}\n\n\tif o.LeaseRenewalThreshold != nil {\n\t\tr.LeaseRenewalThreshold = o.LeaseRenewalThreshold\n\t}\n\n\tif o.K8SAuthRoleName != nil {\n\t\tr.K8SAuthRoleName = o.K8SAuthRoleName\n\t}\n\n\tif o.K8SServiceAccountToken != nil {\n\t\tr.K8SServiceAccountToken = o.K8SServiceAccountToken\n\t}\n\n\tif o.K8SServiceAccountTokenPath != nil {\n\t\tr.K8SServiceAccountTokenPath = o.K8SServiceAccountTokenPath\n\t}\n\n\tif o.K8SServiceMountPath != nil {\n\t\tr.K8SServiceMountPath = o.K8SServiceMountPath\n\t}\n\n\treturn r\n}", "func Merge(object interface{}, overwriteObject interface{}) {\n\tobjectPointerUnsafe := unsafe.Pointer(&object)\n\toverwriteObjectPointerUnsafe := unsafe.Pointer(&overwriteObject)\n\n\tmerge(object, overwriteObject, objectPointerUnsafe, overwriteObjectPointerUnsafe)\n}", "func Merge(observed, lastApplied, desired map[string]interface{}) (map[string]interface{}, error) {\n\t// Make a copy of observed & use it as the destination where merge\n\t// happens\n\tobservedAsDest := runtime.DeepCopyJSON(observed)\n\n\tif _, err := merge(\"\", observedAsDest, lastApplied, desired); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Can't merge desired changes\")\n\t}\n\treturn observedAsDest, nil\n}", "func (j *JobScaling) Merge(b *JobScaling) *JobScaling {\n\tconfig := *j\n\n\tif b.Enabled {\n\t\tconfig.Enabled = b.Enabled\n\t}\n\n\tif b.ConsulToken != \"\" {\n\t\tconfig.ConsulToken = b.ConsulToken\n\t}\n\n\tif b.ConsulKeyLocation != \"\" {\n\t\tconfig.ConsulKeyLocation = b.ConsulKeyLocation\n\t}\n\n\treturn &config\n}", "func Merge(orig, v interface{}, defaults bool) {\n\tvv := reflect.ValueOf(v).Elem()\n\tif !vv.IsValid() {\n\t\treturn\n\t}\n\tvorig := reflect.ValueOf(orig).Elem()\n\tfor i := 0; i < vorig.NumField(); i++ {\n\t\tfield := vv.Field(i)\n\t\tif defaults {\n\t\t\tfield = vorig.Field(i)\n\t\t}\n\t\tvar empty bool\n\t\tswitch field.Type().Kind() {\n\t\tcase reflect.Struct:\n\t\t\tempty = true // TODO: merge structs recursively\n\t\tcase reflect.Chan, reflect.Func, reflect.Slice, reflect.Map:\n\t\t\tempty = field.IsNil()\n\t\tdefault:\n\t\t\tempty = field.Interface() == reflect.Zero(field.Type()).Interface()\n\t\t}\n\t\tif !empty {\n\t\t\tvorig.Field(i).Set(vv.Field(i))\n\t\t}\n\t}\n}", "func (c *ClusterScaling) Merge(b *ClusterScaling) *ClusterScaling {\n\tconfig := *c\n\n\tif b.Enabled {\n\t\tconfig.Enabled = b.Enabled\n\t}\n\n\tif b.MaxSize != 0 {\n\t\tconfig.MaxSize = b.MaxSize\n\t}\n\n\tif b.MinSize != 0 {\n\t\tconfig.MinSize = b.MinSize\n\t}\n\n\tif b.CoolDown != 0 {\n\t\tconfig.CoolDown = b.CoolDown\n\t}\n\n\tif b.NodeFaultTolerance != 0 {\n\t\tconfig.NodeFaultTolerance = b.NodeFaultTolerance\n\t}\n\n\tif b.AutoscalingGroup != \"\" {\n\t\tconfig.AutoscalingGroup = b.AutoscalingGroup\n\t}\n\n\treturn &config\n}", "func (f flags) Merge(config Config) Config {\n\tif len(f.IncludePkgs) > 0 {\n\t\tconfig.IncludePkgs = f.IncludePkgs\n\t}\n\n\tif len(f.RuleNames) > 0 {\n\t\tfor _, ruleName := range f.RuleNames {\n\t\t\tconfig.Rules = append(config.Rules, Rule{\n\t\t\t\tRuleName: ruleName,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn config\n}", "func (obj object) MergeWith(other Object, conflictResolver func(v1, v2 *Term) (*Term, bool)) (Object, bool) {\n\tresult := NewObject()\n\tstop := obj.Until(func(k, v *Term) bool {\n\t\tv2 := other.Get(k)\n\t\t// The key didn't exist in other, keep the original value\n\t\tif v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t\treturn false\n\t\t}\n\n\t\t// The key exists in both, resolve the conflict if possible\n\t\tmerged, stop := conflictResolver(v, v2)\n\t\tif !stop {\n\t\t\tresult.Insert(k, merged)\n\t\t}\n\t\treturn stop\n\t})\n\n\tif stop {\n\t\treturn nil, false\n\t}\n\n\t// Copy in any values from other for keys that don't exist in obj\n\tother.Foreach(func(k, v *Term) {\n\t\tif v2 := obj.Get(k); v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t}\n\t})\n\treturn result, true\n}", "func (cfg *RPCPoolConfig) merge(override *RPCPoolConfig) *RPCPoolConfig {\n\tif cfg == nil && override == nil {\n\t\treturn nil\n\t}\n\n\tmerged := &RPCPoolConfig{\n\t\tSize: -1,\n\t\tWaitTimeout: -1,\n\t}\n\n\tfor _, c := range []*RPCPoolConfig{cfg, override} { // First apply the base config, then any overrides.\n\t\tif c != nil {\n\t\t\tif c.Size >= 0 {\n\t\t\t\tmerged.Size = c.Size\n\t\t\t}\n\n\t\t\tif c.WaitTimeout > 0 {\n\t\t\t\tmerged.WaitTimeout = c.WaitTimeout\n\t\t\t}\n\t\t}\n\t}\n\n\treturn merged\n}", "func (cl *ConfigLocks) Merge(c2 *ConfigLocks) {\n\tcl.Bits |= c2.Bits\n\tfor t := range c2.Tags {\n\t\tcl.Tags[t] = struct{}{}\n\t}\n}", "func (n *Notification) Merge(b *Notification) *Notification {\n\tconfig := *n\n\n\tif b.ClusterIdentifier != \"\" {\n\t\tconfig.ClusterIdentifier = b.ClusterIdentifier\n\t}\n\n\tif b.ClusterScalingUID != \"\" {\n\t\tconfig.ClusterScalingUID = b.ClusterScalingUID\n\t}\n\n\tif b.PagerDutyServiceKey != \"\" {\n\t\tconfig.PagerDutyServiceKey = b.PagerDutyServiceKey\n\t}\n\n\treturn &config\n}", "func (p *ProxySettings) Merge(dst *ProxySettings) {\n\tif dst.HTTPProxy.Empty() {\n\t\tdst.HTTPProxy = p.HTTPProxy\n\t}\n\tif dst.NoProxy.Empty() {\n\t\tdst.NoProxy = p.NoProxy\n\t}\n}", "func (p *ProxySettings) Merge(dst *ProxySettings) {\n\tif dst.HTTPProxy.Empty() {\n\t\tdst.HTTPProxy = p.HTTPProxy\n\t}\n\tif dst.NoProxy.Empty() {\n\t\tdst.NoProxy = p.NoProxy\n\t}\n}", "func (pc ParseContext) Merge(o ParseContext) {\n\tfor k, vs := range o.Args {\n\t\tpc.Args[k] = append(pc.Args[k], vs...)\n\t}\n\n\tfor k, vs := range o.Opts {\n\t\tpc.Opts[k] = append(pc.Opts[k], vs...)\n\t}\n}", "func (conf *RegistryRepoConfig) Merge(other *RegistryRepoConfig) {\n\tif other != nil {\n\t\tif other.Name != \"\" {\n\t\t\tconf.Name = other.Name\n\t\t}\n\t}\n}", "func (b *BaseImpl) Merge() {\n\tb.Flatten()\n}", "func Merge(dst map[interface{}]interface{}, src map[interface{}]interface{}) {\n\tfor k, v := range src {\n\t\tif srcMap, ok := v.(map[interface{}]interface{}); ok {\n\t\t\tif dstMap, ok := dst[k].(map[interface{}]interface{}); ok {\n\t\t\t\tMerge(dstMap, srcMap)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tdst[k] = v\n\t}\n}", "func (s *EnvironmentSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (c *Configuration) Merge(al *alias.Alias, givenFlags []string) error {\n\tvar fl flags = givenFlags\n\n\tif !fl.lookup(\"verbose\") {\n\t\tc.Verbose = al.Verbose\n\t}\n\n\tif !fl.lookup(\"insecure\") {\n\t\tc.Insecure = al.Insecure\n\t}\n\n\tif !fl.lookup(\"detach\") {\n\t\tc.Detach = al.Detach\n\t}\n\n\tc.Id = al.Name\n\tc.TunnelType = al.TunnelType\n\n\tsrcl := AddressInputList{}\n\tfor _, src := range al.Source {\n\t\terr := srcl.Set(src)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tc.Source = srcl\n\n\tdstl := AddressInputList{}\n\tfor _, dst := range al.Destination {\n\t\terr := dstl.Set(dst)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tc.Destination = dstl\n\n\tsrv := AddressInput{}\n\terr := srv.Set(al.Server)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Server = srv\n\n\tc.Key = al.Key\n\n\tkai, err := time.ParseDuration(al.KeepAliveInterval)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.KeepAliveInterval = kai\n\n\tc.ConnectionRetries = al.ConnectionRetries\n\n\twar, err := time.ParseDuration(al.WaitAndRetry)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.WaitAndRetry = war\n\n\tc.SshAgent = al.SshAgent\n\n\ttim, err := time.ParseDuration(al.Timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Timeout = tim\n\n\tc.SshConfig = al.SshConfig\n\n\tc.Rpc = al.Rpc\n\n\tc.RpcAddress = al.RpcAddress\n\n\treturn nil\n}", "func (dst *Worker) Merge(src Worker) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Command != \"\" {\n\t\tdst.Command = src.Command\n\t}\n\tif len(src.Commands) > 0 {\n\t\tdst.Commands = strings.Unique(append(dst.Commands, src.Commands...))\n\t}\n\tif src.Replicas != 0 {\n\t\tdst.Replicas = src.Replicas\n\t}\n\tif src.LivenessProbe != \"\" {\n\t\tdst.LivenessProbe = src.LivenessProbe\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Resources != nil && dst.Resources == nil {\n\t\tdst.Resources = new(Resources)\n\t}\n\tdst.Resources.Merge(src.Resources)\n}", "func (m *NestedEmpty) Merge(overrides *NestedEmpty) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n\tif overrides.Nested != nil {\n\t\tm.Nested = overrides.Nested\n\t}\n\n}", "func Merge(dataA *interface{}, dataB *interface{}, arrayAppend bool) {\n\tmergeRecursive(dataA, dataB, arrayAppend, nil, \"\")\n}", "func (h HyperparameterV0) Merge(other interface{}) interface{} {\n\t// Never merge partial hyperparameters.\n\treturn h\n}", "func (c *Component) Merge(other *Component) *Component {\n\tr := &Component{\n\t\tPath: other.Path,\n\t\tName: mergeStr(c.Name, other.Name),\n\t\tApp: mergeStr(c.App, other.App),\n\t\tKind: mergeStr(c.Kind, other.Kind),\n\t\tIgnore: mergeBool(c.Ignore, other.Ignore),\n\t\tDocker: mergeDocker(c.Docker, other.Docker),\n\t\tECS: mergeECS(c.ECS, other.ECS),\n\t\tToolchain: mergeToolchain(c.Toolchain, other.Toolchain),\n\t\tRules: mergeRules(c.Rules, other.Rules),\n\t\tExports: mergeExports(c.Exports, other.Exports),\n\t\tEnvironment: mergeStringsMap(c.Environment, other.Environment),\n\t}\n\treturn r\n}", "func (e FlatMap) Merge(env ...FlatMap) (res FlatMap) {\n\tres = FlatMap{}\n\tfor _, e1 := range append([]FlatMap{e}, env...) {\n\t\tfor k, v := range e1 {\n\t\t\tres[k] = v\n\t\t}\n\t}\n\treturn\n}", "func (b Binding) Merge(b2 Binding) Binding {\n\n\tresult := Binding{}\n\n\tfor k, v := range b {\n\t\tresult[k] = v\n\t}\n\n\tfor k, v := range b2 {\n\t\tresult[k] = v\n\t}\n\n\treturn result\n}", "func (v *Venom) Merge(l ConfigLevel, data ConfigMap) {\n\tv.Store.Merge(l, data)\n}", "func MergeConfig(m map[string]interface{}) error {\n\terr := viper.MergeConfigMap(m)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to read merge directory configuration: %s\", err)\n\t}\n\treturn nil\n}", "func (m *Empty) Merge(overrides *Empty) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n}", "func (s *YAMLFileSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (that *StrAnyMap) Merge(other *StrAnyMap) {\n\tthat.mu.Lock()\n\tdefer that.mu.Unlock()\n\tif that.data == nil {\n\t\tthat.data = other.MapCopy()\n\t\treturn\n\t}\n\tif other != that {\n\t\tother.mu.RLock()\n\t\tdefer other.mu.RUnlock()\n\t}\n\tfor k, v := range other.data {\n\t\tthat.data[k] = v\n\t}\n}", "func (o Options) Merge(other Options) map[string]string {\n\tout := make(map[string]string, len(o)+len(other))\n\n\tfor k, v := range o {\n\t\tout[k] = v\n\t}\n\n\tfor k, v := range other {\n\t\tout[k] = v\n\t}\n\n\treturn out\n}", "func (c *Catalog) Merge(other *Catalog) {\n\tif other == nil {\n\t\treturn\n\t}\n\tif other.Paths != nil {\n\t\tc.Paths = append(c.Paths, other.Paths...)\n\t}\n\tif other.Stats != nil {\n\t\tstats, _ := c.GetStats()\n\t\tstats.Merge(other.Stats)\n\t}\n\tif other.Cameras != nil {\n\t\tc.Cameras = c.Cameras.Merge(other.Cameras)\n\t}\n\tif other.Lenses != nil {\n\t\tc.Lenses = c.Lenses.Merge(other.Lenses)\n\t}\n\tif other.Photos != nil {\n\t\tc.Photos = append(c.Photos, other.Photos...)\n\t}\n\tif other.Collections != nil {\n\t\tc.Collections = append(c.Collections, other.Collections...)\n\t}\n\tif other.CollectionTree != nil && c.CollectionTree == nil {\n\t\tc.CollectionTree = other.CollectionTree\n\t}\n}", "func (c Config) Merge(newcfg *Config) *Config {\n\tif newcfg == nil {\n\t\treturn &c\n\t}\n\n\tcfg := Config{}\n\n\tif newcfg.Credentials != nil {\n\t\tcfg.Credentials = newcfg.Credentials\n\t} else {\n\t\tcfg.Credentials = c.Credentials\n\t}\n\n\tif newcfg.Endpoint != \"\" {\n\t\tcfg.Endpoint = newcfg.Endpoint\n\t} else {\n\t\tcfg.Endpoint = c.Endpoint\n\t}\n\n\tif newcfg.Region != \"\" {\n\t\tcfg.Region = newcfg.Region\n\t} else {\n\t\tcfg.Region = c.Region\n\t}\n\n\tif newcfg.DisableSSL {\n\t\tcfg.DisableSSL = newcfg.DisableSSL\n\t} else {\n\t\tcfg.DisableSSL = c.DisableSSL\n\t}\n\n\tif newcfg.ManualSend {\n\t\tcfg.ManualSend = newcfg.ManualSend\n\t} else {\n\t\tcfg.ManualSend = c.ManualSend\n\t}\n\n\tif newcfg.HTTPClient != nil {\n\t\tcfg.HTTPClient = newcfg.HTTPClient\n\t} else {\n\t\tcfg.HTTPClient = c.HTTPClient\n\t}\n\n\tif newcfg.LogHTTPBody {\n\t\tcfg.LogHTTPBody = newcfg.LogHTTPBody\n\t} else {\n\t\tcfg.LogHTTPBody = c.LogHTTPBody\n\t}\n\n\tif newcfg.LogLevel != 0 {\n\t\tcfg.LogLevel = newcfg.LogLevel\n\t} else {\n\t\tcfg.LogLevel = c.LogLevel\n\t}\n\n\tif newcfg.Logger != nil {\n\t\tcfg.Logger = newcfg.Logger\n\t} else {\n\t\tcfg.Logger = c.Logger\n\t}\n\n\tif newcfg.MaxRetries != DefaultRetries {\n\t\tcfg.MaxRetries = newcfg.MaxRetries\n\t} else {\n\t\tcfg.MaxRetries = c.MaxRetries\n\t}\n\n\tif newcfg.DisableParamValidation {\n\t\tcfg.DisableParamValidation = newcfg.DisableParamValidation\n\t} else {\n\t\tcfg.DisableParamValidation = c.DisableParamValidation\n\t}\n\n\tif newcfg.DisableComputeChecksums {\n\t\tcfg.DisableComputeChecksums = newcfg.DisableComputeChecksums\n\t} else {\n\t\tcfg.DisableComputeChecksums = c.DisableComputeChecksums\n\t}\n\n\tif newcfg.S3ForcePathStyle {\n\t\tcfg.S3ForcePathStyle = newcfg.S3ForcePathStyle\n\t} else {\n\t\tcfg.S3ForcePathStyle = c.S3ForcePathStyle\n\t}\n\n\tif newcfg.DomainMode {\n\t\tcfg.DomainMode = newcfg.DomainMode\n\t} else {\n\t\tcfg.DomainMode = c.DomainMode\n\t}\n\tif newcfg.SignerVersion != \"\" {\n\t\tcfg.SignerVersion = newcfg.SignerVersion\n\t} else {\n\t\tcfg.SignerVersion = c.SignerVersion\n\t}\n\treturn &cfg\n}", "func (c *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error {\n\to, _ := oa.(*Aggregator)\n\tif o == nil {\n\t\treturn aggregator.NewInconsistentAggregatorError(c, oa)\n\t}\n\n\tc.samples = combine(c.samples, o.samples)\n\treturn nil\n}", "func (m Metadata) Merge(other Metadata) Metadata {\n\tresult := m.Copy()\n\tfor k, v := range other {\n\t\tresult[k] = v // other takes precedence\n\t}\n\treturn result\n}", "func (dst *Proxy) Merge(src Proxy) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tdst.Hosts.Merge(src.Hosts)\n}", "func (m *Nested) Merge(overrides *Nested) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n\tif overrides.Simple != nil {\n\t\tm.Simple = overrides.Simple\n\t}\n\n\tif overrides.OtherSimple != nil {\n\t\tm.OtherSimple = overrides.OtherSimple\n\t}\n\n\tm.Test = overrides.Test\n\n\tif overrides.Empty != nil {\n\t\tm.Empty = overrides.Empty\n\t}\n\n\tm.Hello = overrides.Hello\n\n\tif overrides.Details != nil {\n\t\tm.Details = overrides.Details\n\t}\n\n\tif overrides.Skipper != nil {\n\t\tm.Skipper = overrides.Skipper\n\t}\n\n\tif overrides.X != nil {\n\t\tm.X = overrides.X\n\t}\n\n\tif overrides.Initial != nil {\n\t\tm.Initial = overrides.Initial\n\t}\n\n\tif overrides.SimpleMap != nil {\n\t\tm.SimpleMap = overrides.SimpleMap\n\t}\n\n\tm.RepeatedPrimitive = overrides.RepeatedPrimitive\n\n\tif overrides.RepeatedExternal != nil {\n\t\tm.RepeatedExternal = overrides.RepeatedExternal\n\t}\n\n\tif overrides.MapExternal != nil {\n\t\tm.MapExternal = overrides.MapExternal\n\t}\n\n\tif overrides.TestOneOf != nil {\n\t\tm.TestOneOf = overrides.TestOneOf\n\t}\n\n}", "func Merge(origData, fixedData []byte) ([]byte, error) {\n\torigYaml, err := unmarshal(origData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfixedYaml, err := unmarshal(fixedData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a new document node that contains the merged maps for the original and fixed yaml\n\tmergedYaml := shallowCopyNode(origYaml)\n\tmergedYaml.Content = []*goyaml.Node{\n\t\tmergeMaps(origYaml.Content[0], fixedYaml.Content[0]),\n\t}\n\n\treturn marshal(mergedYaml)\n}", "func (s *MapSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func UnionMerge[T any](obj T, src T) T {\n\tname := fmt.Sprintf(\"%T\", obj)\n\n\tvObj := reflect.ValueOf(obj)\n\tvSrc := reflect.ValueOf(src)\n\n\t// obj must have the same type as src.\n\tassertTypeMatch(vObj, vSrc)\n\n\tif vObj.Kind() != reflect.Struct {\n\t\tpanic(\"UnionMerge must only be called on struct types\")\n\t}\n\n\treturn unionMerge(vObj, vSrc, name).Interface().(T)\n}", "func (c *Config) MergeIn(cfgs ...*Config) {\n\tfor _, other := range cfgs {\n\t\tmergeInConfig(c, other)\n\t}\n}", "func (p *ErrorHandlingPolicy) Merge(src ErrorHandlingPolicy) {\n\tif p.IgnoreFileErrors == nil && src.IgnoreFileErrors != nil {\n\t\tp.IgnoreFileErrors = newBool(*src.IgnoreFileErrors)\n\t}\n\n\tif p.IgnoreDirectoryErrors == nil && src.IgnoreDirectoryErrors != nil {\n\t\tp.IgnoreDirectoryErrors = newBool(*src.IgnoreDirectoryErrors)\n\t}\n}", "func (s *CommandLineSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (s *FKCascadeRuntimeStats) Merge(other execdetails.RuntimeStats) {\n\ttmp, ok := other.(*FKCascadeRuntimeStats)\n\tif !ok {\n\t\treturn\n\t}\n\ts.Total += tmp.Total\n\ts.Keys += tmp.Keys\n}", "func (p *Merger) Merge() error {\n\tsourceYml := map[interface{}]interface{}{}\n\tfor _, file := range p.files {\n\t\ttemp, err := p.load(file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := p.appendUpdate(sourceYml, temp); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tout, err := yaml.Marshal(&sourceYml)\n\tif err != nil {\n\t\treturn err\n\t} else {\n\t\tioutil.WriteFile(p.target, out, os.ModePerm)\n\t}\n\treturn nil\n}", "func (c *HashChain) Merge(src *HashChain) error {\n\ti := 0\n\tfor ; i < len(c.chain) && i < len(src.chain); i++ {\n\t\tif !linkEqual(c.chain[i], src.chain[i]) {\n\t\t\treturn ErrCannotMerge\n\t\t}\n\t}\n\tif len(src.chain) < len(c.chain) {\n\t\treturn ErrNothingToMerge\n\t}\n\tfor ; i < len(src.chain); i++ {\n\t\tvar l link\n\t\tl = *src.chain[i]\n\t\tc.chain = append(c.chain, &l)\n\t\t// Verifiying the entire chain after every entry is a bit excessive,\n\t\t// especially because src is already verified.\n\t\t// But better be safe than sorry.\n\t\tif err := c.verify(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// save\n\t\tif _, err := fmt.Fprintln(c.fp, l.String()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (dst *Engine) Merge(src *Engine) {\n\tif dst == nil || src == nil {\n\t\treturn\n\t}\n\n\tif src.Name != \"\" {\n\t\tdst.Name = src.Name\n\t}\n\tif src.Version != \"\" {\n\t\tdst.Version = src.Version\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Resources != nil && dst.Resources == nil {\n\t\tdst.Resources = new(Resources)\n\t}\n\tdst.Resources.Merge(src.Resources)\n}", "func (rc RC) Merge(other RC) {\n\tfor key, val := range other {\n\t\trc[key] = val\n\t}\n}", "func mergeConfig(cfgs ...apiv1.Config) apiv1.Config {\n\tn := apiv1.Config{}\n\tfor _, cfg := range cfgs {\n\t\tfor k, v2 := range cfg {\n\t\t\tif v1, ok := n[k]; ok {\n\t\t\t\tif nv1, ok1 := v1.(apiv1.Config); ok1 {\n\t\t\t\t\tif nv2, ok2 := v2.(apiv1.Config); ok2 {\n\t\t\t\t\t\tn[k] = mergeConfig(nv1, nv2)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tn[k] = v2\n\t\t}\n\t}\n\n\treturn n\n}", "func Merge(metrics map[string]metricSource.MetricData, other map[string]metricSource.MetricData) map[string]metricSource.MetricData {\n\tresult := make(map[string]metricSource.MetricData, len(metrics)+len(other))\n\tfor k, v := range metrics {\n\t\tresult[k] = v\n\t}\n\tfor k, v := range other {\n\t\tresult[k] = v\n\t}\n\treturn result\n}", "func (m *Metadata) Merge(src proto.Message) {\n\tmetadata, ok := src.(*Metadata)\n\tif !ok {\n\t\treturn\n\t}\n\t*m = *metadata\n\t// Manually clone expiry timestamp as proto.Clone\n\t// cannot cope with values that contain unexported\n\t// attributes (as time.Time does)\n\tif metadata.Expires != nil {\n\t\texpires := *metadata.Expires\n\t\tm.Expires = &expires\n\t}\n\tif len(metadata.Labels) != 0 {\n\t\tm.Labels = make(map[string]string)\n\t\tfor k, v := range metadata.Labels {\n\t\t\tm.Labels[k] = v\n\t\t}\n\t}\n}", "func (p *Properties) Merge(other *Properties) error {\n\tif other != nil {\n\t\tcomposite := errors.NewCompositeError()\n\t\tfor k, v := range other.m {\n\t\t\tcomposite.Append(p.Set(k, v))\n\t\t}\n\n\t\treturn composite.OrNilIfEmpty()\n\t}\n\n\treturn nil\n}", "func (r *JSONResponse) Merge(data map[string]interface{}) {\n\tfor k, v := range data {\n\t\tr.data[k] = v\n\t}\n}", "func Merge(dits []Iterator, cb func([]*Meta) error) error {\n\treturn mergeByKey(dits, metaInputID, cb)\n}", "func (p *UploadPolicy) Merge(src UploadPolicy, def *UploadPolicyDefinition, si snapshot.SourceInfo) {\n\tmergeOptionalInt(&p.MaxParallelSnapshots, src.MaxParallelSnapshots, &def.MaxParallelSnapshots, si)\n\tmergeOptionalInt(&p.MaxParallelFileReads, src.MaxParallelFileReads, &def.MaxParallelFileReads, si)\n\tmergeOptionalInt64(&p.ParallelUploadAboveSize, src.ParallelUploadAboveSize, &def.ParallelUploadAboveSize, si)\n}", "func (mb *MutableBag) Merge(bag *MutableBag) {\n\tfor k, v := range bag.values {\n\t\t// the input bags cannot override values already in the destination bag\n\t\tif !mb.Contains(k) {\n\t\t\tmb.values[k] = copyValue(v)\n\t\t}\n\t}\n}", "func (options Options) merge(defaults Options) {\n for k, v := range defaults {\n if _, present := options[k]; !present {\n options[k] = v\n }\n }\n}", "func (e *updateRuntimeStats) Merge(other execdetails.RuntimeStats) {\n\ttmp, ok := other.(*updateRuntimeStats)\n\tif !ok {\n\t\treturn\n\t}\n\tif tmp.SnapshotRuntimeStats != nil {\n\t\tif e.SnapshotRuntimeStats == nil {\n\t\t\tsnapshotStats := tmp.SnapshotRuntimeStats.Clone()\n\t\t\te.SnapshotRuntimeStats = snapshotStats\n\t\t} else {\n\t\t\te.SnapshotRuntimeStats.Merge(tmp.SnapshotRuntimeStats)\n\t\t}\n\t}\n\tif tmp.AllocatorRuntimeStats != nil {\n\t\tif e.AllocatorRuntimeStats == nil {\n\t\t\te.AllocatorRuntimeStats = tmp.AllocatorRuntimeStats.Clone()\n\t\t}\n\t}\n}", "func (a *AttributeDefinition) Merge(other *AttributeDefinition) *AttributeDefinition {\n\tif other == nil {\n\t\treturn a\n\t}\n\tif a == nil {\n\t\treturn other\n\t}\n\tleft := a.Type.(Object)\n\tright := other.Type.(Object)\n\tif left == nil || right == nil {\n\t\tpanic(\"cannot merge non object attributes\") // bug\n\t}\n\tfor n, v := range right {\n\t\tleft[n] = v\n\t}\n\treturn a\n}", "func (m *Merge) Merge(data interface{}, s *Sources) ([]MergedMeta, error) {\n\t// all types of data & sources must be the same\n\tif err := m.checkDataTypes(data, s); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := m.mergeSources(data, s.Sources()); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m.mergedMeta, nil\n}", "func (s *Storage) Merge(ctx context.Context,\n\tconv types.UnboxConversationInfo, uid gregor1.UID, msgs []chat1.MessageUnboxed) (res MergeResult, err Error) {\n\tvar ierr error\n\tdefer s.Trace(ctx, &ierr, \"Merge\")()\n\tdefer func() { ierr = s.castInternalError(err) }()\n\treturn s.MergeHelper(ctx, conv, uid, msgs, nil)\n}", "func (p PodSpec) Merge(other interface{}) interface{} {\n\tout := k8sV1.Pod{}\n\tk8sP := k8sV1.Pod(p)\n\tk8sOther := k8sV1.Pod(other.(PodSpec))\n\t// Copy the low-priority values first.\n\tk8sOther.DeepCopyInto(&out)\n\t// Overwrite the object with high-priority values.\n\t// DeepCopyInto will only copy non-nil values, so this will effectively merge the objects.\n\tk8sP.DeepCopyInto(&out)\n\treturn PodSpec(out)\n}", "func merge(obj reflect.Value, src reflect.Value, name string) reflect.Value {\n\t// fmt.Printf(\"merge(%T, %T, %v)\\n\", obj.Interface(), src.Interface(), name)\n\tassertTypeMatch(obj, src)\n\n\t// Always handle pointers first.\n\tif obj.Kind() == reflect.Ptr {\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t} else if src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t}\n\t\tout := reflect.New(obj.Elem().Type())\n\t\tout.Elem().Set(merge(obj.Elem(), src.Elem(), name))\n\t\treturn out.Convert(obj.Type())\n\t}\n\n\t// Next handle interfaces.\n\tif obj.Kind() == reflect.Interface {\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t} else if src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t}\n\t\treturn merge(obj.Elem(), src.Elem(), name)\n\t}\n\n\t// Handle the `T Mergable[T]` pseudointerface\n\tif out, ok := mergeIfMergable(obj, src); ok {\n\t\treturn out\n\t}\n\n\tswitch obj.Kind() {\n\tcase reflect.Struct:\n\t\t// Recurse into each field of the struct.\n\t\tout := reflect.New(obj.Type()).Elem()\n\t\tfor i := 0; i < src.NumField(); i++ {\n\t\t\tstructField := src.Type().Field(i)\n\t\t\tfieldName := fmt.Sprintf(\"%v.%v\", name, structField.Name)\n\t\t\tx := merge(obj.Field(i), src.Field(i), fieldName)\n\t\t\tout.Field(i).Set(x)\n\t\t}\n\t\treturn out.Convert(obj.Type())\n\n\tcase reflect.Map:\n\t\t// Handle unallocated maps on either input.\n\t\tif src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t} else if obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t}\n\t\t// allocate a new map\n\t\ttyp := reflect.MapOf(obj.Type().Key(), obj.Type().Elem())\n\t\tout := reflect.MakeMap(typ)\n\t\t// Iterate through keys and objects in obj.\n\t\titer := obj.MapRange()\n\t\tfor iter.Next() {\n\t\t\tkey := iter.Key()\n\t\t\tobjVal := iter.Value()\n\t\t\tif srcVal := src.MapIndex(key); srcVal.IsValid() {\n\t\t\t\t// Key present in both maps.\n\t\t\t\tout.SetMapIndex(key, merge(objVal, srcVal, name))\n\t\t\t} else {\n\t\t\t\t// Key is unique to obj.\n\t\t\t\tout.SetMapIndex(key, cpy(objVal))\n\t\t\t}\n\t\t}\n\t\t// Check for keys only present in src.\n\t\titer = src.MapRange()\n\t\tfor iter.Next() {\n\t\t\tkey := iter.Key()\n\t\t\tsrcVal := iter.Value()\n\t\t\tif objVal := obj.MapIndex(key); !objVal.IsValid() {\n\t\t\t\t// Key is unique to src.\n\t\t\t\tout.SetMapIndex(key, cpy(srcVal))\n\t\t\t}\n\t\t}\n\t\treturn out.Convert(obj.Type())\n\n\tcase reflect.Slice:\n\t\t// Slices are not merged by default. If obj is nil we copy the src.\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t}\n\t\treturn cpy(obj)\n\n\t// Assert that none of the \"complex\" kinds are present.\n\tcase reflect.Array,\n\t\treflect.Chan,\n\t\treflect.Func,\n\t\treflect.UnsafePointer,\n\t\t// We already handled Ptr and Interface.\n\t\treflect.Ptr,\n\t\treflect.Interface:\n\t\tpanic(fmt.Sprintf(\"unable to fill %T with %T at %v\", obj.Interface(), src.Interface(), name))\n\n\tdefault:\n\t\t// Simple kinds just get copied.\n\t\treturn cpy(obj)\n\t}\n}", "func (adp *s3Storage) Merge(ctx context.Context, filename string, data []byte) error {\n\thead, _ := adp.Read(ctx, filename)\n\tentire := append(head, data...)\n\n\treturn adp.Write(ctx, filename, entire)\n}", "func MergeRawExtension(base *runtime.RawExtension, patch *runtime.RawExtension) (*runtime.RawExtension, error) {\n\tpatchParameter, err := util.RawExtension2Map(patch)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to convert patch parameters to map\")\n\t}\n\tbaseParameter, err := util.RawExtension2Map(base)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to convert base parameters to map\")\n\t}\n\tif baseParameter == nil {\n\t\tbaseParameter = make(map[string]interface{})\n\t}\n\terr = mergo.Merge(&baseParameter, patchParameter, mergo.WithOverride)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to do merge with override\")\n\t}\n\tbs, err := json.Marshal(baseParameter)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to marshal merged properties\")\n\t}\n\treturn &runtime.RawExtension{Raw: bs}, nil\n}", "func Merge(mta *MTA, mtaExt *EXT) error {\n\terr := chain().\n\t\textendMap(&mta.Parameters, mta.ParametersMetaData, mtaExt.Parameters, mergeRootParametersErrorMsg, mtaExt.ID).\n\t\terr\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = mergeModules(*mta, mtaExt.Modules); err != nil {\n\t\treturn errors.Wrapf(err, mergeExtErrorMsg, mtaExt.ID)\n\t}\n\n\tif err = mergeResources(*mta, mtaExt.Resources); err != nil {\n\t\treturn errors.Wrapf(err, mergeExtErrorMsg, mtaExt.ID)\n\t}\n\n\treturn nil\n}" ]
[ "0.6919245", "0.6876494", "0.677364", "0.67681247", "0.6718128", "0.66429484", "0.66238296", "0.65589625", "0.64850235", "0.6484942", "0.6467155", "0.6446306", "0.64338857", "0.64224434", "0.6295442", "0.62707984", "0.62031484", "0.6185853", "0.6166469", "0.61020494", "0.60954565", "0.6086329", "0.60835016", "0.6075992", "0.60542864", "0.60468566", "0.6013963", "0.5978689", "0.5938421", "0.59361196", "0.5929734", "0.59112763", "0.5910173", "0.5905599", "0.5845597", "0.5820683", "0.5808344", "0.57977074", "0.5789647", "0.57715285", "0.5761175", "0.57571083", "0.5755264", "0.5754293", "0.5741091", "0.5741091", "0.5714663", "0.5708599", "0.57083744", "0.5692897", "0.5678442", "0.56670535", "0.56659544", "0.5625721", "0.5591824", "0.5577709", "0.5575605", "0.55690014", "0.55654955", "0.5554906", "0.55385506", "0.5523902", "0.55080056", "0.5501916", "0.549786", "0.549549", "0.54896456", "0.54824233", "0.5481796", "0.5480714", "0.5477638", "0.54749954", "0.54633", "0.54587066", "0.54564595", "0.54359704", "0.54272234", "0.54200757", "0.54163706", "0.53970516", "0.5384574", "0.537984", "0.5373966", "0.5372012", "0.5367562", "0.53652245", "0.5361693", "0.535352", "0.53253114", "0.53171384", "0.5316014", "0.5314407", "0.53051233", "0.52962387", "0.5284366", "0.52820027", "0.5280838", "0.52808356", "0.52712834", "0.52677524" ]
0.6040208
26
merge is the recursive layer under Merge. obj and src must always have the same type, and the return type will also be the same. The return value will never share memory with src, so it is safe to alter obj without affecting src after the fact.
func merge(obj reflect.Value, src reflect.Value, name string) reflect.Value { // fmt.Printf("merge(%T, %T, %v)\n", obj.Interface(), src.Interface(), name) assertTypeMatch(obj, src) // Always handle pointers first. if obj.Kind() == reflect.Ptr { if obj.IsZero() { return cpy(src) } else if src.IsZero() { return cpy(obj) } out := reflect.New(obj.Elem().Type()) out.Elem().Set(merge(obj.Elem(), src.Elem(), name)) return out.Convert(obj.Type()) } // Next handle interfaces. if obj.Kind() == reflect.Interface { if obj.IsZero() { return cpy(src) } else if src.IsZero() { return cpy(obj) } return merge(obj.Elem(), src.Elem(), name) } // Handle the `T Mergable[T]` pseudointerface if out, ok := mergeIfMergable(obj, src); ok { return out } switch obj.Kind() { case reflect.Struct: // Recurse into each field of the struct. out := reflect.New(obj.Type()).Elem() for i := 0; i < src.NumField(); i++ { structField := src.Type().Field(i) fieldName := fmt.Sprintf("%v.%v", name, structField.Name) x := merge(obj.Field(i), src.Field(i), fieldName) out.Field(i).Set(x) } return out.Convert(obj.Type()) case reflect.Map: // Handle unallocated maps on either input. if src.IsZero() { return cpy(obj) } else if obj.IsZero() { return cpy(src) } // allocate a new map typ := reflect.MapOf(obj.Type().Key(), obj.Type().Elem()) out := reflect.MakeMap(typ) // Iterate through keys and objects in obj. iter := obj.MapRange() for iter.Next() { key := iter.Key() objVal := iter.Value() if srcVal := src.MapIndex(key); srcVal.IsValid() { // Key present in both maps. out.SetMapIndex(key, merge(objVal, srcVal, name)) } else { // Key is unique to obj. out.SetMapIndex(key, cpy(objVal)) } } // Check for keys only present in src. iter = src.MapRange() for iter.Next() { key := iter.Key() srcVal := iter.Value() if objVal := obj.MapIndex(key); !objVal.IsValid() { // Key is unique to src. out.SetMapIndex(key, cpy(srcVal)) } } return out.Convert(obj.Type()) case reflect.Slice: // Slices are not merged by default. If obj is nil we copy the src. if obj.IsZero() { return cpy(src) } return cpy(obj) // Assert that none of the "complex" kinds are present. case reflect.Array, reflect.Chan, reflect.Func, reflect.UnsafePointer, // We already handled Ptr and Interface. reflect.Ptr, reflect.Interface: panic(fmt.Sprintf("unable to fill %T with %T at %v", obj.Interface(), src.Interface(), name)) default: // Simple kinds just get copied. return cpy(obj) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Merge[T any](obj T, src T) T {\n\tname := fmt.Sprintf(\"%T\", obj)\n\n\tvObj := reflect.ValueOf(obj)\n\tvSrc := reflect.ValueOf(src)\n\n\t// obj must have the same type as src.\n\tassertTypeMatch(vObj, vSrc)\n\n\treturn merge(vObj, vSrc, name).Interface().(T)\n}", "func UnionMerge[T any](obj T, src T) T {\n\tname := fmt.Sprintf(\"%T\", obj)\n\n\tvObj := reflect.ValueOf(obj)\n\tvSrc := reflect.ValueOf(src)\n\n\t// obj must have the same type as src.\n\tassertTypeMatch(vObj, vSrc)\n\n\tif vObj.Kind() != reflect.Struct {\n\t\tpanic(\"UnionMerge must only be called on struct types\")\n\t}\n\n\treturn unionMerge(vObj, vSrc, name).Interface().(T)\n}", "func mergeIfMergable(obj reflect.Value, src reflect.Value) (reflect.Value, bool) {\n\tvar out reflect.Value\n\n\t// Look for the .WithDefaults method.\n\tmeth, ok := obj.Type().MethodByName(\"Merge\")\n\tif !ok {\n\t\treturn out, false\n\t}\n\n\t// Verify the signature matches our Mergable psuedointerface:\n\t// - two inputs (the receiver), and one output\n\t// - input types match output type exactly (disallow the usual pointer receiver semantics)\n\tif meth.Type.NumIn() != 2 || meth.Type.NumOut() != 1 {\n\t\treturn out, false\n\t}\n\tif meth.Type.In(0) != meth.Type.In(1) || meth.Type.In(0) != meth.Type.Out(0) {\n\t\treturn out, false\n\t}\n\n\t// Psuedointerface matches, call the .Merge method.\n\tout = meth.Func.Call([]reflect.Value{obj, src})[0]\n\n\treturn out, true\n}", "func merge(dst, src any, opts ...func(*mergeConfig)) error {\n\tif dst == nil || src == nil {\n\t\t// Nothing available to merge if dst or src are nil.\n\t\t// This can occur early on in reconciliation when the\n\t\t// status subresource has not been set yet.\n\t\treturn nil\n\t}\n\n\tconfig := &mergeConfig{}\n\n\tfor _, opt := range opts {\n\t\topt(config)\n\t}\n\n\tdstMap, ok := dst.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedDstObject)\n\t}\n\n\tsrcMap, ok := src.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedSrcObject)\n\t}\n\n\treturn mergo.Merge(&dstMap, filter(srcMap, config.srcfilter...), config.mergeOptions...)\n}", "func (p *parser) merge() {\n\tif p.cur+1 >= len(p.src) {\n\t\treturn\n\t}\n\tp.src = append(p.src[:p.cur], p.src[p.cur+1:]...)\n}", "func Merge(original interface{}, update interface{}) (merged interface{}, err error) {\n\n\tif original == nil {\n\t\treturn update, nil\n\t}\n\n\tif update == nil {\n\t\treturn original, nil\n\t}\n\n\t// call the recursive merge\n\treturn merge(original, update)\n}", "func merge(dst interface{}, src interface{}) (interface{}, error) {\n\tswitch dstType := dst.(type) {\n\tcase []interface{}:\n\t\tsrcSlice, ok := src.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%w: []interface{} with %T\", errCannotMerge, src)\n\t\t}\n\n\t\treturn append(dstType, srcSlice...), nil\n\tcase map[string]interface{}:\n\t\tsrcMap, ok := src.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%w: map[string]interface{} with %T\", errCannotMerge, src)\n\t\t}\n\n\t\tfor key, value := range srcMap {\n\t\t\tdstType[key] = value\n\t\t}\n\n\t\treturn dstType, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%w: unsupported type %T\", errCannotMerge, dst)\n\t}\n}", "func (oldStruct *object) merge(newStruct object) {\n\tif newStruct.ID != 0 {\n\t\toldStruct.ID = newStruct.ID\n\t}\n\n\tif newStruct.Name != \"\" {\n\t\toldStruct.Name = newStruct.Name\n\t}\n\n\tif newStruct.Value != \"\" {\n\t\toldStruct.Value = newStruct.Value\n\t}\n}", "func merge(dest *config, src config) {\n\tmergo.Merge(dest, src, mergo.WithOverride)\n}", "func Merge(src interface{}, dst interface{}, ignore ...string) interface{} {\n\tsrcStruct := ST.New(src)\n\tdstStruct := ST.New(dst)\nmain:\n\tfor _, field := range srcStruct.Fields() {\n\t\t_, ok := dstStruct.FieldOk(field.Name())\n\t\tif !ok {\n\n\t\t\tcontinue\n\t\t}\n\t\tfor _, ign := range ignore {\n\t\t\t//skip field if it's on the ignore list\n\t\t\tif ign == field.Name() {\n\t\t\t\tcontinue main\n\t\t\t}\n\t\t}\n\t\terr := dstStruct.Field(field.Name()).Set(field.Value())\n\t\tif nil != err {\n\t\t\tlog.Error(\"Failed to assign value from to field \", field.Name(), \" got error \", err)\n\t\t}\n\t}\n\treturn dst\n}", "func Merge(target, source interface{}, opt *Options) error {\n\tvT := reflect.ValueOf(target)\n\tvS := reflect.ValueOf(source)\n\n\tif target != nil && vT.Type() == valType {\n\t\tvT = vT.Interface().(reflect.Value)\n\t}\n\tif source != nil && vS.Type() == valType {\n\t\tvS = vS.Interface().(reflect.Value)\n\t}\n\n\tif vT.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"target must be a pointer\")\n\t}\n\n\tif !reflect.Indirect(vT).IsValid() {\n\t\treturn errors.New(\"target can not be zero value\")\n\t}\n\n\t// use defaults if none are provided\n\tif opt == nil {\n\t\topt = NewOptions()\n\t}\n\n\tif opt.mergeFuncs == nil {\n\t\treturn errors.New(\"invalid options, use NewOptions() to generate and then modify as needed\")\n\t}\n\n\t//make a copy here so if there is an error mid way, the target stays in tact\n\tcp := vT.Elem()\n\n\tmerged, err := merge(cp, reflect.Indirect(vS), opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !isSettable(vT.Elem(), merged) {\n\t\treturn fmt.Errorf(\"Merge failed: expected merged result to be %v but got %v\",\n\t\t\tvT.Elem().Type(), merged.Type())\n\t}\n\n\tvT.Elem().Set(merged)\n\treturn nil\n}", "func unionMerge(obj reflect.Value, src reflect.Value, name string) reflect.Value {\n\tout := reflect.New(obj.Type()).Elem()\n\n\tmergeField := func(i int) {\n\t\tstructField := obj.Type().Field(i)\n\t\tfieldName := fmt.Sprintf(\"%v.%v\", name, structField.Name)\n\t\tx := merge(obj.Field(i), src.Field(i), fieldName)\n\t\tout.Field(i).Set(x)\n\t}\n\n\t// Iterate through all the fields of the struct once, identifying union members and merging\n\t// the non-union members.\n\tobjHasMember := -1\n\tsrcHasMember := -1\n\tfor i := 0; i < src.NumField(); i++ {\n\t\tif _, ok := obj.Type().Field(i).Tag.Lookup(\"union\"); ok {\n\t\t\t// Union member, remember it for later.\n\t\t\tif !obj.Field(i).IsZero() {\n\t\t\t\tobjHasMember = i\n\t\t\t}\n\t\t\tif !src.Field(i).IsZero() {\n\t\t\t\tsrcHasMember = i\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Non-union member, merge it normally.\n\t\tmergeField(i)\n\t}\n\tif objHasMember > -1 {\n\t\t// When obj has a union member, we can only merge that union member.\n\t\tmergeField(objHasMember)\n\t} else if srcHasMember > -1 {\n\t\t// Otherwise we merge whatever the src has defined.\n\t\tmergeField(srcHasMember)\n\t}\n\treturn out.Convert(obj.Type())\n}", "func merge(left, right *mapNode) *mapNode {\n\tswitch {\n\tcase left == nil:\n\t\treturn right.incref()\n\tcase right == nil:\n\t\treturn left.incref()\n\tcase left.weight > right.weight:\n\t\troot := left.shallowCloneWithRef()\n\t\troot.left = left.left.incref()\n\t\troot.right = merge(left.right, right)\n\t\treturn root\n\tdefault:\n\t\troot := right.shallowCloneWithRef()\n\t\troot.left = merge(left, right.left)\n\t\troot.right = right.right.incref()\n\t\treturn root\n\t}\n}", "func Merge(dst, src []byte) ([]byte, error) {\n\tvar dstM, srcM map[string]interface{}\n\tif len(dst) == 0 {\n\t\tdstM = make(map[string]interface{})\n\t} else {\n\t\terr := json.Unmarshal(dst, &dstM)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\terr := json.Unmarshal(src, &srcM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = applyValues(dstM, srcM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.Marshal(dstM)\n}", "func (b *BaseImpl) Merge() {\n\tb.Flatten()\n}", "func (m *Merge) merge(travVals *traversedValues) error {\n\tswitch travVals.data.Kind() {\n\tcase reflect.Struct:\n\t\tfor i := 0; i < travVals.data.NumField(); i++ {\n\t\t\tnewTravVals := newTraversedValues()\n\t\t\tnewTravVals.data = travVals.data.Field(i)\n\t\t\tfor _, s := range travVals.sources {\n\t\t\t\tnewTravVals.sources = append(newTravVals.sources, &traversedSource{\n\t\t\t\t\tname: s.name,\n\t\t\t\t\tdata: s.data.Field(i),\n\t\t\t\t})\n\t\t\t}\n\t\t\tnewTravVals.joinFieldPath(travVals.fieldPath, travVals.data.Type().Field(i).Name)\n\n\t\t\terr := m.merge(newTravVals)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\tcase reflect.Ptr:\n\t\tswitch travVals.data.Type().Elem().Kind() {\n\t\tcase reflect.Struct, reflect.Map, reflect.Slice, reflect.Array, reflect.Interface, reflect.Ptr:\n\t\t\treturn errors.Wrapf(errUnsupportedType, \"merge: `%s`\", travVals.data.Type().Elem().Kind())\n\t\tcase reflect.Invalid:\n\t\t\treturn errReallyWrong\n\t\tdefault:\n\t\t\tselectedValue, selectedSource, err := m.selectValue(travVals)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttravVals.data.Set(selectedValue)\n\n\t\t\tm.mergedMeta = append(m.mergedMeta, MergedMeta{\n\t\t\t\tFieldPath: travVals.fieldPath,\n\t\t\t\tSource: selectedSource,\n\t\t\t\tValue: fmt.Sprintf(\"%+v\", selectedValue.Elem()),\n\t\t\t})\n\t\t}\n\tcase reflect.Invalid:\n\t\treturn errReallyWrong\n\tdefault:\n\t\treturn errors.Wrapf(errUnsupportedType, \"merge: `%s`\", travVals.data.Kind())\n\t}\n\n\treturn nil\n}", "func (dst *Worker) Merge(src Worker) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Command != \"\" {\n\t\tdst.Command = src.Command\n\t}\n\tif len(src.Commands) > 0 {\n\t\tdst.Commands = strings.Unique(append(dst.Commands, src.Commands...))\n\t}\n\tif src.Replicas != 0 {\n\t\tdst.Replicas = src.Replicas\n\t}\n\tif src.LivenessProbe != \"\" {\n\t\tdst.LivenessProbe = src.LivenessProbe\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Resources != nil && dst.Resources == nil {\n\t\tdst.Resources = new(Resources)\n\t}\n\tdst.Resources.Merge(src.Resources)\n}", "func Merge(object interface{}, overwriteObject interface{}) {\n\tobjectPointerUnsafe := unsafe.Pointer(&object)\n\toverwriteObjectPointerUnsafe := unsafe.Pointer(&overwriteObject)\n\n\tmerge(object, overwriteObject, objectPointerUnsafe, overwriteObjectPointerUnsafe)\n}", "func (t *Indexed) merge(l, r *Node) (root *Node) {\n\tif l == nil {\n\t\treturn r\n\t}\n\tif r == nil {\n\t\treturn l\n\t}\n\tif l.key > r.key {\n\t\tl, r = r, l\n\t}\n\tif l.p > r.p {\n\t\tsubR := t.merge(l.right, r)\n\t\tsubR.SetParent(l)\n\t\tl.right = subR\n\t\treturn l\n\t}\n\tsubL := t.merge(l, r.left)\n\tsubL.SetParent(r)\n\tr.left = subL\n\treturn r\n}", "func (s *EnvironmentSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (obj object) Merge(other Object) (Object, bool) {\n\treturn obj.MergeWith(other, func(v1, v2 *Term) (*Term, bool) {\n\t\tobj1, ok1 := v1.Value.(Object)\n\t\tobj2, ok2 := v2.Value.(Object)\n\t\tif !ok1 || !ok2 {\n\t\t\treturn nil, true\n\t\t}\n\t\tobj3, ok := obj1.Merge(obj2)\n\t\tif !ok {\n\t\t\treturn nil, true\n\t\t}\n\t\treturn NewTerm(obj3), false\n\t})\n}", "func (res *ruleMatchResults) merge(other ruleMatchResults) *ruleMatchResults {\n\tif res.cutoverNanos < other.cutoverNanos {\n\t\tres.cutoverNanos = other.cutoverNanos\n\t}\n\tres.pipelines = append(res.pipelines, other.pipelines...)\n\treturn res\n}", "func Merge(dst, src map[string]interface{}) (interface{}, error) {\n\treturn merge(dst, src)\n}", "func (s *segment) merge(oth *segment) {\n\ts.pkt.Data().Merge(oth.pkt.Data())\n\ts.dataMemSize = s.pkt.MemSize()\n\toth.dataMemSize = oth.pkt.MemSize()\n}", "func (d *dataUsageCache) merge(other dataUsageCache) {\n\texistingRoot := d.root()\n\totherRoot := other.root()\n\tif existingRoot == nil && otherRoot == nil {\n\t\treturn\n\t}\n\tif otherRoot == nil {\n\t\treturn\n\t}\n\tif existingRoot == nil {\n\t\t*d = other.clone()\n\t\treturn\n\t}\n\tif other.Info.LastUpdate.After(d.Info.LastUpdate) {\n\t\td.Info.LastUpdate = other.Info.LastUpdate\n\t}\n\texistingRoot.merge(*otherRoot)\n\teHash := d.rootHash()\n\tfor key := range otherRoot.Children {\n\t\tentry := other.Cache[key]\n\t\tflat := other.flatten(entry)\n\t\texisting := d.Cache[key]\n\t\t// If not found, merging simply adds.\n\t\texisting.merge(flat)\n\t\td.replaceHashed(dataUsageHash(key), &eHash, existing)\n\t}\n}", "func (obj object) MergeWith(other Object, conflictResolver func(v1, v2 *Term) (*Term, bool)) (Object, bool) {\n\tresult := NewObject()\n\tstop := obj.Until(func(k, v *Term) bool {\n\t\tv2 := other.Get(k)\n\t\t// The key didn't exist in other, keep the original value\n\t\tif v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t\treturn false\n\t\t}\n\n\t\t// The key exists in both, resolve the conflict if possible\n\t\tmerged, stop := conflictResolver(v, v2)\n\t\tif !stop {\n\t\t\tresult.Insert(k, merged)\n\t\t}\n\t\treturn stop\n\t})\n\n\tif stop {\n\t\treturn nil, false\n\t}\n\n\t// Copy in any values from other for keys that don't exist in obj\n\tother.Foreach(func(k, v *Term) {\n\t\tif v2 := obj.Get(k); v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t}\n\t})\n\treturn result, true\n}", "func (s *CommandLineSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (h HyperparameterV0) Merge(other interface{}) interface{} {\n\t// Never merge partial hyperparameters.\n\treturn h\n}", "func mergeRecursive(left, right interface{}) interface{} {\n\tif left == nil {\n\t\treturn right\n\t}\n\tif right == nil {\n\t\treturn left\n\t}\n\tmLeft, okLeft := left.(map[string]interface{})\n\tmRight, okRight := right.(map[string]interface{})\n\tif !okLeft || !okRight {\n\t\treturn right\n\t}\n\tfor key, val := range mRight {\n\t\tvalLeft, ok := mLeft[key]\n\t\tif ok {\n\t\t\tmLeft[key] = mergeRecursive(valLeft, val)\n\t\t} else {\n\t\t\tmLeft[key] = val\n\t\t}\n\t}\n\treturn mLeft\n}", "func (p *ErrorHandlingPolicy) Merge(src ErrorHandlingPolicy) {\n\tif p.IgnoreFileErrors == nil && src.IgnoreFileErrors != nil {\n\t\tp.IgnoreFileErrors = newBool(*src.IgnoreFileErrors)\n\t}\n\n\tif p.IgnoreDirectoryErrors == nil && src.IgnoreDirectoryErrors != nil {\n\t\tp.IgnoreDirectoryErrors = newBool(*src.IgnoreDirectoryErrors)\n\t}\n}", "func MergeWithExisting(genFile, oldFile *bf.File) *bf.File {\n\tif oldFile == nil {\n\t\treturn genFile\n\t}\n\tif shouldIgnore(oldFile) {\n\t\treturn nil\n\t}\n\n\tmergedFile := *oldFile\n\tmergedFile.Stmt = make([]bf.Expr, len(oldFile.Stmt))\n\tfor i := range oldFile.Stmt {\n\t\tmergedFile.Stmt[i] = oldFile.Stmt[i]\n\t}\n\n\tvar newStmt []bf.Expr\n\tfor _, s := range genFile.Stmt {\n\t\tgenRule, ok := s.(*bf.CallExpr)\n\t\tif !ok {\n\t\t\tlog.Panicf(\"got %v expected only CallExpr in %q\", s, genFile.Path)\n\t\t}\n\t\ti, oldRule := match(&mergedFile, genRule)\n\t\tif oldRule == nil {\n\t\t\tnewStmt = append(newStmt, genRule)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar mergedRule bf.Expr\n\t\tif kind(oldRule) == \"load\" {\n\t\t\tmergedRule = mergeLoad(genRule, oldRule, oldFile)\n\t\t} else {\n\t\t\tmergedRule = mergeRule(genRule, oldRule)\n\t\t}\n\t\tmergedFile.Stmt[i] = mergedRule\n\t}\n\n\tmergedFile.Stmt = append(mergedFile.Stmt, newStmt...)\n\treturn &mergedFile\n}", "func (f *First) Merge(ctx *sql.Context, buffer, partial sql.Row) error {\n\treturn nil\n}", "func (s *YAMLFileSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (bpt *BplusTree) merge(parent *treeNode, curr *treeNode, currNodeIdx int,\n\tsibling *treeNode, siblIndex int, direction SearchDirection) error {\n\n\t// If merging with right sibling then append right sibling's chilren\n\t// to current node, otherwise append current nodes' children to left\n\t// sibling.\n\tvar cIndex int\n\n\t// save all nodes before modifying.\n\tbpt.tracker.origNodes.AddIfNotPresent(curr.NodeKey, curr)\n\tif sibling != nil {\n\t\tbpt.tracker.origNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t}\n\tbpt.tracker.origNodes.AddIfNotPresent(parent.NodeKey, parent)\n\tswitch {\n\tcase direction == Right:\n\t\tglog.V(2).Infof(\"merging %v and right sibling %v\\n\", curr, sibling)\n\t\tcurr.Children = append(curr.Children, sibling.Children...)\n\t\tcurr.NextKey = sibling.NextKey\n\t\t// current is modified, add that to updatedNodes tracker.\n\t\tbpt.tracker.updatedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\tif !sibling.NextKey.IsNil() {\n\t\t\tsibnext, err := bpt.fetch(sibling.NextKey)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"failed to fetch %v during merge (err: %v)\",\n\t\t\t\t\tsibling.NextKey, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbpt.tracker.origNodes.AddIfNotPresent(sibnext.NodeKey, sibnext)\n\t\t\tsibnext.PrevKey = curr.NodeKey\n\t\t\tbpt.tracker.updatedNodes.AddIfNotPresent(sibnext.NodeKey, sibnext)\n\t\t}\n\t\t// sibling is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t\t// drop the entry of the right node from parent's children.\n\t\tparent.Children = append(parent.Children[:siblIndex],\n\t\t\tparent.Children[siblIndex+1:]...)\n\t\tcIndex = currNodeIdx\n\tcase direction == Left:\n\t\tglog.V(2).Infof(\"merging left sibling %v and %v\\n\", sibling, curr)\n\t\tsibling.Children = append(sibling.Children, curr.Children...)\n\t\tsibling.NextKey = curr.NextKey\n\t\t// sibling is modified, add that to updatedNodes tracker.\n\t\tbpt.tracker.updatedNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t\tif !curr.NextKey.IsNil() {\n\t\t\tcurrnext, err := bpt.fetch(curr.NextKey)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"failed to fetch %v during merge (err: %v)\",\n\t\t\t\t\tcurr.NextKey, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbpt.tracker.origNodes.AddIfNotPresent(currnext.NodeKey, currnext)\n\t\t\tcurrnext.PrevKey = sibling.NodeKey\n\t\t\tbpt.tracker.updatedNodes.AddIfNotPresent(currnext.NodeKey, currnext)\n\t\t}\n\t\t// current node is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\t// drop the entry of the current node from parent's children.\n\t\t// Note that if current node is rightmost node, then we need to handle\n\t\t// that specially.\n\t\tif siblIndex == (len(parent.Children) - 2) {\n\t\t\tparent.Children = parent.Children[:siblIndex+1]\n\t\t} else {\n\t\t\tparent.Children = append(parent.Children[:siblIndex+1],\n\t\t\t\tparent.Children[siblIndex+2:]...)\n\t\t}\n\t\tcIndex = siblIndex\n\tdefault: // Merging with parent.\n\t\tglog.V(2).Infof(\"merging Parent %v and %v\\n\", parent, curr)\n\t\t// curr is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\tparent.Children = curr.Children\n\t\tparent.IsLeaf = curr.IsLeaf\n\t}\n\n\t// Parent's children has been modified. update tracker and dataKey\n\tbpt.tracker.updatedNodes.AddIfNotPresent(parent.NodeKey, parent)\n\t_, err := parent.updateDataKey(bpt, cIndex, nil)\n\treturn err\n}", "func mergeReplace(path string, src, dst runtime.Object, mo *xpv1.MergeOptions) error {\n\tcopySrc := src.DeepCopyObject()\n\tif err := mergePath(path, copySrc, dst, mo); err != nil {\n\t\treturn err\n\t}\n\t// replace desired object's value at fieldPath with\n\t// the computed (merged) current value at the same path\n\treturn mergePath(path, dst, copySrc, nil)\n}", "func merge(original interface{}, update interface{}) (merged interface{}, err error) {\n\n\tlogger.Info(\"Merging\", \"original\", original, \"update\", update)\n\n\tswitch O := original.(type) {\n\n\tcase map[string]interface{}:\n\t\tU, ok := update.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"update is not mS like original\")\n\t\t}\n\t\tlogger.Info(\"mS entering\")\n\t\tfor key, val := range U {\n\t\t\tlogger.Debug(\"in merge mS-U\", \"key\", key, \"val\", val, \"curr\", O[key])\n\t\t\tif curr, exists := O[key]; exists {\n\t\t\t\ttmp, err := merge(curr, val)\n\t\t\t\tlogger.Debug(\"after merge mS\", \"tmp\", tmp, \"err\", err)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"in merge mS\")\n\t\t\t\t}\n\t\t\t\tO[key] = tmp\n\t\t\t} else {\n\t\t\t\tO[key] = val\n\t\t\t}\n\t\t}\n\t\tlogger.Info(\"mS returning\", \"O\", O)\n\t\treturn O, nil\n\n\tcase []interface{}:\n\t\tU, ok := update.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"update is not aI like original\")\n\t\t}\n\t\t// logger.Warn(\"O\", \"data\", O)\n\t\t// logger.Warn(\"U\", \"data\", U)\n\n\t\tlogger.Info(\"aI entering\")\n\t\t// turn update into map\n\t\tUM := map[string]interface{}{}\n\t\tfor i, elem := range U {\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\t\t\t\tUM[name.(string)] = E\n\n\t\t\tcase string:\n\t\t\t\tUM[E] = E\n\n\t\t\tdefault:\n\t\t\t\tlogger.Error(\"original unknown elem type in aI\", \"i\", i, \"elem\", elem)\n\t\t\t\treturn nil, errors.New(\"original unknown elem type in aI\")\n\t\t\t}\n\t\t}\n\n\t\tfor i, elem := range O {\n\t\t\t// logger.Crit(\"O-loop\", \"i\", i, \"elem\", elem)\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tiname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\n\t\t\t\tname := iname.(string)\n\t\t\t\t// logger.Error(\"Name\", \"name\", name)\n\n\t\t\t\tcurr, exists := UM[name]\n\t\t\t\tif exists {\n\t\t\t\t\ttmp, err := merge(elem, curr)\n\t\t\t\t\t// this is correct, the var names curr and elem are backwards...\n\t\t\t\t\t// busy fixing a bug\n\t\t\t\t\t// logger.Crit(\"merging with existing element\", \"key\", name, \"val\", curr, \"curr\", elem)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, errors.Wrap(err, \"in merge MS\")\n\t\t\t\t\t}\n\t\t\t\t\tO[i] = tmp\n\t\t\t\t\tdelete(UM, name)\n\t\t\t\t}\n\t\t\tcase string:\n\t\t\t\t_, exists := UM[E]\n\t\t\t\tif exists {\n\t\t\t\t\tdelete(UM, E)\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tlogger.Error(\"original unknown elem type in aI\", \"i\", i, \"elem\", elem)\n\t\t\t\treturn nil, errors.New(\"original unknown elem type in aI\")\n\t\t\t}\n\t\t}\n\t\t// merge\n\t\tlogger.Info(\"aI\")\n\n\t\t// turn back into array\n\t\tOA := []interface{}{}\n\t\tfor _, val := range O {\n\t\t\tOA = append(OA, val)\n\t\t}\n\t\tfor _, elem := range U {\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\t\t\t\t_, exists := UM[name.(string)]\n\t\t\t\tif exists {\n\t\t\t\t\tOA = append(OA, elem)\n\t\t\t\t}\n\n\t\t\tcase string:\n\t\t\t\t_, exists := UM[E]\n\t\t\t\tif exists {\n\t\t\t\t\tOA = append(OA, elem)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// logger.Error(\"OA\", \"data\", OA)\n\n\t\tlogger.Info(\"aI returning\", \"OA\", OA)\n\t\treturn OA, nil\n\n\tcase string:\n\t\treturn update, nil\n\n\tdefault:\n\t\treturn nil, errors.New(\"unmergable original\" + fmt.Sprintf(\"%t, %+v\", original, original))\n\n\t}\n\n\tlogger.Crit(\"Shouldn't get here (end of merge function)\")\n\treturn nil, errors.New(\"PANIC, should not get here\")\n}", "func (ctx *RequestContext) safeMerge(src, dst reflect.Value) (err error) {\n\tty := dst.Type()\n\tfor i := 0; i < dst.NumField(); i++ {\n\t\tw := ty.Field(i).Tag.Get(\"writeRight\")\n\t\tif w == \"\" || ctx.HasRight(w) {\n\t\t\tsrcField := src.Field(i)\n\t\t\tdstField := dst.Field(i)\n\t\t\tif isRecursibleType(srcField) {\n\t\t\t\terr = ctx.safeMerge(srcField, dstField)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdstField.Set(srcField)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func GenMergePatch(originalObj interface{}, modifiedObj interface{}) ([]byte, error) {\n\toriginalBytes, err := json.Marshal(originalObj)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal original object: %w\", err)\n\t}\n\tmodifiedBytes, err := json.Marshal(modifiedObj)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal modified object: %w\", err)\n\t}\n\tpatchBytes, err := jsonpatch.CreateMergePatch(originalBytes, modifiedBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create a merge patch: %w\", err)\n\t}\n\n\t// It's unnecessary to patch.\n\tif string(patchBytes) == \"{}\" {\n\t\treturn nil, nil\n\t}\n\n\treturn patchBytes, nil\n}", "func (mt *MerkleTree) Merge(lt, rt *MerkleTree) *MerkleTree {\n\tif lt == nil || rt == nil {\n\t\treturn mt\n\t}\n\n\tmt.leftTree = lt\n\tmt.rightTree = rt\n\tmt.updateHashCode()\n\n\treturn mt\n}", "func (s *MapSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (mdl *Model) Merge(model std.Model) error {\n\treturn nil\n}", "func Merge(dest interface{}, source interface{}) error {\n\topts := make([]func(*mergo.Config), 0)\n\n\t// lists are always overridden - we don't append merged lists since it generally makes things more complicated\n\topts = append(opts, mergo.WithOverride)\n\n\terr := mergo.Merge(dest, source, opts...)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "func mergePath(path string, dst, src runtime.Object, mergeOptions *xpv1.MergeOptions) error {\n\tsrcPaved, err := fieldpath.PaveObject(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tval, err := srcPaved.GetValue(path)\n\t// if src has no value at the specified path, then nothing to merge\n\tif fieldpath.IsNotFound(err) || val == nil {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn patchFieldValueToObject(path, val, dst, mergeOptions)\n}", "func (m *resourceInfo) merge(info IPMetadata, src source.Source) {\n\tswitch info := info.(type) {\n\tcase labels.Labels:\n\t\tl := labels.NewLabelsFromModel(nil)\n\t\tl.MergeLabels(info)\n\t\tm.labels = l\n\tdefault:\n\t\tlog.Errorf(\"BUG: Invalid IPMetadata passed to ipinfo.merge(): %+v\", info)\n\t\treturn\n\t}\n\tm.source = src\n}", "func (r Rule) Merge(o Rule) Rule {\n\tcopy := r\n\tcopy.Launch = map[ExecName]*types.Any{}\n\tfor k, v := range r.Launch {\n\t\tvar c types.Any\n\t\tif v != nil {\n\t\t\tc = *v\n\t\t}\n\t\tcopy.Launch[k] = &c\n\t}\n\n\tif r.Key != o.Key {\n\t\treturn copy\n\t}\n\tfor k, v := range o.Launch {\n\t\tvar c types.Any\n\t\tif v != nil {\n\t\t\tc = *v\n\t\t}\n\t\tcopy.Launch[k] = &c\n\t}\n\treturn copy\n}", "func Merge(base, overrides interface{}) error {\n\tbaseBytes, err := json.Marshal(base)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\toverrideBytes, err := json.Marshal(overrides)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\tpatchMeta, err := strategicpatch.NewPatchMetaFromStruct(base)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to produce patch meta from struct\")\n\t}\n\tpatch, err := strategicpatch.CreateThreeWayMergePatch(overrideBytes, overrideBytes, baseBytes, patchMeta, true)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to create three way merge patch\")\n\t}\n\n\tmerged, err := strategicpatch.StrategicMergePatchUsingLookupPatchMeta(baseBytes, patch, patchMeta)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to apply patch\")\n\t}\n\n\tvalueOfBase := reflect.Indirect(reflect.ValueOf(base))\n\tinto := reflect.New(valueOfBase.Type())\n\tif err := json.Unmarshal(merged, into.Interface()); err != nil {\n\t\treturn err\n\t}\n\tif !valueOfBase.CanSet() {\n\t\treturn errors.New(\"unable to set unmarshalled value into base object\")\n\t}\n\tvalueOfBase.Set(reflect.Indirect(into))\n\treturn nil\n}", "func (a Annotation) Merge(other schema.Annotation) schema.Annotation {\n\tvar ant Annotation\n\tswitch other := other.(type) {\n\tcase Annotation:\n\t\tant = other\n\tcase *Annotation:\n\t\tif other != nil {\n\t\t\tant = *other\n\t\t}\n\tdefault:\n\t\treturn a\n\t}\n\tif tag := ant.StructTag; tag != \"\" {\n\t\ta.StructTag = tag\n\t}\n\treturn a\n}", "func merge(new, dst *Range) bool {\n\tif new.End() < dst.Pos {\n\t\treturn false\n\t}\n\tif new.End() > dst.End() {\n\t\tdst.Size = new.Size\n\t} else {\n\t\tdst.Size += dst.Pos - new.Pos\n\t}\n\tdst.Pos = new.Pos\n\treturn true\n}", "func (c *HashChain) Merge(src *HashChain) error {\n\ti := 0\n\tfor ; i < len(c.chain) && i < len(src.chain); i++ {\n\t\tif !linkEqual(c.chain[i], src.chain[i]) {\n\t\t\treturn ErrCannotMerge\n\t\t}\n\t}\n\tif len(src.chain) < len(c.chain) {\n\t\treturn ErrNothingToMerge\n\t}\n\tfor ; i < len(src.chain); i++ {\n\t\tvar l link\n\t\tl = *src.chain[i]\n\t\tc.chain = append(c.chain, &l)\n\t\t// Verifiying the entire chain after every entry is a bit excessive,\n\t\t// especially because src is already verified.\n\t\t// But better be safe than sorry.\n\t\tif err := c.verify(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// save\n\t\tif _, err := fmt.Fprintln(c.fp, l.String()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func merge(dst, src *unstructured.Unstructured) bool {\n\tdstNS := dst.GetLabels()[resourceLabelNamespace]\n\tsrcNS := src.GetLabels()[resourceLabelNamespace]\n\tif dstNS != srcNS {\n\t\treturn false\n\t}\n\n\tif dstResults, ok, _ := unstructured.NestedSlice(dst.UnstructuredContent(), \"results\"); ok {\n\t\tif srcResults, ok, _ := unstructured.NestedSlice(src.UnstructuredContent(), \"results\"); ok {\n\t\t\tdstResults = append(dstResults, srcResults...)\n\n\t\t\tif err := unstructured.SetNestedSlice(dst.UnstructuredContent(), dstResults, \"results\"); err == nil {\n\t\t\t\taddSummary(dst, src)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func merge(rw http.ResponseWriter, req *http.Request) {\r\n\t// Decode the POST body\r\n\tdecoder := json.NewDecoder(req.Body)\r\n\tvar model distributed.MergeRequestModel\r\n\terr := decoder.Decode(&model)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tleft := model.Left\r\n\tright := model.Right\r\n\tsize, i, j := len(left)+len(right), 0, 0\r\n\tslice := make([]int, size, size)\r\n\r\n\tfor k := 0; k < size; k++ {\r\n\t\tif i > len(left)-1 && j <= len(right)-1 {\r\n\t\t\tslice[k] = right[j]\r\n\t\t\tj++\r\n\t\t} else if j > len(right)-1 && i <= len(left)-1 {\r\n\t\t\tslice[k] = left[i]\r\n\t\t\ti++\r\n\t\t} else if left[i] < right[j] {\r\n\t\t\tslice[k] = left[i]\r\n\t\t\ti++\r\n\t\t} else {\r\n\t\t\tslice[k] = right[j]\r\n\t\t\tj++\r\n\t\t}\r\n\t}\r\n\r\n\tresponseModel := distributed.MergeResponseModel{slice}\r\n\r\n\t// Parse the response model into a writable format\r\n\tresString, err := json.Marshal(responseModel)\r\n\r\n\trw.Write(resString)\r\n}", "func mergeObjects(live, obj runtime.Object) error {\n\t// Service's clusterIP needs to be re-set to the value provided\n\t// by controller or mutation will be denied.\n\tif liveSvc, ok := live.(*corev1.Service); ok {\n\t\tsvc := obj.(*corev1.Service)\n\t\tsvc.Spec.ClusterIP = liveSvc.Spec.ClusterIP\n\n\t\tgotPort := liveSvc.Spec.HealthCheckNodePort\n\t\twantPort := svc.Spec.HealthCheckNodePort\n\t\t// If port is set (non-zero) and doesn't match the existing port (also non-zero), error out.\n\t\tif wantPort != 0 && gotPort != 0 && wantPort != gotPort {\n\t\t\treturn ErrImmutableRessource(\".spec.healthCheckNodePort\", obj)\n\t\t}\n\t\tsvc.Spec.HealthCheckNodePort = gotPort\n\t}\n\n\tif liveClusterRoleBinding, ok := live.(*rbacv1.ClusterRoleBinding); ok {\n\t\tclusterRoleBinding := obj.(*rbacv1.ClusterRoleBinding)\n\t\tif liveClusterRoleBinding.RoleRef.APIGroup != clusterRoleBinding.RoleRef.APIGroup ||\n\t\t\tliveClusterRoleBinding.RoleRef.Kind != clusterRoleBinding.RoleRef.Kind ||\n\t\t\tliveClusterRoleBinding.RoleRef.Name != clusterRoleBinding.RoleRef.Name {\n\t\t\treturn ErrImmutableRessource(\"roleRef\", obj)\n\t\t}\n\t}\n\n\t// Set metadata.resourceVersion for updates as required by\n\t// Kubernetes API (http://go/k8s-concurrency).\n\tif gotRV := live.(metav1.Object).GetResourceVersion(); gotRV != \"\" {\n\t\tobj.(metav1.Object).SetResourceVersion(gotRV)\n\t}\n\n\treturn nil\n}", "func Merge(arr []interface{}, comp goutils.TypeComparator, low, mid, high int)(){\n if low == high {\n return\n }\n n1 := mid - low + 1;\n n2 := high - mid;\n L := make([]interface{}, n1)\n R := make([]interface{}, n2)\n // Copy data to temp arrays Left[] and Right[]\n for i := 0; i < n1; i++{\n L[i] = arr[low + i]\n }\n for j := 0; j < n2; j++ {\n R[j] = arr[mid+1+j]\n }\n // Merge the temp arrays back into arr[low..high]\n i := 0 // Initial index of first subarray\n j := 0 // Initial index of second subarray\n k := low // Initial index of merged subarray\n for i < n1 && j < n2 {\n if comp(L[i], R[j]) == -1 || comp(L[i], R[j]) == 0 {\n arr[k] = L[i]\n i+=1\n } else{\n arr[k] = R[j]\n j+=1\n }\n k+=1\n }\n // Copy the remaining elements of L[], if there are any\n for i < n1 {\n arr[k] = L[i];\n i+=1\n k+=1\n }\n // Copy the remaining elements of R[], if there are any\n for j < n2 {\n arr[k] = R[j];\n j+=1\n k+=1\n }\n}", "func (dst *Proxy) Merge(src Proxy) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tdst.Hosts.Merge(src.Hosts)\n}", "func (dst *Engine) Merge(src *Engine) {\n\tif dst == nil || src == nil {\n\t\treturn\n\t}\n\n\tif src.Name != \"\" {\n\t\tdst.Name = src.Name\n\t}\n\tif src.Version != \"\" {\n\t\tdst.Version = src.Version\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Resources != nil && dst.Resources == nil {\n\t\tdst.Resources = new(Resources)\n\t}\n\tdst.Resources.Merge(src.Resources)\n}", "func (r *Record) mergeObjects(other *Record) {\n\tdebug.Assert(r.Name == other.Name, r.Name+\" vs \"+other.Name)\n\tif r.Key == nil && other.Key != nil {\n\t\tr.Key = other.Key\n\t}\n\tr.Objects = append(r.Objects, other.Objects...)\n}", "func (t *FileTree) Merge(other *FileTree) {\n\tconditions := WalkConditions{\n\t\tShouldContinueBranch: other.ConditionFn(func(f file.Reference) bool {\n\t\t\treturn !f.Path.IsWhiteout()\n\t\t}),\n\t\tShouldVisit: other.ConditionFn(func(f file.Reference) bool {\n\t\t\treturn !f.Path.IsDirWhiteout()\n\t\t}),\n\t}\n\n\tvisitor := other.VisitorFn(func(f file.Reference) {\n\t\t// opaque whiteouts must be processed first\n\t\topaqueWhiteoutChild := file.Path(path.Join(string(f.Path), file.OpaqueWhiteout))\n\t\tif other.HasPath(opaqueWhiteoutChild) {\n\t\t\terr := t.RemoveChildPaths(f.Path)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"filetree merge failed to remove child paths (path=%s): %w\", f.Path, err)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tif f.Path.IsWhiteout() {\n\t\t\tlowerPath, err := f.Path.UnWhiteoutPath()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"filetree merge failed to find original path for whiteout (path=%s): %w\", f.Path, err)\n\t\t\t}\n\n\t\t\terr = t.RemovePath(lowerPath)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"filetree merge failed to remove path (path=%s): %w\", lowerPath, err)\n\t\t\t}\n\t\t} else {\n\t\t\tif !t.HasPath(f.Path) {\n\t\t\t\t_, err := t.AddPath(f.Path)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"filetree merge failed to add path (path=%s): %w\", f.Path, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\terr := t.SetFile(f)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"filetree merge failed to set file reference (ref=%+v): %w\", f, err)\n\t\t\t}\n\t\t}\n\t})\n\n\tw := NewDepthFirstWalkerWithConditions(other.Reader(), visitor, conditions)\n\tw.WalkAll()\n}", "func MergeStructs(dist interface{}, src interface{}) {\n\tr := reflect.ValueOf(src)\n\tr2 := reflect.ValueOf(dist)\n\n\tif reflect.TypeOf(dist) != reflect.TypeOf(src) {\n\t\treturn\n\t}\n\n\tfor r.Kind() == reflect.Ptr {\n\t\tr = r.Elem()\n\t}\n\n\tfor i := 0; i < r.NumField(); i++ {\n\t\tf := reflect.Indirect(r).Field(i).Interface()\n\t\tif f != reflect.Zero(reflect.TypeOf(f)).Interface() {\n\t\t\t// set field on dist interface{}\n\t\t\tf2 := reflect.Indirect(r2).Field(i)\n\t\t\tif f2.CanSet() {\n\t\t\t\tf2.Set(reflect.ValueOf(f))\n\t\t\t}\n\t\t}\n\t}\n\n}", "func merge[T any](left, right *llNode[T], comparator Comparator[T]) (first *llNode[T], err error) {\n\tcurLeft := left\n\tcurRight := right\n\n\tvar last *llNode[T]\n\n\tappendResults := func(updated *llNode[T]) {\n\t\tif last == nil {\n\t\t\tlast = updated\n\t\t} else {\n\t\t\tlast.next = updated\n\t\t\tlast = last.next\n\t\t}\n\t\tif first == nil {\n\t\t\tfirst = last\n\t\t}\n\t}\n\n\tfor curLeft != nil && curRight != nil {\n\t\tvar res int\n\t\tif res, err = comparator(curLeft.payload, curRight.payload); nil != err {\n\t\t\tbreak // Don't return, stitch the remaining elements back on.\n\t\t} else if res < 0 {\n\t\t\tappendResults(curLeft)\n\t\t\tcurLeft = curLeft.next\n\t\t} else {\n\t\t\tappendResults(curRight)\n\t\t\tcurRight = curRight.next\n\t\t}\n\t}\n\n\tif curLeft != nil {\n\t\tappendResults(curLeft)\n\t}\n\tif curRight != nil {\n\t\tappendResults(curRight)\n\t}\n\treturn\n}", "func (et *executionTableImpl) merge(incoming executionTable) (result executionTable, ok bool) {\n\tresult = et\n\tok = true\n\n\tet.iterate(func(id int, er executionRecord) (doBreak bool) {\n\t\tincomingRecord, err := incoming.recordByID(id)\n\t\tif err != nil {\n\t\t\tok = false\n\t\t\tdoBreak = true\n\t\t\treturn\n\t\t}\n\n\t\tif _, isMerged := er.merge(incomingRecord); !isMerged {\n\t\t\tok = false\n\t\t\tdoBreak = true\n\t\t\treturn\n\t\t}\n\t\treturn\n\t})\n\treturn\n}", "func Merge(orig, v interface{}, defaults bool) {\n\tvv := reflect.ValueOf(v).Elem()\n\tif !vv.IsValid() {\n\t\treturn\n\t}\n\tvorig := reflect.ValueOf(orig).Elem()\n\tfor i := 0; i < vorig.NumField(); i++ {\n\t\tfield := vv.Field(i)\n\t\tif defaults {\n\t\t\tfield = vorig.Field(i)\n\t\t}\n\t\tvar empty bool\n\t\tswitch field.Type().Kind() {\n\t\tcase reflect.Struct:\n\t\t\tempty = true // TODO: merge structs recursively\n\t\tcase reflect.Chan, reflect.Func, reflect.Slice, reflect.Map:\n\t\t\tempty = field.IsNil()\n\t\tdefault:\n\t\t\tempty = field.Interface() == reflect.Zero(field.Type()).Interface()\n\t\t}\n\t\tif !empty {\n\t\t\tvorig.Field(i).Set(vv.Field(i))\n\t\t}\n\t}\n}", "func (g *GitLocal) Merge(dir string, commitish string) error {\n\treturn g.GitCLI.Merge(dir, commitish)\n}", "func Merge(dataA *interface{}, dataB *interface{}, arrayAppend bool) {\n\tmergeRecursive(dataA, dataB, arrayAppend, nil, \"\")\n}", "func AnyMerge(less func(i, j Any) bool, inps ...<-chan Any) (out <-chan Any) {\n\n\tif len(inps) < 1 { // none: return a closed channel\n\t\tcha := make(chan Any)\n\t\tdefer close(cha)\n\t\treturn cha\n\t} else if len(inps) < 2 { // just one: return it\n\t\treturn inps[0]\n\t} else { // tail recurse\n\t\treturn mergeAny(less, inps[0], AnyMerge(less, inps[1:]...))\n\t}\n}", "func MergeSort(src []int64) {\n\tl := len(src)\n\t//如果数组比较小,采用插排即可\n\tif l < grNum*100 {\n\t\tInsertSort(src)\n\t\treturn\n\t}\n\t// 数组分块,block为块大小\n\tblock := l / grNum\n\t// 用来通知主goroutine 那些goroutine已经计算完毕\n\tsignal := make(chan arr, grNum)\n\t// 对所有goroutine 分发任务\n\tfor i := 0; i < grNum; i++ {\n\t\tgo goSubSort(i, src[i*block:(i+1)*block], signal, block)\n\t}\n\t// 主goroutine完成剩余部分\n\tif l%grNum != 0 {\n\t\tgoSubSort(grNum, src[grNum*block:], signal, block)\n\t\tgrNum++\n\t}\n\t// 用来判断是否所有的goroutine都完成归并\n\tcount := 0\n\t// 引入归并树\n\tvar cbTree *combineTreeNode\n\tfor {\n\t\t// 所有的都完成归并\n\t\tif count == grNum {\n\t\t\tbreak\n\t\t}\n\t\t// 去除待归并切片\n\t\tel := <-signal\n\t\t// 插入归并树\n\t\tCheckAndCombine(src, &cbTree, el)\n\t\t// 有效插入时 计数++\n\t\tif el.end != 0 {\n\t\t\tcount++\n\t\t}\n\t}\n\n}", "func (e *dataUsageEntry) merge(other dataUsageEntry) {\n\te.Objects += other.Objects\n\te.Versions += other.Versions\n\te.Size += other.Size\n\tors := other.ReplicationStats\n\tempty := replicationStats{}\n\tif ors != nil && *ors != empty {\n\t\tif e.ReplicationStats == nil {\n\t\t\te.ReplicationStats = &replicationStats{}\n\t\t}\n\t\te.ReplicationStats.PendingSize += other.ReplicationStats.PendingSize\n\t\te.ReplicationStats.FailedSize += other.ReplicationStats.FailedSize\n\t\te.ReplicationStats.ReplicatedSize += other.ReplicationStats.ReplicatedSize\n\t\te.ReplicationStats.ReplicaSize += other.ReplicationStats.ReplicaSize\n\t\te.ReplicationStats.PendingCount += other.ReplicationStats.PendingCount\n\t\te.ReplicationStats.FailedCount += other.ReplicationStats.FailedCount\n\n\t}\n\n\tfor i, v := range other.ObjSizes[:] {\n\t\te.ObjSizes[i] += v\n\t}\n}", "func (dst *SFTP) Merge(src *SFTP) {\n\tif dst == nil || src == nil {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n}", "func Merge(target sgmt.MutableSegment, srcs ...sgmt.MutableSegment) error {\n\tsafeClosers := []io.Closer{}\n\tdefer func() {\n\t\tfor _, c := range safeClosers {\n\t\t\tc.Close()\n\t\t}\n\t}()\n\n\t// for each src\n\tfor _, src := range srcs {\n\t\t// get reader for `src`\n\t\treader, err := src.Reader()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// ensure readers are all closed.\n\t\treaderCloser := x.NewSafeCloser(reader)\n\t\tsafeClosers = append(safeClosers, readerCloser)\n\n\t\t// retrieve all docs known to the reader\n\t\tdIter, err := reader.AllDocs()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// iterate over all known docs\n\t\tfor dIter.Next() {\n\t\t\td := dIter.Current()\n\t\t\t_, err := target.Insert(d)\n\t\t\tif err == nil || err == index.ErrDuplicateID {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// ensure no errors while iterating\n\t\tif err := dIter.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// ensure no errors while closing reader\n\t\tif err := readerCloser.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// all good\n\treturn nil\n}", "func (a *AttributeDefinition) Merge(other *AttributeDefinition) *AttributeDefinition {\n\tif other == nil {\n\t\treturn a\n\t}\n\tif a == nil {\n\t\treturn other\n\t}\n\tleft := a.Type.(Object)\n\tright := other.Type.(Object)\n\tif left == nil || right == nil {\n\t\tpanic(\"cannot merge non object attributes\") // bug\n\t}\n\tfor n, v := range right {\n\t\tleft[n] = v\n\t}\n\treturn a\n}", "func (a *API) Merge(other API) {\n\tif a.Short == \"\" {\n\t\ta.Short = other.Short\n\t}\n\n\tif a.Long == \"\" {\n\t\ta.Long = other.Long\n\t}\n\n\ta.Operations = append(a.Operations, other.Operations...)\n}", "func (d *Release) merge() map[string]interface{} {\n\tif len(d.dep) > 0 {\n\t\treturn d.dep\n\t}\n\tif d.src = d.ref.ToDeploy(d.env1, d.env2); len(d.src) == 0 {\n\t\t// No variable in this project for these environments\n\t\treturn nil\n\t}\n\td.dst = d.fetch()\n\td.dep = make(map[string]interface{})\n\tfor k, sv := range d.src {\n\t\tdv, ok := d.dst[k]\n\t\tswitch {\n\t\tcase !ok:\n\t\t\td.dep[k] = sv\n\t\t\td.task.Add++\n\t\tcase sv == nil:\n\t\t\td.dep[k] = sv\n\t\t\td.task.Del++\n\t\tcase sv != dv:\n\t\t\td.dep[k] = sv\n\t\t\td.task.Upd++\n\t\tdefault:\n\t\t\td.task.NoOp++\n\t\t}\n\t}\n\treturn d.dep\n}", "func MergeSort(src []int64) {\n\tif len(src) > 1 {\n\t\tmid := len(src) / 2\n\t\t// 定一个阀值,小于这个阀值就不再用多goroutine来MergeSort\n\t\t// 如果不定一个阀值的话goroutine会过多,导致系统卡住,别问我是怎么知道的-_-\n\t\tif len(src) <= max {\n\t\t\tMergeSort(src[0:mid])\n\t\t\tMergeSort(src[mid:])\n\t\t} else {\n\t\t\tvar wg sync.WaitGroup\n\t\t\twg.Add(1)\n\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tMergeSort(src[0:mid])\n\t\t\t} ()\n\n\t\t\t//go func() {\n\t\t\t//\tdefer wg.Done()\n\t\t\t//\tMergeSort(src[mid:])\n\t\t\t//} ()\n\t\t\t//直接用主goroutine来调用,减少goroutine的消耗\n\t\t\tMergeSort(src[mid:])\n\n\t\t\twg.Wait()\n\t\t}\n\t\tmerge(src, mid)\n\t}\n}", "func (cfg *RPCPoolConfig) merge(override *RPCPoolConfig) *RPCPoolConfig {\n\tif cfg == nil && override == nil {\n\t\treturn nil\n\t}\n\n\tmerged := &RPCPoolConfig{\n\t\tSize: -1,\n\t\tWaitTimeout: -1,\n\t}\n\n\tfor _, c := range []*RPCPoolConfig{cfg, override} { // First apply the base config, then any overrides.\n\t\tif c != nil {\n\t\t\tif c.Size >= 0 {\n\t\t\t\tmerged.Size = c.Size\n\t\t\t}\n\n\t\t\tif c.WaitTimeout > 0 {\n\t\t\t\tmerged.WaitTimeout = c.WaitTimeout\n\t\t\t}\n\t\t}\n\t}\n\n\treturn merged\n}", "func merge(dst, src Yaml) {\n\tfor k, v := range src {\n\t\tdst[k] = v\n\t}\n}", "func mergeRule(gen, old *bf.CallExpr) *bf.CallExpr {\n\tgenRule := bf.Rule{Call: gen}\n\toldRule := bf.Rule{Call: old}\n\tmerged := *old\n\tmerged.List = nil\n\tmergedRule := bf.Rule{Call: &merged}\n\n\t// Copy unnamed arguments from the old rule without merging. The only rule\n\t// generated with unnamed arguments is go_prefix, which we currently\n\t// leave in place.\n\t// TODO: maybe gazelle should allow the prefix to be changed.\n\tfor _, a := range old.List {\n\t\tif b, ok := a.(*bf.BinaryExpr); ok && b.Op == \"=\" {\n\t\t\tbreak\n\t\t}\n\t\tmerged.List = append(merged.List, a)\n\t}\n\n\t// Merge attributes from the old rule. Preserve comments on old attributes.\n\t// Assume generated attributes have no comments.\n\tfor _, k := range oldRule.AttrKeys() {\n\t\toldAttr := oldRule.AttrDefn(k)\n\t\tif !mergeableFields[k] || shouldKeep(oldAttr) {\n\t\t\tmerged.List = append(merged.List, oldAttr)\n\t\t\tcontinue\n\t\t}\n\n\t\toldExpr := oldAttr.Y\n\t\tgenExpr := genRule.Attr(k)\n\t\tmergedExpr, err := mergeExpr(genExpr, oldExpr)\n\t\tif err != nil {\n\t\t\t// TODO: add a verbose mode and log errors like this.\n\t\t\tmergedExpr = genExpr\n\t\t}\n\t\tif mergedExpr != nil {\n\t\t\tmergedAttr := *oldAttr\n\t\t\tmergedAttr.Y = mergedExpr\n\t\t\tmerged.List = append(merged.List, &mergedAttr)\n\t\t}\n\t}\n\n\t// Merge attributes from genRule that we haven't processed already.\n\tfor _, k := range genRule.AttrKeys() {\n\t\tif mergedRule.Attr(k) == nil {\n\t\t\tmergedRule.SetAttr(k, genRule.Attr(k))\n\t\t}\n\t}\n\n\treturn &merged\n}", "func Merge(l error, r error) error {\n\tif l == nil {\n\t\treturn r\n\t}\n\tif r == nil {\n\t\treturn l\n\t}\n\n\tif c, ok := l.(*collection); ok {\n\t\tc.append(r)\n\t\treturn c\n\t}\n\tif c, ok := r.(*collection); ok {\n\t\tc.insertFront(l)\n\t\treturn c\n\t}\n\tc := newCollection()\n\tc.append(l)\n\tc.append(r)\n\treturn c\n}", "func merge(A map[string]interface{}, i interface{}) interface{} {\n\tswitch t := i.(type) {\n\tcase map[string]interface{}:\n\t\tfor k, v := range t {\n\t\t\tAk, ok := A[k]\n\t\t\tif !ok {\n\t\t\t\t// if A doesn't contain this key, initialise\n\t\t\t\tswitch v.(type) {\n\t\t\t\tcase map[string]interface{}:\n\t\t\t\t\t// if the value is a map, initialise a new map to be merged\n\t\t\t\t\tAk = make(map[string]interface{})\n\t\t\t\tdefault:\n\t\t\t\t\t// otherwise just merge into this A\n\t\t\t\t\tA[k] = v\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tB, ok := Ak.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\t// A[k] is not a map, so just overwrite\n\t\t\t\tA[k] = v\n\t\t\t}\n\t\t\t// if A contains the key, and the current value is also a map, recurse on that map\n\t\t\tA[k] = merge(B, v)\n\t\t}\n\t\treturn A\n\t}\n\t// if a leaf is reached, just return it\n\treturn i\n}", "func (node *skewNode) merge(other *skewNode) *skewNode {\n\tif node == nil {\n\t\treturn other\n\t}\n\n\tif other == nil {\n\t\treturn node\n\t}\n\n\t// Cut the right subtree from each path and store the remaining left subtrees\n\t// in nodes.\n\ttodo := [](*skewNode){node, other}\n\tnodes := [](*skewNode){}\n\n\tfor len(todo) > 0 {\n\t\tlast := todo[0]\n\t\ttodo = todo[1:]\n\n\t\tif last.right != nil {\n\t\t\ttodo = append(todo, last.right)\n\t\t\tlast.right = nil\n\t\t}\n\n\t\tnodes = append(nodes, last)\n\t}\n\n\t// Sort the cut paths\n\tsort.Sort(byPriority(nodes))\n\n\t// Recombine subtrees\n\tvar last *skewNode\n\n\tfor len(nodes) > 1 {\n\t\tlast, nodes = nodes[len(nodes)-1], nodes[:len(nodes)-1]\n\t\tprev := nodes[len(nodes)-1]\n\n\t\t// Set penultimate node's right child to its left (and only) subtree\n\t\tprev.right = prev.left\n\n\t\t// Set its left child to the ultimate node\n\t\tprev.left = last\n\t}\n\n\treturn nodes[0]\n}", "func (c *CheckRestart) Merge(o *CheckRestart) *CheckRestart {\n\tif c == nil {\n\t\t// Just return other\n\t\treturn o\n\t}\n\n\tnc := c.Copy()\n\n\tif o == nil {\n\t\t// Nothing to merge\n\t\treturn nc\n\t}\n\n\tif o.Limit > 0 {\n\t\tnc.Limit = o.Limit\n\t}\n\n\tif o.Grace != nil {\n\t\tnc.Grace = o.Grace\n\t}\n\n\tif o.IgnoreWarnings {\n\t\tnc.IgnoreWarnings = o.IgnoreWarnings\n\t}\n\n\treturn nc\n}", "func (c *CheckRestart) Merge(o *CheckRestart) *CheckRestart {\n\tif c == nil {\n\t\t// Just return other\n\t\treturn o\n\t}\n\n\tnc := c.Copy()\n\n\tif o == nil {\n\t\t// Nothing to merge\n\t\treturn nc\n\t}\n\n\tif o.Limit > 0 {\n\t\tnc.Limit = o.Limit\n\t}\n\n\tif o.Grace != nil {\n\t\tnc.Grace = o.Grace\n\t}\n\n\tif o.IgnoreWarnings {\n\t\tnc.IgnoreWarnings = o.IgnoreWarnings\n\t}\n\n\treturn nc\n}", "func (dst *PostgreSQL) Merge(src *PostgreSQL) {\n\tif dst == nil || src == nil {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Version != \"\" {\n\t\tdst.Version = src.Version\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Fixtures != nil {\n\t\tdst.Fixtures = src.Fixtures\n\t}\n\tif src.OwnName != nil {\n\t\tdst.OwnName = src.OwnName\n\t}\n\n\tif src.DataBus != nil && dst.DataBus == nil {\n\t\tdst.DataBus = new(DataBus)\n\t}\n\tdst.DataBus.Merge(src.DataBus)\n}", "func (d delegate) MergeRemoteState(buf []byte, join bool) {}", "func (c *ResolverConfig) Merge(in *ResolverConfig) *ResolverConfig {\n\tres := *c\n\tif in.Logger != nil {\n\t\tres.Logger = in.Logger\n\t}\n\tif in.Model != nil {\n\t\tres.Model = in.Model\n\t}\n\tif in.SecretResolver != nil {\n\t\tres.SecretResolver = in.SecretResolver\n\t}\n\tif in.PolicyResolver != nil {\n\t\tres.PolicyResolver = in.PolicyResolver\n\t}\n\treturn &res\n}", "func (b Binding) Merge(b2 Binding) Binding {\n\n\tresult := Binding{}\n\n\tfor k, v := range b {\n\t\tresult[k] = v\n\t}\n\n\tfor k, v := range b2 {\n\t\tresult[k] = v\n\t}\n\n\treturn result\n}", "func (s Set) Merge(ss Set) Set {\n\treturn Set{s.Tree.Merge(ss.Tree)}\n}", "func (t *Set) Merge(other *Set, prefix []byte) *Set {\n\tif other != nil {\n\t\tadder := func(key []byte) bool {\n\t\t\tt.Add(key)\n\t\t\treturn true\n\t\t}\n\t\tother.Iter(prefix, adder)\n\t}\n\treturn t\n}", "func mergeConditional(newVal, originalVal interface{}, merge bool) (interface{}, error) {\n\tif !merge || util.IsValueNilOrDefault(originalVal) {\n\t\treturn newVal, nil\n\t}\n\tnewS, err := yaml.Marshal(newVal)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif util.IsYAMLEmpty(string(newS)) {\n\t\treturn originalVal, nil\n\t}\n\toriginalS, err := yaml.Marshal(originalVal)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif util.IsYAMLEmpty(string(originalS)) {\n\t\treturn newVal, nil\n\t}\n\n\tmergedS, err := util.OverlayYAML(string(originalS), string(newS))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif util.IsMap(originalVal) {\n\t\t// For JSON compatibility\n\t\tout := make(map[string]interface{})\n\t\tif err := yaml.Unmarshal([]byte(mergedS), &out); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn out, nil\n\t}\n\t// For scalars and slices, copy the type\n\tout := originalVal\n\tif err := yaml.Unmarshal([]byte(mergedS), &out); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "func mergeRecursive(dataA *interface{}, dataB *interface{}, arrayAppend bool, previousData *interface{}, previousKey string) {\n\taArray, aIsArray := (*dataA).([]interface{})\n\tbArray, bIsArray := (*dataB).([]interface{})\n\taMap, aIsMap := (*dataA).(map[string]interface{})\n\tbMap, bIsMap := (*dataB).(map[string]interface{})\n\n\tif aIsArray && bIsArray {\n\t\tif arrayAppend {\n\t\t\tSetArrayInDataTo(dataB, \"[+]\", previousData, previousKey, append(aArray, bArray...))\n\t\t} else {\n\t\t\tSetArrayInDataTo(dataB, \"[+]\", previousData, previousKey, aArray)\n\t\t}\n\t\treturn\n\t} else if aIsMap && bIsMap {\n\t\tfor aKey, aValue := range aMap {\n\t\t\tif _, exists := bMap[aKey]; exists {\n\t\t\t\ttmp := bMap[aKey]\n\t\t\t\tmergeRecursive(&aValue, &tmp, arrayAppend, dataB, aKey)\n\t\t\t} else {\n\t\t\t\tbMap[aKey] = aValue\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif previousData != nil {\n\t\t\tpMap, pIsMap := (*previousData).(map[string]interface{})\n\n\t\t\tif pIsMap {\n\t\t\t\tpMap[previousKey] = *dataA\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t*dataB = *dataA\n\t}\n}", "func (objectSet *PoolObjectSet) Merge(id *string, targetPoolId *string, force *bool) (*nimbleos.NsPoolMergeReturn, error) {\n\tmergeUri := poolPath\n\tmergeUri = mergeUri + \"/\" + *id\n\tmergeUri = mergeUri + \"/actions/\" + \"merge\"\n\n\tpayload := &struct {\n\t\tId *string `json:\"id,omitempty\"`\n\t\tTargetPoolId *string `json:\"target_pool_id,omitempty\"`\n\t\tForce *bool `json:\"force,omitempty\"`\n\t}{\n\t\tid,\n\t\ttargetPoolId,\n\t\tforce,\n\t}\n\n\tresp, err := objectSet.Client.Post(mergeUri, payload, &nimbleos.NsPoolMergeReturn{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp.(*nimbleos.NsPoolMergeReturn), err\n}", "func (m Map) ForceMerge(src Map) Map {\n\tfor k, v := range src {\n\t\tm[k] = v\n\t}\n\treturn m\n}", "func (d *mlDelegate) MergeRemoteState(buf []byte, join bool) {}", "func (v Values) Merge(src Values) Values {\n\tfor key, srcVal := range src {\n\t\tdestVal, found := v[key]\n\n\t\tsrcType := fmt.Sprintf(\"%T\", srcVal)\n\t\tdestType := fmt.Sprintf(\"%T\", destVal)\n\t\tmatch := srcType == destType\n\t\tvalidSrc := istable(srcVal)\n\t\tvalidDest := istable(destVal)\n\n\t\tif found && match && validSrc && validDest {\n\t\t\tdestMap := destVal.(Values)\n\t\t\tsrcMap := srcVal.(Values)\n\t\t\tdestMap.Merge(srcMap)\n\t\t} else {\n\t\t\tv[key] = srcVal\n\t\t}\n\t}\n\treturn v\n}", "func (s *FKCascadeRuntimeStats) Merge(other execdetails.RuntimeStats) {\n\ttmp, ok := other.(*FKCascadeRuntimeStats)\n\tif !ok {\n\t\treturn\n\t}\n\ts.Total += tmp.Total\n\ts.Keys += tmp.Keys\n}", "func (n *node) merge(idx int) {\n\tfmt.Printf(\"merge %d\\n\", idx)\n\tleftChild := n.children[idx]\n\trightChild := n.children[idx+1]\n\n\t// copy right child to left child\n\tif leftChild.isLeaf {\n\t\tfor i := 0; i < rightChild.count; i++ {\n\t\t\tleftChild.keys[i+leftChild.count] = rightChild.keys[i]\n\t\t}\n\t} else {\n\t\t// removedKey underflow into leftChild\n\t\tleftChild.keys[leftChild.count] = n.keys[idx]\n\n\t\tfor i := 0; i < rightChild.count; i++ {\n\t\t\tleftChild.keys[i+leftChild.count+1] = rightChild.keys[i]\n\t\t}\n\t}\n\n\t// copy right child pointers to left child\n\tif !leftChild.isLeaf {\n\t\tfor i := 0; i <= rightChild.count; i++ {\n\t\t\tleftChild.children[i+leftChild.count+1] = rightChild.children[i]\n\t\t}\n\t}\n\n\t// since removedKey underflow, so fill the gap by moving forward keys\n\tfor i := idx + 1; i < n.count; i++ {\n\t\tn.keys[i-1] = n.keys[i]\n\t}\n\t// fill child pointer gap\n\tfor i := idx + 2; i <= n.count; i++ {\n\t\tn.children[i-1] = n.children[i]\n\t}\n\n\t// update count\n\tif leftChild.isLeaf {\n\t\tleftChild.count += rightChild.count\n\t} else {\n\t\tleftChild.count += rightChild.count + 1\n\t}\n\n\t// update next pointer\n\tif leftChild.isLeaf {\n\t\tleftChild.next = rightChild.next\n\t}\n\n\tn.count--\n\trightChild = nil\n}", "func (obj *JSONObject) Merge(s2 JSONObject) {\n\ttmp := *obj\n\n\tfor k, v := range s2 {\n\t\ttmp[k] = v\n\t}\n\n\t*obj = tmp\n}", "func (tr *trooper) merge() {\n\ttr.trash()\n\ttr.neo = tr.part.AddPart().SetScale(0.5, 0.5, 0.5)\n\tm := tr.neo.MakeModel(\"flata\", \"msh:cube\", \"mat:tblue\")\n\tm.SetUniform(\"fd\", 1000)\n\ttr.addCenter()\n}", "func (s *Storage) Merge(ctx context.Context,\n\tconv types.UnboxConversationInfo, uid gregor1.UID, msgs []chat1.MessageUnboxed) (res MergeResult, err Error) {\n\tvar ierr error\n\tdefer s.Trace(ctx, &ierr, \"Merge\")()\n\tdefer func() { ierr = s.castInternalError(err) }()\n\treturn s.MergeHelper(ctx, conv, uid, msgs, nil)\n}", "func (m groupSalaryStatsMap) merge(key string, src *groupSalaryStats) {\n\tif s, ok := m[key]; ok {\n\t\ts.salaries.merge(&src.salaries)\n\t\treturn\n\t}\n\tm[key] = src\n}", "func (dst *Host) Merge(src Host) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.AgentPort != 0 {\n\t\tdst.AgentPort = src.AgentPort\n\t}\n\tif src.Connections != 0 {\n\t\tdst.Connections = src.Connections\n\t}\n\tif src.MaxConns != 0 {\n\t\tdst.MaxConns = src.MaxConns\n\t}\n\tif src.Weight != 0 {\n\t\tdst.Weight = src.Weight\n\t}\n\tif src.Backup != nil {\n\t\tdst.Backup = src.Backup\n\t}\n}", "func (p params) merge(source params) params {\n\tfor newKey, newValues := range source {\n\t\tif _, ok := p[newKey]; ok {\n\t\t\tp[newKey] = append(p[newKey], newValues...)\n\t\t} else {\n\t\t\tp[newKey] = newValues\n\t\t}\n\t}\n\treturn p\n}" ]
[ "0.71120924", "0.6586343", "0.64700896", "0.6316208", "0.60762954", "0.5997559", "0.5972891", "0.59665084", "0.58371395", "0.5830526", "0.57924247", "0.5792138", "0.56583434", "0.5650656", "0.5536066", "0.5516714", "0.54491425", "0.5431219", "0.54165083", "0.53876007", "0.53849584", "0.5383816", "0.5375772", "0.53693616", "0.53614813", "0.5343267", "0.5310726", "0.5309283", "0.5304042", "0.5293614", "0.52632415", "0.5251578", "0.5244119", "0.52171457", "0.521319", "0.5212351", "0.52049273", "0.5201166", "0.5193862", "0.5181068", "0.5179979", "0.51688343", "0.514938", "0.51484144", "0.5138261", "0.51253927", "0.5111333", "0.5109331", "0.5102347", "0.5101634", "0.50983846", "0.50819266", "0.50657386", "0.5064211", "0.50545824", "0.50541043", "0.5054056", "0.5053048", "0.5028927", "0.50082844", "0.5001381", "0.49872336", "0.49834642", "0.49834538", "0.49662203", "0.4959116", "0.49425074", "0.49379867", "0.49361417", "0.49142227", "0.4913551", "0.49125525", "0.4907986", "0.49058706", "0.49012268", "0.48972192", "0.4889866", "0.48843905", "0.48830196", "0.48830196", "0.48825175", "0.48685402", "0.48679596", "0.48604566", "0.4849502", "0.48384494", "0.48111698", "0.48011303", "0.47992954", "0.47857437", "0.4785638", "0.47848678", "0.47760603", "0.47733057", "0.47721428", "0.47666425", "0.47651806", "0.4755834", "0.4745854", "0.47451407" ]
0.65717524
2
UnionMerge implments the typical Merge logic for union types. The key is to merge all the common fields unconditionally, but to only merge the src's union member into the obj's union member if they are the same member, or if obj has no member.
func UnionMerge[T any](obj T, src T) T { name := fmt.Sprintf("%T", obj) vObj := reflect.ValueOf(obj) vSrc := reflect.ValueOf(src) // obj must have the same type as src. assertTypeMatch(vObj, vSrc) if vObj.Kind() != reflect.Struct { panic("UnionMerge must only be called on struct types") } return unionMerge(vObj, vSrc, name).Interface().(T) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func unionMerge(obj reflect.Value, src reflect.Value, name string) reflect.Value {\n\tout := reflect.New(obj.Type()).Elem()\n\n\tmergeField := func(i int) {\n\t\tstructField := obj.Type().Field(i)\n\t\tfieldName := fmt.Sprintf(\"%v.%v\", name, structField.Name)\n\t\tx := merge(obj.Field(i), src.Field(i), fieldName)\n\t\tout.Field(i).Set(x)\n\t}\n\n\t// Iterate through all the fields of the struct once, identifying union members and merging\n\t// the non-union members.\n\tobjHasMember := -1\n\tsrcHasMember := -1\n\tfor i := 0; i < src.NumField(); i++ {\n\t\tif _, ok := obj.Type().Field(i).Tag.Lookup(\"union\"); ok {\n\t\t\t// Union member, remember it for later.\n\t\t\tif !obj.Field(i).IsZero() {\n\t\t\t\tobjHasMember = i\n\t\t\t}\n\t\t\tif !src.Field(i).IsZero() {\n\t\t\t\tsrcHasMember = i\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Non-union member, merge it normally.\n\t\tmergeField(i)\n\t}\n\tif objHasMember > -1 {\n\t\t// When obj has a union member, we can only merge that union member.\n\t\tmergeField(objHasMember)\n\t} else if srcHasMember > -1 {\n\t\t// Otherwise we merge whatever the src has defined.\n\t\tmergeField(srcHasMember)\n\t}\n\treturn out.Convert(obj.Type())\n}", "func Merge[T any](obj T, src T) T {\n\tname := fmt.Sprintf(\"%T\", obj)\n\n\tvObj := reflect.ValueOf(obj)\n\tvSrc := reflect.ValueOf(src)\n\n\t// obj must have the same type as src.\n\tassertTypeMatch(vObj, vSrc)\n\n\treturn merge(vObj, vSrc, name).Interface().(T)\n}", "func mergeIfMergable(obj reflect.Value, src reflect.Value) (reflect.Value, bool) {\n\tvar out reflect.Value\n\n\t// Look for the .WithDefaults method.\n\tmeth, ok := obj.Type().MethodByName(\"Merge\")\n\tif !ok {\n\t\treturn out, false\n\t}\n\n\t// Verify the signature matches our Mergable psuedointerface:\n\t// - two inputs (the receiver), and one output\n\t// - input types match output type exactly (disallow the usual pointer receiver semantics)\n\tif meth.Type.NumIn() != 2 || meth.Type.NumOut() != 1 {\n\t\treturn out, false\n\t}\n\tif meth.Type.In(0) != meth.Type.In(1) || meth.Type.In(0) != meth.Type.Out(0) {\n\t\treturn out, false\n\t}\n\n\t// Psuedointerface matches, call the .Merge method.\n\tout = meth.Func.Call([]reflect.Value{obj, src})[0]\n\n\treturn out, true\n}", "func Merge(orig, v interface{}, defaults bool) {\n\tvv := reflect.ValueOf(v).Elem()\n\tif !vv.IsValid() {\n\t\treturn\n\t}\n\tvorig := reflect.ValueOf(orig).Elem()\n\tfor i := 0; i < vorig.NumField(); i++ {\n\t\tfield := vv.Field(i)\n\t\tif defaults {\n\t\t\tfield = vorig.Field(i)\n\t\t}\n\t\tvar empty bool\n\t\tswitch field.Type().Kind() {\n\t\tcase reflect.Struct:\n\t\t\tempty = true // TODO: merge structs recursively\n\t\tcase reflect.Chan, reflect.Func, reflect.Slice, reflect.Map:\n\t\t\tempty = field.IsNil()\n\t\tdefault:\n\t\t\tempty = field.Interface() == reflect.Zero(field.Type()).Interface()\n\t\t}\n\t\tif !empty {\n\t\t\tvorig.Field(i).Set(vv.Field(i))\n\t\t}\n\t}\n}", "func Merge(target, source interface{}, opt *Options) error {\n\tvT := reflect.ValueOf(target)\n\tvS := reflect.ValueOf(source)\n\n\tif target != nil && vT.Type() == valType {\n\t\tvT = vT.Interface().(reflect.Value)\n\t}\n\tif source != nil && vS.Type() == valType {\n\t\tvS = vS.Interface().(reflect.Value)\n\t}\n\n\tif vT.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"target must be a pointer\")\n\t}\n\n\tif !reflect.Indirect(vT).IsValid() {\n\t\treturn errors.New(\"target can not be zero value\")\n\t}\n\n\t// use defaults if none are provided\n\tif opt == nil {\n\t\topt = NewOptions()\n\t}\n\n\tif opt.mergeFuncs == nil {\n\t\treturn errors.New(\"invalid options, use NewOptions() to generate and then modify as needed\")\n\t}\n\n\t//make a copy here so if there is an error mid way, the target stays in tact\n\tcp := vT.Elem()\n\n\tmerged, err := merge(cp, reflect.Indirect(vS), opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !isSettable(vT.Elem(), merged) {\n\t\treturn fmt.Errorf(\"Merge failed: expected merged result to be %v but got %v\",\n\t\t\tvT.Elem().Type(), merged.Type())\n\t}\n\n\tvT.Elem().Set(merged)\n\treturn nil\n}", "func merge(dst, src any, opts ...func(*mergeConfig)) error {\n\tif dst == nil || src == nil {\n\t\t// Nothing available to merge if dst or src are nil.\n\t\t// This can occur early on in reconciliation when the\n\t\t// status subresource has not been set yet.\n\t\treturn nil\n\t}\n\n\tconfig := &mergeConfig{}\n\n\tfor _, opt := range opts {\n\t\topt(config)\n\t}\n\n\tdstMap, ok := dst.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedDstObject)\n\t}\n\n\tsrcMap, ok := src.(map[string]any)\n\tif !ok {\n\t\treturn errors.New(errUnsupportedSrcObject)\n\t}\n\n\treturn mergo.Merge(&dstMap, filter(srcMap, config.srcfilter...), config.mergeOptions...)\n}", "func MergeStructs(dist interface{}, src interface{}) {\n\tr := reflect.ValueOf(src)\n\tr2 := reflect.ValueOf(dist)\n\n\tif reflect.TypeOf(dist) != reflect.TypeOf(src) {\n\t\treturn\n\t}\n\n\tfor r.Kind() == reflect.Ptr {\n\t\tr = r.Elem()\n\t}\n\n\tfor i := 0; i < r.NumField(); i++ {\n\t\tf := reflect.Indirect(r).Field(i).Interface()\n\t\tif f != reflect.Zero(reflect.TypeOf(f)).Interface() {\n\t\t\t// set field on dist interface{}\n\t\t\tf2 := reflect.Indirect(r2).Field(i)\n\t\t\tif f2.CanSet() {\n\t\t\t\tf2.Set(reflect.ValueOf(f))\n\t\t\t}\n\t\t}\n\t}\n\n}", "func merge(obj reflect.Value, src reflect.Value, name string) reflect.Value {\n\t// fmt.Printf(\"merge(%T, %T, %v)\\n\", obj.Interface(), src.Interface(), name)\n\tassertTypeMatch(obj, src)\n\n\t// Always handle pointers first.\n\tif obj.Kind() == reflect.Ptr {\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t} else if src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t}\n\t\tout := reflect.New(obj.Elem().Type())\n\t\tout.Elem().Set(merge(obj.Elem(), src.Elem(), name))\n\t\treturn out.Convert(obj.Type())\n\t}\n\n\t// Next handle interfaces.\n\tif obj.Kind() == reflect.Interface {\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t} else if src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t}\n\t\treturn merge(obj.Elem(), src.Elem(), name)\n\t}\n\n\t// Handle the `T Mergable[T]` pseudointerface\n\tif out, ok := mergeIfMergable(obj, src); ok {\n\t\treturn out\n\t}\n\n\tswitch obj.Kind() {\n\tcase reflect.Struct:\n\t\t// Recurse into each field of the struct.\n\t\tout := reflect.New(obj.Type()).Elem()\n\t\tfor i := 0; i < src.NumField(); i++ {\n\t\t\tstructField := src.Type().Field(i)\n\t\t\tfieldName := fmt.Sprintf(\"%v.%v\", name, structField.Name)\n\t\t\tx := merge(obj.Field(i), src.Field(i), fieldName)\n\t\t\tout.Field(i).Set(x)\n\t\t}\n\t\treturn out.Convert(obj.Type())\n\n\tcase reflect.Map:\n\t\t// Handle unallocated maps on either input.\n\t\tif src.IsZero() {\n\t\t\treturn cpy(obj)\n\t\t} else if obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t}\n\t\t// allocate a new map\n\t\ttyp := reflect.MapOf(obj.Type().Key(), obj.Type().Elem())\n\t\tout := reflect.MakeMap(typ)\n\t\t// Iterate through keys and objects in obj.\n\t\titer := obj.MapRange()\n\t\tfor iter.Next() {\n\t\t\tkey := iter.Key()\n\t\t\tobjVal := iter.Value()\n\t\t\tif srcVal := src.MapIndex(key); srcVal.IsValid() {\n\t\t\t\t// Key present in both maps.\n\t\t\t\tout.SetMapIndex(key, merge(objVal, srcVal, name))\n\t\t\t} else {\n\t\t\t\t// Key is unique to obj.\n\t\t\t\tout.SetMapIndex(key, cpy(objVal))\n\t\t\t}\n\t\t}\n\t\t// Check for keys only present in src.\n\t\titer = src.MapRange()\n\t\tfor iter.Next() {\n\t\t\tkey := iter.Key()\n\t\t\tsrcVal := iter.Value()\n\t\t\tif objVal := obj.MapIndex(key); !objVal.IsValid() {\n\t\t\t\t// Key is unique to src.\n\t\t\t\tout.SetMapIndex(key, cpy(srcVal))\n\t\t\t}\n\t\t}\n\t\treturn out.Convert(obj.Type())\n\n\tcase reflect.Slice:\n\t\t// Slices are not merged by default. If obj is nil we copy the src.\n\t\tif obj.IsZero() {\n\t\t\treturn cpy(src)\n\t\t}\n\t\treturn cpy(obj)\n\n\t// Assert that none of the \"complex\" kinds are present.\n\tcase reflect.Array,\n\t\treflect.Chan,\n\t\treflect.Func,\n\t\treflect.UnsafePointer,\n\t\t// We already handled Ptr and Interface.\n\t\treflect.Ptr,\n\t\treflect.Interface:\n\t\tpanic(fmt.Sprintf(\"unable to fill %T with %T at %v\", obj.Interface(), src.Interface(), name))\n\n\tdefault:\n\t\t// Simple kinds just get copied.\n\t\treturn cpy(obj)\n\t}\n}", "func Merge(src interface{}, dst interface{}, ignore ...string) interface{} {\n\tsrcStruct := ST.New(src)\n\tdstStruct := ST.New(dst)\nmain:\n\tfor _, field := range srcStruct.Fields() {\n\t\t_, ok := dstStruct.FieldOk(field.Name())\n\t\tif !ok {\n\n\t\t\tcontinue\n\t\t}\n\t\tfor _, ign := range ignore {\n\t\t\t//skip field if it's on the ignore list\n\t\t\tif ign == field.Name() {\n\t\t\t\tcontinue main\n\t\t\t}\n\t\t}\n\t\terr := dstStruct.Field(field.Name()).Set(field.Value())\n\t\tif nil != err {\n\t\t\tlog.Error(\"Failed to assign value from to field \", field.Name(), \" got error \", err)\n\t\t}\n\t}\n\treturn dst\n}", "func Merge(base, overrides interface{}) error {\n\tbaseBytes, err := json.Marshal(base)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\toverrideBytes, err := json.Marshal(overrides)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert current object to byte sequence\")\n\t}\n\n\tpatchMeta, err := strategicpatch.NewPatchMetaFromStruct(base)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to produce patch meta from struct\")\n\t}\n\tpatch, err := strategicpatch.CreateThreeWayMergePatch(overrideBytes, overrideBytes, baseBytes, patchMeta, true)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to create three way merge patch\")\n\t}\n\n\tmerged, err := strategicpatch.StrategicMergePatchUsingLookupPatchMeta(baseBytes, patch, patchMeta)\n\tif err != nil {\n\t\treturn errors.WrapIf(err, \"failed to apply patch\")\n\t}\n\n\tvalueOfBase := reflect.Indirect(reflect.ValueOf(base))\n\tinto := reflect.New(valueOfBase.Type())\n\tif err := json.Unmarshal(merged, into.Interface()); err != nil {\n\t\treturn err\n\t}\n\tif !valueOfBase.CanSet() {\n\t\treturn errors.New(\"unable to set unmarshalled value into base object\")\n\t}\n\tvalueOfBase.Set(reflect.Indirect(into))\n\treturn nil\n}", "func Merge(original interface{}, update interface{}) (merged interface{}, err error) {\n\n\tif original == nil {\n\t\treturn update, nil\n\t}\n\n\tif update == nil {\n\t\treturn original, nil\n\t}\n\n\t// call the recursive merge\n\treturn merge(original, update)\n}", "func (m *Mob) Merge(mob *Mob) {\n\tassignIfNotZero := func(target interface{}, value interface{}) {\n\t\ttargetValue := reflect.ValueOf(target).Elem()\n\t\tvalueValue := reflect.ValueOf(value)\n\n\t\tif valueValue.Kind() == reflect.Ptr {\n\t\t\tvalueValue = valueValue.Elem()\n\t\t}\n\n\t\tif valueValue.Interface() != reflect.Zero(valueValue.Type()).Interface() {\n\t\t\ttargetValue.Set(valueValue)\n\t\t}\n\t}\n\n\tassignIfNotZero(&m.Species, mob.Species)\n\tassignIfNotZero(&m.SpawnX, mob.SpawnX)\n\tassignIfNotZero(&m.SpawnY, mob.SpawnY)\n\tassignIfNotZero(&m.MoveSpeed, mob.MoveSpeed)\n\tassignIfNotZero(&m.FindCount, mob.FindCount)\n\tassignIfNotZero(&m.FindInterval, mob.FindInterval)\n\tassignIfNotZero(&m.MoveInterval, mob.MoveInterval)\n\tassignIfNotZero(&m.Level, mob.Level)\n\tassignIfNotZero(&m.MaxHP, mob.MaxHP)\n}", "func Merge(dst, src []byte) ([]byte, error) {\n\tvar dstM, srcM map[string]interface{}\n\tif len(dst) == 0 {\n\t\tdstM = make(map[string]interface{})\n\t} else {\n\t\terr := json.Unmarshal(dst, &dstM)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\terr := json.Unmarshal(src, &srcM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = applyValues(dstM, srcM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.Marshal(dstM)\n}", "func (ctx *RequestContext) safeMerge(src, dst reflect.Value) (err error) {\n\tty := dst.Type()\n\tfor i := 0; i < dst.NumField(); i++ {\n\t\tw := ty.Field(i).Tag.Get(\"writeRight\")\n\t\tif w == \"\" || ctx.HasRight(w) {\n\t\t\tsrcField := src.Field(i)\n\t\t\tdstField := dst.Field(i)\n\t\t\tif isRecursibleType(srcField) {\n\t\t\t\terr = ctx.safeMerge(srcField, dstField)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdstField.Set(srcField)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (oldStruct *object) merge(newStruct object) {\n\tif newStruct.ID != 0 {\n\t\toldStruct.ID = newStruct.ID\n\t}\n\n\tif newStruct.Name != \"\" {\n\t\toldStruct.Name = newStruct.Name\n\t}\n\n\tif newStruct.Value != \"\" {\n\t\toldStruct.Value = newStruct.Value\n\t}\n}", "func Merge(dst, src map[string]interface{}) (interface{}, error) {\n\treturn merge(dst, src)\n}", "func Merge(object interface{}, overwriteObject interface{}) {\n\tobjectPointerUnsafe := unsafe.Pointer(&object)\n\toverwriteObjectPointerUnsafe := unsafe.Pointer(&overwriteObject)\n\n\tmerge(object, overwriteObject, objectPointerUnsafe, overwriteObjectPointerUnsafe)\n}", "func (a Annotation) Merge(other schema.Annotation) schema.Annotation {\n\tvar ant Annotation\n\tswitch other := other.(type) {\n\tcase Annotation:\n\t\tant = other\n\tcase *Annotation:\n\t\tif other != nil {\n\t\t\tant = *other\n\t\t}\n\tdefault:\n\t\treturn a\n\t}\n\tif tag := ant.StructTag; tag != \"\" {\n\t\ta.StructTag = tag\n\t}\n\treturn a\n}", "func (r *Record) mergeObjects(other *Record) {\n\tdebug.Assert(r.Name == other.Name, r.Name+\" vs \"+other.Name)\n\tif r.Key == nil && other.Key != nil {\n\t\tr.Key = other.Key\n\t}\n\tr.Objects = append(r.Objects, other.Objects...)\n}", "func (b *Buffer) Merge(bs ...Buffer) {\n\tfor _, buf := range bs {\n\t\tfor p, v := range buf.CellMap {\n\t\t\tb.Set(p.X, p.Y, v)\n\t\t}\n\t\tb.SetArea(b.Area.Union(buf.Area))\n\t}\n}", "func Merge(dest interface{}, source interface{}) error {\n\topts := make([]func(*mergo.Config), 0)\n\n\t// lists are always overridden - we don't append merged lists since it generally makes things more complicated\n\topts = append(opts, mergo.WithOverride)\n\n\terr := mergo.Merge(dest, source, opts...)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "func (a *API) Merge(other API) {\n\tif a.Short == \"\" {\n\t\ta.Short = other.Short\n\t}\n\n\tif a.Long == \"\" {\n\t\ta.Long = other.Long\n\t}\n\n\ta.Operations = append(a.Operations, other.Operations...)\n}", "func (obj object) MergeWith(other Object, conflictResolver func(v1, v2 *Term) (*Term, bool)) (Object, bool) {\n\tresult := NewObject()\n\tstop := obj.Until(func(k, v *Term) bool {\n\t\tv2 := other.Get(k)\n\t\t// The key didn't exist in other, keep the original value\n\t\tif v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t\treturn false\n\t\t}\n\n\t\t// The key exists in both, resolve the conflict if possible\n\t\tmerged, stop := conflictResolver(v, v2)\n\t\tif !stop {\n\t\t\tresult.Insert(k, merged)\n\t\t}\n\t\treturn stop\n\t})\n\n\tif stop {\n\t\treturn nil, false\n\t}\n\n\t// Copy in any values from other for keys that don't exist in obj\n\tother.Foreach(func(k, v *Term) {\n\t\tif v2 := obj.Get(k); v2 == nil {\n\t\t\tresult.Insert(k, v)\n\t\t}\n\t})\n\treturn result, true\n}", "func (obj object) Merge(other Object) (Object, bool) {\n\treturn obj.MergeWith(other, func(v1, v2 *Term) (*Term, bool) {\n\t\tobj1, ok1 := v1.Value.(Object)\n\t\tobj2, ok2 := v2.Value.(Object)\n\t\tif !ok1 || !ok2 {\n\t\t\treturn nil, true\n\t\t}\n\t\tobj3, ok := obj1.Merge(obj2)\n\t\tif !ok {\n\t\t\treturn nil, true\n\t\t}\n\t\treturn NewTerm(obj3), false\n\t})\n}", "func (dst *Worker) Merge(src Worker) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Command != \"\" {\n\t\tdst.Command = src.Command\n\t}\n\tif len(src.Commands) > 0 {\n\t\tdst.Commands = strings.Unique(append(dst.Commands, src.Commands...))\n\t}\n\tif src.Replicas != 0 {\n\t\tdst.Replicas = src.Replicas\n\t}\n\tif src.LivenessProbe != \"\" {\n\t\tdst.LivenessProbe = src.LivenessProbe\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Resources != nil && dst.Resources == nil {\n\t\tdst.Resources = new(Resources)\n\t}\n\tdst.Resources.Merge(src.Resources)\n}", "func (e *encoder) marshalUnion(t reflect.Type, v reflect.Value, alignment int) error {\n\tkind := v.Field(0).Uint()\n\n\t// Index into the fields of the struct, adding 1 for the tag.\n\tfieldIndex := int(kind) + 1\n\tif fieldIndex >= t.NumField() {\n\t\treturn newValueError(ErrInvalidUnionTag, kind)\n\t}\n\t// Save the head for proper padding.\n\thead := e.head\n\te.writeUint(kind, 4)\n\n\tf := t.Field(fieldIndex)\n\tvar n nestedTypeData\n\tif err := n.FromTag(f.Tag); err != nil {\n\t\treturn err\n\t}\n\t// Re-align to the union's alignment before writing its field.\n\te.head = align(e.head, alignment)\n\tif err := e.marshal(f.Type, v.Field(fieldIndex), n); err != nil {\n\t\treturn err\n\t}\n\ts, err := getPayloadSize(t, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.head = head + s\n\treturn nil\n}", "func (p *ErrorHandlingPolicy) Merge(src ErrorHandlingPolicy) {\n\tif p.IgnoreFileErrors == nil && src.IgnoreFileErrors != nil {\n\t\tp.IgnoreFileErrors = newBool(*src.IgnoreFileErrors)\n\t}\n\n\tif p.IgnoreDirectoryErrors == nil && src.IgnoreDirectoryErrors != nil {\n\t\tp.IgnoreDirectoryErrors = newBool(*src.IgnoreDirectoryErrors)\n\t}\n}", "func (p *ProxySettings) Merge(dst *ProxySettings) {\n\tif dst.HTTPProxy.Empty() {\n\t\tdst.HTTPProxy = p.HTTPProxy\n\t}\n\tif dst.NoProxy.Empty() {\n\t\tdst.NoProxy = p.NoProxy\n\t}\n}", "func (p *ProxySettings) Merge(dst *ProxySettings) {\n\tif dst.HTTPProxy.Empty() {\n\t\tdst.HTTPProxy = p.HTTPProxy\n\t}\n\tif dst.NoProxy.Empty() {\n\t\tdst.NoProxy = p.NoProxy\n\t}\n}", "func AddOrMerge(mtes []MetricFilter, mf2 MetricFilter) []MetricFilter {\n\tfor i, mf1 := range mtes {\n\t\tif mf1.ShouldMerge(mf2) {\n\t\t\tmtes[i] = mf1.MergeWith(mf2)\n\t\t\treturn mtes\n\t\t}\n\t}\n\treturn append(mtes, mf2)\n}", "func (s *MapSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (m *Simple) Merge(overrides *Simple) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n\tm.Str = overrides.Str\n\n\tm.Byt = overrides.Byt\n\n\tm.TestUint32 = overrides.TestUint32\n\n\tm.TestUint64 = overrides.TestUint64\n\n\tm.TestBool = overrides.TestBool\n\n\tm.DoubleTest = overrides.DoubleTest\n\n\tm.FloatTest = overrides.FloatTest\n\n\tm.Int32Test = overrides.Int32Test\n\n\tm.Int64Test = overrides.Int64Test\n\n\tm.Sint32Test = overrides.Sint32Test\n\n\tm.Sint64Test = overrides.Sint64Test\n\n\tm.Fixed32Test = overrides.Fixed32Test\n\n\tm.Fixed64Test = overrides.Fixed64Test\n\n\tm.Sfixed32Test = overrides.Sfixed32Test\n\n\tm.Sfixed64Test = overrides.Sfixed64Test\n\n\tm.StrSkipped = overrides.StrSkipped\n\n\tm.IntSkipped = overrides.IntSkipped\n\n\tif overrides.StrOptional != nil {\n\t\tv := overrides.GetStrOptional()\n\t\tm.StrOptional = &v\n\t}\n\n\tif overrides.TestUint32Optional != nil {\n\t\tv := overrides.GetTestUint32Optional()\n\t\tm.TestUint32Optional = &v\n\t}\n\n\tif overrides.TestUint64Optional != nil {\n\t\tv := overrides.GetTestUint64Optional()\n\t\tm.TestUint64Optional = &v\n\t}\n\n\tif overrides.TestBoolOptional != nil {\n\t\tv := overrides.GetTestBoolOptional()\n\t\tm.TestBoolOptional = &v\n\t}\n\n\tif overrides.DoubleTestOptional != nil {\n\t\tv := overrides.GetDoubleTestOptional()\n\t\tm.DoubleTestOptional = &v\n\t}\n\n\tif overrides.FloatTestOptional != nil {\n\t\tv := overrides.GetFloatTestOptional()\n\t\tm.FloatTestOptional = &v\n\t}\n\n\tif overrides.Int32TestOptional != nil {\n\t\tv := overrides.GetInt32TestOptional()\n\t\tm.Int32TestOptional = &v\n\t}\n\n\tif overrides.Int64TestOptional != nil {\n\t\tv := overrides.GetInt64TestOptional()\n\t\tm.Int64TestOptional = &v\n\t}\n\n\tif overrides.Sint32TestOptional != nil {\n\t\tv := overrides.GetSint32TestOptional()\n\t\tm.Sint32TestOptional = &v\n\t}\n\n\tif overrides.Sint64TestOptional != nil {\n\t\tv := overrides.GetSint64TestOptional()\n\t\tm.Sint64TestOptional = &v\n\t}\n\n\tif overrides.Fixed32TestOptional != nil {\n\t\tv := overrides.GetFixed32TestOptional()\n\t\tm.Fixed32TestOptional = &v\n\t}\n\n\tif overrides.Fixed64TestOptional != nil {\n\t\tv := overrides.GetFixed64TestOptional()\n\t\tm.Fixed64TestOptional = &v\n\t}\n\n\tif overrides.Sfixed32TestOptional != nil {\n\t\tv := overrides.GetSfixed32TestOptional()\n\t\tm.Sfixed32TestOptional = &v\n\t}\n\n\tif overrides.Sfixed64TestOptional != nil {\n\t\tv := overrides.GetSfixed64TestOptional()\n\t\tm.Sfixed64TestOptional = &v\n\t}\n\n\tif overrides.StrSkippedOptional != nil {\n\t\tv := overrides.GetStrSkippedOptional()\n\t\tm.StrSkippedOptional = &v\n\t}\n\n\tif overrides.IntSkippedOptional != nil {\n\t\tv := overrides.GetIntSkippedOptional()\n\t\tm.IntSkippedOptional = &v\n\t}\n\n}", "func (p *UploadPolicy) Merge(src UploadPolicy, def *UploadPolicyDefinition, si snapshot.SourceInfo) {\n\tmergeOptionalInt(&p.MaxParallelSnapshots, src.MaxParallelSnapshots, &def.MaxParallelSnapshots, si)\n\tmergeOptionalInt(&p.MaxParallelFileReads, src.MaxParallelFileReads, &def.MaxParallelFileReads, si)\n\tmergeOptionalInt64(&p.ParallelUploadAboveSize, src.ParallelUploadAboveSize, &def.ParallelUploadAboveSize, si)\n}", "func (c ConversionFuncs) Merge(other ConversionFuncs) ConversionFuncs {\n\tmerged := NewConversionFuncs()\n\tfor k, v := range c.untyped {\n\t\tmerged.untyped[k] = v\n\t}\n\tfor k, v := range other.untyped {\n\t\tmerged.untyped[k] = v\n\t}\n\treturn merged\n}", "func TestConverterUnion(t *testing.T) {\n\t// values for union component types\n\tvvTrue := vdl.BoolValue(nil, true)\n\tvv123 := vdl.IntValue(vdl.Int64Type, 123)\n\tvvAbc := vdl.StringValue(nil, \"Abc\")\n\tvvStruct123 := vdl.ZeroValue(vdl.StructInt64TypeN)\n\tvvStruct123.StructField(0).Assign(vv123)\n\trvTrue := bool(true)\n\trv123 := int64(123)\n\trvAbc := string(\"Abc\")\n\trvStruct123 := vdl.NStructInt64{123}\n\t// values for union{A bool;B string;C struct}\n\tvvTrueABC := vdl.UnionValue(vdl.UnionABCTypeN, 0, vvTrue)\n\tvvAbcABC := vdl.UnionValue(vdl.UnionABCTypeN, 1, vvAbc)\n\tvvStruct123ABC := vdl.UnionValue(vdl.UnionABCTypeN, 2, vvStruct123)\n\trvTrueABC := vdl.NUnionABCA{rvTrue}\n\trvAbcABC := vdl.NUnionABCB{rvAbc}\n\trvStruct123ABC := vdl.NUnionABCC{rvStruct123}\n\trvTrueABCi := vdl.NUnionABC(rvTrueABC)\n\trvAbcABCi := vdl.NUnionABC(rvAbcABC)\n\trvStruct123ABCi := vdl.NUnionABC(rvStruct123ABC)\n\t// values for union{B string;C struct;D int64}\n\tvvAbcBCD := vdl.UnionValue(vdl.UnionBCDTypeN, 0, vvAbc)\n\tvvStruct123BCD := vdl.UnionValue(vdl.UnionBCDTypeN, 1, vvStruct123)\n\tvv123BCD := vdl.UnionValue(vdl.UnionBCDTypeN, 2, vv123)\n\trvAbcBCD := vdl.NUnionBCDB{rvAbc}\n\trvStruct123BCD := vdl.NUnionBCDC{rvStruct123}\n\trv123BCD := vdl.NUnionBCDD{rv123}\n\trvAbcBCDi := vdl.NUnionBCD(rvAbcBCD)\n\trvStruct123BCDi := vdl.NUnionBCD(rvStruct123BCD)\n\trv123BCDi := vdl.NUnionBCD(rv123BCD)\n\t// values for union{X string;Y struct}, which has no Go equivalent.\n\tvvAbcXY := vdl.UnionValue(vdl.UnionXYTypeN, 0, vvAbc)\n\tvvStruct123XY := vdl.UnionValue(vdl.UnionXYTypeN, 1, vvStruct123)\n\n\ttests := []struct {\n\t\tvvWant *vdl.Value\n\t\trvWant interface{}\n\t\tvvSrc *vdl.Value\n\t\trvSrc interface{}\n\t}{\n\t\t// Convert source and target same union.\n\t\t{vvTrueABC, rvTrueABC, vvTrueABC, rvTrueABC},\n\t\t{vv123BCD, rv123BCD, vv123BCD, rv123BCD},\n\t\t{vvAbcABC, rvAbcABC, vvAbcABC, rvAbcABC},\n\t\t{vvAbcBCD, rvAbcBCD, vvAbcBCD, rvAbcBCD},\n\t\t{vvStruct123ABC, rvStruct123ABC, vvStruct123ABC, rvStruct123ABC},\n\t\t{vvStruct123BCD, rvStruct123BCD, vvStruct123BCD, rvStruct123BCD},\n\t\t// Same thing, but with pointers to the interface type.\n\t\t{vvTrueABC, &rvTrueABCi, vvTrueABC, &rvTrueABCi},\n\t\t{vv123BCD, &rv123BCDi, vv123BCD, &rv123BCD},\n\t\t{vvAbcABC, &rvAbcABCi, vvAbcABC, &rvAbcABC},\n\t\t{vvAbcBCD, &rvAbcBCDi, vvAbcBCD, &rvAbcBCD},\n\t\t{vvStruct123ABC, &rvStruct123ABCi, vvStruct123ABC, &rvStruct123ABCi},\n\t\t{vvStruct123BCD, &rvStruct123BCDi, vvStruct123BCD, &rvStruct123BCDi},\n\n\t\t// Convert source and target different union.\n\t\t{vvAbcABC, rvAbcABC, vvAbcBCD, rvAbcBCD},\n\t\t{vvAbcBCD, rvAbcBCD, vvAbcABC, rvAbcABC},\n\t\t{vvStruct123ABC, rvStruct123ABC, vvStruct123BCD, rvStruct123BCD},\n\t\t{vvStruct123BCD, rvStruct123BCD, vvStruct123ABC, rvStruct123ABC},\n\t\t// Same thing, but with pointers to the interface type.\n\t\t{vvAbcABC, &rvAbcABCi, vvAbcBCD, &rvAbcBCDi},\n\t\t{vvAbcBCD, &rvAbcBCDi, vvAbcABC, &rvAbcABCi},\n\t\t{vvStruct123ABC, &rvStruct123ABCi, vvStruct123BCD, &rvStruct123BCDi},\n\t\t{vvStruct123BCD, &rvStruct123BCDi, vvStruct123ABC, &rvStruct123ABCi},\n\n\t\t// Test unions that have no Go equivalent.\n\t\t{vvAbcXY, nil, vvAbcXY, nil},\n\t\t{vvStruct123XY, nil, vvStruct123XY, nil},\n\t}\n\tfor _, test := range tests {\n\t\ttestConverterWantSrc(t,\n\t\t\tvvrv{vvSlice(test.vvWant), rvSlice(test.rvWant)},\n\t\t\tvvrv{vvSlice(test.vvSrc), rvSlice(test.rvSrc)})\n\t}\n}", "func Merge(dataA *interface{}, dataB *interface{}, arrayAppend bool) {\n\tmergeRecursive(dataA, dataB, arrayAppend, nil, \"\")\n}", "func (a *AttributeDefinition) Merge(other *AttributeDefinition) *AttributeDefinition {\n\tif other == nil {\n\t\treturn a\n\t}\n\tif a == nil {\n\t\treturn other\n\t}\n\tleft := a.Type.(Object)\n\tright := other.Type.(Object)\n\tif left == nil || right == nil {\n\t\tpanic(\"cannot merge non object attributes\") // bug\n\t}\n\tfor n, v := range right {\n\t\tleft[n] = v\n\t}\n\treturn a\n}", "func (geom Geometry) Union(other Geometry) Geometry {\n\tnewGeom := C.OGR_G_Union(geom.cval, other.cval)\n\treturn Geometry{newGeom}\n}", "func (mdl *Model) Merge(model std.Model) error {\n\treturn nil\n}", "func (f *First) Merge(ctx *sql.Context, buffer, partial sql.Row) error {\n\treturn nil\n}", "func (me *Sac) Merge(i interface{}) *Sac {\n\n\tswitch reflect.TypeOf(i).Kind() {\n\tcase reflect.Struct:\n\t\tif s, ok := i.(Sac); ok {\n\t\t\tme.Merge(s.Data)\n\t\t} else {\n\t\t\tme.Merge(structs.Map(i))\n\t\t}\n\tcase reflect.Map:\n\t\tm := i.(map[string]interface{})\n\t\tfor key, val := range m {\n\t\t\tif _, exists := me.Data[key]; exists {\n\t\t\t\tpanic(\"Merge field already exists:\" + key)\n\t\t\t} else {\n\t\t\t\tme.Data[key] = val\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tpanic(\"Can't merge something that is not struct or map\")\n\t}\n\n\treturn me\n}", "func (b *BaseImpl) Merge() {\n\tb.Flatten()\n}", "func MarshalEx(v interface{}, allowEmptyUnion bool) ([]byte, error) {\n\tdata := make(map[string]interface{})\n\tvalue := reflect.ValueOf(v)\n\tvalueType := reflect.TypeOf(v)\n\n\tunionTypes, err := parseUnionTypes(valueType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set all union type fields in the map.\n\tfor key, fields := range unionTypes {\n\t\tunionDefined := false\n\t\tfor name, field := range fields {\n\t\t\t// Only marshal union types that are defined.\n\t\t\tif value.Field(field.index).IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Only one union type can be marshaled into the JSON struct.\n\t\t\tif unionDefined {\n\t\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\t\"%s defines a union field when one is already defined\", key)\n\t\t\t}\n\n\t\t\t// Marshal the union type to a map and add each field to the parent map.\n\t\t\tnested, err := marshalToMap(value.Field(field.index).Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// TODO: Check if union types have interfering field names.\n\t\t\tfor nestedKey, nestedValue := range nested {\n\t\t\t\tdata[nestedKey] = nestedValue\n\t\t\t}\n\n\t\t\t// Set the union type key to the union type name.\n\t\t\tdata[key] = name\n\t\t\tunionDefined = true\n\t\t}\n\n\t\t// At least one union type must be defined.\n\t\tif !unionDefined && !allowEmptyUnion {\n\t\t\treturn nil, errors.Errorf(\"no union field defined: %s\", key)\n\t\t}\n\t}\n\n\t// Marshal all the fields in the base struct.\n\tfor i := 0; i < valueType.NumField(); i++ {\n\t\tfield := valueType.Field(i)\n\t\tswitch jsonTagValue, ok := field.Tag.Lookup(\"json\"); {\n\t\tcase jsonTagValue == \"-\":\n\t\t\tcontinue\n\t\tcase !ok:\n\t\t\tjsonTagValue = field.Name\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\tif strings.Contains(jsonTagValue, \",\") {\n\t\t\t\treturn nil, errors.New(\n\t\t\t\t\t\"advanced json tag features not support in union type marshaling\")\n\t\t\t}\n\t\t\tdata[jsonTagValue] = value.Field(i).Interface()\n\t\t}\n\t}\n\n\treturn json.Marshal(data)\n}", "func (m *Merge) Merge(data interface{}, s *Sources) ([]MergedMeta, error) {\n\t// all types of data & sources must be the same\n\tif err := m.checkDataTypes(data, s); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := m.mergeSources(data, s.Sources()); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m.mergedMeta, nil\n}", "func (d *decoder) unmarshalUnion(t reflect.Type, v reflect.Value, alignment int) error {\n\t// Save the head for proper padding.\n\thead := d.head\n\tkind := d.readUint(4)\n\n\t// Index into the fields of the struct, adding 1 for the tag.\n\tfieldIndex := int(kind) + 1\n\tif fieldIndex >= t.NumField() {\n\t\treturn ErrInvalidUnionTag\n\t}\n\tv.Field(0).SetUint(kind)\n\n\tf := t.Field(fieldIndex)\n\tvar n nestedTypeData\n\tif err := n.FromTag(f.Tag); err != nil {\n\t\treturn err\n\t}\n\td.head = align(d.head, alignment)\n\tif err := d.unmarshal(f.Type, v.Field(fieldIndex), n); err != nil {\n\t\treturn err\n\t}\n\ts, err := getPayloadSize(t, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.head = head + s\n\treturn nil\n}", "func (dst *PostgreSQL) Merge(src *PostgreSQL) {\n\tif dst == nil || src == nil {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Version != \"\" {\n\t\tdst.Version = src.Version\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Fixtures != nil {\n\t\tdst.Fixtures = src.Fixtures\n\t}\n\tif src.OwnName != nil {\n\t\tdst.OwnName = src.OwnName\n\t}\n\n\tif src.DataBus != nil && dst.DataBus == nil {\n\t\tdst.DataBus = new(DataBus)\n\t}\n\tdst.DataBus.Merge(src.DataBus)\n}", "func (s *CommandLineSource) Merge(ko *koanf.Koanf, val *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func (v Values) Merge(src Values) Values {\n\tfor key, srcVal := range src {\n\t\tdestVal, found := v[key]\n\n\t\tsrcType := fmt.Sprintf(\"%T\", srcVal)\n\t\tdestType := fmt.Sprintf(\"%T\", destVal)\n\t\tmatch := srcType == destType\n\t\tvalidSrc := istable(srcVal)\n\t\tvalidDest := istable(destVal)\n\n\t\tif found && match && validSrc && validDest {\n\t\t\tdestMap := destVal.(Values)\n\t\t\tsrcMap := srcVal.(Values)\n\t\t\tdestMap.Merge(srcMap)\n\t\t} else {\n\t\t\tv[key] = srcVal\n\t\t}\n\t}\n\treturn v\n}", "func (m *Empty) Merge(overrides *Empty) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n}", "func (bm tsidbitmap) Merge(other tsidbitmap) (tsidbitmap, bool) {\n\tfor len(bm) < len(other) {\n\t\tbm = append(bm, 0)\n\t}\n\tdirty := false\n\tfor i, v := range other {\n\t\tdirty = dirty || (bm[i]|v != bm[i])\n\t\tbm[i] |= v\n\t}\n\treturn bm, dirty\n}", "func (def *Definition) Merge(w window.Span, v interface{}, prev window.State) error {\n\tf := merger.Cons()\n\tif def.g.merger != nil {\n\t\tf = merger.Fold(def.g.merger)\n\t}\n\treturn def.g.window.Merge(w, v, prev, f)\n}", "func Merge(dst map[interface{}]interface{}, src map[interface{}]interface{}) {\n\tfor k, v := range src {\n\t\tif srcMap, ok := v.(map[interface{}]interface{}); ok {\n\t\t\tif dstMap, ok := dst[k].(map[interface{}]interface{}); ok {\n\t\t\t\tMerge(dstMap, srcMap)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tdst[k] = v\n\t}\n}", "func (mb *MutableBag) Merge(bags ...*MutableBag) error {\n\t// first step is to make sure there are no redundant definitions of the same attribute\n\tkeys := make(map[string]bool)\n\tfor _, bag := range bags {\n\t\tif bag == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor k := range bag.values {\n\t\t\tif keys[k] {\n\t\t\t\treturn fmt.Errorf(\"conflicting value for attribute %s\", k)\n\t\t\t}\n\t\t\tkeys[k] = true\n\t\t}\n\t}\n\n\t// now that we know there are no conflicting definitions, do the actual merging...\n\tfor _, bag := range bags {\n\t\tif bag == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor k, v := range bag.values {\n\t\t\tmb.values[k] = copyValue(v)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (dst *SFTP) Merge(src *SFTP) {\n\tif dst == nil || src == nil {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n}", "func (h *HyperLogLog32) Union(a, b *HyperLogLog32) error {\n\tif a.p != b.p {\n\t\treturn errors.New(\"card: mismatched precision\")\n\t}\n\tta := reflect.TypeOf(b.hash)\n\tif reflect.TypeOf(b.hash) != ta {\n\t\treturn errors.New(\"card: mismatched hash function\")\n\t}\n\tif h.hash != nil && reflect.TypeOf(h.hash) != ta {\n\t\treturn errors.New(\"card: mismatched hash function\")\n\t}\n\n\tif h != a && h != b {\n\t\t*h = HyperLogLog32{p: a.p, m: a.m, hash: h.hash, register: make([]uint8, a.m)}\n\t}\n\tfor i, r := range a.register {\n\t\th.register[i] = max(r, b.register[i])\n\t}\n\treturn nil\n}", "func (d *ImplData) MergeFields(fields []Field) {\n\tif len(fields) == 0 {\n\t\treturn\n\t}\n\td.Fields = append(fields, d.Fields...)\n}", "func (obj *JSONObject) Merge(s2 JSONObject) {\n\ttmp := *obj\n\n\tfor k, v := range s2 {\n\t\ttmp[k] = v\n\t}\n\n\t*obj = tmp\n}", "func (d PacketData) Merge(oth PacketData) {\n\toth.pk.buf.TrimFront(int64(oth.pk.dataOffset()))\n\td.pk.buf.Merge(&oth.pk.buf)\n}", "func merge(original interface{}, update interface{}) (merged interface{}, err error) {\n\n\tlogger.Info(\"Merging\", \"original\", original, \"update\", update)\n\n\tswitch O := original.(type) {\n\n\tcase map[string]interface{}:\n\t\tU, ok := update.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"update is not mS like original\")\n\t\t}\n\t\tlogger.Info(\"mS entering\")\n\t\tfor key, val := range U {\n\t\t\tlogger.Debug(\"in merge mS-U\", \"key\", key, \"val\", val, \"curr\", O[key])\n\t\t\tif curr, exists := O[key]; exists {\n\t\t\t\ttmp, err := merge(curr, val)\n\t\t\t\tlogger.Debug(\"after merge mS\", \"tmp\", tmp, \"err\", err)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"in merge mS\")\n\t\t\t\t}\n\t\t\t\tO[key] = tmp\n\t\t\t} else {\n\t\t\t\tO[key] = val\n\t\t\t}\n\t\t}\n\t\tlogger.Info(\"mS returning\", \"O\", O)\n\t\treturn O, nil\n\n\tcase []interface{}:\n\t\tU, ok := update.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"update is not aI like original\")\n\t\t}\n\t\t// logger.Warn(\"O\", \"data\", O)\n\t\t// logger.Warn(\"U\", \"data\", U)\n\n\t\tlogger.Info(\"aI entering\")\n\t\t// turn update into map\n\t\tUM := map[string]interface{}{}\n\t\tfor i, elem := range U {\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\t\t\t\tUM[name.(string)] = E\n\n\t\t\tcase string:\n\t\t\t\tUM[E] = E\n\n\t\t\tdefault:\n\t\t\t\tlogger.Error(\"original unknown elem type in aI\", \"i\", i, \"elem\", elem)\n\t\t\t\treturn nil, errors.New(\"original unknown elem type in aI\")\n\t\t\t}\n\t\t}\n\n\t\tfor i, elem := range O {\n\t\t\t// logger.Crit(\"O-loop\", \"i\", i, \"elem\", elem)\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tiname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\n\t\t\t\tname := iname.(string)\n\t\t\t\t// logger.Error(\"Name\", \"name\", name)\n\n\t\t\t\tcurr, exists := UM[name]\n\t\t\t\tif exists {\n\t\t\t\t\ttmp, err := merge(elem, curr)\n\t\t\t\t\t// this is correct, the var names curr and elem are backwards...\n\t\t\t\t\t// busy fixing a bug\n\t\t\t\t\t// logger.Crit(\"merging with existing element\", \"key\", name, \"val\", curr, \"curr\", elem)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, errors.Wrap(err, \"in merge MS\")\n\t\t\t\t\t}\n\t\t\t\t\tO[i] = tmp\n\t\t\t\t\tdelete(UM, name)\n\t\t\t\t}\n\t\t\tcase string:\n\t\t\t\t_, exists := UM[E]\n\t\t\t\tif exists {\n\t\t\t\t\tdelete(UM, E)\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tlogger.Error(\"original unknown elem type in aI\", \"i\", i, \"elem\", elem)\n\t\t\t\treturn nil, errors.New(\"original unknown elem type in aI\")\n\t\t\t}\n\t\t}\n\t\t// merge\n\t\tlogger.Info(\"aI\")\n\n\t\t// turn back into array\n\t\tOA := []interface{}{}\n\t\tfor _, val := range O {\n\t\t\tOA = append(OA, val)\n\t\t}\n\t\tfor _, elem := range U {\n\t\t\tswitch E := elem.(type) {\n\n\t\t\tcase map[string]interface{}:\n\t\t\t\tname, ok := E[\"name\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, errors.New(\"original array objects must have names to be merged\")\n\t\t\t\t}\n\t\t\t\t_, exists := UM[name.(string)]\n\t\t\t\tif exists {\n\t\t\t\t\tOA = append(OA, elem)\n\t\t\t\t}\n\n\t\t\tcase string:\n\t\t\t\t_, exists := UM[E]\n\t\t\t\tif exists {\n\t\t\t\t\tOA = append(OA, elem)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// logger.Error(\"OA\", \"data\", OA)\n\n\t\tlogger.Info(\"aI returning\", \"OA\", OA)\n\t\treturn OA, nil\n\n\tcase string:\n\t\treturn update, nil\n\n\tdefault:\n\t\treturn nil, errors.New(\"unmergable original\" + fmt.Sprintf(\"%t, %+v\", original, original))\n\n\t}\n\n\tlogger.Crit(\"Shouldn't get here (end of merge function)\")\n\treturn nil, errors.New(\"PANIC, should not get here\")\n}", "func (d *DSU) Union(x, y interface{}) bool {\n\tif !d.Contains(x) || !d.Contains(y) {\n\t\treturn false\n\t}\n\n\tif d.Find(x) == d.Find(y) {\n\t\treturn false\n\t}\n\n\tnodex := d.nodes[d.Find(x)]\n\tnodey := d.nodes[d.Find(y)]\n\n\tif nodex.size > nodey.size {\n\t\tnodey.parent = nodex\n\t\tnodex.size += nodey.size\n\t} else {\n\t\tnodex.parent = nodey\n\t\tnodey.size += nodex.size\n\t}\n\n\treturn true\n}", "func (e *updateRuntimeStats) Merge(other execdetails.RuntimeStats) {\n\ttmp, ok := other.(*updateRuntimeStats)\n\tif !ok {\n\t\treturn\n\t}\n\tif tmp.SnapshotRuntimeStats != nil {\n\t\tif e.SnapshotRuntimeStats == nil {\n\t\t\tsnapshotStats := tmp.SnapshotRuntimeStats.Clone()\n\t\t\te.SnapshotRuntimeStats = snapshotStats\n\t\t} else {\n\t\t\te.SnapshotRuntimeStats.Merge(tmp.SnapshotRuntimeStats)\n\t\t}\n\t}\n\tif tmp.AllocatorRuntimeStats != nil {\n\t\tif e.AllocatorRuntimeStats == nil {\n\t\t\te.AllocatorRuntimeStats = tmp.AllocatorRuntimeStats.Clone()\n\t\t}\n\t}\n}", "func Merge(arr []interface{}, comp goutils.TypeComparator, low, mid, high int)(){\n if low == high {\n return\n }\n n1 := mid - low + 1;\n n2 := high - mid;\n L := make([]interface{}, n1)\n R := make([]interface{}, n2)\n // Copy data to temp arrays Left[] and Right[]\n for i := 0; i < n1; i++{\n L[i] = arr[low + i]\n }\n for j := 0; j < n2; j++ {\n R[j] = arr[mid+1+j]\n }\n // Merge the temp arrays back into arr[low..high]\n i := 0 // Initial index of first subarray\n j := 0 // Initial index of second subarray\n k := low // Initial index of merged subarray\n for i < n1 && j < n2 {\n if comp(L[i], R[j]) == -1 || comp(L[i], R[j]) == 0 {\n arr[k] = L[i]\n i+=1\n } else{\n arr[k] = R[j]\n j+=1\n }\n k+=1\n }\n // Copy the remaining elements of L[], if there are any\n for i < n1 {\n arr[k] = L[i];\n i+=1\n k+=1\n }\n // Copy the remaining elements of R[], if there are any\n for j < n2 {\n arr[k] = R[j];\n j+=1\n k+=1\n }\n}", "func (dst *Proxy) Merge(src Proxy) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tdst.Hosts.Merge(src.Hosts)\n}", "func (fs *FieldSlice) Merge(fields ...*Field) error {\n\tfor _, f := range fields {\n\t\tif err := (*fs).merge(f); err != nil {\n\t\t\treturn errgo.Mask(err)\n\t\t}\n\t}\n\treturn nil\n}", "func (f *ValuedFull) Merge(val Valued) {\n\toverlaps := make([]Valued, 0, 16)\n\tf.overlapped(val.Key, &overlaps)\n\tf.mergeWithOverlap(val, overlaps, nil)\n}", "func Merge(target sgmt.MutableSegment, srcs ...sgmt.MutableSegment) error {\n\tsafeClosers := []io.Closer{}\n\tdefer func() {\n\t\tfor _, c := range safeClosers {\n\t\t\tc.Close()\n\t\t}\n\t}()\n\n\t// for each src\n\tfor _, src := range srcs {\n\t\t// get reader for `src`\n\t\treader, err := src.Reader()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// ensure readers are all closed.\n\t\treaderCloser := x.NewSafeCloser(reader)\n\t\tsafeClosers = append(safeClosers, readerCloser)\n\n\t\t// retrieve all docs known to the reader\n\t\tdIter, err := reader.AllDocs()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// iterate over all known docs\n\t\tfor dIter.Next() {\n\t\t\td := dIter.Current()\n\t\t\t_, err := target.Insert(d)\n\t\t\tif err == nil || err == index.ErrDuplicateID {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// ensure no errors while iterating\n\t\tif err := dIter.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// ensure no errors while closing reader\n\t\tif err := readerCloser.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// all good\n\treturn nil\n}", "func (f *FieldConstraint) MergeInferred(other *FieldConstraint) {\n\tfor _, by := range other.InferredBy {\n\t\tduplicate := false\n\t\tfor _, fby := range f.InferredBy {\n\t\t\tif fby.IsEqual(by) {\n\t\t\t\tduplicate = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !duplicate {\n\t\t\tf.InferredBy = append(f.InferredBy, by)\n\t\t}\n\t}\n}", "func (u OpUnion) Equal(other OpUnion) bool {\n\t// keep in sync with Pipeline.Equal as go is terrible at inlining anything with a loop\n\tif u.Type != other.Type {\n\t\treturn false\n\t}\n\n\tif u.Type == pipeline.RollupOpType {\n\t\treturn u.Rollup.Equal(other.Rollup)\n\t}\n\n\treturn u.Transformation.Type == other.Transformation.Type\n}", "func (s *FKCheckRuntimeStats) Merge(other execdetails.RuntimeStats) {\n\ttmp, ok := other.(*FKCheckRuntimeStats)\n\tif !ok {\n\t\treturn\n\t}\n\ts.Total += tmp.Total\n\ts.Check += tmp.Check\n\ts.Lock += tmp.Lock\n\ts.Keys += tmp.Keys\n}", "func (f *FilterParams) MergeFilterObjects(filters []model.FilterObject) {\n\tfor _, features := range filters {\n\t\tfor _, filter := range features.List {\n\t\t\tfound := false\n\t\t\tfor _, setOther := range f.Filters {\n\t\t\t\tfor _, filters := range setOther.FeatureFilters {\n\t\t\t\t\tfor _, currentFilter := range filters.List {\n\t\t\t\t\t\tif filtersEqual(filter, currentFilter) {\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}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tf.AddFilter(filter)\n\t\t\t}\n\t\t}\n\t}\n}", "func (bst *BST) Union(other *BST) []interface{} {\n\treturn set_operation(bst.Root, other.Root, setUnion)\n}", "func (attr SGRAttr) Merge(other SGRAttr) SGRAttr {\n\tif other&SGRAttrClear != 0 {\n\t\tattr = SGRClear\n\t}\n\tattr |= other & SGRAttrMask\n\tif c, set := other.FG(); set {\n\t\tattr = attr.SansFG() | c.FG()\n\t}\n\tif c, set := other.BG(); set {\n\t\tattr = attr.SansBG() | c.BG()\n\t}\n\treturn attr\n}", "func Unionize(lhs, rhs SelectStatement, unionType string, by OrderBy, limit *Limit, lock string) *Union {\n\n\tunion, isUnion := lhs.(*Union)\n\tif isUnion {\n\t\tunion.UnionSelects = append(union.UnionSelects, &UnionSelect{UnionType: unionType, Statement: rhs})\n\t\tunion.OrderBy = by\n\t\tunion.Limit = limit\n\t\tunion.Lock = lock\n\t\treturn union\n\t}\n\n\treturn &Union{FirstStatement: lhs, UnionSelects: []*UnionSelect{{UnionType: unionType, Statement: rhs}}, OrderBy: by, Limit: limit, Lock: lock}\n}", "func (a *AudioMeta) Merge(b *AudioMeta) {\n\tif len(a.Title) == 0 {\n\t\ta.Title = b.Title\n\t}\n\n\tif len(a.Artist) == 0 {\n\t\ta.Artist = b.Artist\n\t}\n\n\tif len(a.Album) == 0 {\n\t\ta.Album = b.Album\n\t}\n\n\tif a.Track != b.Track && a.Track == 0 {\n\t\ta.Track = b.Track\n\t}\n\n\tif a.TotalTracks != b.TotalTracks && a.TotalTracks == 0 {\n\t\ta.TotalTracks = b.TotalTracks\n\t}\n\n\tif a.Year != b.Year && a.Year == 0 {\n\t\ta.Year = b.Year\n\t}\n\n\tif len(a.AlbumArtist) == 0 {\n\t\ta.AlbumArtist = b.AlbumArtist\n\t}\n\n\tif len(a.Genre) == 0 {\n\t\ta.Genre = b.Genre\n\t}\n\n\tif a.Duration != b.Duration && a.Duration == 0 {\n\t\ta.Duration = b.Duration\n\t}\n\n\tif a.CoverBufer == nil {\n\t\ta.CoverBufer = b.CoverBufer\n\t}\n}", "func merge(dst interface{}, src interface{}) (interface{}, error) {\n\tswitch dstType := dst.(type) {\n\tcase []interface{}:\n\t\tsrcSlice, ok := src.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%w: []interface{} with %T\", errCannotMerge, src)\n\t\t}\n\n\t\treturn append(dstType, srcSlice...), nil\n\tcase map[string]interface{}:\n\t\tsrcMap, ok := src.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"%w: map[string]interface{} with %T\", errCannotMerge, src)\n\t\t}\n\n\t\tfor key, value := range srcMap {\n\t\t\tdstType[key] = value\n\t\t}\n\n\t\treturn dstType, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%w: unsupported type %T\", errCannotMerge, dst)\n\t}\n}", "func (m *MockVirtualDestinationSet) Union(set v1beta1sets.VirtualDestinationSet) v1beta1sets.VirtualDestinationSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1beta1sets.VirtualDestinationSet)\n\treturn ret0\n}", "func (s *SeriesIDSet) Merge(others ...*SeriesIDSet) {\n\tbms := make([]*roaring.Bitmap, 0, len(others)+1)\n\n\ts.RLock()\n\tbms = append(bms, s.bitmap) // Add ourself.\n\n\t// Add other bitsets.\n\tfor _, other := range others {\n\t\tother.RLock()\n\t\tdefer other.RUnlock() // Hold until we have merged all the bitmaps\n\t\tbms = append(bms, other.bitmap)\n\t}\n\n\tresult := roaring.FastOr(bms...)\n\ts.RUnlock()\n\n\ts.Lock()\n\ts.bitmap = result\n\ts.Unlock()\n}", "func (s *FKCascadeRuntimeStats) Merge(other execdetails.RuntimeStats) {\n\ttmp, ok := other.(*FKCascadeRuntimeStats)\n\tif !ok {\n\t\treturn\n\t}\n\ts.Total += tmp.Total\n\ts.Keys += tmp.Keys\n}", "func (cfg Config) Merge(override Config) Config {\n\tmerged := Config{\n\t\tID: cfg.ID,\n\t\tName: cfg.Name,\n\t\tDiscoveryImpl: cfg.DiscoveryImpl,\n\t\tDiscoveryFlagsByImpl: map[string]map[string]string{},\n\t\tTabletFQDNTmplStr: cfg.TabletFQDNTmplStr,\n\t\tVtSQLFlags: map[string]string{},\n\t\tVtctldFlags: map[string]string{},\n\t\tBackupReadPoolConfig: cfg.BackupReadPoolConfig.merge(override.BackupReadPoolConfig),\n\t\tSchemaReadPoolConfig: cfg.SchemaReadPoolConfig.merge(override.SchemaReadPoolConfig),\n\t\tTopoReadPoolConfig: cfg.TopoReadPoolConfig.merge(override.TopoReadPoolConfig),\n\t\tTopoRWPoolConfig: cfg.TopoRWPoolConfig.merge(override.TopoRWPoolConfig),\n\t\tWorkflowReadPoolConfig: cfg.WorkflowReadPoolConfig.merge(override.WorkflowReadPoolConfig),\n\t\tEmergencyFailoverPoolConfig: cfg.EmergencyFailoverPoolConfig.merge(override.EmergencyFailoverPoolConfig),\n\t\tFailoverPoolConfig: cfg.FailoverPoolConfig.merge(override.FailoverPoolConfig),\n\t\tSchemaCacheConfig: mergeCacheConfigs(cfg.SchemaCacheConfig, override.SchemaCacheConfig),\n\t}\n\n\tif override.ID != \"\" {\n\t\tmerged.ID = override.ID\n\t}\n\n\tif override.Name != \"\" {\n\t\tmerged.Name = override.Name\n\t}\n\n\tif override.DiscoveryImpl != \"\" {\n\t\tmerged.DiscoveryImpl = override.DiscoveryImpl\n\t}\n\n\tif override.TabletFQDNTmplStr != \"\" {\n\t\tmerged.TabletFQDNTmplStr = override.TabletFQDNTmplStr\n\t}\n\n\t// first, the default flags\n\tmerged.DiscoveryFlagsByImpl.Merge(cfg.DiscoveryFlagsByImpl)\n\t// then, apply any overrides\n\tmerged.DiscoveryFlagsByImpl.Merge(override.DiscoveryFlagsByImpl)\n\n\tmergeStringMap(merged.VtSQLFlags, cfg.VtSQLFlags)\n\tmergeStringMap(merged.VtSQLFlags, override.VtSQLFlags)\n\n\tmergeStringMap(merged.VtctldFlags, cfg.VtctldFlags)\n\tmergeStringMap(merged.VtctldFlags, override.VtctldFlags)\n\n\treturn merged\n}", "func (s *BaseSyslParserListener) EnterUnion(ctx *UnionContext) {}", "func merge(dest *config, src config) {\n\tmergo.Merge(dest, src, mergo.WithOverride)\n}", "func (m *Merge) merge(travVals *traversedValues) error {\n\tswitch travVals.data.Kind() {\n\tcase reflect.Struct:\n\t\tfor i := 0; i < travVals.data.NumField(); i++ {\n\t\t\tnewTravVals := newTraversedValues()\n\t\t\tnewTravVals.data = travVals.data.Field(i)\n\t\t\tfor _, s := range travVals.sources {\n\t\t\t\tnewTravVals.sources = append(newTravVals.sources, &traversedSource{\n\t\t\t\t\tname: s.name,\n\t\t\t\t\tdata: s.data.Field(i),\n\t\t\t\t})\n\t\t\t}\n\t\t\tnewTravVals.joinFieldPath(travVals.fieldPath, travVals.data.Type().Field(i).Name)\n\n\t\t\terr := m.merge(newTravVals)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\tcase reflect.Ptr:\n\t\tswitch travVals.data.Type().Elem().Kind() {\n\t\tcase reflect.Struct, reflect.Map, reflect.Slice, reflect.Array, reflect.Interface, reflect.Ptr:\n\t\t\treturn errors.Wrapf(errUnsupportedType, \"merge: `%s`\", travVals.data.Type().Elem().Kind())\n\t\tcase reflect.Invalid:\n\t\t\treturn errReallyWrong\n\t\tdefault:\n\t\t\tselectedValue, selectedSource, err := m.selectValue(travVals)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttravVals.data.Set(selectedValue)\n\n\t\t\tm.mergedMeta = append(m.mergedMeta, MergedMeta{\n\t\t\t\tFieldPath: travVals.fieldPath,\n\t\t\t\tSource: selectedSource,\n\t\t\t\tValue: fmt.Sprintf(\"%+v\", selectedValue.Elem()),\n\t\t\t})\n\t\t}\n\tcase reflect.Invalid:\n\t\treturn errReallyWrong\n\tdefault:\n\t\treturn errors.Wrapf(errUnsupportedType, \"merge: `%s`\", travVals.data.Kind())\n\t}\n\n\treturn nil\n}", "func (s *SQLOperations) Merge(ops SQLOperations) {\n\tfor _, slice := range ops {\n\t\tif len(slice.Statement) > 0 {\n\t\t\ts.Add(slice)\n\t\t}\n\t}\n}", "func (d *decoder) unmarshalStructOrUnionInline(t reflect.Type, v reflect.Value) error {\n\ta, err := getPayloadAlignment(t, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.head = align(d.head, a)\n\tif isUnionType(t) {\n\t\terr = d.unmarshalUnion(t, v, a)\n\t} else {\n\t\terr = d.unmarshalStructFields(t, v)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\td.head = align(d.head, a)\n\treturn nil\n}", "func (m Meta) Merge(other Change) (otherx, cx Change) {\n\tif m.Change != nil {\n\t\tother, m.Change = m.Change.Merge(other)\n\t}\n\treturn other, m\n}", "func (so *Operations) Merge(merge api.Operations) {\n\tfor _, id := range merge.Order() {\n\t\top, _ := merge.Get(id)\n\t\tso.Add(op)\n\t}\n}", "func (j *JSONCodec) Update(data []byte, obj basemodels.Object) ([]byte, error) {\n\tif obj == nil {\n\t\treturn nil, errors.New(\"got nil basemodels.Object\")\n\t}\n\t// Get new instance of the same type as obj.\n\tdst := proto.Clone(obj)\n\tdst.Reset()\n\n\t// Unmarshal old data into fresh instance.\n\terr := json.Unmarshal(data, dst)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error unmarshalling previous object data: %v\", err)\n\t}\n\n\t// Merge new obj to old.\n\tif err := mergo.Merge(dst, obj, mergo.WithOverride); err != nil {\n\t\treturn nil, fmt.Errorf(\"error merging structs: %v\", err)\n\t}\n\n\treturn j.Encode(dst)\n}", "func (e *dataUsageEntry) merge(other dataUsageEntry) {\n\te.Objects += other.Objects\n\te.Versions += other.Versions\n\te.Size += other.Size\n\tors := other.ReplicationStats\n\tempty := replicationStats{}\n\tif ors != nil && *ors != empty {\n\t\tif e.ReplicationStats == nil {\n\t\t\te.ReplicationStats = &replicationStats{}\n\t\t}\n\t\te.ReplicationStats.PendingSize += other.ReplicationStats.PendingSize\n\t\te.ReplicationStats.FailedSize += other.ReplicationStats.FailedSize\n\t\te.ReplicationStats.ReplicatedSize += other.ReplicationStats.ReplicatedSize\n\t\te.ReplicationStats.ReplicaSize += other.ReplicationStats.ReplicaSize\n\t\te.ReplicationStats.PendingCount += other.ReplicationStats.PendingCount\n\t\te.ReplicationStats.FailedCount += other.ReplicationStats.FailedCount\n\n\t}\n\n\tfor i, v := range other.ObjSizes[:] {\n\t\te.ObjSizes[i] += v\n\t}\n}", "func (c *DedupConfig) Merge(o *DedupConfig) *DedupConfig {\n\tif c == nil {\n\t\tif o == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn o.Copy()\n\t}\n\n\tif o == nil {\n\t\treturn c.Copy()\n\t}\n\n\tr := c.Copy()\n\n\tif o.Enabled != nil {\n\t\tr.Enabled = o.Enabled\n\t}\n\n\tif o.MaxStale != nil {\n\t\tr.MaxStale = o.MaxStale\n\t}\n\n\tif o.Prefix != nil {\n\t\tr.Prefix = o.Prefix\n\t}\n\n\tif o.TTL != nil {\n\t\tr.TTL = o.TTL\n\t}\n\n\tif o.BlockQueryWaitTime != nil {\n\t\tr.BlockQueryWaitTime = o.BlockQueryWaitTime\n\t}\n\n\treturn r\n}", "func (that *StrAnyMap) Merge(other *StrAnyMap) {\n\tthat.mu.Lock()\n\tdefer that.mu.Unlock()\n\tif that.data == nil {\n\t\tthat.data = other.MapCopy()\n\t\treturn\n\t}\n\tif other != that {\n\t\tother.mu.RLock()\n\t\tdefer other.mu.RUnlock()\n\t}\n\tfor k, v := range other.data {\n\t\tthat.data[k] = v\n\t}\n}", "func (c *ConfigureOpener) Merge(other ConfigureOpener) {\n\tif c.ErrorThresholdPercentage == 0 {\n\t\tc.ErrorThresholdPercentage = other.ErrorThresholdPercentage\n\t}\n\tif c.RequestVolumeThreshold == 0 {\n\t\tc.RequestVolumeThreshold = other.RequestVolumeThreshold\n\t}\n\tif c.Now == nil {\n\t\tc.Now = other.Now\n\t}\n\tif c.RollingDuration == 0 {\n\t\tc.RollingDuration = other.RollingDuration\n\t}\n\tif c.NumBuckets == 0 {\n\t\tc.NumBuckets = other.NumBuckets\n\t}\n}", "func Union(s, t Interface) (u Interface) {\n\tu = s.Copy()\n\tfor _, x := range t.Members() {\n\t\tu.Add(x)\n\t}\n\treturn\n}", "func (s *EnvironmentSource) Merge(ko *koanf.Koanf, _ *schema.StructValidator) (err error) {\n\treturn ko.Merge(s.koanf)\n}", "func Do(dst, src interface{}) error {\n\tif err := checkInput(dst, src); err != nil {\n\t\treturn err\n\t}\n\n\tt := reflect.TypeOf(src)\n\tvDst := reflect.ValueOf(dst)\n\tvSrc := reflect.ValueOf(src)\n\n\t// Iterate over all available fields and read the tag value\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfield := t.Field(i)\n\n\t\tif field.Type.Kind() == reflect.Struct {\n\t\t\t// Pass the address of the interface type to recursion so all supported values get set\n\t\t\t// in entire structure tree\n\t\t\tif err := Do(vDst.Elem().Field(i).Addr().Interface(), vSrc.Field(i).Interface()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Skip kinds that are not supported\n\t\tif !checkSupportedKind(field.Type.Kind()) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get the field tag value\n\t\ttag, err := newTags(field.Tag.Get(tagOverwrite))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Ignore non tagged fields\n\t\tif !tag.overwrite {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := checkCanSet(vDst.Elem(), field.Name); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif tag.omitempty && vSrc.Field(i).IsZero() {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Overwrite value\n\t\tvDst.Elem().FieldByName(field.Name).Set(vSrc.Field(i))\n\t}\n\n\treturn nil\n}", "func (b *Bucket) Merge(others ...*Bucket) {\n\tfor _, other := range others {\n\t\tif b.Added < other.Added { // Find the maximum added\n\t\t\tb.Added = other.Added\n\t\t}\n\n\t\tif b.Taken < other.Taken { // Find the maximum taken\n\t\t\tb.Taken = other.Taken\n\t\t}\n\n\t\tif b.Last < other.Last { // Find the latest timestamp\n\t\t\tb.Last = other.Last\n\t\t}\n\t}\n}", "func (sm *DefaultIDSetMap) SetUnion(key int, other *IDSet) {\n\tif other == nil || other.Len() == 0 {\n\t\treturn\n\t}\n\n\tsm.getOrCreate(key).Union(other)\n}", "func Merge(fps ...FieldPath) SetOption {\n\tfor _, fp := range fps {\n\t\tif err := fp.validate(); err != nil {\n\t\t\treturn merge{err: err}\n\t\t}\n\t}\n\treturn merge{paths: fps}\n}", "func (m *NestedEmpty) Merge(overrides *NestedEmpty) {\n\tif m == nil || overrides == nil {\n\t\treturn\n\t}\n\n\tif overrides.Nested != nil {\n\t\tm.Nested = overrides.Nested\n\t}\n\n}", "func (s *Storage) Merge(ctx context.Context,\n\tconv types.UnboxConversationInfo, uid gregor1.UID, msgs []chat1.MessageUnboxed) (res MergeResult, err Error) {\n\tvar ierr error\n\tdefer s.Trace(ctx, &ierr, \"Merge\")()\n\tdefer func() { ierr = s.castInternalError(err) }()\n\treturn s.MergeHelper(ctx, conv, uid, msgs, nil)\n}", "func Merge(changing [][]byte, static ...[]byte) (merged []byte) {\n\tmerged = make([]byte, 0)\n\tif len(changing) <= 0 && len(static) <= 0 {\n\t\treturn\n\t}\n\tfor _, bs := range static {\n\t\tmerged = append(merged, bs...)\n\t}\n\tfor _, bs := range changing {\n\t\tmerged = append(merged, Int64ToBytes(int64(len(bs)))...)\n\t\tmerged = append(merged, bs...)\n\t}\n\treturn\n}" ]
[ "0.76296824", "0.6607315", "0.60419023", "0.5921004", "0.57844806", "0.5702725", "0.56396395", "0.5607462", "0.5569295", "0.55603033", "0.55053216", "0.5448726", "0.5343944", "0.52083373", "0.51789504", "0.5155493", "0.51227105", "0.50993407", "0.5091289", "0.50386083", "0.5029839", "0.50292164", "0.5012778", "0.49906632", "0.49668208", "0.49596822", "0.49509674", "0.49398342", "0.49398342", "0.49330416", "0.49206144", "0.49000424", "0.4883411", "0.4873397", "0.48720765", "0.48562747", "0.48527956", "0.48489597", "0.48451242", "0.48407155", "0.48364154", "0.48354256", "0.48273876", "0.47438005", "0.47350007", "0.46997336", "0.46983516", "0.46963152", "0.46864778", "0.4685772", "0.46804982", "0.46760112", "0.46731147", "0.46715397", "0.46607018", "0.46483934", "0.4646788", "0.4635371", "0.4635005", "0.4633395", "0.4631709", "0.46244675", "0.46205154", "0.46195173", "0.46178174", "0.46156523", "0.46144912", "0.46066448", "0.46016037", "0.45928895", "0.45875418", "0.45682773", "0.45675808", "0.45668453", "0.45600635", "0.45588627", "0.45491746", "0.4543488", "0.4541869", "0.45417148", "0.4525235", "0.4514058", "0.45113882", "0.45101985", "0.4505814", "0.45055133", "0.4502687", "0.45006424", "0.44962236", "0.4495226", "0.44918284", "0.44888672", "0.4488167", "0.44738415", "0.44697925", "0.4467071", "0.44664875", "0.4463426", "0.44595066", "0.44535512" ]
0.7698778
0
unionMerge is the reflect layer beneath UnionMerge.
func unionMerge(obj reflect.Value, src reflect.Value, name string) reflect.Value { out := reflect.New(obj.Type()).Elem() mergeField := func(i int) { structField := obj.Type().Field(i) fieldName := fmt.Sprintf("%v.%v", name, structField.Name) x := merge(obj.Field(i), src.Field(i), fieldName) out.Field(i).Set(x) } // Iterate through all the fields of the struct once, identifying union members and merging // the non-union members. objHasMember := -1 srcHasMember := -1 for i := 0; i < src.NumField(); i++ { if _, ok := obj.Type().Field(i).Tag.Lookup("union"); ok { // Union member, remember it for later. if !obj.Field(i).IsZero() { objHasMember = i } if !src.Field(i).IsZero() { srcHasMember = i } continue } // Non-union member, merge it normally. mergeField(i) } if objHasMember > -1 { // When obj has a union member, we can only merge that union member. mergeField(objHasMember) } else if srcHasMember > -1 { // Otherwise we merge whatever the src has defined. mergeField(srcHasMember) } return out.Convert(obj.Type()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (u *UnionFindNode) Union(B *UnionFindNode) {\n\tu.SetParent(B)\n}", "func UnionMerge[T any](obj T, src T) T {\n\tname := fmt.Sprintf(\"%T\", obj)\n\n\tvObj := reflect.ValueOf(obj)\n\tvSrc := reflect.ValueOf(src)\n\n\t// obj must have the same type as src.\n\tassertTypeMatch(vObj, vSrc)\n\n\tif vObj.Kind() != reflect.Struct {\n\t\tpanic(\"UnionMerge must only be called on struct types\")\n\t}\n\n\treturn unionMerge(vObj, vSrc, name).Interface().(T)\n}", "func (g *unionGraph) Union(a, b unionNode) {\n\tinA := g.find(a)\n\tinB := g.find(b)\n\tif inA != inB {\n\t\tif inA.rank > inB.rank {\n\t\t\tinB.parent = inA\n\t\t} else if inA.rank < inB.rank {\n\t\t\tinA.parent = inB\n\t\t} else { // inA.rank == inB.rank\n\t\t\tinA.parent = inB\n\t\t\tinB.rank++\n\t\t}\n\t}\n}", "func (b *BaseImpl) Merge() {\n\tb.Flatten()\n}", "func (d *decoder) unmarshalUnion(t reflect.Type, v reflect.Value, alignment int) error {\n\t// Save the head for proper padding.\n\thead := d.head\n\tkind := d.readUint(4)\n\n\t// Index into the fields of the struct, adding 1 for the tag.\n\tfieldIndex := int(kind) + 1\n\tif fieldIndex >= t.NumField() {\n\t\treturn ErrInvalidUnionTag\n\t}\n\tv.Field(0).SetUint(kind)\n\n\tf := t.Field(fieldIndex)\n\tvar n nestedTypeData\n\tif err := n.FromTag(f.Tag); err != nil {\n\t\treturn err\n\t}\n\td.head = align(d.head, alignment)\n\tif err := d.unmarshal(f.Type, v.Field(fieldIndex), n); err != nil {\n\t\treturn err\n\t}\n\ts, err := getPayloadSize(t, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.head = head + s\n\treturn nil\n}", "func Unionize(lhs, rhs SelectStatement, unionType string, by OrderBy, limit *Limit, lock string) *Union {\n\n\tunion, isUnion := lhs.(*Union)\n\tif isUnion {\n\t\tunion.UnionSelects = append(union.UnionSelects, &UnionSelect{UnionType: unionType, Statement: rhs})\n\t\tunion.OrderBy = by\n\t\tunion.Limit = limit\n\t\tunion.Lock = lock\n\t\treturn union\n\t}\n\n\treturn &Union{FirstStatement: lhs, UnionSelects: []*UnionSelect{{UnionType: unionType, Statement: rhs}}, OrderBy: by, Limit: limit, Lock: lock}\n}", "func (s *BaseSyslParserListener) EnterUnion(ctx *UnionContext) {}", "func (tr *trooper) demerge() {\n\ttr.trash()\n\ttr.addCenter()\n\tfor _, b := range tr.bits {\n\t\tb.reset(b.box().cmax)\n\t}\n\ttr.detach()\n}", "func union(first, second *mapNode, less func(a, b interface{}) bool, overwrite bool) *mapNode {\n\tif first == nil {\n\t\treturn second.incref()\n\t}\n\tif second == nil {\n\t\treturn first.incref()\n\t}\n\n\tif first.weight < second.weight {\n\t\tsecond, first, overwrite = first, second, !overwrite\n\t}\n\n\tleft, mid, right := split(second, first.key, less, false)\n\tvar result *mapNode\n\tif overwrite && mid != nil {\n\t\tresult = mid.shallowCloneWithRef()\n\t} else {\n\t\tresult = first.shallowCloneWithRef()\n\t}\n\tresult.weight = first.weight\n\tresult.left = union(first.left, left, less, overwrite)\n\tresult.right = union(first.right, right, less, overwrite)\n\tleft.decref()\n\tmid.decref()\n\tright.decref()\n\treturn result\n}", "func (ops *SimpleOperations) Merge(merge Operations) {\n\tops.safe()\n\n\tfor _, operation := range merge.Order() {\n\t\tmergeOperation, _ := merge.Get(operation)\n\t\tops.Add(mergeOperation)\n\t}\n}", "func (m *MockVirtualMeshSet) Union(set v1alpha1sets.VirtualMeshSet) v1alpha1sets.VirtualMeshSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha1sets.VirtualMeshSet)\n\treturn ret0\n}", "func (s *BaseMySqlParserListener) EnterUnionSelect(ctx *UnionSelectContext) {}", "func (e *encoder) marshalUnion(t reflect.Type, v reflect.Value, alignment int) error {\n\tkind := v.Field(0).Uint()\n\n\t// Index into the fields of the struct, adding 1 for the tag.\n\tfieldIndex := int(kind) + 1\n\tif fieldIndex >= t.NumField() {\n\t\treturn newValueError(ErrInvalidUnionTag, kind)\n\t}\n\t// Save the head for proper padding.\n\thead := e.head\n\te.writeUint(kind, 4)\n\n\tf := t.Field(fieldIndex)\n\tvar n nestedTypeData\n\tif err := n.FromTag(f.Tag); err != nil {\n\t\treturn err\n\t}\n\t// Re-align to the union's alignment before writing its field.\n\te.head = align(e.head, alignment)\n\tif err := e.marshal(f.Type, v.Field(fieldIndex), n); err != nil {\n\t\treturn err\n\t}\n\ts, err := getPayloadSize(t, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.head = head + s\n\treturn nil\n}", "func (h *HyperLogLog32) Union(a, b *HyperLogLog32) error {\n\tif a.p != b.p {\n\t\treturn errors.New(\"card: mismatched precision\")\n\t}\n\tta := reflect.TypeOf(b.hash)\n\tif reflect.TypeOf(b.hash) != ta {\n\t\treturn errors.New(\"card: mismatched hash function\")\n\t}\n\tif h.hash != nil && reflect.TypeOf(h.hash) != ta {\n\t\treturn errors.New(\"card: mismatched hash function\")\n\t}\n\n\tif h != a && h != b {\n\t\t*h = HyperLogLog32{p: a.p, m: a.m, hash: h.hash, register: make([]uint8, a.m)}\n\t}\n\tfor i, r := range a.register {\n\t\th.register[i] = max(r, b.register[i])\n\t}\n\treturn nil\n}", "func (c MethodsCollection) Union() pUnion {\n\treturn pUnion{\n\t\tMethod: c.MustGet(\"Union\"),\n\t}\n}", "func (m *MockVirtualDestinationSet) Union(set v1beta1sets.VirtualDestinationSet) v1beta1sets.VirtualDestinationSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1beta1sets.VirtualDestinationSet)\n\treturn ret0\n}", "func Union(subQuery ...SQLProvider) *Query {\n\tq := newQuery()\n\tq.unions = append(q.unions, subQuery...)\n\tq.action = action_union\n\treturn q\n}", "func (m *MockVirtualServiceSet) Union(set v1alpha3sets.VirtualServiceSet) v1alpha3sets.VirtualServiceSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha3sets.VirtualServiceSet)\n\treturn ret0\n}", "func (mdl *Model) Merge(model std.Model) error {\n\treturn nil\n}", "func (p *planner) UnionClause(n *parser.UnionClause, desiredTypes []parser.Datum, autoCommit bool) (planNode, error) {\n\tvar emitAll = false\n\tvar emit unionNodeEmit\n\tswitch n.Type {\n\tcase parser.UnionOp:\n\t\tif n.All {\n\t\t\temitAll = true\n\t\t} else {\n\t\t\temit = make(unionNodeEmitDistinct)\n\t\t}\n\tcase parser.IntersectOp:\n\t\tif n.All {\n\t\t\temit = make(intersectNodeEmitAll)\n\t\t} else {\n\t\t\temit = make(intersectNodeEmitDistinct)\n\t\t}\n\tcase parser.ExceptOp:\n\t\tif n.All {\n\t\t\temit = make(exceptNodeEmitAll)\n\t\t} else {\n\t\t\temit = make(exceptNodeEmitDistinct)\n\t\t}\n\tdefault:\n\t\treturn nil, errors.Errorf(\"%v is not supported\", n.Type)\n\t}\n\n\tleft, err := p.newPlan(n.Left, desiredTypes, autoCommit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tright, err := p.newPlan(n.Right, desiredTypes, autoCommit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tleftColumns := left.Columns()\n\trightColumns := right.Columns()\n\tif len(leftColumns) != len(rightColumns) {\n\t\treturn nil, fmt.Errorf(\"each %v query must have the same number of columns: %d vs %d\", n.Type, len(left.Columns()), len(right.Columns()))\n\t}\n\tfor i := 0; i < len(leftColumns); i++ {\n\t\tl := leftColumns[i]\n\t\tr := rightColumns[i]\n\t\t// TODO(dan): This currently checks whether the types are exactly the same,\n\t\t// but Postgres is more lenient:\n\t\t// http://www.postgresql.org/docs/9.5/static/typeconv-union-case.html.\n\t\tif !l.Typ.TypeEqual(r.Typ) {\n\t\t\treturn nil, fmt.Errorf(\"%v types %s and %s cannot be matched\", n.Type, l.Typ.Type(), r.Typ.Type())\n\t\t}\n\t\tif l.hidden != r.hidden {\n\t\t\treturn nil, fmt.Errorf(\"%v types cannot be matched\", n.Type)\n\t\t}\n\t}\n\n\tnode := &unionNode{\n\t\tright: right,\n\t\tleft: left,\n\t\trightDone: false,\n\t\tleftDone: false,\n\t\temitAll: emitAll,\n\t\temit: emit,\n\t\tscratch: make([]byte, 0),\n\t}\n\treturn node, nil\n}", "func (u *OpUnion) Reset() { *u = OpUnion{} }", "func (bml BitmapLayers) Merge() (BitmapLayer, error) {\n\tout := BitmapLayer{}\n\tif len(bml) != 2 {\n\t\treturn out, fmt.Errorf(\"merge requires exactly two input segments\")\n\t}\n\n\tleft, right := bml[0], bml[1]\n\n\tadditions := left.Additions.Clone()\n\tadditions.Or(right.Additions)\n\tadditions.AndNot(right.Deletions)\n\n\tdeletions := left.Deletions.Clone()\n\tdeletions.AndNot(right.Additions)\n\tdeletions.Or(right.Deletions)\n\n\tout.Additions = Condense(additions)\n\tout.Deletions = Condense(deletions)\n\treturn out, nil\n}", "func Union(s, t Interface) (u Interface) {\n\tu = s.Copy()\n\tfor _, x := range t.Members() {\n\t\tu.Add(x)\n\t}\n\treturn\n}", "func (bst *BST) Union(other *BST) []interface{} {\n\treturn set_operation(bst.Root, other.Root, setUnion)\n}", "func (m *MockWasmDeploymentSet) Union(set v1beta1sets.WasmDeploymentSet) v1beta1sets.WasmDeploymentSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1beta1sets.WasmDeploymentSet)\n\treturn ret0\n}", "func (ct *ClusterTopology) Merge(topology *ClusterTopology) {\n\tlog.Println(\"Merging topologies ...\")\n\tfor _, node := range topology.Nodes {\n\t\tlog.Printf(\"Evaluating node %s ...\\r\\n\", node.Node.Name)\n\t\tct.addNode(node)\n\t}\n\tct.AddNode(currentNode) // restore current node if needed\n\tct.buildHashcode()\n}", "func (s *BaseMySqlParserListener) EnterUnionStatement(ctx *UnionStatementContext) {}", "func (m *MockServiceDependencySet) Union(set v1beta1sets.ServiceDependencySet) v1beta1sets.ServiceDependencySet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1beta1sets.ServiceDependencySet)\n\treturn ret0\n}", "func (v *VersionVector) Merge(other *VersionVector) {\n\tother.REach(func(actor string, t LamportTime) {\n\t\tv.Witness(actor, t)\n\t})\n}", "func (d *Release) merge() map[string]interface{} {\n\tif len(d.dep) > 0 {\n\t\treturn d.dep\n\t}\n\tif d.src = d.ref.ToDeploy(d.env1, d.env2); len(d.src) == 0 {\n\t\t// No variable in this project for these environments\n\t\treturn nil\n\t}\n\td.dst = d.fetch()\n\td.dep = make(map[string]interface{})\n\tfor k, sv := range d.src {\n\t\tdv, ok := d.dst[k]\n\t\tswitch {\n\t\tcase !ok:\n\t\t\td.dep[k] = sv\n\t\t\td.task.Add++\n\t\tcase sv == nil:\n\t\t\td.dep[k] = sv\n\t\t\td.task.Del++\n\t\tcase sv != dv:\n\t\t\td.dep[k] = sv\n\t\t\td.task.Upd++\n\t\tdefault:\n\t\t\td.task.NoOp++\n\t\t}\n\t}\n\treturn d.dep\n}", "func mergeTypeFlag(a, b uint) uint {\n\treturn a & (b&mysql.NotNullFlag | ^mysql.NotNullFlag) & (b&mysql.UnsignedFlag | ^mysql.UnsignedFlag)\n}", "func (stmt *statement) Union(all bool, query Statement) Statement {\n\tp := posUnion\n\tif len(stmt.parts) > 0 {\n\t\tlast := (&stmt.parts[len(stmt.parts)-1]).position\n\t\tif last >= p {\n\t\t\tp = last + 1\n\t\t}\n\t}\n\tvar index int\n\tif all {\n\t\tindex = stmt.addPart(p, \"UNION ALL \", \"\", query.Args(), \"\")\n\t} else {\n\t\tindex = stmt.addPart(p, \"UNION \", \"\", query.Args(), \"\")\n\t}\n\tpart := &stmt.parts[index]\n\t// Make sure subquery is not dialect-specific.\n\tif query.GetDialect() != DefaultDialect {\n\t\tquery.SetDialect(DefaultDialect)\n\t\tquery.Invalidate()\n\t}\n\tstmt.buffer.WriteString(query.String())\n\tpart.bufHigh = stmt.buffer.Len()\n\t// Close the subquery\n\tquery.Close()\n\n\treturn stmt\n}", "func (so *Operations) Merge(merge api.Operations) {\n\tfor _, id := range merge.Order() {\n\t\top, _ := merge.Get(id)\n\t\tso.Add(op)\n\t}\n}", "func (mr *MockWasmDeploymentSetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockWasmDeploymentSet)(nil).Union), set)\n}", "func (m *MockEnvoyFilterSet) Union(set v1alpha3sets.EnvoyFilterSet) v1alpha3sets.EnvoyFilterSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha3sets.EnvoyFilterSet)\n\treturn ret0\n}", "func (sd *SelectDataset) Union(other *SelectDataset) *SelectDataset {\n\treturn sd.withCompound(exp.UnionCompoundType, other.CompoundFromSelf())\n}", "func (sb *schemaBuilder) buildUnionStruct(typ reflect.Type) error {\n\tvar name string\n\tvar description string\n\n\tif name == \"\" {\n\t\tname = typ.Name()\n\t\tif name == \"\" {\n\t\t\treturn fmt.Errorf(\"bad type %s: should have a name\", typ)\n\t\t}\n\t}\n\n\tunion := &graphql.Union{\n\t\tName: name,\n\t\tDescription: description,\n\t\tTypes: make(map[string]*graphql.Object),\n\t}\n\tsb.types[typ] = union\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tfield := typ.Field(i)\n\t\tif field.PkgPath != \"\" || (field.Anonymous && field.Type == unionType) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif !field.Anonymous {\n\t\t\treturn fmt.Errorf(\"bad type %s: union type member types must be anonymous\", name)\n\t\t}\n\n\t\ttyp, err := sb.getType(field.Type)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tobj, ok := typ.(*graphql.Object)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"bad type %s: union type member must be a pointer to a struct, received %s\", name, typ.String())\n\t\t}\n\n\t\tif union.Types[obj.Name] != nil {\n\t\t\treturn fmt.Errorf(\"bad type %s: union type member may only appear once\", name)\n\t\t}\n\n\t\tunion.Types[obj.Name] = obj\n\t}\n\treturn nil\n}", "func (*Interface_Aggregation_SwitchedVlan_TrunkVlans_Union_Uint16) Is_Interface_Aggregation_SwitchedVlan_TrunkVlans_Union() {\n}", "func (uf *UnionFind) Union(x, y int) {\n\tuf.checkRange(x, y)\n\tpx := uf.parent(x)\n\tpy := uf.parent(y)\n\tif px != py {\n\t\tuf.volume--\n\t\tif uf.size[px] < uf.size[py] {\n\t\t\tuf.id[px] = py\n\t\t\tuf.size[py] += uf.size[px]\n\t\t} else {\n\t\t\tuf.id[py] = px\n\t\t\tuf.size[px] += uf.size[py]\n\t\t}\n\t}\n}", "func (q *pathCompression) Union(p, r int) {\n\tqr := q.Root(r)\n\tqp := q.Root(p)\n\tif qr == qp {\n\t\treturn\n\t}\n\n\tif q.Weights[qr] > q.Weights[qp] {\n\t\tq.IDs[qp] = qr\n\t\tq.Weights[qr] += q.Weights[qp]\n\t} else {\n\t\tq.IDs[qr] = qp\n\t\tq.Weights[qp] += q.Weights[qr]\n\t}\n\n}", "func (*aggregationPushDownSolver) pushAggCrossUnion(agg *LogicalAggregation, unionSchema *expression.Schema, unionChild LogicalPlan) (LogicalPlan, error) {\n\tctx := agg.SCtx()\n\tnewAgg := LogicalAggregation{\n\t\tAggFuncs: make([]*aggregation.AggFuncDesc, 0, len(agg.AggFuncs)),\n\t\tGroupByItems: make([]expression.Expression, 0, len(agg.GroupByItems)),\n\t\taggHints: agg.aggHints,\n\t}.Init(ctx, agg.SelectBlockOffset())\n\tnewAgg.SetSchema(agg.schema.Clone())\n\tfor _, aggFunc := range agg.AggFuncs {\n\t\tnewAggFunc := aggFunc.Clone()\n\t\tnewArgs := make([]expression.Expression, 0, len(newAggFunc.Args))\n\t\tfor _, arg := range newAggFunc.Args {\n\t\t\tnewArgs = append(newArgs, expression.ColumnSubstitute(arg, unionSchema, expression.Column2Exprs(unionChild.Schema().Columns)))\n\t\t}\n\t\tnewAggFunc.Args = newArgs\n\t\tnewAgg.AggFuncs = append(newAgg.AggFuncs, newAggFunc)\n\t}\n\tfor _, gbyExpr := range agg.GroupByItems {\n\t\tnewExpr := expression.ColumnSubstitute(gbyExpr, unionSchema, expression.Column2Exprs(unionChild.Schema().Columns))\n\t\tnewAgg.GroupByItems = append(newAgg.GroupByItems, newExpr)\n\t\t// TODO: if there is a duplicated first_row function, we can delete it.\n\t\tfirstRow, err := aggregation.NewAggFuncDesc(agg.SCtx(), ast.AggFuncFirstRow, []expression.Expression{gbyExpr}, false)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Update mode of new generated firstRow as other agg funcs.\n\t\tif len(agg.AggFuncs) != 0 {\n\t\t\tfirstRow.Mode = agg.AggFuncs[0].Mode\n\t\t} else {\n\t\t\tfirstRow.Mode = aggregation.Partial1Mode\n\t\t}\n\t\tnewAgg.AggFuncs = append(newAgg.AggFuncs, firstRow)\n\t}\n\ttmpSchema := expression.NewSchema(newAgg.GetGroupByCols()...)\n\t// e.g. Union distinct will add a aggregation like `select join_agg_0, join_agg_1, join_agg_2 from t group by a, b, c` above UnionAll.\n\t// And the pushed agg will be something like `select a, b, c, a, b, c from t group by a, b, c`. So if we just return child as join does,\n\t// this will cause error during executor phase.\n\tfor _, key := range unionChild.Schema().Keys {\n\t\tif tmpSchema.ColumnsIndices(key) != nil {\n\t\t\tif ok, proj := ConvertAggToProj(newAgg, newAgg.schema); ok {\n\t\t\t\tproj.SetChildren(unionChild)\n\t\t\t\treturn proj, nil\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\tnewAgg.SetChildren(unionChild)\n\treturn newAgg, nil\n}", "func isUnionType(t reflect.Type) bool {\n\t// This is a safe way to check if it's a union type because the generated\n\t// code inserts a \"dummy\" field (of type struct{}) at the beginning as a\n\t// marker that the struct should be treated as a FIDL union. Because all FIDL\n\t// fields are exported, there's no potential for name collision either, and a\n\t// struct accidentally being treated as a union.\n\treturn t.Kind() == reflect.Struct && t.NumField() > 1 && t.Field(0).Tag.Get(\"fidl\") == \"tag\"\n}", "func (t Topology) Merge(other Topology) Topology {\n\treturn Topology{\n\t\tNodes: t.Nodes.Merge(other.Nodes),\n\t}\n}", "func (mr *MockServiceDependencySetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockServiceDependencySet)(nil).Union), set)\n}", "func TestConverterUnion(t *testing.T) {\n\t// values for union component types\n\tvvTrue := vdl.BoolValue(nil, true)\n\tvv123 := vdl.IntValue(vdl.Int64Type, 123)\n\tvvAbc := vdl.StringValue(nil, \"Abc\")\n\tvvStruct123 := vdl.ZeroValue(vdl.StructInt64TypeN)\n\tvvStruct123.StructField(0).Assign(vv123)\n\trvTrue := bool(true)\n\trv123 := int64(123)\n\trvAbc := string(\"Abc\")\n\trvStruct123 := vdl.NStructInt64{123}\n\t// values for union{A bool;B string;C struct}\n\tvvTrueABC := vdl.UnionValue(vdl.UnionABCTypeN, 0, vvTrue)\n\tvvAbcABC := vdl.UnionValue(vdl.UnionABCTypeN, 1, vvAbc)\n\tvvStruct123ABC := vdl.UnionValue(vdl.UnionABCTypeN, 2, vvStruct123)\n\trvTrueABC := vdl.NUnionABCA{rvTrue}\n\trvAbcABC := vdl.NUnionABCB{rvAbc}\n\trvStruct123ABC := vdl.NUnionABCC{rvStruct123}\n\trvTrueABCi := vdl.NUnionABC(rvTrueABC)\n\trvAbcABCi := vdl.NUnionABC(rvAbcABC)\n\trvStruct123ABCi := vdl.NUnionABC(rvStruct123ABC)\n\t// values for union{B string;C struct;D int64}\n\tvvAbcBCD := vdl.UnionValue(vdl.UnionBCDTypeN, 0, vvAbc)\n\tvvStruct123BCD := vdl.UnionValue(vdl.UnionBCDTypeN, 1, vvStruct123)\n\tvv123BCD := vdl.UnionValue(vdl.UnionBCDTypeN, 2, vv123)\n\trvAbcBCD := vdl.NUnionBCDB{rvAbc}\n\trvStruct123BCD := vdl.NUnionBCDC{rvStruct123}\n\trv123BCD := vdl.NUnionBCDD{rv123}\n\trvAbcBCDi := vdl.NUnionBCD(rvAbcBCD)\n\trvStruct123BCDi := vdl.NUnionBCD(rvStruct123BCD)\n\trv123BCDi := vdl.NUnionBCD(rv123BCD)\n\t// values for union{X string;Y struct}, which has no Go equivalent.\n\tvvAbcXY := vdl.UnionValue(vdl.UnionXYTypeN, 0, vvAbc)\n\tvvStruct123XY := vdl.UnionValue(vdl.UnionXYTypeN, 1, vvStruct123)\n\n\ttests := []struct {\n\t\tvvWant *vdl.Value\n\t\trvWant interface{}\n\t\tvvSrc *vdl.Value\n\t\trvSrc interface{}\n\t}{\n\t\t// Convert source and target same union.\n\t\t{vvTrueABC, rvTrueABC, vvTrueABC, rvTrueABC},\n\t\t{vv123BCD, rv123BCD, vv123BCD, rv123BCD},\n\t\t{vvAbcABC, rvAbcABC, vvAbcABC, rvAbcABC},\n\t\t{vvAbcBCD, rvAbcBCD, vvAbcBCD, rvAbcBCD},\n\t\t{vvStruct123ABC, rvStruct123ABC, vvStruct123ABC, rvStruct123ABC},\n\t\t{vvStruct123BCD, rvStruct123BCD, vvStruct123BCD, rvStruct123BCD},\n\t\t// Same thing, but with pointers to the interface type.\n\t\t{vvTrueABC, &rvTrueABCi, vvTrueABC, &rvTrueABCi},\n\t\t{vv123BCD, &rv123BCDi, vv123BCD, &rv123BCD},\n\t\t{vvAbcABC, &rvAbcABCi, vvAbcABC, &rvAbcABC},\n\t\t{vvAbcBCD, &rvAbcBCDi, vvAbcBCD, &rvAbcBCD},\n\t\t{vvStruct123ABC, &rvStruct123ABCi, vvStruct123ABC, &rvStruct123ABCi},\n\t\t{vvStruct123BCD, &rvStruct123BCDi, vvStruct123BCD, &rvStruct123BCDi},\n\n\t\t// Convert source and target different union.\n\t\t{vvAbcABC, rvAbcABC, vvAbcBCD, rvAbcBCD},\n\t\t{vvAbcBCD, rvAbcBCD, vvAbcABC, rvAbcABC},\n\t\t{vvStruct123ABC, rvStruct123ABC, vvStruct123BCD, rvStruct123BCD},\n\t\t{vvStruct123BCD, rvStruct123BCD, vvStruct123ABC, rvStruct123ABC},\n\t\t// Same thing, but with pointers to the interface type.\n\t\t{vvAbcABC, &rvAbcABCi, vvAbcBCD, &rvAbcBCDi},\n\t\t{vvAbcBCD, &rvAbcBCDi, vvAbcABC, &rvAbcABCi},\n\t\t{vvStruct123ABC, &rvStruct123ABCi, vvStruct123BCD, &rvStruct123BCDi},\n\t\t{vvStruct123BCD, &rvStruct123BCDi, vvStruct123ABC, &rvStruct123ABCi},\n\n\t\t// Test unions that have no Go equivalent.\n\t\t{vvAbcXY, nil, vvAbcXY, nil},\n\t\t{vvStruct123XY, nil, vvStruct123XY, nil},\n\t}\n\tfor _, test := range tests {\n\t\ttestConverterWantSrc(t,\n\t\t\tvvrv{vvSlice(test.vvWant), rvSlice(test.rvWant)},\n\t\t\tvvrv{vvSlice(test.vvSrc), rvSlice(test.rvSrc)})\n\t}\n}", "func (tr *trooper) merge() {\n\ttr.trash()\n\ttr.neo = tr.part.AddPart().SetScale(0.5, 0.5, 0.5)\n\tm := tr.neo.MakeModel(\"flata\", \"msh:cube\", \"mat:tblue\")\n\tm.SetUniform(\"fd\", 1000)\n\ttr.addCenter()\n}", "func (tn *MergeNode) setMergeTrigger() {}", "func merge(rw http.ResponseWriter, req *http.Request) {\r\n\t// Decode the POST body\r\n\tdecoder := json.NewDecoder(req.Body)\r\n\tvar model distributed.MergeRequestModel\r\n\terr := decoder.Decode(&model)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tleft := model.Left\r\n\tright := model.Right\r\n\tsize, i, j := len(left)+len(right), 0, 0\r\n\tslice := make([]int, size, size)\r\n\r\n\tfor k := 0; k < size; k++ {\r\n\t\tif i > len(left)-1 && j <= len(right)-1 {\r\n\t\t\tslice[k] = right[j]\r\n\t\t\tj++\r\n\t\t} else if j > len(right)-1 && i <= len(left)-1 {\r\n\t\t\tslice[k] = left[i]\r\n\t\t\ti++\r\n\t\t} else if left[i] < right[j] {\r\n\t\t\tslice[k] = left[i]\r\n\t\t\ti++\r\n\t\t} else {\r\n\t\t\tslice[k] = right[j]\r\n\t\t\tj++\r\n\t\t}\r\n\t}\r\n\r\n\tresponseModel := distributed.MergeResponseModel{slice}\r\n\r\n\t// Parse the response model into a writable format\r\n\tresString, err := json.Marshal(responseModel)\r\n\r\n\trw.Write(resString)\r\n}", "func (s *segment) merge(oth *segment) {\n\ts.pkt.Data().Merge(oth.pkt.Data())\n\ts.dataMemSize = s.pkt.MemSize()\n\toth.dataMemSize = oth.pkt.MemSize()\n}", "func (s *summarizer) addUnions(unions []fidlgen.Union) {\n\tfor _, st := range unions {\n\t\tfor _, m := range st.Members {\n\t\t\tif m.Reserved {\n\t\t\t\t// Disregard reserved members.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ts.addElement(newMember(\n\t\t\t\tst.Name, m.Name, m.Type, fidlgen.UnionDeclType))\n\t\t}\n\t\ts.addElement(\n\t\t\tnewAggregate(st.Name, st.Resourceness, fidlgen.UnionDeclType))\n\t}\n}", "func (u OpUnion) Clone() OpUnion {\n\tclone := OpUnion{\n\t\tType: u.Type,\n\t\tTransformation: u.Transformation,\n\t}\n\tif u.Type == pipeline.RollupOpType {\n\t\tclone.Rollup = u.Rollup.Clone()\n\t}\n\treturn clone\n}", "func (mr *MockVirtualMeshSetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockVirtualMeshSet)(nil).Union), set)\n}", "func (mr *MockVirtualDestinationSetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockVirtualDestinationSet)(nil).Union), set)\n}", "func (s *BaseSyslParserListener) ExitUnion(ctx *UnionContext) {}", "func (mr *MockEnvoyFilterSetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockEnvoyFilterSet)(nil).Union), set)\n}", "func (d *DSU) Union(x, y interface{}) bool {\n\tif !d.Contains(x) || !d.Contains(y) {\n\t\treturn false\n\t}\n\n\tif d.Find(x) == d.Find(y) {\n\t\treturn false\n\t}\n\n\tnodex := d.nodes[d.Find(x)]\n\tnodey := d.nodes[d.Find(y)]\n\n\tif nodex.size > nodey.size {\n\t\tnodey.parent = nodex\n\t\tnodex.size += nodey.size\n\t} else {\n\t\tnodex.parent = nodey\n\t\tnodey.size += nodex.size\n\t}\n\n\treturn true\n}", "func Union(a, b RegInvImage) RegInvImage {\n\tfor imageName, digestTags := range b {\n\t\t// If a does not have this image at all, then it's a simple\n\t\t// injection.\n\t\tif a[imageName] == nil {\n\t\t\ta[imageName] = digestTags\n\t\t\tcontinue\n\t\t}\n\t\tfor digest, tags := range digestTags {\n\t\t\t// If a has the image but not this digest, inject just this digest\n\t\t\t// and all associated tags.\n\t\t\tif a[imageName][digest] == nil {\n\t\t\t\ta[imageName][digest] = tags\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// If c has the digest already, try to inject those tags in b that\n\t\t\t// are not already in a.\n\t\t\ttagSlice := TagSlice{}\n\t\t\tfor tag := range tags.Union(a[imageName][digest]) {\n\t\t\t\tif tag == \"latest\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttagSlice = append(tagSlice, tag)\n\t\t\t}\n\t\t\ta[imageName][digest] = tagSlice\n\t\t}\n\t}\n\n\treturn a\n}", "func (s *SQLOperations) Merge(ops SQLOperations) {\n\tfor _, slice := range ops {\n\t\tif len(slice.Statement) > 0 {\n\t\t\ts.Add(slice)\n\t\t}\n\t}\n}", "func (mr *MockVirtualServiceSetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockVirtualServiceSet)(nil).Union), set)\n}", "func (self *Rectangle) Union(b *Rectangle) *Rectangle{\n return &Rectangle{self.Object.Call(\"union\", b)}\n}", "func (m *MockGatewaySet) Union(set v1alpha3sets.GatewaySet) v1alpha3sets.GatewaySet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha3sets.GatewaySet)\n\treturn ret0\n}", "func (a *API) Merge(other API) {\n\tif a.Short == \"\" {\n\t\ta.Short = other.Short\n\t}\n\n\tif a.Long == \"\" {\n\t\ta.Long = other.Long\n\t}\n\n\ta.Operations = append(a.Operations, other.Operations...)\n}", "func (m *MockFailoverServiceSet) Union(set v1alpha1sets.FailoverServiceSet) v1alpha1sets.FailoverServiceSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha1sets.FailoverServiceSet)\n\treturn ret0\n}", "func (m *MockTrafficPolicySet) Union(set v1alpha1sets.TrafficPolicySet) v1alpha1sets.TrafficPolicySet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha1sets.TrafficPolicySet)\n\treturn ret0\n}", "func (m *resourceInfo) unmerge(info IPMetadata) {\n\tswitch info.(type) {\n\tcase labels.Labels:\n\t\tm.labels = nil\n\tdefault:\n\t\tlog.Errorf(\"BUG: Invalid IPMetadata passed to ipinfo.unmerge(): %+v\", info)\n\t\treturn\n\t}\n}", "func (m *merger) Merge(rawManifests []*apprclient.OperatorMetadata) (manifests *RawOperatorManifestData, err error) {\n\tallErrors := []error{}\n\tmerged := StructuredOperatorManifestData{}\n\n\tfor _, rawManifest := range rawManifests {\n\t\tmanifest, err := m.parser.Unmarshal(rawManifest.RawYAML)\n\t\tif err != nil {\n\t\t\tallErrors = append(allErrors, err)\n\t\t\tm.logger.Infof(\"skipping repository due to parsing error - %s\", rawManifest.RegistryMetadata)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tmerged.Packages = append(merged.Packages, manifest.Packages...)\n\t\tmerged.CustomResourceDefinitions = append(merged.CustomResourceDefinitions, manifest.CustomResourceDefinitions...)\n\t\tmerged.ClusterServiceVersions = append(merged.ClusterServiceVersions, manifest.ClusterServiceVersions...)\n\t}\n\n\tmanifests, err = m.parser.Marshal(&merged)\n\tif err != nil {\n\t\tallErrors = append(allErrors, err)\n\t}\n\n\terr = utilerrors.NewAggregate(allErrors)\n\treturn\n}", "func (p *parser) merge() {\n\tif p.cur+1 >= len(p.src) {\n\t\treturn\n\t}\n\tp.src = append(p.src[:p.cur], p.src[p.cur+1:]...)\n}", "func TestUnion9POne(t *testing.T) {\n\tv = t.Logf\n\tfs, err := NewCPIO9P(\"data/a.cpio\")\n\tif err != nil {\n\t\tt.Fatalf(\"data/a.cpio: got %v, want nil\", err)\n\t}\n\n\t// See if anything is there.\n\tc, err := fs.Attach()\n\tif err != nil {\n\t\tt.Fatalf(\"Attach: got %v, want nil\", err)\n\t}\n\tt.Logf(\"root:%v\", c)\n\n\tu, err := NewUnion9P([]UnionMount{UnionMount{walk: []string{}, mount: c}})\n\n\tif err != nil {\n\t\tt.Fatalf(\"NewUnion9P: got %v, want nil\", err)\n\t}\n\n\tattach, err := u.Attach()\n\tif err != nil {\n\t\tt.Fatalf(\"union attach: want nil, got %v\", err)\n\t}\n\n\t_, root, err := attach.Walk([]string{})\n\tif err != nil {\n\t\tt.Fatalf(\"walking '': want nil, got %v\", err)\n\t}\n\n\td, err := attach.Readdir(0, 1024)\n\tif err != nil {\n\t\tt.Fatalf(\"union readdir: want nil, got %v\", err)\n\t}\n\tt.Logf(\"dirents %v\", d)\n\n\tif q, f, err := root.Walk([]string{\"barf\"}); err == nil {\n\t\tt.Fatalf(\"walking 'barf': want err, got (%v,%v,%v)\", q, f, err)\n\t}\n\n\tif _, _, _, _, err := root.WalkGetAttr([]string{\"barf\"}); err == nil {\n\t\tt.Fatalf(\"walkgetattr to 'barf': want err, got nil\")\n\t}\n\n\t_, b, err := root.Walk([]string{\"b\"})\n\tif err != nil {\n\t\tt.Fatalf(\"walking 'b': want nil, got %v\", err)\n\t}\n\tt.Logf(\"b %v\", b)\n\n\tif _, _, _, _, err := root.WalkGetAttr([]string{\"b\"}); err != nil {\n\t\tt.Fatalf(\"walkgetattr to 'b': want nil, got %v\", err)\n\t}\n\n\tq, c, err := root.Walk([]string{\"b\", \"c\"})\n\tif err != nil {\n\t\tt.Fatalf(\"walking a/b: want nil, got %v\", err)\n\t}\n\tif len(q) != 2 {\n\t\tt.Fatalf(\"walking a/b: want 2 qids, got (%v,%v)\", q, err)\n\t}\n\tif c == nil {\n\t\tt.Fatalf(\"walking a/b: want non-nil file, got nil\")\n\t}\n\n\tvar (\n\t\tof p9.OpenFlags\n\t\tm p9.FileMode\n\t)\n\tif _, _, _, err := root.Create(\"\", of, m, p9.UID(0), p9.GID(0)); err == nil {\n\t\tt.Fatalf(\"create in root: got nil, want err\")\n\t}\n\n\tif _, err := root.Mkdir(\"\", m, p9.UID(0), p9.GID(0)); err == nil {\n\t\tt.Fatalf(\"mkdir in root: got hil, want err\")\n\t}\n\n\tif _, _, err := c.Walk([]string{\"d\"}); err != nil {\n\t\tt.Fatalf(\"walking d from b/c: want nil, got %v\", err)\n\t}\n\n\t_, hi, err := c.Walk([]string{\"hi\"})\n\tif err != nil {\n\t\tt.Fatalf(\"walking hi from b/c: want nil, got %v\", err)\n\t}\n\tvar data [2]byte\n\toff := int64(1)\n\tif _, err := hi.ReadAt(data[:], off); err != nil {\n\t\tt.Fatalf(\"Reading hi: want nil, got %v\", err)\n\t}\n\tif n, _ := hi.ReadAt(data[:], off); n != 2 {\n\t\tt.Fatalf(\"Reading hi: want 2 bytes, got %v\", n)\n\t}\n\tif string(data[:]) != \"i\\n\" {\n\t\tt.Fatalf(\"Reading hi: want %q, got %q\", \"i\\n\", string(data[:]))\n\t}\n\n\tvar (\n\t\tmask p9.SetAttrMask\n\t\tattr p9.SetAttr\n\t)\n\n\tif err := hi.SetAttr(mask, attr); err == nil {\n\t\tt.Fatalf(\"setattr: got nil, want err\")\n\t}\n\n\tvar am p9.AttrMask\n\tif _, _, _, err = hi.GetAttr(am); err != nil {\n\t\tt.Fatalf(\"getattr: want nil, got %v\", err)\n\t}\n\n\tdirs, err := c.Readdir(0, 64*1024)\n\tif err != nil {\n\t\tt.Fatalf(\"readdir on root: want nil, got %v\", err)\n\t}\n\tif len(dirs) != 4 {\n\t\tt.Fatalf(\"readdir on root: want %d entries, got %d\", 4, len(dirs))\n\t}\n\tt.Logf(\"readdir c/ %v\", dirs)\n\n\tdirs, err = root.Readdir(0, 64*1024)\n\tif err != nil {\n\t\tt.Fatalf(\"readdir on root: want nil, got %v\", err)\n\t}\n\tif len(dirs) != 3 {\n\t\tt.Fatalf(\"readdir on root: want %d entries, got %d\", 3, len(dirs))\n\t}\n\tt.Logf(\"readdir / %v\", dirs)\n\n}", "func (b *Bag) union(c Bag) Bag {\n\tbag := make(Bag)\n\tfor k, v := range *b {\n\t\tbag[k] += v\n\t}\n\tfor k, v := range c {\n\t\tbag[k] += v\n\t}\n\treturn bag\n}", "func mergeUtxoView(viewA *blockchain.UtxoViewpoint, viewB *blockchain.UtxoViewpoint) {\n\tviewAEntries := viewA.Entries()\n\tfor outpoint, entryB := range viewB.Entries() {\n\t\tif entryA, exists := viewAEntries[outpoint]; !exists ||\n\t\t\tentryA == nil || entryA.IsSpent() {\n\t\t\tviewAEntries[outpoint] = entryB\n\t\t}\n\t}\n}", "func (*Interface_Ethernet_SwitchedVlan_TrunkVlans_Union_Uint16) Is_Interface_Ethernet_SwitchedVlan_TrunkVlans_Union() {\n}", "func AsUnion(dt DataType) *Union {\n\tswitch t := dt.(type) {\n\tcase *UserTypeExpr:\n\t\treturn AsUnion(t.Type)\n\tcase *ResultTypeExpr:\n\t\treturn AsUnion(t.Type)\n\tcase *Union:\n\t\treturn t\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (unitImpl *UnitImpl) DeltaMerge(\n\tdeltaMerge base.DeltaMerge,\n\tattribute string,\n\tdelta interface{},\n) (bool, error) {\n\tmerged, err := unitImpl.GameObjectImpl.DeltaMerge(\n\t\tdeltaMerge,\n\t\tattribute,\n\t\tdelta,\n\t)\n\tif merged || err != nil {\n\t\treturn merged, err\n\t}\n\n\tstardashDeltaMerge, ok := deltaMerge.(DeltaMerge)\n\tif !ok {\n\t\treturn false, errors.New(\n\t\t\t\"deltaMerge is not the expected type of: \" +\n\t\t\t\t\"'stardash.impl.DeltaMerge'\",\n\t\t)\n\t}\n\n\tswitch attribute {\n\tcase \"acted\":\n\t\tunitImpl.actedImpl = stardashDeltaMerge.Boolean(delta)\n\t\treturn true, nil\n\tcase \"dashX\":\n\t\tunitImpl.dashXImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"dashY\":\n\t\tunitImpl.dashYImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"energy\":\n\t\tunitImpl.energyImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"genarium\":\n\t\tunitImpl.genariumImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"isBusy\":\n\t\tunitImpl.isBusyImpl = stardashDeltaMerge.Boolean(delta)\n\t\treturn true, nil\n\tcase \"job\":\n\t\tunitImpl.jobImpl = stardashDeltaMerge.Job(delta)\n\t\treturn true, nil\n\tcase \"legendarium\":\n\t\tunitImpl.legendariumImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"moves\":\n\t\tunitImpl.movesImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"mythicite\":\n\t\tunitImpl.mythiciteImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"owner\":\n\t\tunitImpl.ownerImpl = stardashDeltaMerge.Player(delta)\n\t\treturn true, nil\n\tcase \"protector\":\n\t\tunitImpl.protectorImpl = stardashDeltaMerge.Unit(delta)\n\t\treturn true, nil\n\tcase \"rarium\":\n\t\tunitImpl.rariumImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"shield\":\n\t\tunitImpl.shieldImpl = stardashDeltaMerge.Int(delta)\n\t\treturn true, nil\n\tcase \"x\":\n\t\tunitImpl.xImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\tcase \"y\":\n\t\tunitImpl.yImpl = stardashDeltaMerge.Float(delta)\n\t\treturn true, nil\n\t}\n\n\treturn false, nil // no errors in delta merging\n}", "func (m *MockServiceEntrySet) Union(set v1alpha3sets.ServiceEntrySet) v1alpha3sets.ServiceEntrySet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha3sets.ServiceEntrySet)\n\treturn ret0\n}", "func (e *dataUsageEntry) merge(other dataUsageEntry) {\n\te.Objects += other.Objects\n\te.Versions += other.Versions\n\te.Size += other.Size\n\tors := other.ReplicationStats\n\tempty := replicationStats{}\n\tif ors != nil && *ors != empty {\n\t\tif e.ReplicationStats == nil {\n\t\t\te.ReplicationStats = &replicationStats{}\n\t\t}\n\t\te.ReplicationStats.PendingSize += other.ReplicationStats.PendingSize\n\t\te.ReplicationStats.FailedSize += other.ReplicationStats.FailedSize\n\t\te.ReplicationStats.ReplicatedSize += other.ReplicationStats.ReplicatedSize\n\t\te.ReplicationStats.ReplicaSize += other.ReplicationStats.ReplicaSize\n\t\te.ReplicationStats.PendingCount += other.ReplicationStats.PendingCount\n\t\te.ReplicationStats.FailedCount += other.ReplicationStats.FailedCount\n\n\t}\n\n\tfor i, v := range other.ObjSizes[:] {\n\t\te.ObjSizes[i] += v\n\t}\n}", "func (m *Merge) merge(travVals *traversedValues) error {\n\tswitch travVals.data.Kind() {\n\tcase reflect.Struct:\n\t\tfor i := 0; i < travVals.data.NumField(); i++ {\n\t\t\tnewTravVals := newTraversedValues()\n\t\t\tnewTravVals.data = travVals.data.Field(i)\n\t\t\tfor _, s := range travVals.sources {\n\t\t\t\tnewTravVals.sources = append(newTravVals.sources, &traversedSource{\n\t\t\t\t\tname: s.name,\n\t\t\t\t\tdata: s.data.Field(i),\n\t\t\t\t})\n\t\t\t}\n\t\t\tnewTravVals.joinFieldPath(travVals.fieldPath, travVals.data.Type().Field(i).Name)\n\n\t\t\terr := m.merge(newTravVals)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\tcase reflect.Ptr:\n\t\tswitch travVals.data.Type().Elem().Kind() {\n\t\tcase reflect.Struct, reflect.Map, reflect.Slice, reflect.Array, reflect.Interface, reflect.Ptr:\n\t\t\treturn errors.Wrapf(errUnsupportedType, \"merge: `%s`\", travVals.data.Type().Elem().Kind())\n\t\tcase reflect.Invalid:\n\t\t\treturn errReallyWrong\n\t\tdefault:\n\t\t\tselectedValue, selectedSource, err := m.selectValue(travVals)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttravVals.data.Set(selectedValue)\n\n\t\t\tm.mergedMeta = append(m.mergedMeta, MergedMeta{\n\t\t\t\tFieldPath: travVals.fieldPath,\n\t\t\t\tSource: selectedSource,\n\t\t\t\tValue: fmt.Sprintf(\"%+v\", selectedValue.Elem()),\n\t\t\t})\n\t\t}\n\tcase reflect.Invalid:\n\t\treturn errReallyWrong\n\tdefault:\n\t\treturn errors.Wrapf(errUnsupportedType, \"merge: `%s`\", travVals.data.Kind())\n\t}\n\n\treturn nil\n}", "func Union(elements ...Shape) Shape {\n\treturn Group{space.NoTransformation(), elements}\n}", "func (s *BasemumpsListener) EnterMerge_(ctx *Merge_Context) {}", "func (mr *MockFailoverServiceSetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockFailoverServiceSet)(nil).Union), set)\n}", "func (a Annotation) Merge(other schema.Annotation) schema.Annotation {\n\tvar ant Annotation\n\tswitch other := other.(type) {\n\tcase Annotation:\n\t\tant = other\n\tcase *Annotation:\n\t\tif other != nil {\n\t\t\tant = *other\n\t\t}\n\tdefault:\n\t\treturn a\n\t}\n\tif tag := ant.StructTag; tag != \"\" {\n\t\ta.StructTag = tag\n\t}\n\treturn a\n}", "func (*Stp_Mstp_MstInstance_Vlan_Union_Uint16) Is_Stp_Mstp_MstInstance_Vlan_Union() {}", "func (mr *MockTrafficPolicySetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockTrafficPolicySet)(nil).Union), set)\n}", "func (*Interface_Aggregation_SwitchedVlan_TrunkVlans_Union_String) Is_Interface_Aggregation_SwitchedVlan_TrunkVlans_Union() {\n}", "func MergeFlags(cmd *cobra.Command) {\n\tif flagMap == nil {\n\t\tflagMap = make(map[string][]string)\n\t}\n\tfs := cmd.Flags()\n\tfs.AddFlagSet(common)\n\tfor _, s := range registered {\n\t\tif s.flags == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfs.AddFlagSet(s.flags)\n\t\ts.flags.VisitAll(func(flag *pflag.Flag) {\n\t\t\tflagMap[flag.Name] = append(flagMap[flag.Name], s.Name)\n\t\t})\n\t}\n\t// customize the usage function so that if --sig-type is set then only those flags are displayed\n\torig := cmd.UsageFunc()\n\tcmd.SetUsageFunc(func(c *cobra.Command) error {\n\t\tif t, _ := fs.GetString(\"sig-type\"); t != \"\" {\n\t\t\tfor name, signers := range flagMap {\n\t\t\t\tvar ok bool\n\t\t\t\tfor _, signer := range signers {\n\t\t\t\t\tif signer == t {\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\t_ = fs.MarkHidden(name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn orig(c)\n\t})\n}", "func (mr *MockDestinationRuleSetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockDestinationRuleSet)(nil).Union), set)\n}", "func (a TimeWindowAggregation) Union(other TimeWindowAggregation) TimeWindowAggregation {\r\n\treturn TimeWindowAggregation{\r\n\t\tVa: a.Va.Union(other.Va),\r\n\t\tTw: a.Tw.Union(other.Tw),\r\n\t}\r\n}", "func (*NetworkInstance_Protocol_Aggregate_SetTag_Union_Uint32) Is_NetworkInstance_Protocol_Aggregate_SetTag_Union() {\n}", "func (mr *MockServiceEntrySetMockRecorder) Union(set interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Union\", reflect.TypeOf((*MockServiceEntrySet)(nil).Union), set)\n}", "func (a *Ports) Merge(b *Ports) *Ports {\n\tresult := *a\n\n\tif b.HTTP != 0 {\n\t\tresult.HTTP = b.HTTP\n\t}\n\treturn &result\n}", "func newUnionGraph() *unionGraph {\n\treturn &unionGraph{\n\t\tnodes: map[unionNode]*internalUnionNode{},\n\t}\n}", "func (m *MockDestinationRuleSet) Union(set v1alpha3sets.DestinationRuleSet) v1alpha3sets.DestinationRuleSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Union\", set)\n\tret0, _ := ret[0].(v1alpha3sets.DestinationRuleSet)\n\treturn ret0\n}", "func (*Interface_RoutedVlan_Vlan_Union_Uint16) Is_Interface_RoutedVlan_Vlan_Union() {}", "func (m pUnion) Extend(fnct func(m.UserSet, m.UserSet) m.UserSet) pUnion {\n\treturn pUnion{\n\t\tMethod: m.Method.Extend(fnct),\n\t}\n}", "func (orchCol *OrchestratorCollection) Merge(otherOrchCol *OrchestratorCollection) *OrchestratorCollection {\n\n\tfor _, orch := range otherOrchCol.Orchestrators {\n\t\torchCol.Orchestrators = append(orchCol.Orchestrators, orch)\n\t}\n\n\treturn orchCol\n}", "func DeltaMerge(tx *sql.Tx, targetTable, tempTable, conditional string) error {\n\tif tx == nil || targetTable == \"\" || tempTable == \"\" || conditional == \"\" {\n\t\treturn nil\n\t}\n\tdeleteQuery := fmt.Sprintf(`\n\t\t\tDELETE FROM %v\n\t\t\tUSING %v\n\t\t\tWHERE %v\n\t`, targetTable, tempTable, conditional)\n\n\tif _, err := tx.Exec(deleteQuery); err != nil {\n\t\treturn err\n\t}\n\n\tinsertQuery := fmt.Sprintf(\"INSERT INTO %v SELECT DISTINCT * FROM %v\", targetTable, tempTable)\n\tif _, err := tx.Exec(insertQuery); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (bpt *BplusTree) merge(parent *treeNode, curr *treeNode, currNodeIdx int,\n\tsibling *treeNode, siblIndex int, direction SearchDirection) error {\n\n\t// If merging with right sibling then append right sibling's chilren\n\t// to current node, otherwise append current nodes' children to left\n\t// sibling.\n\tvar cIndex int\n\n\t// save all nodes before modifying.\n\tbpt.tracker.origNodes.AddIfNotPresent(curr.NodeKey, curr)\n\tif sibling != nil {\n\t\tbpt.tracker.origNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t}\n\tbpt.tracker.origNodes.AddIfNotPresent(parent.NodeKey, parent)\n\tswitch {\n\tcase direction == Right:\n\t\tglog.V(2).Infof(\"merging %v and right sibling %v\\n\", curr, sibling)\n\t\tcurr.Children = append(curr.Children, sibling.Children...)\n\t\tcurr.NextKey = sibling.NextKey\n\t\t// current is modified, add that to updatedNodes tracker.\n\t\tbpt.tracker.updatedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\tif !sibling.NextKey.IsNil() {\n\t\t\tsibnext, err := bpt.fetch(sibling.NextKey)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"failed to fetch %v during merge (err: %v)\",\n\t\t\t\t\tsibling.NextKey, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbpt.tracker.origNodes.AddIfNotPresent(sibnext.NodeKey, sibnext)\n\t\t\tsibnext.PrevKey = curr.NodeKey\n\t\t\tbpt.tracker.updatedNodes.AddIfNotPresent(sibnext.NodeKey, sibnext)\n\t\t}\n\t\t// sibling is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t\t// drop the entry of the right node from parent's children.\n\t\tparent.Children = append(parent.Children[:siblIndex],\n\t\t\tparent.Children[siblIndex+1:]...)\n\t\tcIndex = currNodeIdx\n\tcase direction == Left:\n\t\tglog.V(2).Infof(\"merging left sibling %v and %v\\n\", sibling, curr)\n\t\tsibling.Children = append(sibling.Children, curr.Children...)\n\t\tsibling.NextKey = curr.NextKey\n\t\t// sibling is modified, add that to updatedNodes tracker.\n\t\tbpt.tracker.updatedNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t\tif !curr.NextKey.IsNil() {\n\t\t\tcurrnext, err := bpt.fetch(curr.NextKey)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"failed to fetch %v during merge (err: %v)\",\n\t\t\t\t\tcurr.NextKey, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbpt.tracker.origNodes.AddIfNotPresent(currnext.NodeKey, currnext)\n\t\t\tcurrnext.PrevKey = sibling.NodeKey\n\t\t\tbpt.tracker.updatedNodes.AddIfNotPresent(currnext.NodeKey, currnext)\n\t\t}\n\t\t// current node is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\t// drop the entry of the current node from parent's children.\n\t\t// Note that if current node is rightmost node, then we need to handle\n\t\t// that specially.\n\t\tif siblIndex == (len(parent.Children) - 2) {\n\t\t\tparent.Children = parent.Children[:siblIndex+1]\n\t\t} else {\n\t\t\tparent.Children = append(parent.Children[:siblIndex+1],\n\t\t\t\tparent.Children[siblIndex+2:]...)\n\t\t}\n\t\tcIndex = siblIndex\n\tdefault: // Merging with parent.\n\t\tglog.V(2).Infof(\"merging Parent %v and %v\\n\", parent, curr)\n\t\t// curr is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\tparent.Children = curr.Children\n\t\tparent.IsLeaf = curr.IsLeaf\n\t}\n\n\t// Parent's children has been modified. update tracker and dataKey\n\tbpt.tracker.updatedNodes.AddIfNotPresent(parent.NodeKey, parent)\n\t_, err := parent.updateDataKey(bpt, cIndex, nil)\n\treturn err\n}", "func mergeIfMergable(obj reflect.Value, src reflect.Value) (reflect.Value, bool) {\n\tvar out reflect.Value\n\n\t// Look for the .WithDefaults method.\n\tmeth, ok := obj.Type().MethodByName(\"Merge\")\n\tif !ok {\n\t\treturn out, false\n\t}\n\n\t// Verify the signature matches our Mergable psuedointerface:\n\t// - two inputs (the receiver), and one output\n\t// - input types match output type exactly (disallow the usual pointer receiver semantics)\n\tif meth.Type.NumIn() != 2 || meth.Type.NumOut() != 1 {\n\t\treturn out, false\n\t}\n\tif meth.Type.In(0) != meth.Type.In(1) || meth.Type.In(0) != meth.Type.Out(0) {\n\t\treturn out, false\n\t}\n\n\t// Psuedointerface matches, call the .Merge method.\n\tout = meth.Func.Call([]reflect.Value{obj, src})[0]\n\n\treturn out, true\n}", "func (s *BaseMySqlParserListener) EnterUnionStatement2(ctx *UnionStatement2Context) {}", "func (def *Definition) Merge(w window.Span, v interface{}, prev window.State) error {\n\tf := merger.Cons()\n\tif def.g.merger != nil {\n\t\tf = merger.Fold(def.g.merger)\n\t}\n\treturn def.g.window.Merge(w, v, prev, f)\n}", "func (geom Geometry) Union(other Geometry) Geometry {\n\tnewGeom := C.OGR_G_Union(geom.cval, other.cval)\n\treturn Geometry{newGeom}\n}" ]
[ "0.562135", "0.5415054", "0.52032477", "0.51933634", "0.5127445", "0.5108151", "0.5107937", "0.50855553", "0.5077597", "0.49961337", "0.4991926", "0.49450478", "0.49342978", "0.49312794", "0.49225685", "0.4920965", "0.4918539", "0.4917029", "0.4902565", "0.48937187", "0.48912147", "0.48625705", "0.48482698", "0.48316556", "0.48257267", "0.48176673", "0.48033258", "0.47873157", "0.47867033", "0.47798577", "0.47664124", "0.4761836", "0.47445434", "0.47255906", "0.47238654", "0.47212875", "0.47077647", "0.47009313", "0.46974146", "0.46931615", "0.46909934", "0.46900815", "0.46819156", "0.46808764", "0.4673075", "0.46726173", "0.46689987", "0.4660133", "0.46594593", "0.46551755", "0.46359923", "0.46348536", "0.46331862", "0.46191928", "0.46130264", "0.46117368", "0.46049744", "0.45972645", "0.4596303", "0.45935255", "0.45920962", "0.4587581", "0.45857832", "0.45853773", "0.4583478", "0.45778924", "0.4576489", "0.4575726", "0.45548055", "0.45517352", "0.45503527", "0.45439884", "0.45325798", "0.45167014", "0.45160535", "0.45080304", "0.4505928", "0.44981134", "0.4497559", "0.44960696", "0.44953656", "0.44888017", "0.44863793", "0.44797948", "0.44762954", "0.44718984", "0.4462176", "0.44619572", "0.4461614", "0.44542852", "0.4438547", "0.44369856", "0.44326425", "0.4428237", "0.4426822", "0.4424275", "0.4416565", "0.44111824", "0.44034305", "0.43959406" ]
0.603249
0
UpdatedFilenames Get updated video's filename between stime and etime.
func (d *Dao) UpdatedFilenames(c context.Context, stime, etime time.Time) (fns []string, err error) { rows, err := d.db.Query(c, _updatedFilenamesByTime, stime, etime) if err != nil { log.Error("d.UpdatedFilenames.Query(%v,%v) error(%v)", stime, etime, err) return } defer rows.Close() for rows.Next() { fn := "" if err = rows.Scan(&fn); err != nil { log.Error("rows.Scan error(%v)", err) return } fns = append(fns, fn) } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func videoFileFullName(videoId string) string {\n\tdirStoreVideo := GetConfVal(\"dirStoreVideo\")\n\tvideoFileName := dirStoreVideo + videoId + \".mp4\"\n\treturn videoFileName\n}", "func getFileName(url string, videoType string) string{\n\n\tfilename := url[:strings.Index(url, videoType)]\n\tfilename = filepath.Base(filename)\n\tfilename = filename + \".mp4\"\n\treturn filename\n\n}", "func (statics AssestStruct) GetFileNames(dir string) []string {\n\tnames := make([]string, len(statics.Files))\n\tfor name := range statics.Files {\n\t\tnames = append(names, name)\n\t}\n\treturn names\n}", "func GetFileName(url string, videoType string) string{\n\n\tif videoType == \".m3u8\" {\n\t\tif strings.Contains(url, \"/d1.vnecdn.net/\"){\n\t\t\tvar re = regexp.MustCompile(`(?m)[a-z0-9\\-\\_]+\\-\\d{8,}`)\n\t\t\tmatch := re.FindString(url)\n\n\t\t\treturn match + \".mp4\"\n\t\t} else if strings.Contains(url, \"ss-hls.catscdn.vn\") {\n\t\t\tvar re = regexp.MustCompile(`(?m)[a-z0-9\\-\\_]+\\.mp4`)\n\t\t\tmatch := re.FindString(url)\n\n\t\t\treturn match + \".mp4\"\n\t\t}\n\t}\n\n\tfilename := url[:strings.Index(url, videoType)]\n\tfilename = filepath.Base(filename)\n\tfilename = filename + \".mp4\"\n\n\treturn filename\n}", "func (r Remapping) Filenames(index uint32) (string, string) {\n\tvar original cxstring\n\tdefer original.Dispose()\n\tvar transformed cxstring\n\tdefer transformed.Dispose()\n\n\tC.clang_remap_getFilenames(r.c, C.uint(index), &original.c, &transformed.c)\n\n\treturn original.String(), transformed.String()\n}", "func (s *SeriesInfoCmd) GetRenamedEpisodes(filenames []string) map[string]string {\n\tvar series *Series\n\tvar episodes map[string]*Episode\n\tvar renamedEpisodes map[string]string\n\tvar err error\n\tdone := make(chan error, 1)\n\tgo func() {\n\t\trenamedEpisodes, err = GetRenamedRedisEpisodes(s.Title, filenames)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tdone <- err\n\t}()\n\tgo func() {\n\t\trenamedEpisodes = make(map[string]string)\n\t\tseries, err = s.GetSeries()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tepisodes = series.EpisodeMap()\n\t\tfor _, filename := range filenames {\n\t\t\tcode := GetEpisodeCodeFromFilename(filename)\n\t\t\tif episode, ok := episodes[code]; ok {\n\t\t\t\trenamedEpisodes[filename] = GetEpisodeFilename(code, episode.Title, filepath.Ext(filename))\n\t\t\t} else {\n\t\t\t\trenamedEpisodes[filename] = \"\"\n\t\t\t}\n\t\t}\n\t\tdone <- err\n\t}()\n\tselect {\n\tcase <-time.After(s.Timeout):\n\t\tclose(done)\n\t\treturn renamedEpisodes\n\tcase err = <-done:\n\t\tclose(done)\n\t\treturn renamedEpisodes\n\t}\n}", "func GetFileName(file *multipart.FileHeader) (newFileName string, err error) {\n\treturn strconv.Itoa(int(time.Now().Unix())) + file.Filename, nil\n}", "func GetFilename(urlSubStr []string) string {\n\treturn urlSubStr[3]\n}", "func getRecentlyModified(match []string, modified int, verbose bool) []string {\n\tvar matches []string // slice to hold the matching file paths\n\tvar paths []string // slice to hold the file paths\n\tvar modTimes []time.Time // slice to hold the modification times of the files\n\n\t// Loop through the provided slice of file names\n\tfor _, file := range match {\n\t\t// Get the file info and handle any errors\n\t\tinfo, err := os.Stat(file)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\t// Append the file path and modification time to the corresponding slices\n\t\tpaths = append(paths, file)\n\t\tmodTimes = append(modTimes, info.ModTime())\n\t}\n\n\t// Sort the slices by modification time\n\tsort.SliceStable(paths, func(i, j int) bool {\n\t\treturn modTimes[i].After(modTimes[j])\n\t})\n\n\t// Get the current time\n\tnow := time.Now()\n\n\t// Loop through the sorted slice of file paths\n\tfor i, path := range paths {\n\t\t// Check if the file was modified within the last modified hours\n\t\tif now.Sub(modTimes[i]) < (time.Duration(modified) * time.Hour) {\n\t\t\t// If it was, append the file path to the matches slice\n\t\t\tmatches = append(matches, path)\n\t\t} else {\n\t\t\tif verbose {\n\t\t\t\tlog.Printf(\"[IGNORING] Last modified time: %s older than configured timeframe (%d hours): %s.\", modTimes[i], modified, path)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the slice of matching file paths\n\treturn matches\n}", "func getFilename(now *time.Time) string {\n\thour, _, _ := now.Clock()\n\tvar buf [2]byte\n\tbuf[1] = digits[hour%10]\n\thour /= 10\n\tbuf[0] = digits[hour]\n\treturn string(buf[:]) + \".log\"\n}", "func AvGetFrameFilename(b string, bs int, pa string, n int) int {\n\tcb := C.CString(b)\n\tdefer C.free(unsafe.Pointer(cb))\n\tcpa := C.CString(pa)\n\tdefer C.free(unsafe.Pointer(cpa))\n\treturn int(C.av_get_frame_filename(cb, C.int(bs), cpa, C.int(n)))\n}", "func (p *Post) GetFileName() string {\n\ttimeStamp, _ := time.Parse(time.RubyDate, p.CreatedAt)\n\treturn fmt.Sprintf(\"%d-%s-%dx%d.%s\", timeStamp.Unix(), p.Id, p.Width, p.Height, getFileExt(p.FileURL))\n}", "func (e S3Emitter) S3FileName(firstSeq string, lastSeq string) string {\n\tdate := time.Now().UTC().Format(\"2006/01/02\")\n\treturn fmt.Sprintf(\"%v/%v-%v\", date, firstSeq, lastSeq)\n}", "func ProbeFiles(dir string, files []string, folderdates []string) [][]string {\n\tvar matrix [][]string\n\t// matrix = append(matrix, []string{\n\t// \t\"Filename\",\n\t// \t\"File Type\",\n\t// \t\"Folder Date\",\n\t// \t\"Folder Day Number\",\n\t// \t\"Edit Date\",\n\t// \t\"Edit Day Number\",\n\t// \t\"Edit Day\",\n\t// \t\"Month\",\n\t// \t\"Year\",\n\t// \t\"Time\",\n\t// \t\"Timezone\",\n\t// \t\"Duration\",\n\t// \t\"Size\",\n\t// \t\"Bitrate\",\n\t// \t\"Format\",\n\t// \t\"Formant Long\"})\n\n\tmatrix = append(matrix, []string{\n\t\t\"Filename\",\n\t\t\"FolderDate\",\n\t\t\"Folder Month\",\n\t\t\"Folder Day\",\n\t\t\"Folder Year\",\n\t\t\"Edit Date\",\n\t\t\"Edit Month\",\n\t\t\"Edit Day\",\n\t\t\"Edit Year\",\n\t\t\"Edit Day Number\",\n\t\t\"Timestamp\",\n\t\t\"Timezone\",\n\t\t\"Duration\",\n\t\t\"Size\",\n\t\t\"Bitrate\",\n\t\t\"Format\",\n\t\t\"Formant Long\"})\n\t// Probe Video Files\n\tfor h := 0; h < len(files); h++ {\n\t\tnew := dir + \"/\" + folderdates[h] + \"/edits/\" + files[h]\n\t\t// fmt.Println(new)\n\t\tdata, err := ffprobe.GetProbeData(new, 5000*time.Millisecond)\n\t\tif err != nil {\n\t\t\tlog.Panicf(\"Error getting data: %v\", err)\n\t\t}\n\n\t\tbuf, err := json.MarshalIndent(data, \"\", \" \")\n\t\tif err != nil {\n\t\t\tlog.Panicf(\"Error unmarshalling: %v\", err)\n\t\t}\n\t\t// log.Print(string(buf))\n\n\t\tvar probed Ffprobe\n\t\tif err := json.Unmarshal(buf, &probed); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// ffprobeFilename := probed.Format.Filename\n\t\t// cleanName := filepath.Base(ffprobeFilename)\n\n\t\t// unixdate := string(probed.Format.Tags.CreationTime.Format(time.RFC850))\n\n\t\t// s := strings.Split(unixdate, \",\")\n\t\t// // date := s[1][1:11]\n\t\t// day := s[0]\n\t\t// dayNum := s[1][1:3]\n\t\t// month := s[1][4:7]\n\t\t// year := \"20\" + s[1][8:11]\n\t\t// edittime := s[1][11:19]\n\t\t// loc := s[1][20:23]\n\t\t// folderDay := folderdates[h][3:5]\n\n\t\t// // fmt.Println(date, day, dayNum, month, year, time, loc)\n\n\t\t// fmt.Println(cleanName[:len(cleanName)-4], cleanName[len(cleanName)-4:], folderdates[h], month, folderDay, year, folderDay, day, dayNum, month, year, edittime, loc, probed.Format.Duration, probed.Format.Tags.CreationTime, probed.Format.FormatLongName, probed.Format.Size)\n\n\t\tffprobeFilename := probed.Format.Filename\n\t\tcleanFilename := filepath.Base(ffprobeFilename)\n\n\t\tfmt.Println(cleanFilename)\n\t\tfmt.Println(probed.Format.Duration)\n\t\tfmt.Println(probed.Format.Tags.CreationTime)\n\t\tfmt.Println(probed.Format.FormatLongName)\n\t\tfmt.Println(probed.Format.Size)\n\n\t\tunixdate := string(probed.Format.Tags.CreationTime.Format(time.RFC850))\n\n\t\ts := strings.Split(unixdate, \",\")\n\t\tfolderMonth := folderdates[h][:2]\n\t\tfolderDay := folderdates[h][3:5]\n\t\tfolderYear := folderdates[h][len(folderdates[h])-4:]\n\t\teditDate := s[1][1:11]\n\t\teditMonth := s[1][4:7]\n\t\teditDay := s[0]\n\t\teditYear := \"20\" + s[1][8:11]\n\t\teditDayNumber := s[1][1:3]\n\t\ttimestamp := s[1][11:19]\n\t\tloc := s[1][20:23]\n\n\t\tfmt.Println(\"______________________________________\")\n\t\tmatrix = append(matrix, []string{\n\t\t\t// cleanFilename[:len(cleanFilename)-4],\n\t\t\tcleanFilename,\n\t\t\tfolderdates[h],\n\t\t\tfolderMonth,\n\t\t\tfolderDay,\n\t\t\tfolderYear,\n\t\t\teditMonth,\n\t\t\teditDate,\n\t\t\teditDay,\n\t\t\teditYear,\n\t\t\teditDayNumber,\n\t\t\ttimestamp,\n\t\t\tloc,\n\t\t\tprobed.Format.Duration,\n\t\t\tprobed.Format.Size,\n\t\t\tprobed.Format.BitRate,\n\t\t\tprobed.Format.FormatName,\n\t\t\tprobed.Format.FormatLongName})\n\t\t// matrix = append(matrix, []string{\n\t\t// \tcleanName[:len(cleanName)-4],\n\t\t// \t// cleanName[len(cleanName)-4:],\n\t\t// \tfolderdates[h],\n\t\t// \tfolderDay,\n\t\t// \t// date,\n\t\t// \tday,\n\t\t// \tdayNum,\n\t\t// \tmonth,\n\t\t// \tyear,\n\t\t// \tedittime,\n\t\t// \tloc,\n\t\t// \tprobed.Format.Duration,\n\t\t// \tprobed.Format.Size,\n\t\t// \tprobed.Format.BitRate,\n\t\t// \tprobed.Format.FormatName,\n\t\t// \tprobed.Format.FormatLongName})\n\t}\n\t// fmt.Println(matrix)\n\treturn matrix\n}", "func modify_filename(filename string) string{\n\tfilenameRaw := strings.Split(filename, \".\")\n\tnewFilename := filenameRaw[0] + \"1\" + \".\" + filenameRaw[1]\n\treturn newFilename\n\n}", "func (sp *SimpleFileBasedSnapshotPersistence) getKVPairFilename(epoch uint64, key string) string {\n\tsha256Hash := sha256.Sum256([]byte(key))\n\treturn filepath.Join(sp.SnapshotPath, fmt.Sprintf(\"%d\", epoch), fmt.Sprintf(\"%x\", sha256Hash))\n}", "func (e *Automation) GetFileName() string {\n\treturn fmt.Sprintf(\n\t\t\"%s_v%d_%d.json\",\n\t\te.Name,\n\t\te.VersionNumber,\n\t\te.ID)\n}", "func (s *SeriesInfoCmd) RenameEpisodes(path string) {\n\tvar episodes map[string]string\n\tif s.NormalizedTitle {\n\t\tepisodes = s.GetRenamedNormalizedEpisodes(GetVideoFiles(path))\n\t} else {\n\t\tepisodes = s.GetRenamedEpisodes(GetVideoFiles(path))\n\t}\n\tfilenames := make([]string, 0, len(episodes))\n\tfor k := range episodes {\n\t\tfilenames = append(filenames, k)\n\t}\n\tsort.Strings(filenames)\n\tfor _, filename := range filenames {\n\t\tepisode := episodes[filename]\n\t\tdirname, basename := filepath.Split(filename)\n\t\tif shellutil.IdenticalFilenames(basename, episode) {\n\t\t\tlog.Println(basename, \"-> ok\")\n\t\t} else if episode == \"\" {\n\t\t\tlog.Println(basename, \"-> title not found\")\n\t\t} else {\n\t\t\tlog.Println(basename, \"->\", episode)\n\t\t\tif !s.DryRun {\n\t\t\t\tos.Rename(filename, dirname+string(filepath.Separator)+episode)\n\t\t\t}\n\t\t}\n\t}\n}", "func GetEpisodeName(fileName string) string {\n\tunwanted := []string{\"web\", \"720p\", \"1080p\", \"REPACK\", \"WEBRip\", \"AAC\", \"x264\"}\n\tfor _, word := range unwanted {\n\t\tfileName = strings.Replace(fileName, word, \"\", -1)\n\t}\n\n\tepisodeName := removeFileType(fileName)\n\tepisodeName = removeBrackets(episodeName)\n\n\tepisodeName = strings.Replace(episodeName, \".\", \" \", -1)\n\tepisodeName = strings.Replace(episodeName, \"_\", \" \", -1)\n\tepisodeName = strings.Replace(episodeName, \" \", \" \", -1)\n\n\tepisodeName = extractName(episodeName)\n\n\tepisodeName = removeEpisodeDetails(episodeName)\n\tepisodeName = removeExtraWhiteSpace(episodeName)\n\n\treturn strings.Trim(episodeName, \" \")\n}", "func (mf MultipartFilename) Filename() string {\n\n\t// NOTE(dustin): The total filename length is specified in the \"Stream\n\t// Extension\" directory entry that occurs after the primary file entry and\n\t// before these file-name directory-entries, but we don't implement/\n\t// validate that count, here.\n\n\tparts := make([]string, 0)\n\n\tfor _, deRaw := range mf {\n\t\tif fnde, ok := deRaw.(*ExfatFileNameDirectoryEntry); ok == true {\n\t\t\tpart := UnicodeFromAscii(fnde.FileName[:], 15)\n\t\t\tparts = append(parts, part)\n\t\t}\n\t}\n\n\tfilename := strings.Join(parts, \"\")\n\n\treturn filename\n}", "func AvGetFrameFilename(buf_size int, path string, number int) (int, string) {\n\tCbuf := (*C.char)(C.malloc(C.sizeof_char * C.ulong(buf_size)))\n\tdefer C.free(unsafe.Pointer(Cbuf))\n\n\tCpath := C.CString(path)\n\tdefer C.free(unsafe.Pointer(Cpath))\n\n\tret := int(C.av_get_frame_filename(Cbuf, C.int(buf_size), Cpath, C.int(number)))\n\n\treturn ret, C.GoString(Cbuf)\n}", "func slotFileNameExtract(slotFileName string) string {\n\n//\tPresumed Unique Marker that precedes actual Slot File Name\n//\tThe Slot File Name will be the String at the End\n\n\tfileMetadata := strings.Split(slotFileName, \"]_\")\n\n\tfileName := \"\"\n\tfor _, value := range fileMetadata { fileName = value }\n\n\treturn fileName\n}", "func (gossiper *Gossiper) GetFileNames() []string {\n\tvar names []string = nil\n\tgossiper.FileHashes.Range(func(name interface{}, hash interface{}) bool {\n\t\tnames = append(names, name.(string))\n\t\treturn true\n\t})\n\treturn names\n}", "func FileNameVersion(fileName string, v int) string {\n\tif v == 0 {\n\t\treturn fileName\n\t}\n\treturn fmt.Sprintf(\"%s.%d\", fileName, v)\n}", "func (p *para) getFilename(s *http.Response) error {\n\tif len(s.Header[\"Content-Disposition\"]) > 0 {\n\t\t_, para, err := mime.ParseMediaType(s.Header[\"Content-Disposition\"][0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif p.Filename == \"\" {\n\t\t\tp.Filename = para[\"filename\"]\n\t\t}\n\t} else {\n\t\treturn errors.New(fmt.Sprintf(\"File ID [ %s ] is not shared, while the file is existing.\\n\", p.Id))\n\t}\n\treturn nil\n}", "func setFilename(filenames []string) []string {\n\tif len(filenames) == 0 {\n\t\treturn []string{fileName}\n\t}\n\n\treturn filenames\n}", "func (e S3Emitter) S3FileName(firstSeq string, lastSeq string) string {\n\tdate := time.Now().UTC().Format(\"2006/01/02\")\n\tif e.S3Prefix == \"\" {\n\t\treturn fmt.Sprintf(\"%v/%v-%v\", date, firstSeq, lastSeq)\n\t} else {\n\t\treturn fmt.Sprintf(\"%v/%v/%v-%v\", e.S3Prefix, date, firstSeq, lastSeq)\n\t}\n}", "func Filename(e *editarea.EditArea) string {\n\t_, fn := filepath.Split(e.Filename)\n\tif e.Saved() {\n\t\treturn fn\n\t}\n\treturn fn + \" *\"\n}", "func handleUploadedZipVideo(tempDir string) map[string]string {\n\tfileHandleMsgMap := make(map[string]string)\n\tfilepath.Walk(tempDir, func(path string, info os.FileInfo, err error) error {\n\t\tvar msg string\n\t\tj := jewelry{}\n\t\tif info.IsDir() {\n\t\t\tmsg = fmt.Sprintf(\"SKIP folder %s\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\t\tvar filename string\n\t\tbs, err := ioutil.ReadFile(path)\n\t\tif err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tif !filetype.IsVideo(bs) {\n\t\t\tmsg = fmt.Sprintf(\"%s is not video\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\t\text := filepath.Ext(info.Name())\n\t\tif ext == \"\" {\n\t\t\tmsg = fmt.Sprintf(\"SKIP file %s as the file has no extension\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\n\t\tif ext == \"mp4\" || ext == \"mov\" || ext == \"ogv\" || ext == \"webm\" {\n\t\t\tfilename = fmt.Sprintf(\"beyoudiamond-video-%s\", info.Name())\n\t\t} else {\n\t\t\tmsg = fmt.Sprintf(\"Uploaded file %s extension is not supported\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\n\t\tj.StockID = strings.Split(info.Name(), \"-\")[0]\n\t\tif err := j.isJewelryExistByStockID(); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tif err := util.RunWithStdOutput(\"mv\", path, filepath.Join(\".video\", \"jewelry\", filename)); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tj.VideoLink = filename\n\t\tq := j.composeUpdateQuery()\n\t\tif _, err := dbExec(q); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tif msg == \"\" {\n\t\t\tfileHandleMsgMap[info.Name()] = msg\n\t\t} else {\n\t\t\tfileHandleMsgMap[info.Name()] = \"uploaded\"\n\t\t}\n\t\treturn nil\n\t})\n\treturn fileHandleMsgMap\n}", "func (fs *OneFile) Name() string {\n\tif fs.r.Hourly {\n\t\treturn fmt.Sprintf(\"files: %s\\\\%s_YYYYMMDD_HH.%s (keep: %s)\", fs.r.Directory, fs.r.Prefix, fs.r.Extension, fs.r.Retention.String())\n\t}\n\treturn fmt.Sprintf(\"files: %s\\\\%s_YYYYMMDD_.%s (keep: %s)\", fs.r.Directory, fs.r.Prefix, fs.r.Extension, fs.r.Retention.String())\n}", "func (ds *dataset) newFilename() string {\n\tnow := time.Now().UTC().String()[:10]\n\treturn datasetFolder + \"/\" + string(*ds) + \"_\" + now + \".csv\"\n}", "func renameFile(pmConfig config.PMConfig) (string, error) {\n\toffset := \"0000\"\n\tcurrentTime := time.Now().UTC()\n\t//calculating 15 minutes time frame\n\tdiff := currentTime.Minute() - (currentTime.Minute() / 15 * 15)\n\tbegTime := currentTime.Add(time.Duration(-1*diff) * time.Minute)\n\tendTime := begTime.Add(time.Duration(15) * time.Minute)\n\n\tfileName := pmConfig.DestinationDir + \"/\"\n\tfileName += filePrefix + begTime.Format(dateFormat) + \".\" + begTime.Format(timeFormat) + \"-\" + offset\n\tfileName += \"-\" + endTime.Format(timeFormat) + \"-\" + offset\n\tfileName += \"_\" + pmConfig.ForeignID\n\tcounter := 1\n\tname := fileName\n\tfor fileExists(name) {\n\t\tname = fileName + \"_\" + strconv.Itoa(counter)\n\t\tcounter++\n\t}\n\tfileName = name\n\treturn fileName, nil\n}", "func GetBlobFilename(filename string, datetime time.Time) string {\n\treturn datetime.Format(filePrefixFormat) + filename\n}", "func (ap *AudioPlayer) GetFilename() string {\n\treturn ap.filename\n}", "func (afs *assetFiles) GetFileNames(dir string) []string {\n\tif dir == \"\" {\n\t\tdir = \"/\"\n\t}\n\tnames := make([]string, 0, len(afs.Files))\n\tdirRaw := dir\n\tdir = path.Clean(dir)\n\n\tif dir != \"/\" && strings.HasSuffix(dirRaw, \"/\") {\n\t\tdir += string(filepath.Separator)\n\t}\n\n\tdir = filepath.ToSlash(dir)\n\n\tfor name := range afs.Files {\n\t\tif strings.HasPrefix(name, dir) {\n\t\t\tnames = append(names, name)\n\t\t}\n\t}\n\treturn names\n}", "func adjustFilename(in string, extension string) string {\n\tout := strings.Split(in, \".\")\n\treturn out[0] + extension\n}", "func (v *VFile) Name() string {\n\treturn v.FileName\n}", "func (idx *HardlinkIndex) GetFilename(inode uint64, device uint64) string {\n\tidx.m.Lock()\n\tdefer idx.m.Unlock()\n\treturn idx.Index[HardlinkKey{inode, device}]\n}", "func (attachment *Attachment) GetFilename() string {\n\treturn attachment.GetString(14084)\n}", "func (v *Video) LogFullFileInfo() error {\n\tres, err := shell.ExecuteCommand(v.l, \"ffprobe\", v.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tv.l.Println(string(res))\n\treturn nil\n}", "func ExtractFileName(s string) string {\n\t_, name := filepath.Split(s)\n\treturn name\n}", "func (c *Sound) GetFilename() string {\n\treturn c.Filename\n}", "func (a *Response) FileName() string {\r\n\t_, file := filepath.Split(a.filePath)\r\n\treturn file\r\n}", "func (id Id) Filename() string {\n\treturn strings.Replace(id.String(), \":\", \"-\", -1)\n}", "func replaceTempFilename(diff []byte, filename string) ([]byte, error) {\n\tbs := bytes.SplitN(diff, []byte{'\\n'}, 3)\n\tif len(bs) < 3 {\n\t\treturn nil, fmt.Errorf(\"got unexpected diff for %s\", filename)\n\t}\n\t// Preserve timestamps.\n\tvar t0, t1 []byte\n\tif i := bytes.LastIndexByte(bs[0], '\\t'); i != -1 {\n\t\tt0 = bs[0][i:]\n\t}\n\tif i := bytes.LastIndexByte(bs[1], '\\t'); i != -1 {\n\t\tt1 = bs[1][i:]\n\t}\n\t// Always print filepath with slash separator.\n\tf := filepath.ToSlash(filename)\n\tbs[0] = []byte(fmt.Sprintf(\"--- %s%s\", f+\".orig\", t0))\n\tbs[1] = []byte(fmt.Sprintf(\"+++ %s%s\", f, t1))\n\treturn bytes.Join(bs, []byte{'\\n'}), nil\n}", "func GetFileName() string {\n\tfile, _ := GetFileNoByDepth(1)\n\t_, filename := path.Split(file)\n\treturn filename\n}", "func (fi *fileInfo) Name() string { return fi.name }", "func initFilesModTimes() map[string]time.Time {\n\tfileModTimes := make(map[string]time.Time)\n\n\tfor _, f := range watchFiles {\n\t\tfInfo, err := os.Stat(f)\n\t\tif err != nil {\n\t\t\toutput.FatalError(err)\n\t\t}\n\t\tfileModTimes[f] = fInfo.ModTime()\n\t}\n\n\treturn fileModTimes\n}", "func FilterUnchanged(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {\n\tfiles := p.Get(\"files\", []string{}).([]string)\n\tsince := p.Get(\"since\", time.Now().Add(time.Second * -10)).(time.Time)\n\n\tmodified := []string{}\n\tfor _, file := range files {\n\t\tstat, err := os.Stat(file)\n\t\tif err == nil && stat.ModTime().After(since) {\n\t\t\tmodified = append(modified, file)\n\t\t}\n\t}\n\n\treturn modified, nil\n}", "func (fi *fileInfo) ModTime() time.Time { return fi.mtime }", "func getNamesOfFileInfo(fileInfoSlice []fs.DirEntry) (namesSlice []string) {\n\tfor _, element := range fileInfoSlice {\n\t\tnamesSlice = append(namesSlice, element.Name())\n\t}\n\treturn\n}", "func videoPath(filename string) string {\n\treturn fmt.Sprintf(\"content/video/%s\", filename)\n}", "func GetFileName(token string) (string, error) {\n\tsql := \"select name from files where autoName=?\"\n\tvar fileName string\n\trows := database.query(sql, fileName)\n\tif rows.Next() {\n\t\terr := rows.Scan(&fileName)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fileName, nil\n}", "func (promise AttachmentPromise) GetFilename() string {\n\tif ret, ok := promise.params[\"filename\"]; ok {\n\t\treturn ret\n\t}\n\treturn \"\"\n}", "func filesModified(fileModTimes map[string]time.Time) bool {\n\treturnVal := false\n\tfor f := range fileModTimes {\n\t\tfInfo, err := os.Stat(f)\n\t\tif err != nil {\n\t\t\toutput.FatalError(err)\n\t\t}\n\t\tif fileModTimes[f] != fInfo.ModTime() {\n\t\t\tfileModTimes[f] = fInfo.ModTime()\n\t\t\treturnVal = true\n\t\t}\n\t}\n\treturn returnVal\n}", "func (f *FTPS) GetFilenameToDownload() []string {\n\treturn f.filenameToDownload\n}", "func (x ExportResult) Filename() (string) {\n _, filename := filepath.Split(x.Path)\n return filename\n}", "func (m *File) UpdateVideoInfos() error {\n\tvalues := FileInfos{}\n\n\tif err := deepcopier.Copy(&values).From(m); err != nil {\n\t\treturn err\n\t}\n\n\treturn Db().Model(File{}).Where(\"photo_id = ? AND file_video = 1\", m.PhotoID).Updates(values).Error\n}", "func getFilename(src string) string {\n\trs := []rune(src)\n\ti := strings.LastIndex(src, \"\\\\\")\n\tif i == -1 {\n\t\ti = strings.LastIndex(src, \"/\")\n\t}\n\tres := string(rs[i+1:])\n\tres = strings.Split(res, \".bz2\")[0]\n\treturn res\n}", "func fileName(name, version string) string {\n\treturn strings.ToLower(fmt.Sprintf(\"%s_v%s.html\", fileNamePrefix(name), version))\n}", "func GetFrameFilename(filename string) string {\n\t_, file := filepath.Split(filename)\n\tfile = strings.TrimSuffix(file, filepath.Ext(file))\n\tframeFileName := path.Join(config.Opts.FrameDir, file+\".frame.jpg\")\n\treturn frameFileName\n}", "func (ds *dataset) mostRecentFilename() (string, error) {\n\tfiles, err := ioutil.ReadDir(datasetFolder)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\tvar filenames []string\n\n\tfor _, f := range files {\n\t\tif strings.Contains(f.Name(), string(*ds)) {\n\t\t\tfilenames = append(filenames, f.Name())\n\t\t}\n\t}\n\n\tif len(filenames) == 0 {\n\t\treturn \"\", nil\n\t}\n\n\tsort.Slice(filenames, func(i, j int) bool {\n\t\tt1 := timeFromFilename(filenames[i])\n\t\tt2 := timeFromFilename(filenames[j])\n\t\treturn t1.Before(t2)\n\t})\n\n\treturn filenames[0], nil\n}", "func (cache *FileCache) GetFileName(key string) string {\n\tpath := filepath.Join(cache.dir, key)\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn \"\"\n\t}\n\tif abs, err := filepath.Abs(path); err == nil {\n\t\treturn abs\n\t}\n\treturn \"\"\n}", "func (jf *JFile) GetFilename() string {\n\treturn jf.filename\n}", "func updateModificationTimeToNow(ctx context.Context, tconn *chrome.TestConn, folderPath, filename string) error {\n\tfilePath := filepath.Join(folderPath, filename)\n\tnowTime := time.Now().Local()\n\treturn os.Chtimes(filePath, nowTime, nowTime)\n}", "func (g GroupedResponses) SortedFileNames() []string {\n\tvar keys []string\n\tfor k := range g {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "func (t *Table) Filename() string { return t.fd.Name() }", "func (l *Logger) getFilename() (filename string) {\n\t// Get current unix timestamp\n\tnow := time.Now().UnixNano()\n\t// Create a filename by:\n\t//\t- Concatinate directory and name\n\t//\t- Append unix timestamp\n\t//\t- Append log extension\n\treturn fmt.Sprintf(\"%s.%d.log\", path.Join(l.dir, l.name), now)\n}", "func (d *DirEntry) FileName() string {\n\tcpointer := (*C.char)(unsafe.Pointer(&d.fileName[0]))\n\tclength := C.int(d.FileNameSize)\n\tfileName := C.GoStringN(cpointer, clength)\n\treturn fileName\n}", "func (dlr DirectoryListResponse) LastModified() string {\n\treturn PathList(dlr).LastModified()\n}", "func FileTime(name string) (string, error) {\n\tfi, err := os.Stat(name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tmtime := fi.ModTime().Unix()\n\treturn fmt.Sprintf(\"%v\", mtime), nil\n}", "func (cl *GSCChangeLog) GetFilename() string {\n\treturn cl.filename\n}", "func GetFileInfo(Filename string) ([]Track, []Track, []Track, error) {\n\ttype Info struct {\n\t\tFileName string `json:\"file_name\"`\n\t\tTracks []struct {\n\t\t\tCodec string `json:\"codec\"`\n\t\t\tID int `json:\"id\"`\n\t\t\tProperties struct {\n\t\t\t\tLanguage string `json:\"language\"`\n\t\t\t}\n\t\t\tType string `json:\"type\"`\n\t\t} `json:\"tracks\"`\n\t}\n\tout, err := exec.Command(\"mkvmerge\", \"-F\", \"json\", \"-i\", Filename).Output()\n\tif err != nil {\n\t\tcolor.Red.Println(\"Error: Can't open the file\")\n\t\t//os.Exit(1) <-------\n\t}\n\tvar mkvinfo Info\n\terr = json.Unmarshal(out, &mkvinfo)\n\tif err != nil {\n\t\tcolor.Red.Println(\"Error: Can't extract information from the file\")\n\t\tos.Exit(1)\n\t}\n\n\tif len(mkvinfo.Tracks) == 0 {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\tif len(mkvinfo.Tracks) == 1 && mkvinfo.Tracks[0].Type == \"subtitles\" {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\tvar Videos []Track\n\tvar Audios []Track\n\tvar Audios2 []Track\n\tvar Subtitles []Track\n\tvar Subtitles2 []Track\n\tvar Tracktmp []Track\n\tfor k := range mkvinfo.Tracks {\n\t\tTracktmp = []Track{{\n\t\t\tID: mkvinfo.Tracks[k].ID,\n\t\t\tLang: mkvinfo.Tracks[k].Properties.Language,\n\t\t\tCodec: mkvinfo.Tracks[k].Codec,\n\t\t}}\n\n\t\tswitch mkvinfo.Tracks[k].Type {\n\t\tcase \"video\":\n\n\t\t\tVideos = append(Videos, Tracktmp[0])\n\t\tcase \"audio\":\n\t\t\tif mkvinfo.Tracks[k].Properties.Language == CFG.SortLang {\n\t\t\t\tAudios = append(Audios, Tracktmp[0])\n\t\t\t} else {\n\t\t\t\tAudios2 = append(Audios2, Tracktmp[0])\n\t\t\t}\n\n\t\tcase \"subtitles\":\n\t\t\tif mkvinfo.Tracks[k].Properties.Language == CFG.SortLang {\n\t\t\t\tSubtitles = append(Subtitles, Tracktmp[0])\n\t\t\t} else {\n\t\t\t\tSubtitles2 = append(Subtitles2, Tracktmp[0])\n\t\t\t}\n\t\t}\n\n\t}\n\tfor k := range Audios2 {\n\t\tAudios = append(Audios, Audios2[k])\n\t}\n\tfor k := range Subtitles2 {\n\t\tSubtitles = append(Subtitles, Subtitles2[k])\n\t}\n\tif CFG.MaxTracksAudio > 0 && len(Audios) >= CFG.MaxTracksAudio {\n\t\tAudios = Audios[:CFG.MaxTracksAudio]\n\t}\n\tif CFG.MaxTracksSub > 0 && len(Subtitles) >= CFG.MaxTracksSub {\n\t\tSubtitles = Subtitles[:CFG.MaxTracksSub]\n\t}\n\n\tif len(Videos) == 0 {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\treturn Videos, Audios, Subtitles, nil\n\n}", "func grpcGeneratedFileName(reldir string) func(f *protoc.File) []string {\n\treturn func(f *protoc.File) []string {\n\t\tname := strings.ReplaceAll(f.Name, \"-\", \"_\")\n\t\tif reldir != \"\" {\n\t\t\tname = path.Join(reldir, name)\n\t\t}\n\t\treturn []string{name + \"_grpc_pb.js\"}\n\t}\n}", "func (a *Attachment) GetCleanFileName() string {\n\treturn strings.Replace(a.name, \" \", \"_\", -1)\n}", "func legacyFileName(prefix, instance, class, id string) string {\n\tvar fileName string\n\tinstance = strings.Replace(instance, \"\\\\\", \"__\", -1)\n\n\t// use it to build the file name\n\tif prefix == \"\" {\n\t\tfileName = fmt.Sprintf(\"%s_%s_%s.status\", instance, class, id)\n\t} else {\n\t\tfileName = fmt.Sprintf(\"%s_%s_%s_%s.status\", prefix, instance, class, id)\n\t}\n\treturn fileName\n}", "func (e *FileEvent) IsRename() bool { return (e.flags & EventFlagItemRenamed) == EventFlagItemRenamed }", "func (o *FileversionFileversion) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func (i *FileInfo) Name() string { return i.name }", "func Update(recordings storage.Recordings) {\n\tapi := slack.New(os.Getenv(\"SLACK_API_KEY\"))\n\tchannels, err := api.GetChannels(true)\n\tif nil != err {\n\t\tlog.Println(err.Error())\n\t\treturn\n\t}\n\n\tsearchFilesAndAddToRecordings(api, channels, recordings, \"mp4\")\n\tsearchFilesAndAddToRecordings(api, channels, recordings, \"m4a\")\n}", "func statTimes(name string) (mtime time.Time, err error) {\n\tfi, err := os.Stat(name)\n\tif err != nil {\n\t\treturn\n\t}\n\tmtime = fi.ModTime()\n\treturn\n}", "func (file File) GetFilename() string {\n\treturn filepath.Base(file.Path)\n}", "func (sw *Swizzle) GetEncodedFilename() string {\n\treturn \"\"\n}", "func (o ExportOutput) Updated() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Export) pulumi.StringOutput { return v.Updated }).(pulumi.StringOutput)\n}", "func (status VerifyImageStatus) ImageDownloadFilenames() (string, string, string) {\n\tvar pendingFilename, verifierFilename, verifiedFilename string\n\n\tpendingDirname, verifierDirname, verifiedDirname :=\n\t\tstatus.ImageDownloadDirNames()\n\tif status.IsContainer {\n\t\tpendingFilename = pendingDirname + \"/\" + status.ContainerImageID + \".aci\"\n\t\tverifierFilename = verifierDirname + \"/\" + status.ContainerImageID + \".aci\"\n\t\tverifiedFilename = verifiedDirname + \"/\" + status.ContainerImageID + \".aci\"\n\t} else {\n\t\t// Else..VMs\n\t\tpendingFilename = pendingDirname + \"/\" + status.Safename\n\t\tverifierFilename = verifierDirname + \"/\" + status.Safename\n\t\tverifiedFilename = verifiedDirname + \"/\" + status.Safename\n\t}\n\treturn pendingFilename, verifierFilename, verifiedFilename\n}", "func Filename() string {\n\tmutex.RLock()\n\tdefer mutex.RUnlock()\n\treturn logFilename\n}", "func (fv *FileView) UpdateFiles() {\n\tupdt := fv.UpdateStart()\n\tdefer fv.UpdateEnd(updt)\n\tvar win oswin.Window\n\tif fv.Viewport != nil && fv.Viewport.Win != nil && fv.Viewport.Win.OSWin != nil {\n\t\twin = fv.Viewport.Win.OSWin\n\t} else {\n\t\twin = oswin.TheApp.WindowInFocus()\n\t}\n\n\tfv.UpdatePath()\n\tpf := fv.PathField()\n\tif len(gi.SavedPaths) == 0 {\n\t\tgi.OpenPaths()\n\t}\n\tgi.SavedPaths.AddPath(fv.DirPath, gi.Prefs.SavedPathsMax)\n\tgi.SavePaths()\n\tsp := []string(gi.SavedPaths)\n\tsp = append(sp, fileViewResetPaths)\n\tpf.ItemsFromStringList(sp, true, 0)\n\tpf.SetText(fv.DirPath)\n\tsf := fv.SelField()\n\tsf.SetText(fv.SelFile)\n\toswin.TheApp.Cursor(win).Push(cursor.Wait)\n\tdefer oswin.TheApp.Cursor(win).Pop()\n\n\tfv.Files = make([]*FileInfo, 0, 1000)\n\tfilepath.Walk(fv.DirPath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\temsg := fmt.Sprintf(\"Path %q: Error: %v\", fv.DirPath, err)\n\t\t\t// if fv.Viewport != nil {\n\t\t\t// \tgi.PromptDialog(fv.Viewport, \"FileView UpdateFiles\", emsg, true, false, nil, nil)\n\t\t\t// } else {\n\t\t\tlog.Printf(\"gi.FileView error: %v\\n\", emsg)\n\t\t\t// }\n\t\t\treturn nil // ignore\n\t\t}\n\t\tif path == fv.DirPath { // proceed..\n\t\t\treturn nil\n\t\t}\n\t\tfi, ferr := NewFileInfo(path)\n\t\tkeep := ferr == nil\n\t\tif fv.FilterFunc != nil {\n\t\t\tkeep = fv.FilterFunc(fv, fi)\n\t\t}\n\t\tif keep {\n\t\t\tfv.Files = append(fv.Files, fi)\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\treturn nil\n\t})\n\n\tsv := fv.FilesView()\n\tsv.SelField = \"Name\"\n\tsv.SelVal = fv.SelFile\n\tsv.UpdateFromSlice()\n\tfv.SelectedIdx = sv.SelectedIdx\n\tif sv.SelectedIdx >= 0 {\n\t\tsv.ScrollToRow(sv.SelectedIdx)\n\t}\n}", "func (ts TestSuite) Filename() string {\n\tvar b strings.Builder\n\n\tif ts.Type == \"xpack\" {\n\t\tb.WriteString(\"xpack_\")\n\t}\n\n\tb.WriteString(strings.ToLower(strings.Replace(ts.Dir, \".\", \"_\", -1)))\n\tb.WriteString(\"__\")\n\n\tbname := reFilename.ReplaceAllString(filepath.Base(ts.Filepath), \"$1\")\n\tb.WriteString(strings.ToLower(bname))\n\n\treturn b.String()\n}", "func GetTSFileName(fileName string) string {\n\tbaseName := filepath.Base(fileName)\n\text := filepath.Ext(fileName)\n\tname := baseName[0 : len(baseName)-len(ext)]\n\treturn path.Join(filepath.Dir(fileName), name+\".pb.ts\")\n}", "func setLastModified(resp *http.Response, filename string) error {\n\t// https://tools.ietf.org/html/rfc7232#section-2.2\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified\n\theader := resp.Header.Get(\"Last-Modified\")\n\tif header == \"\" {\n\t\treturn nil\n\t}\n\tlastmod, err := time.Parse(http.TimeFormat, header)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn os.Chtimes(filename, lastmod, lastmod)\n}", "func GetTimePassedSinceModified(f File) time.Duration {\n\tnow := time.Now()\n\tdiff := now.Sub(f.Modified)\n\treturn diff\n}", "func (s s3Repository) GetFileNameFromS3(key string) string {\n\tconst FileNameTag = \"file-name\"\n\tresult := \"\"\n\tparams := &s3.GetObjectTaggingInput{\n\t\tBucket: aws.String(s.bucketName),\n\t\tKey: aws.String(key),\n\t}\n\n\ttags, _ := s.s3repo.GetObjectTagging(params)\n\n\tfor _, v := range tags.TagSet {\n\t\tif *v.Key == FileNameTag {\n\t\t\tresult = *v.Value\n\t\t\treturn result\n\t\t}\n\t}\n\n\treturn result\n}", "func (upr UpdatePathResponse) LastModified() string {\n\treturn upr.rawResponse.Header.Get(\"Last-Modified\")\n}", "func splitFileName(filename string) (name, ver, rel string, epoch int, arch string) {\n\tif strings.HasSuffix(filename, \".rpm\") {\n\t\tfilename = filename[:len(filename)-4]\n\t}\n\n\tarchIndex := strings.LastIndex(filename, \".\")\n\tarch = filename[archIndex+1:]\n\n\trelIndex := strings.LastIndex(filename[:archIndex], \"-\")\n\trel = filename[relIndex+1 : archIndex]\n\n\tverIndex := strings.LastIndex(filename[:relIndex], \"-\")\n\tver = filename[verIndex+1 : relIndex]\n\n\tepochIndex := strings.Index(filename, \":\")\n\tif epochIndex == -1 {\n\t\tepoch = 0\n\t} else {\n\t\tepoch, _ = strconv.Atoi(filename[:epochIndex])\n\t}\n\n\tname = filename[epochIndex+1 : verIndex]\n\treturn name, ver, rel, epoch, arch\n}", "func GetFilename(URL string) string {\n\n\tif u, err := url.Parse(URL); err == nil && filepath.Ext(u.Path) != \"\" {\n\n\t\treturn filepath.Base(u.Path)\n\t}\n\n\tres, err := http.Head(URL)\n\tif err == nil {\n\t\theader := res.Header\n\t\tif hcd, ok := header[\"Content-Disposition\"]; ok && len(hcd) > 0 {\n\t\t\thcds := strings.Split(hcd[0], \"=\")\n\t\t\tif len(hcds) > 1 {\n\t\t\t\tif filename := hcds[1]; filename != \"\" {\n\t\t\t\t\treturn filepath.Base(filename)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn DefaultFileName\n}", "func (*DSGit) ExtractPrevFileName(f string) (res string) {\n\ti := strings.Index(f, \"{\")\n\tj := strings.Index(f, \"}\")\n\tif i > -1 && j > -1 {\n\t\tk := IndexAt(f, \" => \", i)\n\t\tif k > -1 {\n\t\t\tprefix := f[:i]\n\t\t\tinner := f[i+1 : k]\n\t\t\tsuffix := f[j+1:]\n\t\t\tres = prefix + inner + suffix\n\t\t}\n\t} else if strings.Index(f, \" => \") > -1 {\n\t\tres = strings.Split(f, \" => \")[0]\n\t} else {\n\t\tres = f\n\t}\n\treturn\n}", "func downloadingFileName(ur string) (string, error) {\n\tu, err := url.Parse(ur)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tss := strings.Split(u.Path, \"/\")\n\treturn ss[len(ss)-1], nil\n}", "func getEventDetails(filename string) (eventDate string) {\n\n\tvar index int\n\tfile := path.Base(filename)\n\tsepCount := strings.Count(file, \"-\")\n\n\tif sepCount > 0 && sepCount < 3 {\n\t\tindex = sepCount - 1\n\t} else {\n\t\tdms3libs.LogFatal(\"unexpected Motion filenaming convention: missing separators\")\n\t}\n\n\tres := strings.Split(file, \"-\")\n\n\tif len(res[index]) != 14 {\n\t\tdms3libs.LogFatal(\"unexpected Motion filenaming convention: incorrect string length\")\n\t}\n\n\tyear, _ := strconv.Atoi(res[index][0:4])\n\tmonth, _ := strconv.Atoi(res[index][4:6])\n\tday, _ := strconv.Atoi(res[index][6:8])\n\thour, _ := strconv.Atoi(res[index][8:10])\n\tmin, _ := strconv.Atoi(res[index][10:12])\n\tsec, _ := strconv.Atoi(res[index][12:14])\n\n\treturn time.Date(year, time.Month(month), day, hour, min, sec, 0, time.UTC).Format(\"15:04:05 on 2006-01-02\")\n\n}", "func (fi *fileInfo) Name() string {\n\treturn fi.name\n}", "func (pv *PixView) RenameByDate() {\n\tpv.UpdtMu.Lock()\n\tdefer pv.UpdtMu.Unlock()\n\n\tpv.UpdateFolders()\n\tpv.GetFolderFiles() // greatly speeds up rename\n\n\tadir := filepath.Join(pv.ImageDir, \"All\")\n\ttdir := pv.ThumbDir()\n\n\tpv.PProg.Start(len(pv.AllInfo))\n\tfor fn, pi := range pv.AllInfo {\n\t\tif pi.DateTaken.IsZero() {\n\t\t\tpv.PProg.ProgStep()\n\t\t\tcontinue\n\t\t}\n\t\tds := pi.DateTaken.Format(DateFileFmt)\n\t\tn := pi.Number\n\t\tnfn := fmt.Sprintf(\"img_%s_n%d\", ds, n)\n\t\tif fn == nfn {\n\t\t\tpv.PProg.ProgStep()\n\t\t\tcontinue\n\t\t}\n\t\tofn := filepath.Base(pi.File)\n\t\totf := pi.Thumb\n\n\t\topi := &picinfo.Info{}\n\t\t*opi = *pi\n\n\t\tnfn, pi.Number = pv.UniqueNameNumber(pi.DateTaken, 0)\n\t\tpi.SetFileThumbFmBase(nfn, adir, tdir)\n\n\t\tnfb := filepath.Base(pi.File)\n\n\t\tfmt.Printf(\"renaming %s => %s\\n\", ofn, nfb)\n\t\t// fmt.Printf(\"rename: %s -> %s\\n\", fn, nfn)\n\t\tpv.RenameFile(ofn, nfb)\n\t\tos.Rename(otf, pi.Thumb)\n\n\t\tdelete(pv.AllInfo, fn)\n\t\tpv.AllInfo[nfn] = pi\n\t\tpv.PProg.ProgStep()\n\t}\n\tfmt.Println(\"...Done\\n\")\n\t// gi.PromptDialog(nil, gi.DlgOpts{Title: \"Done\", Prompt: \"Done Renaming by Date\"}, gi.AddOk, gi.NoCancel, nil, nil)\n\tpv.DirInfo(false)\n\tpv.FolderFiles = nil\n\treturn\n}" ]
[ "0.52834725", "0.5220768", "0.51961505", "0.513757", "0.51145893", "0.5060113", "0.5055772", "0.50115466", "0.4949762", "0.48961532", "0.4890889", "0.48701093", "0.48465112", "0.47909465", "0.47878554", "0.47806117", "0.47538057", "0.4744122", "0.47032753", "0.46919453", "0.4683146", "0.46602598", "0.46586365", "0.46526468", "0.4625049", "0.45953888", "0.4594057", "0.45890054", "0.45862776", "0.45798895", "0.45734462", "0.4569883", "0.4560399", "0.45577368", "0.45348716", "0.4530458", "0.45290497", "0.45227787", "0.45209983", "0.4510079", "0.45093432", "0.4506942", "0.4503603", "0.449443", "0.44798246", "0.44797546", "0.44767627", "0.44722727", "0.44708115", "0.44694054", "0.4468118", "0.44669837", "0.44558623", "0.4454752", "0.44324762", "0.4425762", "0.44245216", "0.44148383", "0.44062394", "0.43841523", "0.43728906", "0.43692493", "0.4369162", "0.43573618", "0.4345882", "0.43298844", "0.43294019", "0.43221182", "0.43184444", "0.4312008", "0.43085685", "0.43023318", "0.42983955", "0.42980772", "0.4287696", "0.42867213", "0.42850277", "0.42826828", "0.42818597", "0.42715856", "0.42617145", "0.42521116", "0.4243314", "0.42425963", "0.42423773", "0.42393464", "0.4238842", "0.42360076", "0.42345172", "0.42315423", "0.42275465", "0.42233554", "0.4211219", "0.42094436", "0.42090723", "0.4209023", "0.42028573", "0.4190985", "0.4187678", "0.4185048" ]
0.6873114
0
Videos2 get videos by 2 table em.......
func (d *Dao) Videos2(c context.Context, aid int64) (vs []*archive.Video, err error) { rows, err := d.db.Query(c, _videos2SQL, aid) if err != nil { log.Error("d.db.Query(%s, %d) error(%v)", _videos2SQL, aid, err) return } defer rows.Close() for rows.Next() { v := &archive.Video{} if err = rows.Scan(&v.ID, &v.Filename, &v.Cid, &v.Aid, &v.Title, &v.Desc, &v.SrcType, &v.Duration, &v.Filesize, &v.Resolutions, &v.Playurl, &v.FailCode, &v.Index, &v.Attribute, &v.XcodeState, &v.Status, &v.State, &v.CTime, &v.MTime); err != nil { log.Error("rows.Scan error(%v)", err) return } vs = append(vs, v) } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func obtenerVideos(tema string, autor string, fecha string) ([]Video, error) {\n\tvideos := []Video{}\n\tdb, err := obtenerBaseDeDatos()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer db.Close()\n\t\n\tfilas, err := db.Query(\"SELECT id, tema, autor, fecha, link FROM videos where autor LIKE '%\"+autor+\"%' AND tema LIKE '%\"+tema+\"%' AND fecha LIKE '%\"+fecha+\"%'\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Si llegamos aquí, significa que no ocurrió ningún error\n\tdefer filas.Close()\n\n\t// Aquí vamos a \"mapear\" lo que traiga la consulta en el while de más abajo\n\tvar c Video\n\n\t// Recorrer todas las filas, en un \"while\"\n\tfor filas.Next() {\n\t\terr = filas.Scan(&c.Id, &c.Tema, &c.Autor, &c.Fecha , &c.Link)\n\t\t// Al escanear puede haber un error\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t\n\t\t// Y si no, entonces agregamos lo leído al arreglo\n\t\n\t\tvideos = append(videos, c)\n\t}\n\t// Vacío o no, regresamos el arreglo de contactos\n\treturn videos, nil\n}", "func GetVideos(c *fiber.Ctx) error {\n\tvar products []models.Video\n\n\t// basic sql query\n\tsql := \"SELECT * FROM videos\"\n\n\t// if your searches for video using title ot description\n\tif s := c.Query(\"s\"); s != \"\" {\n\t\tsql = fmt.Sprintf(\"%s WHERE title LIKE '%%%s%%' OR description LIKE '%%%s%%'\", sql, s, s)\n\t}\n\n\t// sort by asc or desc\n\tif sort := c.Query(\"sort\"); sort != \"\" {\n\t\tsql = fmt.Sprintf(\"%s ORDER BY date %s\", sql, sort)\n\t}\n\n\t// page number specified by user\n\tpage, _ := strconv.Atoi(c.Query(\"page\", \"1\"))\n\tperPage := 9\n\tvar total int64\n\n\t// total videos\n\tdatabase.DBConn.Raw(sql).Count(&total)\n\n\t// sql query to get videos on particular page\n\tsql = fmt.Sprintf(\"%s LIMIT %d OFFSET %d\", sql, perPage, (page-1)*perPage)\n\tdatabase.DBConn.Raw(sql).Scan(&products)\n\n\t// return the result to user\n\treturn c.JSON(fiber.Map{\n\t\t\"data\": products,\n\t\t\"total\": total,\n\t\t\"page\": page,\n\t\t\"last_page\": math.Ceil(float64(total / int64(perPage))),\n\t})\n}", "func (a *ApiV2) getVideos(accountId string) (videos []json.RawMessage, err error) {\n\tpath := \"/videos\"\n\tif accountId != \"\" {\n\t\tpath = \"/accounts/\" + accountId + path\n\t}\n\t// iterate through the requests until we get no more videos\n\tbase_url := a.getBaseUrl() + path\n\tpageNumber := 1\n\tpageSize := a.PageSize\n\tfor {\n\t\tvar obj VideoList\n\t\turl := base_url + fmt.Sprintf(\"?page_number=%d&page_size=%d\", pageNumber, pageSize)\n\t\treq, err := a.makeRequest(\"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn videos, err\n\t\t}\n\t\terr = handleReq(a, req, &obj)\n\t\tif err != nil {\n\t\t\treturn videos, err\n\t\t}\n\t\tif len(obj.Videos) == 0 {\n\t\t\treturn videos, nil\n\t\t}\n\t\tvideos = append(videos, obj.Videos...)\n\t\tpageNumber++\n\t}\n\treturn videos, nil\n}", "func (d *Dao) VideoOpers(c context.Context, vid int64) (op []*model.VOper, uids []int64, err error) {\n\tvar (\n\t\trows *sql.Rows\n\t\tctime time.Time\n\t)\n\top = []*model.VOper{}\n\tuids = []int64{}\n\tif rows, err = d.arcReadDB.Query(c, _videoOperSQL, vid); err != nil {\n\t\tlog.Error(\"d.arcReadDB.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tp := &model.VOper{}\n\t\tif err = rows.Scan(&p.ID, &p.AID, &p.UID, &p.VID, &p.Status, &p.Content, &p.Attribute, &p.LastID, &p.Remark, &ctime); err != nil {\n\t\t\tlog.Error(\"rows.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tp.CTime = ctime.Format(\"2006-01-02 15:04:05\")\n\t\top = append(op, p)\n\t\tuids = append(uids, p.UID)\n\t}\n\treturn\n}", "func GetVideosEndpoint(w http.ResponseWriter, req *http.Request){\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\n\t\t\n\tvideos, err := obtenerVideos(\"\",\"\",\"20\")\n\tif err != nil {\n\t\tfmt.Printf(\"Error obteniendo videos: %v\", err)\n\t\treturn\n\t}\n\tvar resultado []Video\n\tfor _, video := range videos {\n\t\tresultado = append(resultado, Video{Id: video.Id, Tema: video.Tema, Autor: video.Autor, Fecha: video.Fecha, Link: video.Link})\n\t\tfmt.Printf(\"%v\\n\", video.Tema)\n\t}\n\tfmt.Printf(\"%v\\n\", resultado)\n\tjson.NewEncoder(w).Encode(resultado)\n}", "func (c *PostClient) QueryVideos(po *Post) *PostVideoQuery {\n\tquery := &PostVideoQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postvideo.Table, postvideo.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.VideosTable, post.VideosColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (vc VideoController) ViewVideos(w http.ResponseWriter, r *http.Request) {\n\tvar videos []models.Video\n\tif err := storage.DB.Find(&videos).Error; err != nil {\n\t\tlogrus.Error(\"Could not find videos : \", err.Error())\n\t\thttp.Error(w, \"Error finding videos\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\trender.Render(w, r, \"videos\", map[string]interface{}{\n\t\t\"Videos\": videos,\n\t})\n}", "func (c *UnsavedPostClient) QueryVideos(up *UnsavedPost) *UnsavedPostVideoQuery {\n\tquery := &UnsavedPostVideoQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostvideo.Table, unsavedpostvideo.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.VideosTable, unsavedpost.VideosColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (client Client) Video(parameters Parameters) (VideoResultContainer, error) {\n\tvar result videoResultWrapper\n\n\tif err := client.search(parameters.GetURI(SearchTypeVideo), &result); err != nil {\n\t\treturn VideoResultContainer{}, err\n\t}\n\n\treturn result.Data, nil\n}", "func GetVideo(router *gin.RouterGroup) {\n\trouter.GET(\"/videos/:hash/:token/:type\", func(c *gin.Context) {\n\t\tif InvalidPreviewToken(c) {\n\t\t\tc.Data(http.StatusForbidden, \"image/svg+xml\", brokenIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tfileHash := c.Param(\"hash\")\n\t\ttypeName := c.Param(\"type\")\n\n\t\t_, ok := video.Types[typeName]\n\n\t\tif !ok {\n\t\t\tlog.Errorf(\"video: invalid type %s\", txt.Quote(typeName))\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tf, err := query.FileByHash(fileHash)\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"video: %s\", err.Error())\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tif !f.FileVideo {\n\t\t\tf, err = query.VideoByPhotoUID(f.PhotoUID)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"video: %s\", err.Error())\n\t\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif f.FileError != \"\" {\n\t\t\tlog.Errorf(\"video: file error %s\", f.FileError)\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tfileName := photoprism.FileName(f.FileRoot, f.FileName)\n\n\t\tif !fs.FileExists(fileName) {\n\t\t\tlog.Errorf(\"video: file %s is missing\", txt.Quote(f.FileName))\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\n\t\t\t// Set missing flag so that the file doesn't show up in search results anymore.\n\t\t\tlogError(\"video\", f.Update(\"FileMissing\", true))\n\n\t\t\treturn\n\t\t}\n\n\t\tif c.Query(\"download\") != \"\" {\n\t\t\tc.FileAttachment(fileName, f.ShareFileName())\n\t\t} else {\n\t\t\tc.File(fileName)\n\t\t}\n\n\t\treturn\n\t})\n}", "func getVideoSuggestions(videoId string, videoChan chan ytvideo.YTVideo, pageToken string, tPoolNum chan int) {\n\t//([]*youtube.Video){\n\tflag.Parse()\n\n\tclient := &http.Client{\n\t\tTransport: &transport.APIKey{Key: developerKey},\n\t}\n\n\tservice, err := youtube.New(client)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating new YouTube client: %v\", err)\n\t}\n\n\t// Make the API call to YouTube.\n\tcall := service.Search.List(\"id,snippet\").\n\t\tMaxResults(*maxResults).\n\t\tType(\"video\").\n\t\tRelatedToVideoId(videoId).\n\t\tPageToken(pageToken)\n\n\tresponse, err := call.Do()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error making search API call: %v\", err)\n\t}\n\n\t// Group video, channel, and playlist results in separate lists.\n\t//can use type youtube.Video later\n\tvideos := make(map[string]ytvideo.YTVideo)\n\n\n\t// // Iterate through each item and add it to the correct list.\n\tfor _, item := range response.Items {\n\t\tvideoObj := ytvideo.YTVideo{}.ConvertSearchResult(item)\n\t\tvideos[item.Id.VideoId] = videoObj\n\t\tgo videosHandler(videoChan, tPoolNum)\n\t\tvideoChan <- videoObj\n\t}\n\n\n\t//fetch the rest of th videos if we still have\n\tif len(response.NextPageToken) > 0 {\n\t\tgetVideoSuggestions(videoId, videoChan, response.NextPageToken, tPoolNum)\n\t}\n}", "func videosHandler(videoChan chan ytvideo.YTVideo, tPoolNum chan int) {\n\tvideo := <-videoChan\n\t<-tPoolNum // get a turn in the pool\n\tdefer consumeThread(tPoolNum) // to give turn to other threads\n\tif debugOutput {\n\t\tfmt.Println(video.Id)\n\t}\n\tytdl := youtube_dl.YoutubeDl{}\n\tytdl.Path = \"$GOPATH/src/app/srts\"\n\terr := ytdl.DownloadVideo(video.Id)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t}\n\t//if debugOutput {\n\t//\tlog.Printf(\"command : %v\", command)\n\t//}\n\tfmt.Print(\".\");\n\tStoreValue(video)\n\tgetVideoSuggestions(video.Id, videoChan, \"12\", tPoolNum)// 12 is a random token that works as initial value\n}", "func Videos(videos []fs.Video) html.Node {\n\n\tdivs := make([]html.Node, 0, len(videos))\n\n\tdivs = append(divs, html.Style().Text(VideoCSS().String()))\n\n\tfor _, video := range videos {\n\t\tdivs = append(divs, Video(video))\n\t}\n\n\tif len(videos) == 0 {\n\t\tdivs = append(divs, CenterByBoxes(html.H2().Text(\"No videos\")))\n\t}\n\n\tpage := html.Div().Class(layout.HBox, layout.Grow, layout.Wrap).Children(\n\t\tdivs...,\n\t)\n\n\treturn Layout(\"Videos\", page)\n}", "func (upq *UnsavedPostQuery) QueryVideos() *UnsavedPostVideoQuery {\n\tquery := &UnsavedPostVideoQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostvideo.Table, unsavedpostvideo.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.VideosTable, unsavedpost.VideosColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func getRatings(baseName, mediaTitle string, mediaYear, mediaSeason, mediaEpisode int,\n\tchannel chan<- renderTable) error {\n\t// Initial cache lookup with filename hash: we are not sure at this point if this is TV series of Movie, so lookup\n\t// in both cache tables\n\tvar cacheEntry CacheEntry\n\tbaseNameHash := getCacheKey(baseName)\n\terr := getCacheOne(cacheTv, \"BaseNameHash\", baseNameHash, &cacheEntry)\n\tif err != nil {\n\t\tlog.Debugf(\"TV series file %v (decoded: %v/%v/%v/%v) not found in cache: %v\", baseName, mediaTitle,\n\t\t\tmediaYear, mediaSeason, mediaEpisode, err)\n\t} else {\n\t\tchannel <- renderTable{isCached: true, data: cacheEntry}\n\t\treturn nil\n\t}\n\terr = getCacheOne(cacheMovie, \"BaseNameHash\", baseNameHash, &cacheEntry)\n\tif err != nil {\n\t\tlog.Debugf(\"Movie file %v (decoded: %v/%v) not found in cache: %v\", baseName, mediaTitle, mediaYear,\n\t\t\terr)\n\t} else {\n\t\tchannel <- renderTable{isCached: true, data: cacheEntry}\n\t\treturn nil\n\t}\n\n\t// Prepare OMDb query\n\tapi := gomdb.Init(omdbKey)\n\tquery := &gomdb.QueryData{Title: mediaTitle, Year: zString(mediaYear)}\n\n\tisTv := false\n\tif mediaSeason > 0 && mediaEpisode > 0 {\n\t\tisTv = true\n\n\t\tquery.Season = zString(mediaSeason)\n\t\tquery.Episode = zString(mediaEpisode)\n\t\tquery.SearchType = gomdb.EpisodeSearch\n\n\t} else {\n\t\tquery.SearchType = gomdb.MovieSearch\n\t}\n\n\t// OMDb query by title (type \"t\")\n\tres, err := api.MovieByTitle(query)\n\tif err != nil {\n\t\tlog.Debugf(\"Could not find media %q in OMDb, will retry with IMDB lookup: %v\", mediaTitle, err)\n\n\t\t// IMDB query by title\n\t\timdbID, err := getImdbId(mediaTitle, mediaYear)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"Could not query IMDB with media %q: %v\", mediaTitle, err)\n\t\t\treturn err\n\t\t}\n\n\t\t// do another OMDb query by IMDB Id (type \"i\")\n\t\tquery.ImdbId = imdbID\n\t\tres, err = api.MovieByImdbID(query)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"Could not query IMDB with for media %q and IMDB ID %v: %v\", mediaTitle, query.ImdbId,\n\t\t\t\terr)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// We have title, year, season and episode details and attempt to lookup them in cache\n\tif isTv {\n\t\t// hash(Title, Year, Season, Episode)\n\t\tkeyId := getCacheKey(mediaTitle, res.Year, query.Season, query.Episode)\n\t\terr := getCacheOne(cacheTv, \"Id\", keyId, &cacheEntry)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"TV series %v/%v/%v/%v (internal: %v) not found in cache: %v\", mediaTitle, query.Year,\n\t\t\t\tquery.Season, query.Episode, keyId, err)\n\t\t} else {\n\t\t\tchannel <- renderTable{isCached: true, data: cacheEntry}\n\t\t\treturn nil\n\t\t}\n\t} else {\n\t\t// hash(Title, Year)\n\t\tkeyId := getCacheKey(mediaTitle, query.Year)\n\t\terr := getCacheOne(cacheMovie, \"Id\", keyId, &cacheEntry)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"Movie %v/%v (internal: %v) not found in cache: %v\", mediaTitle, mediaYear, keyId, err)\n\t\t} else {\n\t\t\tchannel <- renderTable{isCached: true, data: cacheEntry}\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// RottenTomatoes scraping: only if OMDb doesn't have RT score\n\tif res.TomatoRating == \"N/A\" {\n\t\trt, err := getRtScore(mediaTitle, res.Title, mediaSeason, res.TomatoURL, isTv)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"Could not get RottenTomatoes rating for media %q: %v\", mediaTitle, err)\n\t\t} else {\n\t\t\tres.TomatoRating = rt\n\t\t}\n\t}\n\n\t// Metacritic scraping\n\tmetaCriticRating, err := getMcScore(mediaTitle, res.Title, mediaYear, mediaSeason, mediaEpisode, isTv)\n\tif err != nil {\n\t\tlog.Debugf(\"Could not get Metacritic rating for media %q: %v\", mediaTitle, err)\n\t\tmetaCriticRating = \"N/A\"\n\t}\n\n\t// We now have all data, send it to rendering and set cache flag to yes\n\tif isTv {\n\t\tcacheEntry = CacheEntry{Title: mediaTitle, Year: res.Year, EpisodeTitle: res.Title,\n\t\t\tSeason: query.Season, EpisodeNr: query.Episode, ImdbRating: res.ImdbRating,\n\t\t\tRtRating: res.TomatoRating, McRating: metaCriticRating, BaseNameHash: getCacheKey(baseName),\n\t\t\tIsTv: isTv, Id: getCacheKey(mediaTitle, res.Year, query.Season, query.Episode)}\n\t} else {\n\t\tcacheEntry = CacheEntry{Title: mediaTitle, Year: res.Year, ImdbRating: res.ImdbRating,\n\t\t\tRtRating: res.TomatoRating, McRating: metaCriticRating, BaseNameHash: getCacheKey(baseName),\n\t\t\tIsTv: isTv, Id: getCacheKey(mediaTitle, res.Year)}\n\t}\n\tchannel <- renderTable{isCached: false, data: cacheEntry}\n\n\treturn nil\n}", "func TestGetVideosFullList(t *testing.T) {\r\n\tlog.Printf(\"--------------------------------------------------------\")\r\n\tlog.Printf(\"RUNNING: ===>tablecrud/videoCrud.TestGetVideosFullList()\")\r\n\tlog.Printf(\"--------------------------------------------------------\")\r\n\tmyDB := db.Connect()\r\n\tmyVideo := &Video{}\r\n\tmyVideo.GetVideosFullList(myDB)\r\n}", "func DownloadMultipleYoutubeVideo(input string) (*[]VideoInfo, error) {\n\t// TODO(sandaluz) when you queue a large playlist it waitings for every video to be downloaded before it start playing music\n\tcmd := exec.Command(\"youtube-dl\", \"-i\", \"--print-json\", \"-f\", \"140\", \"-o\", \"audio_cache/%(id)s\", input)\n\tfmt.Println(cmd)\n\tvar out bytes.Buffer\n\tcmd.Stdout = &out\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tjsonList := strings.Split(strings.TrimSpace(out.String()), \"\\n\")\n\tvideoInfoList := make([]VideoInfo, len(jsonList))\n\tfor i, videoJSON := range jsonList {\n\t\tfmt.Println(i, videoJSON)\n\t\tvideoInfo := new(VideoInfo)\n\t\terr = json.Unmarshal([]byte(videoJSON), &videoInfo)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvideoInfoList[i] = *videoInfo\n\t}\n\n\treturn &videoInfoList, nil\n}", "func (d *Dao) VideoByCid(c context.Context, cid int64, ip string) (v *archive.Video, err error) {\n\tparams := url.Values{}\n\tparams.Set(\"cid\", strconv.FormatInt(cid, 10))\n\tvar res struct {\n\t\tCode int `json:\"code\"`\n\t\tData *archive.Video `json:\"data\"`\n\t}\n\tif err = d.client.Get(c, d.video, ip, params, &res); err != nil {\n\t\tlog.Error(\"VideoByCid cidURI(%s) error(%v)\", d.video+\"?\"+params.Encode(), err)\n\t\treturn\n\t}\n\tif res.Code != 0 {\n\t\terr = ecode.Int(res.Code)\n\t\tlog.Error(\"VideoByCid cidURI(%s) Code=(%d)\", d.video+\"?\"+params.Encode(), res.Code)\n\t\treturn\n\t}\n\tv = res.Data\n\treturn\n}", "func (s *Server) GetFavouriteVideos2(w rest.ResponseWriter, r *rest.Request) {\n\tresponse := models.BaseResponse{}\n\tresponse.Init(w)\n\n\tcurrentUser, err := s.LoginProcess(response, r)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpage := s.GetPageFromParams(r)\n\tuserID, err := s.GetUserIDFromParams(r)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tif userID == 0 {\n\t\tuserID = currentUser.ID\n\t}\n\n\tvideo := models.Video{}\n\tvideos, err := video.GetFavouriteVideos2(s.Db, userID, currentUser.ID, page)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tresponse.SendSuccess(videos)\n}", "func (repository *MockVideoRepository) GetVideoList(search string, start *uint, count *uint) ([]Video, error) {\n\tvideos := repository.videos\n\tif len(search) != 0 {\n\t\tfiltered := make([]Video, 0)\n\t\tfor _, v := range videos {\n\t\t\tif strings.Contains(v.Name, search) {\n\t\t\t\tfiltered = append(filtered, v)\n\t\t\t}\n\t\t}\n\t\tvideos = filtered\n\t}\n\tif start != nil {\n\t\tvideos = videos[*start:]\n\t}\n\tif count != nil {\n\t\tvideos = videos[:*count]\n\t}\n\treturn videos, repository.errorToReturn\n}", "func (d *Dao) VideoMetas(c context.Context, cids []int64) (meta map[int64]*model.VideoCMS, err error) {\n\tmeta = make(map[int64]*model.VideoCMS)\n\trows, err := d.db.Query(c, fmt.Sprintf(_videoMetas, xstr.JoinInts(cids)))\n\tif err != nil {\n\t\tlog.Error(\"VideoMetaDB d.db.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tli := &model.VideoCMS{}\n\t\tif err = rows.Scan(&li.CID, &li.Title, &li.AID, &li.IndexOrder, &li.Valid, &li.Deleted, &li.Result); err != nil {\n\t\t\tlog.Error(\"VideoMetaDB row.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tmeta[int64(li.CID)] = li\n\t}\n\treturn\n}", "func Video_(children ...HTML) HTML {\n return Video(nil, children...)\n}", "func ReadVideoFileLink(projectid int64, database *sql.DB) (string, error) {\n\tvar videolink string\n\tstmt, err := database.Prepare(`SELECT \n\t\t\t\t\t video_link\n\t\t\t\t\t FROM project \n\t\t\t\t\t WHERE id = ?`)\n\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(projectid)\n\tif err != nil {\n\t\tlog.Println(\"[ERR] prepare statment query err : \", err)\n\t\treturn \"\", err\n\t}\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&videolink)\n\t\tif err != nil {\n\t\t\tlog.Println(\"[ERR] rows scan err : \", err)\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn videolink, nil\n}", "func loadNewVideosFromMyChannel(knownVideos *tomlKnownVideos) {\n\n\tclient := getClient(youtube.YoutubeReadonlyScope)\n\tservice, err := youtube.New(client)\n\n\t// videoMeta data does not exist if there is no local data in knownvideos.toml\n\tif knownVideos.Videos == nil {\n\t\tknownVideos.Videos = make(map[string]videoMeta)\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating YouTube client: %v\", err)\n\t}\n\n\tresponse := channelsListMine(service, \"contentDetails\")\n\n\tfor _, channel := range response.Items {\n\t\tplaylistId := channel.ContentDetails.RelatedPlaylists.Uploads\n\n\t\t// Print the playlist ID for the list of uploaded videos.\n\t\tfmt.Printf(\"Checking for new videos in list %s\\r\\n\", playlistId)\n\n\t\tnextPageToken := \"\"\n\t\tvar numItemsPerPage int64 = 35\t\t\t// max 50 https://developers.google.com/youtube/v3/docs/playlistItems/list#parameters\n\t\tfoundNewVideos := false\t\t\t\t\t// if we added videos, we will look for next page of videos\n\t\tfor {\n\t\t\t// Retrieve next set of items in the playlist.\n\t\t\t// Items are not returned in perfectly sorted order, so just go through all pages to get all items\n\t\t\t// Revisit this if it gets too slow\n\t\t\tplaylistResponse := playlistItemsList(service, \"snippet,ContentDetails\", playlistId, nextPageToken, numItemsPerPage)\n\n\t\t\tfor _, playlistItem := range playlistResponse.Items {\n\t\t\t\tfoundNewVideos = addNewVideosToList(playlistItem, knownVideos)\n\t\t\t}\n\n\t\t\tif foundNewVideos {\n\t\t\t\tfmt.Println(\"Found some new videos. Let's look for more!\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Searched %v videos and found nothing new. Let's move on.\\r\\n\",numItemsPerPage)\n\t\t\t\t// The results are not exactly ordered by publishDate, so there could be cases where we didn't find expected videos\n\t\t\t\tfmt.Println(\"If we should have found some, increase numItemsPerPage or remove \\\"!foundNewVideos ||\\\" from code\")\n\t\t\t}\n\t\t\t// Set the token to retrieve the next page of results\n\t\t\t// or exit the loop if all results have (apparently) been retrieved.\n\t\t\tnextPageToken = playlistResponse.NextPageToken\n\t\t\tif !foundNewVideos || nextPageToken == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "func LiveScrape(name string, local string, t bool, cors bool) (List string) {\n\t// Request the HTML page.\n\tvar (\n\t\terr error\n\t\turl string\n\t)\n\tList = \"#EXTM3U\\n\"\n\turl = strings.Join([]string{\"https://members.sexcamvideos.net\", name}, \"/\")\n\tif name == \"index\" {\n\t\turl = \"https://members.sexcamvideos.net\"\n\t}\n\tif t {\n\t\turl = strings.Join([]string{\"https://members.sexcamvideos.net\", \"tag\", name}, \"/\")\n\t}\n\tif cors {\n\t\turl = strings.Join([]string{\"https://cors.zme.ink\", url}, \"/\")\n\t}\n\t// fmt.Println(url)\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn List\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != 200 {\n\t\t// log.Fatalf(\"status code error: %d %s\", res.StatusCode, res.Status)\n\t\treturn List\n\t}\n\n\t// Load the HTML document\n\tdoc, err := goquery.NewDocumentFromReader(res.Body)\n\tif err != nil {\n\t\treturn List\n\t}\n\troot := doc.Find(\"body ul#room_list > li.room_list_room\")\n\timgurl := \"https://roomimg.stream.highwebmedia.com/ri\"\n\troot.Each(func(index int, ele *goquery.Selection) {\n\t\ttitle := ele.Find(\"div.details > div.title > a\").Text()\n\t\ttitle = strings.Replace(title, \" \", \"\", -1)\n\t\tt := time.Now().Unix()\n\t\ttt := strconv.FormatInt(t, 10)\n\t\tcc := strings.Join([]string{imgurl, title}, \"/\")\n\t\tcc = strings.Join([]string{cc, \"jpg?\"}, \".\")\n\t\tcover := strings.Join([]string{cc, tt}, \"\")\n\t\tfirst := `#EXTINF:-1 tvg-id=\"\" tvg-name=\"`\n\t\tcv := `\" tvg-language=\"English\" tvg-logo=\"`\n\t\tafter := `\" group-title=\"livecam\",`\n\t\tr := \"\\n\"\n\t\tm3u8 := strings.Join([]string{local, \"livecam\", title, \"playlist.m3u8\"}, \"/\")\n\t\tm3u8 = strings.Join([]string{m3u8, \"\\n\"}, \"\")\n\t\tvar str []string = []string{first, title, cv, cover, after, title, r, m3u8}\n\t\tList += strings.Join(str, \"\")\n\t})\n\treturn List\n}", "func (c *Client) GetVideos(params *VideosParams) (*VideosResponse, error) {\n\tresp, err := c.get(\"/videos\", &ManyVideos{}, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvideos := &VideosResponse{}\n\tresp.HydrateResponseCommon(&videos.ResponseCommon)\n\tvideos.Data.Videos = resp.Data.(*ManyVideos).Videos\n\tvideos.Data.Pagination = resp.Data.(*ManyVideos).Pagination\n\n\treturn videos, nil\n}", "func (*ListVideosV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{1}\n}", "func (client *Client) GetVideoListWithOptions(request *GetVideoListRequest, runtime *util.RuntimeOptions) (_result *GetVideoListResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CateId)) {\n\t\tquery[\"CateId\"] = request.CateId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.EndTime)) {\n\t\tquery[\"EndTime\"] = request.EndTime\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageNo)) {\n\t\tquery[\"PageNo\"] = request.PageNo\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageSize)) {\n\t\tquery[\"PageSize\"] = request.PageSize\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.SortBy)) {\n\t\tquery[\"SortBy\"] = request.SortBy\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.StartTime)) {\n\t\tquery[\"StartTime\"] = request.StartTime\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Status)) {\n\t\tquery[\"Status\"] = request.Status\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.StorageLocation)) {\n\t\tquery[\"StorageLocation\"] = request.StorageLocation\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetVideoList\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetVideoListResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func Video(attrs []htmlgo.Attribute, children ...HTML) HTML {\n\treturn &htmlgo.Tree{Tag: \"video\", Attributes: attrs, Children: children}\n}", "func (s *GroupsService) ListVideo(gr string, opt ...CallOption) ([]*Video, *Response, error) {\n\tu := fmt.Sprintf(\"groups/%s/videos\", gr)\n\tvideos, resp, err := listVideo(s.client, u, opt...)\n\n\treturn videos, resp, err\n}", "func youTubeMoreVideo(a *chan []byte,c *string,e *int64){\n\n\n client := &http.Client{\n Transport: &transport.APIKey{Key: developerKey},\n }\n\n service, err := youtube.New(client)\n if err != nil {\n panic(err)\n }\n\n // Make the API call to YouTube.\n call := service.Search.List(\"id,snippet\").\n Q(*c).\n MaxResults(*e)\n response, err := call.Do()\n if err != nil {\n panic(err)\n }\n\n // Group video, channel, and playlist results in separate lists.\n videos := make(map[string]string)\n channels := make(map[string]string)\n playlists := make(map[string]string)\n sArr:=make([]YouTube,0)\n // Iterate through each item and add it to the correct list.\n for _, item := range response.Items {\n switch item.Id.Kind {\n case \"youtube#video\":\n c:=YouTube{Id:item.Id.VideoId,Title:item.Snippet.Title}\n sArr=append(sArr,c)\n //jsonString, _ := json.Marshal(datas)\n //fmt.Println(jsonString)\n //videos[item.Id.VideoId] = item.Snippet.Title\n case \"youtube#channel\":\n channels[item.Id.ChannelId] = item.Snippet.Title\n case \"youtube#playlist\":\n playlists[item.Id.PlaylistId] = item.Snippet.Title\n }\n }\n //*a<-videos\n datas:=AllYoutube{All:sArr}\n jsonString, _ := json.Marshal(datas)\n\n\n *a <- jsonString\n //fmt.Println(videos)\n printIDs(\"Videos\", videos)\n\n}", "func DBVideoToGQLVideo(i *dbm.Video) (o *gql.Video, err error) {\n\to = &gql.Video{\n\t\tID: *i.ID,\n\t\tTitle: i.Title,\n\t\tURL: *i.Url,\n\t}\n\treturn o, err\n}", "func EnumerateVideos(URL string, videos chan FlatVideo) (int, error) {\n\tvar (\n\t\tcount int\n\t\tfinalError error\n\t)\n\n\terr := doYoutubedl([]string{ytFlatPlaylist, ytDumpJSON, URL}, func(stdin io.ReadCloser, stderr io.ReadCloser) {\n\t\tdefer func() {\n\t\t\tif videos != nil {\n\t\t\t\tclose(videos)\n\t\t\t}\n\t\t}()\n\t\treader := bufio.NewReader(stdin)\n\t\tfor {\n\t\t\tline, err := reader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\tfinalError = err\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcount++\n\n\t\t\tif videos != nil {\n\t\t\t\tvar fv = FlatVideo{}\n\t\t\t\terr := json.Unmarshal([]byte(line), &fv)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfinalError = err\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tvideos <- fv\n\t\t\t}\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn count, finalError\n}", "func (d *Dao) VideoMetaDB(c context.Context, cid int64) (meta *model.VideoCMS, err error) {\n\trows, err := d.db.Query(c, _videoMeta, cid)\n\tif err != nil {\n\t\tlog.Error(\"VideoMetaDB d.db.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tli := &model.VideoCMS{}\n\t\tif err = rows.Scan(&li.CID, &li.Title, &li.AID, &li.IndexOrder, &li.Valid, &li.Deleted, &li.Result); err != nil {\n\t\t\tlog.Error(\"VideoMetaDB row.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tmeta = li\n\t}\n\treturn\n}", "func (uuo *UserUpdateOne) AddVideos(v ...*Video) *UserUpdateOne {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uuo.AddVideoIDs(ids...)\n}", "func (s *Service) loadVideoAds() (err error) {\n\tvar (\n\t\tok bool\n\t\tvdoAds []*model.VideoAD\n\t\tvdoAdsAPP = make(map[int8]map[int8]map[int8]map[string]*model.VideoAD)\n\t\ttmpAIDm []map[int64]int64\n\t\ttmpAIDs = make(map[int64]int64)\n\t)\n\tif vdoAds, err = s.ads.VideoAds(context.TODO()); err != nil {\n\t\tlog.Error(\"s.ads.VideoAds error(%v)\", err)\n\t\treturn\n\t}\n\tfor _, ad := range vdoAds {\n\t\tvar (\n\t\t\ttmpAPP map[int8]map[int8]map[string]*model.VideoAD\n\t\t\ttmpAPP2 map[int8]map[string]*model.VideoAD\n\t\t\ttmpAPP3 map[string]*model.VideoAD\n\t\t)\n\t\tif tmpAPP, ok = vdoAdsAPP[ad.Platform]; !ok {\n\t\t\ttmpAPP = make(map[int8]map[int8]map[string]*model.VideoAD)\n\t\t\tvdoAdsAPP[ad.Platform] = tmpAPP\n\t\t}\n\t\tif tmpAPP2, ok = tmpAPP[ad.Type]; !ok {\n\t\t\ttmpAPP2 = make(map[int8]map[string]*model.VideoAD)\n\t\t\ttmpAPP[ad.Type] = tmpAPP2\n\t\t}\n\t\tif tmpAPP3, ok = tmpAPP2[ad.Target]; !ok {\n\t\t\ttmpAPP3 = make(map[string]*model.VideoAD)\n\t\t\ttmpAPP2[ad.Target] = tmpAPP3\n\t\t}\n\t\tswitch ad.Target {\n\t\tcase model.VdoAdsTargetArchive:\n\t\t\tif ad.Aids == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txids := strings.Split(ad.Aids, \",\")\n\t\t\tfor _, xid := range xids {\n\t\t\t\ttmpAPP3[xid] = ad\n\t\t\t\tif ad.FrontAid > 0 {\n\t\t\t\t\ttmpAIDs[ad.FrontAid] = ad.FrontAid\n\t\t\t\t}\n\t\t\t}\n\t\tcase model.VdoAdsTargetBangumi:\n\t\t\tif ad.SeasonID <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsid := strconv.Itoa(ad.SeasonID)\n\t\t\ttmpAPP3[sid] = ad\n\t\t\tif ad.Platform == model.VdoAdsPC {\n\t\t\t\tif ad.AdCid > 0 {\n\t\t\t\t\ttmpAIDs[ad.AdCid] = ad.AdCid\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ad.FrontAid > 0 {\n\t\t\t\t\ttmpAIDs[ad.FrontAid] = ad.FrontAid\n\t\t\t\t}\n\t\t\t}\n\t\tcase model.VdoAdsTargetType:\n\t\t\tif ad.TypeID <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttid := strconv.Itoa(int(ad.TypeID))\n\t\t\ttmpAPP3[tid] = ad\n\t\t\tif ad.FrontAid > 0 {\n\t\t\t\ttmpAIDs[ad.FrontAid] = ad.FrontAid\n\t\t\t}\n\t\t}\n\t\tif len(tmpAIDs) == 50 {\n\t\t\ttmpAIDm = append(tmpAIDm, tmpAIDs)\n\t\t\ttmpAIDs = make(map[int64]int64)\n\t\t}\n\t}\n\tif len(tmpAIDs) > 0 {\n\t\ttmpAIDm = append(tmpAIDm, tmpAIDs)\n\t}\n\ts.videoAdsAPPCache = vdoAdsAPP\n\ts.PasterAIDCache = tmpAIDm\n\treturn\n}", "func GetVideoCatalogueByCourseHandle(es *database.ElasticService) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tsetupResponse(&w, r)\n\t\tif (*r).Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\t\tcourse := r.URL.Query()[\"course\"]\n\t\tvideos, err := es.GetUniqueStringFieldValuesInIndexWithFilter(\n\t\t\tdatabase.VideoEventDescriptionIndexName,\n\t\t\t\"video_id\",\n\t\t\t\"course_id\",\n\t\t\tcourse[0],\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error! Can't get unique videos for course: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\tb, err := json.Marshal(videos)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error! Can't convert video list to json: %v\\n\", err)\n\t\t}\n\t\tfmt.Fprintf(w, string(b))\n\t}\n}", "func getTagsFromVideo(video *types.UserVideoItem) []string {\n\tuserTags := []string{}\n\tfor _, tag := range video.Items[0].Snippet.Tags {\n\t\twords := strings.Split(tag, \" \")\n\t\tfor _, w := range words {\n\t\t\tuserTags = append(userTags, w)\n\t\t}\n\t}\n\ttitleWords := strings.Split(video.Items[0].Snippet.Title, \" \")\n\tfor _, w := range titleWords {\n\t\tuserTags = append(userTags, w)\n\t}\n\tdescriptionWords := strings.Split(video.Items[0].Snippet.Description, \" \")\n\tfor _, w := range descriptionWords {\n\t\tuserTags = append(userTags, w)\n\t}\n\tfreeFormText := strings.Join(userTags, \" \")\n\tfreeFormText = CleanString(freeFormText)\n\tuserTags = strings.Split(freeFormText, \" \")\n\n\tprocessedWords := []string{}\n\tfor _, w := range userTags {\n\t\tw = GetStemOfWord(w)\n\t\tw = strings.ToLower(w)\n\t\tif len(w) > 1 {\n\t\t\tprocessedWords = append(processedWords, w)\n\t\t}\n\t}\n\treturn processedWords\n}", "func (c *client) ListLiveVideos(applicantID string) LiveVideoIter {\n\treturn &liveVideoIter{&iter{\n\t\tc: c,\n\t\tnextURL: \"/live_videos?applicant_id=\" + applicantID,\n\t\thandler: func(body []byte) ([]interface{}, error) {\n\t\t\tvar r struct {\n\t\t\t\tLiveVideos []*LiveVideo `json:\"live_videos\"`\n\t\t\t}\n\n\t\t\tif err := json.Unmarshal(body, &r); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvalues := make([]interface{}, len(r.LiveVideos))\n\t\t\tfor i, v := range r.LiveVideos {\n\t\t\t\tvalues[i] = v\n\t\t\t}\n\t\t\treturn values, nil\n\t\t},\n\t}}\n}", "func (s *UsersService) ProtfolioListVideo(uid string, p string, opt ...CallOption) ([]*Video, *Response, error) {\n\tvar u string\n\tif uid == \"\" {\n\t\tu = fmt.Sprintf(\"me/portfolios/%s/videos\", p)\n\t} else {\n\t\tu = fmt.Sprintf(\"users/%s/portfolios/%s/videos\", uid, p)\n\t}\n\n\tvideos, resp, err := listVideo(s.client, u, opt...)\n\n\treturn videos, resp, err\n}", "func getMediaByTitle(title string) Medias{\n\tsqlStatement := \"EXEC getMediabyTitle '\" + title + \"'\"\n\tst, _ := db.Prepare(sqlStatement)\n\trows,_ := st.Query()\n\tvar mediaCol Medias\n\tvar tempMedia Media\n\ti := 0\n\tfor rows.Next() {\n\t\t//for media info\n\t\terr = rows.Scan(\n\t\t\t\t\t\t&tempMedia.MediaId,\n\t\t\t\t\t\t&tempMedia.MediaHead,\n\t\t\t\t\t\t&tempMedia.Codec,\n\t\t\t\t\t\t&tempMedia.Container,\n\t\t\t\t\t\t&tempMedia.UniqueViews,\n\t\t\t\t\t\t&tempMedia.TargetDemographic,\n\t\t\t\t\t\t&tempMedia.SizeInBytes,\n\t\t\t\t\t\t&tempMedia.UploadedDate,\n\t\t\t\t\t\t&tempMedia.WidthInPixels,\n\t\t\t\t\t\t&tempMedia.HeightInPixels,\n\t\t\t\t\t\t&tempMedia.Orientation,\n\t\t\t\t\t\t&tempMedia.DefinitionHD,\n\t\t\t\t\t\t&tempMedia.RegionOfOrgin,\n\t\t\t\t\t\t&tempMedia.ModifiedDate,\n\t\t\t\t\t\t&tempMedia.Duration)\n\t\ttempMedia.TitleCol, _ = getTitleByMediaId(tempMedia.MediaId)\n\t\ttempMedia.DescriptionCol, _= getDescriptionByMediaId(tempMedia.MediaId)\n\t\ttempMedia.ThumbnailCol = getThumbnailByMediaId(tempMedia.MediaId)\n\t\tcheckErr(err)\n\t\ti++\n\t\tmediaCol = append(mediaCol, tempMedia)\n\n\t}\n\tfmt.Println(\"#Media: \" , i )\n\n\t//close the result set so that we can reopen it later\n\tst.Close()\n\trows.Close()\n\treturn mediaCol\n\n}", "func (i InputInlineQueryResultVideo) construct() InputInlineQueryResultClass { return &i }", "func DownloadVideo(video *Video) {\n\tdefer wg.Done()\n\tif video.VideoUrl == \"\" {\n\t\treturn\n\t}\n\t// $cmd = sprintf(\"ffmpeg -i \\\"%s\\\" -c copy \\\"%s/%s.mp4\\\"\", $param['video'], $dir, $val['title']);\n\t// cmd := fmt.Sprintf(\"ffmpeg -i \\\"%s\\\" -c copy \\\"%s/%s.mp4\\\"\",\n\t// \tvideo.VideoUrl, VConf.Main.DownloadDir, video.Title)\n\t// log.Println(cmd)\n\tcmd := exec.Command(\"ffmpeg\", \"-i\", `\"`+video.VideoUrl+`\"`,\n\t\t\"-c copy\", fmt.Sprintf(`\"%s/%s.mp4\"`, VConf.Main.DownloadDir, video.Title))\n\tlog.Println(cmd.Path, cmd.Args)\n\terr := cmd.Start()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n}", "func FetchYouTubeVideos(after time.Time, before time.Time, maxCount int64) ([]model.Video, error) {\n\tvideos := []model.Video{}\n\n\tyoutube, err := gapi.GenYouTubeService()\n\tif err != nil {\n\t\treturn videos, err\n\t}\n\n\tpageToken := \"\"\n\tparts := []string{\"id\", \"snippet\"}\n\tfor {\n\t\tcall := youtube.Search.\n\t\t\tList(parts).\n\t\t\tType(\"video\").\n\t\t\tOrder(\"date\").\n\t\t\tChannelId(os.Getenv(\"YOUTUBE_CHANNEL_ID\")).\n\t\t\tMaxResults(maxCount).\n\t\t\tPageToken(pageToken)\n\n\t\tif !after.IsZero() && !before.IsZero() {\n\t\t\tcall = call.PublishedAfter(after.Format(format)).PublishedBefore(before.Format(format))\n\t\t}\n\n\t\tresp, err := call.Do()\n\t\tif err != nil {\n\t\t\treturn videos, err\n\t\t}\n\n\t\tfor _, item := range resp.Items {\n\t\t\tvideo := model.NewVideo(item)\n\t\t\tvideos = append(videos, video)\n\t\t}\n\n\t\tpageToken = resp.NextPageToken\n\t\tif pageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn videos, nil\n}", "func (vr *VideosRepo) GetVideos() (*youtube.VideoListResponse, error) {\n\tif vr.Videos.Id == \"\" {\n\t\treturn nil, errors.New(\"data: GetVideos by nil id\")\n\t}\n\treturn vr.Videos.List()\n}", "func (*ListVideosV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{0}\n}", "func (d *Dao) AvidVideoMap(ctx context.Context, avids []int64) (avidVideoMap map[int64]*model.UpCardVideo, err error) {\n\tavidVideoMap = make(map[int64]*model.UpCardVideo)\n\tarchives, err := d.listArchives(ctx, avids)\n\tif err != nil {\n\t\tlog.Error(\"d.listArchives error(%v) arg(%v)\", err, avids)\n\t\terr = ecode.CreativeArcServiceErr\n\t\treturn\n\t}\n\n\tfor avid, data := range archives {\n\t\tvideo := transfer(avid, data)\n\t\tavidVideoMap[avid] = video\n\t}\n\treturn\n}", "func ConcatenateVideos(srcDir, destDir string) error {\n\tlistFilePath := path.Join(destDir, \"list.txt\")\n\terr := generateMP4List(srcDir, listFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutMP4Path := path.Join(destDir, \"out.mp4\")\n\t// ffmpeg -f concat -i mylist.txt -c copy output.mp4\n\targs := []string{\n\t\t\"-f\", \"concat\",\n\t\t\"-safe\", \"0\",\n\t\t\"-i\", listFilePath,\n\t\t\"-c\", \"copy\",\n\t\toutMP4Path,\n\t}\n\treturn runCmd(FFMPEG, \"\", args...)\n}", "func (m *MockIRepository) GetRelatedVideos(id aggregates.Id, start, count int) ([]aggregates.RelatedVideo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetRelatedVideos\", id, start, count)\n\tret0, _ := ret[0].([]aggregates.RelatedVideo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (uu *UserUpdate) AddVideos(v ...*Video) *UserUpdate {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uu.AddVideoIDs(ids...)\n}", "func (vc VideoController) ViewVideo(w http.ResponseWriter, r *http.Request) {\n\tid, err := strconv.Atoi(mux.Vars(r)[\"id\"])\n\tif err != nil {\n\t\thttp.Error(w, \"Could not find video with id \"+mux.Vars(r)[\"id\"], http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvideo, err := videos.GetVideo(uint(id))\n\tif err != nil {\n\t\thttp.Error(w, \"Could not find video : \"+err.Error(), 500)\n\t}\n\n\tvideo.Views += 1\n\tstorage.DB.Save(&video)\n\n\tvar creator models.User\n\tstorage.DB.Find(&creator, video.UserID)\n\n\trender.Render(w, r, \"video\", map[string]interface{}{\n\t\t\"Video\": video,\n\t\t\"User\": creator,\n\t\t\"VideoUrl\": videos.GetVideoUrl(video),\n\t})\n}", "func getCompTable(c *gin.Context) {\n\tid := c.Param(\"id\")\n\n\ttype Competitor struct {\n\t\tPlayer Player `json:\"player\"`\n\t\tPlayed int `json:\"played\"`\n\t\tWins int `json:\"wins\"`\n\t\tLosses int `json:\"losses\"`\n\t}\n\n\tvar response struct {\n\t\tCompetitors []Competitor `json:\"competitors\"`\n\t}\n\n\tsqlStatement := `SELECT \n\tp.id, first_name, last_name,\n\t(SELECT count(player_id)\n\tFROM match_participant\n\tJOIN match ON match_id = match.id\n\tJOIN comp on match.comp_id = comp.id\n\tJOIN match_result mr ON mr.match_id =match.id\n\twhere comp.id = $1 and player_id = p.id) AS played, \n\t(SELECT count(winner_id)\n\tFROM match_result\n\tJOIN match ON match_id = match.id\n\tJOIN comp on match.comp_id = comp.id\n\twhere comp.id = $1 and winner_id = p.id) AS wins \n\tFROM player p\n\t\tJOIN match_participant mp on mp.player_id = p.id\n\t\tJOIN match m ON mp.match_id = m.id\n\tJOIN comp c ON c.id = m.comp_id\n\t\tJOIN match_result mr on mr.match_id = m.id \n\tWHERE c.id = $1\n\tGROUP BY p.id\n\tORDER BY wins DESC\n\t`\n\n\trows, err := db.Query(sqlStatement, id)\n\tif handleError(err, c) {\n\t\treturn\n\t}\n\n\tresponse.Competitors = []Competitor{}\n\tfor rows.Next() {\n\t\tvar competitor Competitor\n\t\terr = rows.Scan(&competitor.Player.Id, &competitor.Player.FirstName, &competitor.Player.LastName, &competitor.Played, &competitor.Wins)\n\t\tif err != nil {\n\t\t\tprintln(err.Error())\n\t\t}\n\n\t\tcompetitor.Losses = competitor.Played - competitor.Wins\n\t\tresponse.Competitors = append(response.Competitors, competitor)\n\t}\n\n\tc.JSON(http.StatusOK, response)\n}", "func (s *Server) GetImportedVideos(w rest.ResponseWriter, r *rest.Request) {\n\tresponse := models.BaseResponse{}\n\tresponse.Init(w)\n\n\tcurrentUser, err := s.LoginProcess(response, r)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpage := s.GetPageFromParams(r)\n\tuserID, err := s.GetUserIDFromParams(r)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tif userID == 0 {\n\t\tuserID = currentUser.ID\n\t}\n\n\tvideo := models.Video{}\n\tvideos, err := video.GetImportedVideos(s.Db, userID, page)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tresponse.SendSuccess(videos)\n}", "func (c *CLI) FindVideos(query string) (*SearchResult, error) {\n\tvals := &url.Values{}\n\tvals.Add(\"q\", query)\n\tvals.Add(\"key\", c.Token)\n\n\tres, err := c.request(\"GET\",\n\t\t\"https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&type=video&\"+vals.Encode(),\n\t\tnil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\t// Save server response into a txt file - debug\n\t// b, _ := ioutil.ReadAll(res.Body)\n\t// ioutil.WriteFile(\"cc.txt\", b, 0644)\n\n\tvideo := &SearchResult{}\n\tif err := json.NewDecoder(res.Body).Decode(video); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn video, nil\n}", "func (v *videoService) GetById(ctx context.Context, req *pbVideo.GetVideoRequest, res *pbVideo.GetVideoResponse) error {\n\tif req.Id == \"\" {\n\t\treturn errors.MissingVideoId\n\t}\n\n\tvideo, err := v.videoRepository.FindById(req.Id)\n\tif err != nil {\n\t\tlog.Info().Str(\"video\", req.Id).Msg(\"unable to find video\")\n\t\treturn errors.VideoNotFound\n\t}\n\n\terrorCount := len(video.Transcode.Errors)\n\ttrError := false\n\n\tif errorCount >= 1 {\n\t\ttrError = true\n\t} else {\n\t\ttrError = false\n\t}\n\tres.SignedUrl, err = v.s3Bucket.GetSignedResourceURL(video.Storage.OutputKey)\n\tif err != nil {\n\t\tlog.Warn().Err(err).Str(\"video\", req.Id).Msg(\"unable to fetch signed url for video\")\n\t}\n\n\t// count the view\n\terr = v.videoRepository.IncrementViews(video.ID)\n\tif err != nil {\n\t log.Warn().Err(err).Str(\"video\", video.ID.Hex()).Msg(\"unable to increment view counter\")\n\t}\n\t// TODO: publish video.events.view\n\n\tres.Video = &pbVideo.VideoDetails{\n\t\tId: video.ID.Hex(),\n\t\tTitle: video.Title,\n\t\tDescription: video.Description,\n\t\tTags: video.Tags,\n\t\tStorage: &pbVideo.VideoStorage{\n\t\t\tRawKey: video.Storage.RawKey,\n\t\t\tTranscodedKey: video.Storage.OutputKey,\n\t\t},\n\t\tStatistics: &pbVideo.VideoStatistics{\n\t\t\tViewCount: video.Statistics.ViewCount,\n\t\t},\n\t\tStatus: &pbVideo.VideoStatus{\n\t\t\tCompleted: video.Transcode.Completed,\n\t\t\tError: trError,\n\t\t\tErrorMessages: video.Transcode.Errors,\n\t\t},\n\t}\n\n\treturn nil\n}", "func (op Operator) search(target string, lim int64) map[string]*youtube.SearchResult {\n\tcall := op.service.Search.List(\"id, snippet\").Q(target).MaxResults(lim)\n\tresp, err := call.Do()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tvideos := make(map[string]*youtube.SearchResult)\n\tfor _, item := range resp.Items {\n\t\tif item.Id.Kind == \"youtube#video\" {\n\t\t\tvideos[item.Id.VideoId] = item\n\t\t}\n\t}\n\treturn videos\n}", "func (uuo *UserUpdateOne) RemoveVideos(v ...*Video) *UserUpdateOne {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uuo.RemoveVideoIDs(ids...)\n}", "func ParseVideoUrl(video *Video) {\n\tdefer wg.Done()\n\tres, err := http.Get(video.Url)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\tbytes, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\treg := `videoFlashPlayUrl\\s=\\s\\'(.*)\\'`\n\tsubmatch := regexp.MustCompile(reg).FindAllSubmatch(bytes, -1)\n\tif len(submatch) > 0 && len(submatch[0]) > 0 {\n\t\tvv := submatch[0][1]\n\t\turlInfo, err := url.Parse(string(vv))\n\t\tif err != nil {\n\t\t\tlog.Println(err, string(vv))\n\t\t\treturn\n\t\t}\n\t\tlog.Println(urlInfo.Query()[\"video\"][0])\n\t\tvideo.VideoUrl = urlInfo.Query()[\"video\"][0]\n\t\tgo DownloadVideo(video)\n\t\twg.Add(1)\n\t\t// videoChan <- video\n\t}\n}", "func downloadVideo(writer io.Writer, videoInfo ytdl.VideoInfo) error {\n\tif len(videoInfo.Formats) == 0 {\n\t\treturn errors.New(\"No available video formats\")\n\t}\n\n\tformat := videoInfo.Formats[0]\n\n\tlog.Debugf(\"Format: %v\", format)\n\n\tif err := videoInfo.Download(format, writer); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func videoThumbnailsFetcher(domains ...string) func(context.Context, *http.Client, *url.URL) (*unfurlist.Metadata, bool) {\n\tdoms := make(map[string]struct{})\n\tfor _, d := range domains {\n\t\tdoms[d] = struct{}{}\n\t}\n\treturn func(_ context.Context, _ *http.Client, u *url.URL) (*unfurlist.Metadata, bool) {\n\t\tif _, ok := doms[u.Host]; !ok {\n\t\t\treturn nil, false\n\t\t}\n\t\tswitch strings.ToLower(path.Ext(u.Path)) {\n\t\tdefault:\n\t\t\treturn nil, false\n\t\tcase \".mp4\", \".mov\", \".m4v\", \".3gp\", \".webm\", \".mkv\":\n\t\t}\n\t\tu2 := &url.URL{\n\t\t\tScheme: u.Scheme,\n\t\t\tHost: u.Host,\n\t\t\tPath: u.Path + \".thumb\",\n\t\t}\n\t\treturn &unfurlist.Metadata{\n\t\t\tTitle: path.Base(u.Path),\n\t\t\tType: \"video\",\n\t\t\tImage: u2.String(),\n\t\t}, true\n\t}\n}", "func (video *FakeVideo) GetAllVideos(userID string) (videos []Video, err error) {\n\tjsonFile, err := os.Open(\"testdata/fake_videos.json\")\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer jsonFile.Close()\n\n\tjsonData, err := ioutil.ReadAll(jsonFile)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar fakeVideos []FakeVideo\n\tjson.Unmarshal(jsonData, &fakeVideos)\n\n\tfor _, fakeVideo := range fakeVideos {\n\t\tif fakeVideo.CreatedBy == userID {\n\t\t\tvideo := Video{\n\t\t\t\tID: fakeVideo.ID,\n\t\t\t\tName: fakeVideo.Name,\n\t\t\t\tURL: fakeVideo.URL,\n\t\t\t\tYoutubeVideoID: fakeVideo.YoutubeVideoID,\n\t\t\t}\n\n\t\t\tvideos = append(videos, video)\n\t\t}\n\t}\n\n\treturn\n}", "func (c *Client) SearchVideoByVideo(lib string, args *api.BaseRequest) (*api.SearchTaskResultResponse, error) {\n\treturn api.SearchVideoByVideo(c, lib, args)\n}", "func (amv *AMV) VideoEditors() []*User {\n\tobjects := DB.GetMany(\"User\", amv.VideoEditorIDs)\n\teditors := []*User{}\n\n\tfor _, obj := range objects {\n\t\tif obj == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\teditors = append(editors, obj.(*User))\n\t}\n\n\treturn editors\n}", "func getCompPlayers(c *gin.Context) {\n\tid := c.Param(\"id\")\n\tsqlStatement := `SELECT id, first_name, last_name, is_admin FROM player \n\tLEFT JOIN comp_reg ON id=comp_reg.player_id\n\tWHERE comp_reg.comp_id=$1 and (comp_reg.pending != true or comp_reg.pending is null);`\n\tqueryPlayers(c, sqlStatement, id)\n}", "func CrawlUrls(cat *CatType) []*Video {\n\tret := []*Video{}\n\tmaxPageNum := cat.MaxPageNum\n\tpage := 1\n\tnow := time.Now().Unix()\n\tfor page <= maxPageNum {\n\t\turl := fmt.Sprintf(cat.PageUrl, page, now)\n\t\tpage++\n\t\tlog.Println(url)\n\t\tres, err := http.Get(url)\n\t\tif err != nil {\n\t\t\tlog.Println(err, url)\n\t\t\tcontinue\n\t\t}\n\t\tbytes, _ := ioutil.ReadAll(res.Body)\n\t\tres.Body.Close()\n\t\tv := &Result{}\n\t\terr = json.Unmarshal(bytes, v)\n\t\tif err != nil {\n\t\t\tlog.Println(err, string(bytes), page)\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, v.Data.Videos...)\n\n\t}\n\treturn ret\n}", "func generateVideoUrlsMessage(videoUrl, audioUrl string) string {\n\tvar sb strings.Builder\n\tsb.Grow(150)\n\tsb.WriteString(\"Here is the link to video file: \")\n\tsb.WriteString(videoUrl)\n\tif audioUrl != \"\" {\n\t\tsb.WriteString(\"\\n\")\n\t\tsb.WriteString(generateAudioURLMessage(audioUrl))\n\t}\n\treturn sb.String()\n}", "func (s *Service) VideoReports(c context.Context, t int8, stime, etime time.Time) (reports []*archive.Report, err error) {\n\tif reports, err = s.arc.Reports(c, t, stime, etime); err != nil {\n\t\tlog.Error(\"s.arc.Reports(%d) err(%v)\", t, err)\n\t\treturn\n\t}\n\treturn\n}", "func getPlayerComps(c *gin.Context) {\n\n\tparam := c.Param(\"id\")\n\tplayerid, err := strconv.Atoi(param)\n\tif handleError(err, c) {\n\t\treturn\n\t}\n\n\tsqlStatement := `SELECT id, comp_name, is_private, creator_id, \n\t(SELECT COUNT(player_id) FROM comp_reg WHERE comp_id = id and pending = false) as totalplayers, null as pos \n\t\tFROM comp\n\t\tLEFT JOIN comp_reg ON comp.id = comp_reg.comp_id \n\t\tWHERE comp_reg.player_id = $1 and pending = false\n\t\tGROUP BY comp.id`\n\n\tres, err := getCompetitions(c, sqlStatement, playerid)\n\tif handleError(err, c) {\n\t\treturn\n\t}\n\n\t// Getting player position\n\n\tsqlStatement = `SELECT \n\tp.id,\n\t(SELECT count(winner_id)\n\tFROM match_result\n\tJOIN match ON match_id = match.id\n\tJOIN comp on match.comp_id = comp.id\n\twhere comp.id = $1 and winner_id = p.id) AS wins \n\tFROM player p\n\tJOIN match_participant mp on mp.player_id = p.id\n\tJOIN match m ON mp.match_id = m.id\n\tJOIN comp c ON c.id = m.comp_id\n\tJOIN match_result mr on mr.match_id = m.id \n\tWHERE c.id = $1\n\tGROUP BY p.id\n\tORDER BY wins DESC\n\t;`\n\n\t// For each comp\n\n\tfor index := 0; index < len(res.Competitions); index++ {\n\t\trows, err := db.Query(sqlStatement, res.Competitions[index].Id)\n\t\tif handleError(err, c) {\n\t\t\treturn\n\t\t}\n\n\t\t// For each player in comp\n\t\ti := 1\n\t\tfor rows.Next() {\n\t\t\tvar scannedID, wins int\n\t\t\terr = rows.Scan(&scannedID, &wins)\n\t\t\tif err != nil {\n\t\t\t\tprintln(err.Error())\n\t\t\t}\n\n\t\t\tif scannedID == playerid {\n\t\t\t\tres.Competitions[index].PlayerPos = &i\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ti++\n\n\t\t}\n\t}\n\n\tc.JSON(http.StatusOK, res)\n\n}", "func addNewVideosToList(playlistItem *youtube.PlaylistItem, knownVideos *tomlKnownVideos) bool {\n\tfoundNewVideos := false\n\t// Thanks to https://github.com/go-shadow/moment/blob/master/moment.go for the format that must be used\n\t// https://golang.org/src/time/format.go?s=37668:37714#L735\n\tvidPublishTime, err := time.Parse(\"2006-01-02T15:04:05Z0700\",playlistItem.ContentDetails.VideoPublishedAt)\n\tcheck(err)\n\tvidDuration, err := time.ParseDuration(\"0ms\")\t\t// TODO put actual number here if they ever make this data available https://issuetracker.google.com/issues/35170788\n\tcheck(err)\n\n\t// See if the video key we loaded from Youtube's API is already known to us\n\t_, exists := knownVideos.Videos[playlistItem.Snippet.ResourceId.VideoId]\n\t// Save video information into knownVideos only if it does not exist\n\t// (if it exists, we would overwrite the duration with 0)\n\tif !exists {\n\t\tfoundNewVideos = true\n\t\tknownVideos.Videos[playlistItem.Snippet.ResourceId.VideoId] =\n\t\t\tvideoMeta{\n\t\t\t\tVideoId:playlistItem.Snippet.ResourceId.VideoId,\n\t\t\t\tTitle:playlistItem.Snippet.Title,\n\t\t\t\tPublished:vidPublishTime,\n\t\t\t\tDuration:vidDuration,\n\t\t\t\tVideoType:determineVideoTypeBasedOnTitle(playlistItem.Snippet.Title),\n\t\t\t}\n\t}\n\treturn foundNewVideos\n}", "func (c *controller) FindAll() []entity.Video {\n\treturn c.service.FindAll()\n}", "func (s *Service) getLive(c context.Context, mid int64, ak, ip string, rand int, now time.Time) (sis []*show.Item) {\n\tconst (\n\t\t_halfCnt = 2\n\t)\n\tsis = make([]*show.Item, _cnt) // _cnt=4 [0,1,2,3]: 0 1 feed and hot, 2 3 moe and hot\n\tfeed, err := s.lv.Feed(c, mid, ak, ip, now)\n\tif err != nil {\n\t\tlog.Error(\"s.live.Feed(%d) error(%d)\", mid, err)\n\t}\n\tvar have int\n\t// get two feed\n\tif feed != nil {\n\t\tfor i := 0; i < _halfCnt && i < len(feed.Lives); i++ {\n\t\t\tsi := &show.Item{}\n\t\t\tsi.FromLive(feed.Lives[i])\n\t\t\tsis[i] = si\n\t\t\thave++\n\t\t}\n\t}\n\t// get two moe\n\tfdCnt := have\n\tstart := _halfCnt * rand\n\tif len(s.liveMoeCache) < start+_halfCnt {\n\t\tstart = 0\n\t}\n\tindex := _halfCnt\nMOENEXT:\n\tfor _, l := range s.liveMoeCache[start:] {\n\t\tfor i := 0; i < fdCnt; i++ {\n\t\t\tif sis[i].Param == l.Param {\n\t\t\t\tcontinue MOENEXT\n\t\t\t}\n\t\t}\n\t\tsis[index] = l\n\t\tindex++\n\t\thave++\n\t\tif index >= _cnt {\n\t\t\tbreak\n\t\t}\n\t}\n\t// if feed and moe not enough, get hot\n\tyu := _cnt - have\n\tif yu > 0 {\n\t\tstart := yu * rand\n\t\tif len(s.liveHotCache) < start+yu {\n\t\t\tstart = 0\n\t\t}\n\t\tvar nilI int\n\tHOTNEXT:\n\t\tfor _, l := range s.liveHotCache[start:] {\n\t\t\tnilI = -1\n\t\t\tfor i := len(sis) - 1; i >= 0; i-- {\n\t\t\t\tif sis[i] == nil {\n\t\t\t\t\tnilI = i\n\t\t\t\t} else if sis[i].Param == l.Param {\n\t\t\t\t\tcontinue HOTNEXT\n\t\t\t\t}\n\t\t\t}\n\t\t\tif nilI != -1 {\n\t\t\t\tsis[nilI] = l\n\t\t\t\thave++\n\t\t\t} else {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tif have < _cnt {\n\t\tfor k, v := range sis {\n\t\t\tif v == nil {\n\t\t\t\tsis[k] = _emptyItem\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func Video(props *VideoProps, children ...Element) *VideoElem {\n\trProps := &_VideoProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &VideoElem{\n\t\tElement: createElement(\"video\", rProps, children...),\n\t}\n}", "func (client *Client) GetVideoList(request *GetVideoListRequest) (_result *GetVideoListResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetVideoListResponse{}\n\t_body, _err := client.GetVideoListWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func URLbyID(id string) string { return \"https://www.youtube.com/watch?v=\" + id }", "func (uuo *UserUpdateOne) ClearVideos() *UserUpdateOne {\n\tuuo.mutation.ClearVideos()\n\treturn uuo\n}", "func (uu *UserUpdate) RemoveVideos(v ...*Video) *UserUpdate {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uu.RemoveVideoIDs(ids...)\n}", "func (a PromptsApi) GetVideoEmailPrompts() ([]VideoEmailPrompt, *APIResponse, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/prompt/\"\n\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(BBOAuth2)' required\n\t// oauth required\n\tif a.Configuration.AccessToken != \"\"{\n\t\theaderParams[\"Authorization\"] = \"Bearer \" + a.Configuration.AccessToken\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/x-www-form-urlencoded\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload = new([]VideoEmailPrompt)\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn *successPayload, NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\treturn *successPayload, NewAPIResponse(httpResponse.RawResponse), err\n}", "func (s *StickerSet) GetVideos() (value bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Flags.Has(6)\n}", "func (s *Service) treatDiffV(diff *ugcmdl.VideoDiff) (err error) {\n\tvar (\n\t\tnewPages []*arcmdl.Page\n\t\tpage *arcmdl.Page\n\t\taid = diff.Aid\n\t\ttx *sql.Tx\n\t)\n\t// all the operations about this archive's videos, will be in one transaction\n\tif tx, err = s.dao.BeginTran(ctx); err != nil {\n\t\tlog.Error(\"BeginTran Error %v\", err)\n\t\treturn\n\t}\n\t// add new videos\n\tif len(diff.New) > 0 {\n\t\tfor _, v := range diff.New {\n\t\t\tif page, err = s.pagePick(ctx, v, aid, \"\"); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnewPages = append(newPages, page)\n\t\t}\n\t\tif err = s.dao.TxAddVideos(tx, newPages, aid); err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\t}\n\tif len(diff.Removed) > 0 {\n\t\tfor _, v := range diff.Removed {\n\t\t\tif err = s.dao.TxDelVideo(tx, v); err != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tif len(diff.Updated) > 0 {\n\t\tfor _, v := range diff.Updated {\n\t\t\tif err = s.dao.TxUpdateVideo(tx, v); err != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\ttx.Commit()\n\treturn\n}", "func listHandler(w http.ResponseWriter, r *http.Request) *appError {\n\tvideos, err := bittube.DB.ListVideos()\n\tif err != nil {\n\t\treturn appErrorf(err, \"could not list videos: %v\", err)\n\t}\n\n\treturn listTmpl.Execute(w, r, videos)\n}", "func InsertVideos(videos []Video) error {\n\tids := []string{}\n\tvideosConvert := []interface{}{}\n\tfor _, video := range videos {\n\t\tvideosConvert = append(videosConvert, video)\n\t\tids = append(ids, video.VideoID)\n\t}\n\treturn DB.InsertIntoElastisearch(CONSTANT.VideosIndex, videosConvert, ids)\n}", "func (od *OnDemand) extractLinksFromLecture(videoID string) (ResourceGroup, error) {\n\tcontent, err := od.extractMediaAndSubtitles(videoID)\n\tif err != nil {\n\t\tlog.Panicf(\"Could not download videos\")\n\t\treturn nil, err\n\t}\n\treturn content, nil\n}", "func (client *Client) GetVideoInfosWithOptions(request *GetVideoInfosRequest, runtime *util.RuntimeOptions) (_result *GetVideoInfosResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.VideoIds)) {\n\t\tquery[\"VideoIds\"] = request.VideoIds\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetVideoInfos\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetVideoInfosResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (upuo *UnsavedPostUpdateOne) AddVideos(u ...*UnsavedPostVideo) *UnsavedPostUpdateOne {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upuo.AddVideoIDs(ids...)\n}", "func getmovieData(url string) {\n\t// Make HTTP GET request\n\tresponse, err := http.Get(\"https://www.imdb.com/\" + url)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Create a goquery document from the HTTP response\n\tdocument, err := goquery.NewDocumentFromReader(response.Body)\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading HTTP response body. \", err)\n\t}\n\n\t// Movie Data\n\n\t// Movie Name\n\tmovieTitle, _ := document.Find(\"#star-rating-widget\").Attr(\"data-title\")\n\t// Movie Year\n\tmovieYear := document.Find(\"#titleYear a\").Text()\n\t// IMDB Rating\n\tmovieIMDBRating := document.Find(\".imdbRating .ratingValue strong span\").Text()\n\t// Movie Summary\n\tmovieSummary := strings.TrimSpace(document.Find(\".plot_summary .summary_text\").Text())\n\t// Movie Time\n\tmovieDuration := strings.TrimSpace(document.Find(\".title_wrapper .subtext time\").Text())\n\t// Movie Genres\n\tmovieInfo := strings.Split(document.Find(\".title_wrapper .subtext\").Text(), \"|\")\n\tmovieGenres := strings.Split(movieInfo[2], \",\")\n\tfor i, s := range movieGenres {\n\t\tmovieGenres[i] = strings.TrimSpace(s)\n\t}\n\n\t// Save each movie data\n\tmovieData := movies{movieTitle, movieYear, movieIMDBRating, movieSummary, movieDuration, strings.Join(movieGenres, \", \")}\n\tmovielist = append(movielist, movieData)\n}", "func (e *extractor) Extract(url string, _ types.Options) ([]*types.Data, error) {\n\tvar err error\n\tmatches := utils.MatchOneOf(url, `https?://time.geekbang.org/course/detail/(\\d+)-(\\d+)`)\n\tif matches == nil || len(matches) < 3 {\n\t\treturn nil, types.ErrURLParseFailed\n\t}\n\n\t// Get video information\n\theanders := map[string]string{\"Origin\": \"https://time.geekbang.org\", \"Content-Type\": \"application/json\", \"Referer\": url}\n\tparams := strings.NewReader(fmt.Sprintf(`{\"id\": %q}`, matches[2]))\n\tres, err := request.Request(http.MethodPost, \"https://time.geekbang.org/serv/v1/article\", params, heanders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close() // nolint\n\n\tvar data geekData\n\tif err = json.NewDecoder(res.Body).Decode(&data); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif data.Code < 0 {\n\t\treturn nil, errors.New(string(data.Error))\n\t}\n\n\tif data.Data.VideoID == \"\" && !data.Data.ColumnHadSub {\n\t\treturn nil, errors.New(\"请先购买课程,或使用Cookie登录。\")\n\t}\n\n\t// Get video license token information\n\tparams = strings.NewReader(\"{\\\"source_type\\\":1,\\\"aid\\\":\" + string(matches[2]) + \",\\\"video_id\\\":\\\"\" + string(data.Data.VideoID) + \"\\\"}\")\n\tres, err = request.Request(http.MethodPost, \"https://time.geekbang.org/serv/v3/source_auth/video_play_auth\", params, heanders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close() // nolint\n\n\tvar playAuth videoPlayAuth\n\tif err = json.NewDecoder(res.Body).Decode(&playAuth); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif playAuth.Code < 0 {\n\t\treturn nil, errors.New(string(playAuth.Error))\n\t}\n\n\t// Get video playback information\n\theanders = map[string]string{\"Accept-Encoding\": \"\"}\n\tres, err = request.Request(http.MethodGet, \"http://ali.mantv.top/play/info?playAuth=\"+playAuth.Data.PlayAuth, nil, heanders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close() // nolint\n\n\tvar playInfo playInfo\n\tif err = json.NewDecoder(res.Body).Decode(&playInfo); err != nil {\n\t\treturn nil, err\n\t}\n\n\ttitle := data.Data.Title\n\n\tstreams := make(map[string]*types.Stream, len(playInfo.PlayInfoList.PlayInfo))\n\n\tfor _, media := range playInfo.PlayInfoList.PlayInfo {\n\t\tm3u8URLs, err := geekM3u8(media.URL)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\turls := make([]*types.Part, len(m3u8URLs))\n\t\tfor index, u := range m3u8URLs {\n\t\t\turls[index] = &types.Part{\n\t\t\t\tURL: u.URL,\n\t\t\t\tSize: u.Size,\n\t\t\t\tExt: \"ts\",\n\t\t\t}\n\t\t}\n\n\t\tstreams[media.Definition] = &types.Stream{\n\t\t\tParts: urls,\n\t\t\tSize: media.Size,\n\t\t}\n\t}\n\n\treturn []*types.Data{\n\t\t{\n\t\t\tSite: \"极客时间 geekbang.org\",\n\t\t\tTitle: title,\n\t\t\tType: types.DataTypeVideo,\n\t\t\tStreams: streams,\n\t\t\tURL: url,\n\t\t},\n\t}, nil\n}", "func GetTeamsByVID(v int64) ([]TeamID, error) {\n\tvar teams []TeamID\n\n\trow, err := db.Query(\"SELECT teamID FROM team WHERE vteam = ?\", v)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn teams, err\n\t}\n\tdefer row.Close()\n\n\tfor row.Next() {\n\t\tvar teamID TeamID\n\t\terr = row.Scan(&teamID)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tteams = append(teams, teamID)\n\t}\n\treturn teams, nil\n}", "func (d *Dao) SelMidFromVideo() (mids []int64, err error) {\n\trows, err := d.db.Query(context.Background(), _selMidFromVideo)\n\tif err != nil {\n\t\tlog.Error(\"SelMidFromVideo failed, err(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar s string\n\t\tif err = rows.Scan(&s); err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tvar mid int64\n\t\tif mid, err = strconv.ParseInt(s, 10, 64); err != nil {\n\t\t\tlog.Error(\"strconv.ParseInt(%s) error(%v)\", s, err)\n\t\t\treturn\n\t\t}\n\t\tmids = append(mids, mid)\n\t}\n\treturn\n}", "func (s *PlaylistLoader) CreateURLsFromYoutube(ctx context.Context, db nest.Querier, playlistID string) error {\n\tvideos, err := s.youtubeClient.GetVideosFromPlaylist(ctx, playlistID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := range videos {\n\t\tyoutubeID := videos[i].ID\n\t\tif _, err := s.getOrCreateYoutubeVideo(ctx, db, youtubeID); err != nil {\n\t\t\t// TODO: log err, don't return\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (upu *UnsavedPostUpdate) AddVideos(u ...*UnsavedPostVideo) *UnsavedPostUpdate {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upu.AddVideoIDs(ids...)\n}", "func (tag Tag) Movies(conn Connection) []Movie {\n\tvar movies []Movie\n\tfor _, id := range tag.MovieIds {\n\t\tmovie, err := newMovie(id, conn)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to get movie %v: %s\", id, err)\n\t\t}\n\t\tmovies = append(movies, *movie)\n\t}\n\treturn movies\n}", "func (video *FakeVideo) GetVideo(userID string, id int) (err error) {\n\tjsonFile, err := os.Open(\"testdata/fake_videos.json\")\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer jsonFile.Close()\n\n\tjsonData, err := ioutil.ReadAll(jsonFile)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar fakeVideos []FakeVideo\n\tjson.Unmarshal(jsonData, &fakeVideos)\n\n\tfor _, fakeVideo := range fakeVideos {\n\t\tif fakeVideo.ID == id && fakeVideo.CreatedBy == userID {\n\n\t\t\tvideo.ID = fakeVideo.ID\n\t\t\tvideo.Name = fakeVideo.Name\n\t\t\tvideo.URL = fakeVideo.URL\n\t\t\tvideo.YoutubeVideoID = fakeVideo.YoutubeVideoID\n\n\t\t\treturn\n\t\t}\n\t}\n\n\terr = errors.New(\"no corresponding video found\")\n\n\treturn\n}", "func MovieList(w http.ResponseWriter, r *http.Request) {\n\n\tvar results []*Movie\n\n\tfilter := bson.D{{}}\n\toptions := options.Find()\n\n\tcur, err := collection.Find(context.TODO(), filter, options)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor cur.Next(context.TODO()) {\n\t\tvar elem Movie\n\t\terr := cur.Decode(&elem)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(elem)\n\t\tresults = append(results, &elem)\n\t}\n\n\tif err := cur.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcur.Close(context.TODO())\n\n\tfmt.Printf(\"Se encontraron documentos %+v\\n\", results)\n\n}", "func SortVideoQualities(videos []AvailableVideo) {\n\tsort.Sort(sortableVideoQualities(videos))\n}", "func (d *Dao) ListVideoArchive(ctx context.Context, avids []int64) (videos []*model.UpCardVideo, err error) {\n\n\tarchives, err := d.listArchives(ctx, avids)\n\tif err != nil {\n\t\tlog.Error(\"d.listArchives error(%v) arg(%v)\", err, avids)\n\t\terr = ecode.CreativeArcServiceErr\n\t\treturn\n\t}\n\tfor avid, data := range archives {\n\t\tvideo := transfer(avid, data)\n\t\tvideos = append(videos, video)\n\t}\n\n\treturn\n}", "func processYoutubeResponses(result string) []messageQueryBody {\n\n\tsubsl := \"<a id=\\\"video-title\\\"\"\n\tsubsl2 := \"href=\\\"\"\n\tsubsl3 := \"</a>\"\n\tlensubsl3 := len(subsl3)\n\tsubsl4 := \"<yt-formatted-string id=\\\"description-text\\\" class=\\\"style-scope ytd-video-renderer\\\">\"\n\tlensubsl4 := len(subsl4)\n\tsubsl5 := \"</yt-formatted-string>\"\n\tlensubsl5 := len(subsl5)\n\n\tvar queryResult messageQueryBody\n\tvar queryResultArray []messageQueryBody\n\tvar mid int\n\n\tfor i := 0; i < len(result) - len(subsl); i++ {\n\t\tmess := \"\"\n\t\tif result[i : i + len(subsl)] == subsl {\n\t\t\tlength := i + len(subsl)\n\t\t\tvar last int\n\t\t\tfor j:=1; ; j++ {\n\t\t\t\tif result[length + j: length + j + len(subsl2)] == subsl2 {\n\t\t\t\t\tmid = length + j + len(subsl2)\n\t\t\t\t\tfor k := 1; ; k++ {\n\t\t\t\t\t\tif result[mid + k: mid + k + 1] == \"\\\"\" {\n\t\t\t\t\t\t\tlink := result[mid: mid + k]\n\t\t\t\t\t\t\tflink := \"https://www.youtube.com\" + link\n\t\t\t\t\t\t\tqueryResult.Link = flink\n\t\t\t\t\t\t\tlast = mid + k + 1\n\t\t\t\t\t\t\tfor l := 1; ; l++ {\n\t\t\t\t\t\t\t\tif result[last + l: last+ l +2] == \"\\\">\" {\n\t\t\t\t\t\t\t\t\tlast = last + l +2\n\t\t\t\t\t\t\t\t\ti = last + l + 2\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfound := false\n\t\t\tfor j:= 1; ; j++ {\n\t\t\t\tif result[last + j: last + j + lensubsl3] == subsl3 { // matched found for \"</a>\"\n\t\t\t\t\tmess = result[last: last + j]\n\t\t\t\t\ti = last + j + lensubsl3\n\t\t\t\t\tfound = true\n\t\t\t\t\tqueryResult.Head = mess\n\t\t\t\t\tfor k := 1; ; k++ {\n\t\t\t\t\t\tif result[i + k : i + k + lensubsl4] == subsl4 {\n\t\t\t\t\t\t\tlength = i + k + lensubsl4;\n\t\t\t\t\t\t\tfor l := 1; ; l++ {\n\t\t\t\t\t\t\t\tif result[length + l: length + l + lensubsl5] == subsl5 {\n\t\t\t\t\t\t\t\t\tdesc := result[length: length + l]\n\t\t\t\t\t\t\t\t\tqueryResult.Desc = desc;\n\t\t\t\t\t\t\t\t\ti = length + l +4;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif found {\n\t\t\t\t\tqueryResultArray = append(queryResultArray, queryResult)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn queryResultArray\n\n}", "func (uuo *UserUpdateOne) AddVideoIDs(ids ...uuid.UUID) *UserUpdateOne {\n\tuuo.mutation.AddVideoIDs(ids...)\n\treturn uuo\n}", "func (client *Client) DescribePlayTopVideosWithOptions(request *DescribePlayTopVideosRequest, runtime *util.RuntimeOptions) (_result *DescribePlayTopVideosResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.BizDate)) {\n\t\tquery[\"BizDate\"] = request.BizDate\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageNo)) {\n\t\tquery[\"PageNo\"] = request.PageNo\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageSize)) {\n\t\tquery[\"PageSize\"] = request.PageSize\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DescribePlayTopVideos\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DescribePlayTopVideosResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func printTable() {\n\trows, err := db.Query(\"SELECT id, VideoTitle, DownloadStatus, Activity, ErrorMsg, Timestamp FROM vlog\")\n\terrorHandler(err)\n\n\tvar id int\n\tvar VideoTitle, DownloadStatus, ErrorMsg, Activity, Timestamp string\n\n\tfor rows.Next() {\n\t\trows.Scan(&id, &VideoTitle, &DownloadStatus, &Activity, &ErrorMsg, &Timestamp)\n\t\tfmt.Println(strconv.Itoa(id) + \": \" + VideoTitle + \" \" + DownloadStatus + \" \" + Activity + \" \" + ErrorMsg + \" \" + Timestamp)\n\t}\n}", "func (s *GroupsService) GetVideo(gr string, vid int, opt ...CallOption) (*Video, *Response, error) {\n\tu := fmt.Sprintf(\"groups/%s/videos/%d\", gr, vid)\n\tvideo, resp, err := getVideo(s.client, u, opt...)\n\n\treturn video, resp, err\n}" ]
[ "0.69053125", "0.6542648", "0.6282211", "0.6119174", "0.6039335", "0.5990814", "0.5956337", "0.58259183", "0.5674542", "0.5660387", "0.5636056", "0.5566819", "0.55357826", "0.5523401", "0.55159956", "0.54962265", "0.54350865", "0.53841186", "0.5379191", "0.53260857", "0.5262091", "0.5256175", "0.5229621", "0.52138066", "0.5167738", "0.51585746", "0.5133277", "0.51235366", "0.5119785", "0.51025575", "0.5094733", "0.5076499", "0.5072452", "0.50678265", "0.5065414", "0.5050533", "0.5021127", "0.50196165", "0.4993538", "0.49874347", "0.49851978", "0.49808916", "0.49799687", "0.49688834", "0.4965883", "0.49628663", "0.49316517", "0.49142256", "0.48802707", "0.48793772", "0.48757648", "0.48749676", "0.4856478", "0.48551306", "0.48453316", "0.48423836", "0.4841064", "0.48214728", "0.4821299", "0.47854844", "0.47831634", "0.47821635", "0.4774786", "0.47715038", "0.4763715", "0.47609925", "0.47269633", "0.47150272", "0.4711221", "0.47081712", "0.46890217", "0.46787083", "0.46716845", "0.46694055", "0.46582547", "0.4650721", "0.4650108", "0.46473444", "0.4636879", "0.4633971", "0.4626281", "0.46248704", "0.46157813", "0.46153122", "0.4612629", "0.46104154", "0.46037546", "0.460361", "0.46030807", "0.45941347", "0.45904136", "0.45887446", "0.45834047", "0.4575959", "0.45639467", "0.45508742", "0.45507583", "0.4546316", "0.45453537", "0.45449045" ]
0.72057843
0
NewVideo get video info by filename.
func (d *Dao) NewVideo(c context.Context, filename string) (v *archive.Video, err error) { hash64 := int64(farm.Hash64([]byte(filename))) row := d.db.QueryRow(c, _newVideoByFnSQL, hash64, filename) v = &archive.Video{} var avrState, vState int16 if err = row.Scan(&v.ID, &v.Filename, &v.Cid, &v.Aid, &v.Title, &v.Desc, &v.SrcType, &v.Duration, &v.Filesize, &v.Resolutions, &v.Playurl, &v.FailCode, &v.Index, &v.Attribute, &v.XcodeState, &avrState, &vState, &v.CTime, &v.MTime); err != nil { if err == sql.ErrNoRows { v = nil err = nil } else { log.Error("row.Scan error(%v)", err) } return } // 2 state map to 1 if avrState == archive.VideoStatusDelete { v.Status = archive.VideoStatusDelete } else { v.Status = vState } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetVideo(router *gin.RouterGroup) {\n\trouter.GET(\"/videos/:hash/:token/:type\", func(c *gin.Context) {\n\t\tif InvalidPreviewToken(c) {\n\t\t\tc.Data(http.StatusForbidden, \"image/svg+xml\", brokenIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tfileHash := c.Param(\"hash\")\n\t\ttypeName := c.Param(\"type\")\n\n\t\t_, ok := video.Types[typeName]\n\n\t\tif !ok {\n\t\t\tlog.Errorf(\"video: invalid type %s\", txt.Quote(typeName))\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tf, err := query.FileByHash(fileHash)\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"video: %s\", err.Error())\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tif !f.FileVideo {\n\t\t\tf, err = query.VideoByPhotoUID(f.PhotoUID)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"video: %s\", err.Error())\n\t\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif f.FileError != \"\" {\n\t\t\tlog.Errorf(\"video: file error %s\", f.FileError)\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tfileName := photoprism.FileName(f.FileRoot, f.FileName)\n\n\t\tif !fs.FileExists(fileName) {\n\t\t\tlog.Errorf(\"video: file %s is missing\", txt.Quote(f.FileName))\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\n\t\t\t// Set missing flag so that the file doesn't show up in search results anymore.\n\t\t\tlogError(\"video\", f.Update(\"FileMissing\", true))\n\n\t\t\treturn\n\t\t}\n\n\t\tif c.Query(\"download\") != \"\" {\n\t\t\tc.FileAttachment(fileName, f.ShareFileName())\n\t\t} else {\n\t\t\tc.File(fileName)\n\t\t}\n\n\t\treturn\n\t})\n}", "func NewVideo(title, fileName string, id int64, createdBy *Profile) *Video {\n\tv := &Video{\n\t\tTitle: title,\n\t\tFileName: fileName,\n\t\tID: id,\n\t\tCreated: time.Now(),\n\t\tCreatedByID: createdBy.ID,\n\t}\n\n\treturn v\n}", "func GetVideoInfo(path string) (info *VideoInfo, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = errors.Wrap(err, \"get video info\")\n\t\t}\n\t}()\n\n\t// Make sure file exists so we can give a clean error\n\t// message in this case, instead of depending on ffmpeg.\n\tif _, err := os.Stat(path); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlines, err := infoOutputLines(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar foundFPS, foundSize bool\n\tresult := &VideoInfo{}\n\n\tfpsExp := regexp.MustCompilePOSIX(\" ([0-9\\\\.]*) fps,\")\n\tsizeExp := regexp.MustCompilePOSIX(\" ([0-9]+)x([0-9]+)(,| )\")\n\tfor _, line := range lines {\n\t\tif !strings.Contains(line, \"Video:\") {\n\t\t\tcontinue\n\t\t}\n\t\tif match := fpsExp.FindStringSubmatch(line); match != nil {\n\t\t\tfoundFPS = true\n\t\t\tfps, err := strconv.ParseFloat(match[1], 0)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"parse FPS\")\n\t\t\t}\n\t\t\tresult.FPS = fps\n\t\t}\n\t\tif match := sizeExp.FindStringSubmatch(line); match != nil {\n\t\t\tfoundSize = true\n\t\t\tvar size [2]int\n\t\t\tfor i, s := range match[1:3] {\n\t\t\t\tn, err := strconv.Atoi(s)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"parse dimensions\")\n\t\t\t\t}\n\t\t\t\tsize[i] = n\n\t\t\t}\n\t\t\tresult.Width = size[0]\n\t\t\tresult.Height = size[1]\n\t\t}\n\t}\n\n\tif !foundFPS {\n\t\treturn nil, errors.New(\"could not find fps in output\")\n\t}\n\tif !foundSize {\n\t\treturn nil, errors.New(\"could not find dimensions in output\")\n\t}\n\treturn result, nil\n}", "func videoPath(filename string) string {\n\treturn fmt.Sprintf(\"content/video/%s\", filename)\n}", "func ParseVideo(path string) (*Video, error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinfo, err := f.Stat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsize := info.Size()\n\ttimestamp := info.ModTime()\n\tmodified := timestamp.Format(\"2006-01-02 03:04 PM\")\n\tname := info.Name()\n\t// ID is name without extension\n\tidx := strings.LastIndex(name, \".\")\n\tif idx == -1 {\n\t\tidx = len(name)\n\t}\n\tid := name[:idx]\n\tm, err := tag.ReadFrom(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttitle := m.Title()\n\t// Default title is filename\n\tif title == \"\" {\n\t\ttitle = name\n\t}\n\tv := &Video{\n\t\tID: id,\n\t\tTitle: title,\n\t\tAlbum: m.Album(),\n\t\tDescription: m.Comment(),\n\t\tModified: modified,\n\t\tSize: size,\n\t\tTimestamp: timestamp,\n\t}\n\t// Add thumbnail (if exists)\n\tp := m.Picture()\n\tif p != nil {\n\t\tv.Thumb = p.Data\n\t\tv.ThumbType = p.MIMEType\n\t}\n\treturn v, nil\n}", "func videoFileFullName(videoId string) string {\n\tdirStoreVideo := GetConfVal(\"dirStoreVideo\")\n\tvideoFileName := dirStoreVideo + videoId + \".mp4\"\n\treturn videoFileName\n}", "func NewVideo(logger *logger.Logger, path string) *Video {\n\tv := &Video{\n\t\tl: logger,\n\t\tpath: path,\n\t}\n\treturn v\n}", "func (video *FakeVideo) GetVideo(userID string, id int) (err error) {\n\tjsonFile, err := os.Open(\"testdata/fake_videos.json\")\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer jsonFile.Close()\n\n\tjsonData, err := ioutil.ReadAll(jsonFile)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar fakeVideos []FakeVideo\n\tjson.Unmarshal(jsonData, &fakeVideos)\n\n\tfor _, fakeVideo := range fakeVideos {\n\t\tif fakeVideo.ID == id && fakeVideo.CreatedBy == userID {\n\n\t\t\tvideo.ID = fakeVideo.ID\n\t\t\tvideo.Name = fakeVideo.Name\n\t\t\tvideo.URL = fakeVideo.URL\n\t\t\tvideo.YoutubeVideoID = fakeVideo.YoutubeVideoID\n\n\t\t\treturn\n\t\t}\n\t}\n\n\terr = errors.New(\"no corresponding video found\")\n\n\treturn\n}", "func (client *Client) GetVideoInfo(request *GetVideoInfoRequest) (_result *GetVideoInfoResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetVideoInfoResponse{}\n\t_body, _err := client.GetVideoInfoWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (repository *MockVideoRepository) GetVideoDetails(videoID string) (Video, error) {\n\tfor _, v := range repository.videos {\n\t\tif v.ID == videoID {\n\t\t\treturn v, repository.errorToReturn\n\t\t}\n\t}\n\treturn Video{}, errors.New(\"Invalid video requested. ID=\" + videoID)\n}", "func (img *Image) RetrieveVideo(buf *bytes.Buffer) {\n\tfname := strings.Join([]string{img.Handle, \"webm\"}, \".\")\n\tfname = Repository.dataPath(img.Source, fname)\n\tif b, err := ioutil.ReadFile(fname); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tif n, err := buf.Write(b); err != nil {\n\t\t\tpanic(err)\n\t\t} else if n != len(b) {\n\t\t\tpanic(\"partial write to memory buffer\")\n\t\t}\n\t}\n}", "func getFileName(url string, videoType string) string{\n\n\tfilename := url[:strings.Index(url, videoType)]\n\tfilename = filepath.Base(filename)\n\tfilename = filename + \".mp4\"\n\treturn filename\n\n}", "func (v *videoService) GetById(ctx context.Context, req *pbVideo.GetVideoRequest, res *pbVideo.GetVideoResponse) error {\n\tif req.Id == \"\" {\n\t\treturn errors.MissingVideoId\n\t}\n\n\tvideo, err := v.videoRepository.FindById(req.Id)\n\tif err != nil {\n\t\tlog.Info().Str(\"video\", req.Id).Msg(\"unable to find video\")\n\t\treturn errors.VideoNotFound\n\t}\n\n\terrorCount := len(video.Transcode.Errors)\n\ttrError := false\n\n\tif errorCount >= 1 {\n\t\ttrError = true\n\t} else {\n\t\ttrError = false\n\t}\n\tres.SignedUrl, err = v.s3Bucket.GetSignedResourceURL(video.Storage.OutputKey)\n\tif err != nil {\n\t\tlog.Warn().Err(err).Str(\"video\", req.Id).Msg(\"unable to fetch signed url for video\")\n\t}\n\n\t// count the view\n\terr = v.videoRepository.IncrementViews(video.ID)\n\tif err != nil {\n\t log.Warn().Err(err).Str(\"video\", video.ID.Hex()).Msg(\"unable to increment view counter\")\n\t}\n\t// TODO: publish video.events.view\n\n\tres.Video = &pbVideo.VideoDetails{\n\t\tId: video.ID.Hex(),\n\t\tTitle: video.Title,\n\t\tDescription: video.Description,\n\t\tTags: video.Tags,\n\t\tStorage: &pbVideo.VideoStorage{\n\t\t\tRawKey: video.Storage.RawKey,\n\t\t\tTranscodedKey: video.Storage.OutputKey,\n\t\t},\n\t\tStatistics: &pbVideo.VideoStatistics{\n\t\t\tViewCount: video.Statistics.ViewCount,\n\t\t},\n\t\tStatus: &pbVideo.VideoStatus{\n\t\t\tCompleted: video.Transcode.Completed,\n\t\t\tError: trError,\n\t\t\tErrorMessages: video.Transcode.Errors,\n\t\t},\n\t}\n\n\treturn nil\n}", "func (d *Dao) VideoByCid(c context.Context, cid int64, ip string) (v *archive.Video, err error) {\n\tparams := url.Values{}\n\tparams.Set(\"cid\", strconv.FormatInt(cid, 10))\n\tvar res struct {\n\t\tCode int `json:\"code\"`\n\t\tData *archive.Video `json:\"data\"`\n\t}\n\tif err = d.client.Get(c, d.video, ip, params, &res); err != nil {\n\t\tlog.Error(\"VideoByCid cidURI(%s) error(%v)\", d.video+\"?\"+params.Encode(), err)\n\t\treturn\n\t}\n\tif res.Code != 0 {\n\t\terr = ecode.Int(res.Code)\n\t\tlog.Error(\"VideoByCid cidURI(%s) Code=(%d)\", d.video+\"?\"+params.Encode(), res.Code)\n\t\treturn\n\t}\n\tv = res.Data\n\treturn\n}", "func (ivr InMemoryVideoRepository) Retrieve(id string) (*Video, error) {\n\tv, ok := ivr.storage[id]\n\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no video with id %s in storage\", id)\n\t}\n\n\treturn v, nil\n}", "func (config VideoConfig) name() string {\n\treturn \"video\"\n}", "func GetVidFromFile(path string) (io.ReadCloser, error) {\n\treturn ic.GetFileByPath(path)\n}", "func (a *ApiV2) GetVideo(id string) (video VideoV2, err error) {\n\tvar resp VideoResp\n\tif !common.ValidUUID(id) {\n\t\treturn video, common.NewError(\"video id '%s' is invalid\", id)\n\t}\n\tuuid := common.ConvertToUUIDFormat(id)\n\turl := a.getBaseUrl() + \"/videos/\" + uuid\n\treq, err := a.makeRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn video, err\n\t}\n\terr = handleReq(a, req, &resp)\n\tif err != nil {\n\t\treturn video, err\n\t}\n\tvideo = resp.Video\n\ta.SetApi(&video)\n\treturn video, nil\n}", "func (*NewVideo) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{13}\n}", "func videoFromForm(r *http.Request) (*bittube.Video, error) {\n\tvideoURL, err := uploadFileFromForm(r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not upload file: %v\", err)\n\t}\n\tif videoURL == \"\" {\n\t\tvideoURL = r.FormValue(\"videoURL\")\n\t}\n\n\tvideo := &bittube.Video{\n\t\tTitle: r.FormValue(\"title\"),\n\t\tAuthor: r.FormValue(\"author\"),\n\t\tPublishedDate: r.FormValue(\"publishedDate\"),\n\t\tVideoURL: videoURL,\n\t\tDescription: r.FormValue(\"description\"),\n\t\tCreatedBy: r.FormValue(\"createbittube.DBy\"),\n\t\tCreatedByID: r.FormValue(\"createbittube.DByID\"),\n\t}\n\n\t// If the form didn't carry the user information for the creator, populate it\n\t// from the currently logged in user (or mark as anonymous).\n\tif video.CreatedByID == \"\" {\n\t\tuser := profileFromSession(r)\n\t\tif user != nil {\n\t\t\t// Logged in.\n\t\t\tvideo.CreatedBy = user.DisplayName\n\t\t\tvideo.CreatedByID = user.ID\n\t\t} else {\n\t\t\t// Not logged in.\n\t\t\tvideo.SetCreatorAnonymous()\n\t\t}\n\t}\n\n\treturn video, nil\n}", "func GetFileInfo(Filename string) ([]Track, []Track, []Track, error) {\n\ttype Info struct {\n\t\tFileName string `json:\"file_name\"`\n\t\tTracks []struct {\n\t\t\tCodec string `json:\"codec\"`\n\t\t\tID int `json:\"id\"`\n\t\t\tProperties struct {\n\t\t\t\tLanguage string `json:\"language\"`\n\t\t\t}\n\t\t\tType string `json:\"type\"`\n\t\t} `json:\"tracks\"`\n\t}\n\tout, err := exec.Command(\"mkvmerge\", \"-F\", \"json\", \"-i\", Filename).Output()\n\tif err != nil {\n\t\tcolor.Red.Println(\"Error: Can't open the file\")\n\t\t//os.Exit(1) <-------\n\t}\n\tvar mkvinfo Info\n\terr = json.Unmarshal(out, &mkvinfo)\n\tif err != nil {\n\t\tcolor.Red.Println(\"Error: Can't extract information from the file\")\n\t\tos.Exit(1)\n\t}\n\n\tif len(mkvinfo.Tracks) == 0 {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\tif len(mkvinfo.Tracks) == 1 && mkvinfo.Tracks[0].Type == \"subtitles\" {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\tvar Videos []Track\n\tvar Audios []Track\n\tvar Audios2 []Track\n\tvar Subtitles []Track\n\tvar Subtitles2 []Track\n\tvar Tracktmp []Track\n\tfor k := range mkvinfo.Tracks {\n\t\tTracktmp = []Track{{\n\t\t\tID: mkvinfo.Tracks[k].ID,\n\t\t\tLang: mkvinfo.Tracks[k].Properties.Language,\n\t\t\tCodec: mkvinfo.Tracks[k].Codec,\n\t\t}}\n\n\t\tswitch mkvinfo.Tracks[k].Type {\n\t\tcase \"video\":\n\n\t\t\tVideos = append(Videos, Tracktmp[0])\n\t\tcase \"audio\":\n\t\t\tif mkvinfo.Tracks[k].Properties.Language == CFG.SortLang {\n\t\t\t\tAudios = append(Audios, Tracktmp[0])\n\t\t\t} else {\n\t\t\t\tAudios2 = append(Audios2, Tracktmp[0])\n\t\t\t}\n\n\t\tcase \"subtitles\":\n\t\t\tif mkvinfo.Tracks[k].Properties.Language == CFG.SortLang {\n\t\t\t\tSubtitles = append(Subtitles, Tracktmp[0])\n\t\t\t} else {\n\t\t\t\tSubtitles2 = append(Subtitles2, Tracktmp[0])\n\t\t\t}\n\t\t}\n\n\t}\n\tfor k := range Audios2 {\n\t\tAudios = append(Audios, Audios2[k])\n\t}\n\tfor k := range Subtitles2 {\n\t\tSubtitles = append(Subtitles, Subtitles2[k])\n\t}\n\tif CFG.MaxTracksAudio > 0 && len(Audios) >= CFG.MaxTracksAudio {\n\t\tAudios = Audios[:CFG.MaxTracksAudio]\n\t}\n\tif CFG.MaxTracksSub > 0 && len(Subtitles) >= CFG.MaxTracksSub {\n\t\tSubtitles = Subtitles[:CFG.MaxTracksSub]\n\t}\n\n\tif len(Videos) == 0 {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\treturn Videos, Audios, Subtitles, nil\n\n}", "func (t *Track) extractVideoCodec() {\n\tt.codec = \"avc1.\" + strings.ToUpper(hex.EncodeToString(t.extradata[1:2]) + hex.EncodeToString(t.extradata[2:3]) + hex.EncodeToString(t.extradata[3:4]))\n}", "func (vc VideoController) ViewVideo(w http.ResponseWriter, r *http.Request) {\n\tid, err := strconv.Atoi(mux.Vars(r)[\"id\"])\n\tif err != nil {\n\t\thttp.Error(w, \"Could not find video with id \"+mux.Vars(r)[\"id\"], http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvideo, err := videos.GetVideo(uint(id))\n\tif err != nil {\n\t\thttp.Error(w, \"Could not find video : \"+err.Error(), 500)\n\t}\n\n\tvideo.Views += 1\n\tstorage.DB.Save(&video)\n\n\tvar creator models.User\n\tstorage.DB.Find(&creator, video.UserID)\n\n\trender.Render(w, r, \"video\", map[string]interface{}{\n\t\t\"Video\": video,\n\t\t\"User\": creator,\n\t\t\"VideoUrl\": videos.GetVideoUrl(video),\n\t})\n}", "func serveVideoAction(w http.ResponseWriter, request *http.Request) {\nvar video VideoProxy\n\n\tvars := mux.Vars(request)\n\tfilename := config.basepath + vars[\"filename\"]\n\tlog.Println(\"GET \" + vars[\"filename\"])\n\tvideo.init(filename)\n\tdefer video.close()\n\thttp.ServeContent(w, request, filename, time.Now(),&video)\n}", "func (b *GroupsSetLongPollSettingsBuilder) VideoNew(v bool) *GroupsSetLongPollSettingsBuilder {\n\tb.Params[\"video_new\"] = v\n\treturn b\n}", "func (client Client) Video(parameters Parameters) (VideoResultContainer, error) {\n\tvar result videoResultWrapper\n\n\tif err := client.search(parameters.GetURI(SearchTypeVideo), &result); err != nil {\n\t\treturn VideoResultContainer{}, err\n\t}\n\n\treturn result.Data, nil\n}", "func ExtractVideoInformation(config VideoConfiguration) (VideoInformation, error) {\n\tfmt.Print(\"Extracting video information\")\n\t// Extract frames to configured dir\n\tframePaths, err := video.ExtractFrames(config.VideoPath(), config.FrameOutputDirectory())\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintProgressDot()\n\n\t// Predict intertitle frames\n\tpredictions, err := predictIntertitles(framePaths, config.PredictorPath())\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintProgressDot()\n\n\t// Smooth intertitle frames\n\tsmoothIntertitles(predictions, config.SmoothingClosingThreshold(), config.SmoothingOpeningThreshold())\n\tprintProgressDot()\n\n\t// Get some basic video info\n\tbasicInfo, err := video.GetBasicInformation(config.VideoPath())\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintProgressDot()\n\n\t// Extract intertitle timings\n\tinterRanges, err := intertitle.MapRanges(predictions, basicInfo.FPS, framePaths)\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintDone()\n\n\treturn VideoInformation{\n\t\tVideoFPS: basicInfo.FPS,\n\t\tVideoHeight: basicInfo.Height,\n\t\tVideoWidth: basicInfo.Width,\n\t\tIntertitleRanges: interRanges,\n\t}, nil\n}", "func getVideoCut(saveFile string, videofps float64, newFile string, cutTime int) {\r\n\tstreamVideo, err := gocv.VideoCaptureFile(saveFile)\r\n\tif err != nil {\r\n\t\tfmt.Printf(\"Error opening video capture device: %v\\n\", saveFile)\r\n\t\treturn\r\n\t}\r\n\tdefer streamVideo.Close()\r\n\r\n\timg := gocv.NewMat()\r\n\tdefer img.Close()\r\n\r\n\tif ok := streamVideo.Read(&img); !ok {\r\n\t\tfmt.Printf(\"Cannot read device %v\\n\", saveFile)\r\n\t\treturn\r\n\t}\r\n\r\n\t//Video codecs .mp4 \"MP4V\" | .avi \"MJPG\" | .flv \"FLV1\"\r\n\twriter, err := gocv.VideoWriterFile(\"./live/\"+newFile+\".mp4\", \"MP4V\", videofps, img.Cols(), img.Rows(), true)\r\n\tif err != nil {\r\n\t\tfmt.Printf(\"error opening video writer device: %v\\n\", saveFile)\r\n\t\treturn\r\n\t}\r\n\tdefer writer.Close()\r\n\r\n\ttimeStart := time.Now()\r\n\tfmt.Println((cutTime / 1000 * int(videofps)))\r\n\tfor i := 0; i < (cutTime / 1000 * int(videofps)); i++ {\r\n\t\tif ok := streamVideo.Read(&img); !ok {\r\n\t\t\tfmt.Printf(\"Device closed: %v\\n\", saveFile)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tif img.Empty() {\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\twriter.Write(img)\r\n\t\tfmt.Println(time.Since(timeStart).Milliseconds())\r\n\t}\r\n}", "func (client *Client) GetVideoInfoWithOptions(request *GetVideoInfoRequest, runtime *util.RuntimeOptions) (_result *GetVideoInfoResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.VideoId)) {\n\t\tquery[\"VideoId\"] = request.VideoId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetVideoInfo\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetVideoInfoResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func DownloadVideo(video *Video) {\n\tdefer wg.Done()\n\tif video.VideoUrl == \"\" {\n\t\treturn\n\t}\n\t// $cmd = sprintf(\"ffmpeg -i \\\"%s\\\" -c copy \\\"%s/%s.mp4\\\"\", $param['video'], $dir, $val['title']);\n\t// cmd := fmt.Sprintf(\"ffmpeg -i \\\"%s\\\" -c copy \\\"%s/%s.mp4\\\"\",\n\t// \tvideo.VideoUrl, VConf.Main.DownloadDir, video.Title)\n\t// log.Println(cmd)\n\tcmd := exec.Command(\"ffmpeg\", \"-i\", `\"`+video.VideoUrl+`\"`,\n\t\t\"-c copy\", fmt.Sprintf(`\"%s/%s.mp4\"`, VConf.Main.DownloadDir, video.Title))\n\tlog.Println(cmd.Path, cmd.Args)\n\terr := cmd.Start()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n}", "func newMovie(id int, conn Connection) (*Movie, error) {\n\turl := fmt.Sprintf(\"%s/api/v3/movie/%v?APIKey=%s\", conn.Authority, id, conn.APIKey)\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tres.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar movie Movie\n\tjson.Unmarshal(body, &movie)\n\treturn &movie, nil\n}", "func (g *Guessit) Guess(file polochon.File, movieConf polochon.MovieConfig, showConf polochon.ShowConfig, log *logrus.Entry) (polochon.Video, error) {\n\tfilename := filepath.Base(file.Path)\n\tguess, err := g.client.Guess(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Format the title\n\tguess.Title = toUpperCaseFirst(guess.Title)\n\n\tvar video polochon.Video\n\n\tswitch guess.Type {\n\tcase \"movie\":\n\t\tvideo = &polochon.Movie{\n\t\t\tMovieConfig: movieConf,\n\t\t\tTitle: guess.Title,\n\t\t\tYear: guess.Year,\n\t\t}\n\tcase \"episode\":\n\t\tshow := polochon.NewShow(showConf)\n\t\tshow.Year = guess.Year\n\t\tshow.Title = guess.Title\n\t\tvideo = &polochon.ShowEpisode{\n\t\t\tShowConfig: showConf,\n\t\t\tShow: show,\n\t\t\tShowTitle: guess.Title,\n\t\t\tEpisode: guess.Episode,\n\t\t\tSeason: guess.Season,\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"guessit: invalid guess type: %s\", guess.Type)\n\t}\n\n\tvideo.SetFile(file)\n\tvideo.SetMetadata(&polochon.VideoMetadata{\n\t\tQuality: polochon.Quality(guess.Quality),\n\t\tReleaseGroup: guess.ReleaseGroup,\n\t\tAudioCodec: guess.AudioCodec,\n\t\tVideoCodec: guess.VideoCodec,\n\t\tContainer: guess.Container,\n\t})\n\n\treturn video, nil\n}", "func ReadVideoFileLink(projectid int64, database *sql.DB) (string, error) {\n\tvar videolink string\n\tstmt, err := database.Prepare(`SELECT \n\t\t\t\t\t video_link\n\t\t\t\t\t FROM project \n\t\t\t\t\t WHERE id = ?`)\n\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(projectid)\n\tif err != nil {\n\t\tlog.Println(\"[ERR] prepare statment query err : \", err)\n\t\treturn \"\", err\n\t}\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&videolink)\n\t\tif err != nil {\n\t\t\tlog.Println(\"[ERR] rows scan err : \", err)\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn videolink, nil\n}", "func (s *GroupsService) GetVideo(gr string, vid int, opt ...CallOption) (*Video, *Response, error) {\n\tu := fmt.Sprintf(\"groups/%s/videos/%d\", gr, vid)\n\tvideo, resp, err := getVideo(s.client, u, opt...)\n\n\treturn video, resp, err\n}", "func (b *GroupsSetCallbackSettingsBuilder) VideoNew(v bool) *GroupsSetCallbackSettingsBuilder {\n\tb.Params[\"video_new\"] = v\n\treturn b\n}", "func (m *VideoManager) GetVideoOrCreateTask(uri, kind string) (Video, error) {\n\tclaim, err := claim.Resolve(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tv, err := m.library.Get(claim.SDHash)\n\tif v == nil || err == sql.ErrNoRows {\n\t\terr := video.ValidateByClaim(claim)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, video.ErrChannelNotEnabled) {\n\t\t\t\tm.library.IncViews(claim.PermanentURL, claim.SDHash)\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\tt, err := m.queue.GetBySDHash(claim.SDHash)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif t != nil {\n\t\t\treturn nil, video.ErrTranscodingUnderway\n\t\t}\n\t\t_, err = m.queue.Add(uri, claim.SDHash, kind)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, video.ErrTranscodingUnderway\n\t}\n\treturn *v, nil\n}", "func newVideoTrackFromDriver(d driver.Driver, recorder driver.VideoRecorder, constraints MediaTrackConstraints, selector *CodecSelector) (Track, error) {\n\treader, err := recorder.VideoRecord(constraints.selectedMedia)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newVideoTrackFromReader(d, reader, selector), nil\n}", "func GetMetadata(url string) (ytdl.VideoInfo, error) {\n\tvideoInfo, err := ytdl.GetVideoInfo(url)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn ytdl.VideoInfo{}, err\n\t}\n\treturn *videoInfo, nil\n}", "func (o *EquipmentFanModule) GetVid() string {\n\tif o == nil || o.Vid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Vid\n}", "func (g *Guessit) GuessMetadata(file *polochon.File, log *logrus.Entry) (*polochon.VideoMetadata, error) {\n\tfilePath := filepath.Base(file.Path)\n\tguess, err := g.client.Guess(filePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &polochon.VideoMetadata{\n\t\tQuality: polochon.Quality(guess.Quality),\n\t\tReleaseGroup: guess.ReleaseGroup,\n\t\tAudioCodec: guess.AudioCodec,\n\t\tVideoCodec: guess.VideoCodec,\n\t\tContainer: guess.Container,\n\t}, nil\n}", "func downloadVideo(writer io.Writer, videoInfo ytdl.VideoInfo) error {\n\tif len(videoInfo.Formats) == 0 {\n\t\treturn errors.New(\"No available video formats\")\n\t}\n\n\tformat := videoInfo.Formats[0]\n\n\tlog.Debugf(\"Format: %v\", format)\n\n\tif err := videoInfo.Download(format, writer); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func GetFileName(url string, videoType string) string{\n\n\tif videoType == \".m3u8\" {\n\t\tif strings.Contains(url, \"/d1.vnecdn.net/\"){\n\t\t\tvar re = regexp.MustCompile(`(?m)[a-z0-9\\-\\_]+\\-\\d{8,}`)\n\t\t\tmatch := re.FindString(url)\n\n\t\t\treturn match + \".mp4\"\n\t\t} else if strings.Contains(url, \"ss-hls.catscdn.vn\") {\n\t\t\tvar re = regexp.MustCompile(`(?m)[a-z0-9\\-\\_]+\\.mp4`)\n\t\t\tmatch := re.FindString(url)\n\n\t\t\treturn match + \".mp4\"\n\t\t}\n\t}\n\n\tfilename := url[:strings.Index(url, videoType)]\n\tfilename = filepath.Base(filename)\n\tfilename = filename + \".mp4\"\n\n\treturn filename\n}", "func getEventDetails(filename string) (eventDate string) {\n\n\tvar index int\n\tfile := path.Base(filename)\n\tsepCount := strings.Count(file, \"-\")\n\n\tif sepCount > 0 && sepCount < 3 {\n\t\tindex = sepCount - 1\n\t} else {\n\t\tdms3libs.LogFatal(\"unexpected Motion filenaming convention: missing separators\")\n\t}\n\n\tres := strings.Split(file, \"-\")\n\n\tif len(res[index]) != 14 {\n\t\tdms3libs.LogFatal(\"unexpected Motion filenaming convention: incorrect string length\")\n\t}\n\n\tyear, _ := strconv.Atoi(res[index][0:4])\n\tmonth, _ := strconv.Atoi(res[index][4:6])\n\tday, _ := strconv.Atoi(res[index][6:8])\n\thour, _ := strconv.Atoi(res[index][8:10])\n\tmin, _ := strconv.Atoi(res[index][10:12])\n\tsec, _ := strconv.Atoi(res[index][12:14])\n\n\treturn time.Date(year, time.Month(month), day, hour, min, sec, 0, time.UTC).Format(\"15:04:05 on 2006-01-02\")\n\n}", "func (o *CapabilitySiocModuleManufacturingDef) GetVid() string {\n\tif o == nil || o.Vid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Vid\n}", "func (m *MalService) GetAnimeVideo(id int, page ...int) (anime.VideoParser, error) {\n\treturn anime.InitVideoParser(m.Config, id, page...)\n}", "func (v *videoService) Create(ctx context.Context, req *pbVideo.CreateVideoRequest, res *pbVideo.CreateVideoResponse) error {\n\n\t// Fetch token\n\tmd, _ := metadata.FromContext(ctx)\n\ttoken, err := v.jwtHandler.GetBearerToken(md)\n\tif err != nil {\n\t\treturn merr.Unauthorized(config.ServiceName, \"%s\", err.Error())\n\t}\n\t// Decode jwt and extract user\n\tclaims, err := v.jwtHandler.Decode(token)\n\tif err != nil {\n\t\tlog.Debug().Interface(\"error\", err).Msg(\"unable to decode jwt token\")\n\t\treturn merr.Unauthorized(config.ServiceName, \"%s\", err.Error())\n\t}\n\tuser := claims.User\n\n\t// TODO: Authorization: create:video\n\n\t// Check if raw file does already exist\n\texistingVideo, _ := v.videoRepository.FindByRawStorageKey(req.Video.Storage.RawKey)\n\tif existingVideo != nil {\n\t\tlog.Warn().Str(\"file_key\", existingVideo.Storage.RawKey).Msg(\"a source video with that key already exists\")\n\t\treturn errors.RawVideoAlreadyExists\n\t}\n\n\t// Check if file actually exists in S3\n\tfileKey := req.Video.Storage.RawKey\n\terr = v.s3Bucket.CheckFileExists(fileKey, config.AwsS3VideoBucket)\n\tif err != nil {\n\t\tlog.Warn().Str(\"key\", fileKey).Err(err).Msg(\"key does not exist in bucket\")\n\t\tres.Errors = append(res.Errors, &pbVideo.Error{\n\t\t\tDescription: errors.RawVideoFileS3NotFound.Error(),\n\t\t\tCode: 404,\n\t\t})\n\t\treturn merr.NotFound(config.ServiceName, \"%s\", errors.RawVideoFileS3NotFound)\n\t}\n\tlog.Info().Str(\"key\", fileKey).Str(\"bucket\", config.AwsS3VideoBucket).Msg(\"key found in bucket\")\n\n\t// Insert video into DB\n\tvideo, err := v.videoRepository.CreateVideo(mongodb.UnmarshalProtobuf(req.Video, user.Id))\n\tif err != nil {\n\t\tlog.Warn().Interface(\"error\", err).Msg(\"unable to create video in database\")\n\t\treturn err\n\t}\n\tlog.Info().Str(\"video_id\", video.ID.Hex()).Msg(\"created video\")\n\treq.Video.Id = video.ID.Hex()\n\n\t// Publish event\n\tv.videoPublisher.PublishVideoCreated(&pbVideo.VideoCreatedEvent{\n\t\tVideo: req.Video,\n\t\tUserId: user.Id,\n\t})\n\n\tres.Video = req.Video\n\n\treturn nil\n}", "func (*Video) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{12}\n}", "func (o *EquipmentIoCardBase) GetVid() string {\n\tif o == nil || o.Vid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Vid\n}", "func (d *Dao) Videos2(c context.Context, aid int64) (vs []*archive.Video, err error) {\n\trows, err := d.db.Query(c, _videos2SQL, aid)\n\tif err != nil {\n\t\tlog.Error(\"d.db.Query(%s, %d) error(%v)\", _videos2SQL, aid, err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tv := &archive.Video{}\n\t\tif err = rows.Scan(&v.ID, &v.Filename, &v.Cid, &v.Aid, &v.Title, &v.Desc, &v.SrcType, &v.Duration, &v.Filesize, &v.Resolutions,\n\t\t\t&v.Playurl, &v.FailCode, &v.Index, &v.Attribute, &v.XcodeState, &v.Status, &v.State, &v.CTime, &v.MTime); err != nil {\n\t\t\tlog.Error(\"rows.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tvs = append(vs, v)\n\t}\n\treturn\n}", "func GetMovieInfo(info string) (duration string) {\n split := strings.Split(info, \" - \")\n\n return split[0]\n}", "func Video(attrs []htmlgo.Attribute, children ...HTML) HTML {\n\treturn &htmlgo.Tree{Tag: \"video\", Attributes: attrs, Children: children}\n}", "func (a *attachUp) AddVideo(p, n string) AttachmentUploader {\n\ta.v = append(a.v, p)\n\tif n == \"\" {\n\t\tn = filepath.Base(p)\n\t}\n\ta.vn = append(a.vn, n)\n\treturn a\n}", "func ffmpegDecode(videoFileNameWithExt string, title string) (string, error) {\n\tmp3FileName := makeFileName(title, \"mp3\")\n\tdeleteFile(mp3FileName) //remove target file if exists\n\tfmt.Printf(\"Start FFMPEG decoding %s\\n\", videoFileNameWithExt)\n\tcmd := exec.Command(\"ffmpeg\", \"-i\", videoFileNameWithExt, mp3FileName)\n\tvar out bytes.Buffer\n\tcmd.Stdout = &out\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\toutputText := strings.TrimSpace(out.String()) // normally, returns empty string if everything OK\n\tif len(outputText) != 0 {\n\t\treturn \"\", errors.New(\"FFMPEG returned non-empty string: \" + outputText)\n\t}\n\tfmt.Printf(\"FFMPEG decoded normally: %s\\n\", videoFileNameWithExt)\n\treturn mp3FileName, err\n}", "func ParseVideoUrl(video *Video) {\n\tdefer wg.Done()\n\tres, err := http.Get(video.Url)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\tbytes, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\treg := `videoFlashPlayUrl\\s=\\s\\'(.*)\\'`\n\tsubmatch := regexp.MustCompile(reg).FindAllSubmatch(bytes, -1)\n\tif len(submatch) > 0 && len(submatch[0]) > 0 {\n\t\tvv := submatch[0][1]\n\t\turlInfo, err := url.Parse(string(vv))\n\t\tif err != nil {\n\t\t\tlog.Println(err, string(vv))\n\t\t\treturn\n\t\t}\n\t\tlog.Println(urlInfo.Query()[\"video\"][0])\n\t\tvideo.VideoUrl = urlInfo.Query()[\"video\"][0]\n\t\tgo DownloadVideo(video)\n\t\twg.Add(1)\n\t\t// videoChan <- video\n\t}\n}", "func (f *FFmpeg_Generator) GetFrameFile(wg *sync.WaitGroup) {\n\tvar objectStorage = &s3.ObjectStorage\n\terr := objectStorage.Client.FGetObject(\n\t\tcontext.Background(),\n\t\t\"frame\",\n\t\tf.Frame.FileCode,\n\t\tf.Dir+f.Recipe.FrameCode,\n\t\tminio.GetObjectOptions{})\n\tif err != nil {\n\t\tf.Error.Status = false\n\t\tf.Error.Message = \"s3 error\"\n\t}\n\twg.Done()\n\n}", "func getTVFromFile(fileName string) *tv.TestVector {\n\tlog.Debug(\"In getTVFromFile\")\n\ttvdata, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error opening test vector file: %s\\n%s\", fileName, err)\n\t}\n\ttestvector := &tv.TestVector{}\n\tif err = proto.UnmarshalText(string(tvdata), testvector); err != nil {\n\t\tlog.Fatalf(\"Error parsing proto message of type %T from file %s\\n%s\", testvector, fileName, err)\n\t}\n\treturn testvector\n}", "func (c *Client) DetectImpurityVideo(filename string) (VideoData, error) {\n\tdata := VideoData{}\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\tr, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\tvar b bytes.Buffer\n\tw := multipart.NewWriter(&b)\n\tdefer w.Close()\n\n\tfw, err := w.CreateFormFile(\"file_video\", filename)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\tif _, err = fw.Write(r); err != nil {\n\t\treturn data, err\n\t}\n\n\tfw, err = w.CreateFormField(\"API_KEY\")\n\tif err != nil {\n\t\treturn data, err\n\t}\n\tif _, err = fw.Write([]byte(c.Key)); err != nil {\n\t\treturn data, err\n\t}\n\n\tif fw, err = w.CreateFormField(\"task\"); err != nil {\n\t\treturn data, err\n\t}\n\tif _, err = fw.Write([]byte(c.Tasks)); err != nil {\n\t\treturn data, err\n\t}\n\treq, err := http.NewRequest(http.MethodPost, c.VideoURL, &b)\n\tif err != nil {\n\t\treturn data, errors.Wrap(err, \"picpurify client: creating request\")\n\t}\n\treq.ContentLength = int64(len(b.Bytes()))\n\treq.Header.Set(\"Content-Type\", w.FormDataContentType())\n\tfmt.Println(\"content length! \", req.ContentLength)\n\tvar bytes []byte\n\tresp, err := c.Client.Do(req)\n\tif err != nil {\n\t\treturn data, errors.Wrap(err, \"picpurify client: executing request\")\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn data, errors.Errorf(\"got unexpected http code: %d\", resp.StatusCode)\n\t}\n\n\tbytes, err = ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn data, errors.Wrap(err, \"picpurify client: reading response body\")\n\t}\n\n\tif err != nil {\n\t\treturn data, errors.New(\"retrieving data from picpurify\")\n\t}\n\tfmt.Println(string(bytes))\n\terr = json.Unmarshal(bytes, &data)\n\treturn data, err\n}", "func handleUploadedZipVideo(tempDir string) map[string]string {\n\tfileHandleMsgMap := make(map[string]string)\n\tfilepath.Walk(tempDir, func(path string, info os.FileInfo, err error) error {\n\t\tvar msg string\n\t\tj := jewelry{}\n\t\tif info.IsDir() {\n\t\t\tmsg = fmt.Sprintf(\"SKIP folder %s\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\t\tvar filename string\n\t\tbs, err := ioutil.ReadFile(path)\n\t\tif err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tif !filetype.IsVideo(bs) {\n\t\t\tmsg = fmt.Sprintf(\"%s is not video\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\t\text := filepath.Ext(info.Name())\n\t\tif ext == \"\" {\n\t\t\tmsg = fmt.Sprintf(\"SKIP file %s as the file has no extension\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\n\t\tif ext == \"mp4\" || ext == \"mov\" || ext == \"ogv\" || ext == \"webm\" {\n\t\t\tfilename = fmt.Sprintf(\"beyoudiamond-video-%s\", info.Name())\n\t\t} else {\n\t\t\tmsg = fmt.Sprintf(\"Uploaded file %s extension is not supported\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\n\t\tj.StockID = strings.Split(info.Name(), \"-\")[0]\n\t\tif err := j.isJewelryExistByStockID(); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tif err := util.RunWithStdOutput(\"mv\", path, filepath.Join(\".video\", \"jewelry\", filename)); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tj.VideoLink = filename\n\t\tq := j.composeUpdateQuery()\n\t\tif _, err := dbExec(q); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tif msg == \"\" {\n\t\t\tfileHandleMsgMap[info.Name()] = msg\n\t\t} else {\n\t\t\tfileHandleMsgMap[info.Name()] = \"uploaded\"\n\t\t}\n\t\treturn nil\n\t})\n\treturn fileHandleMsgMap\n}", "func (file *File) getParams() (params *common.File) {\n\tfile.lock.Lock()\n\tdefer file.lock.Unlock()\n\n\tparams = &common.File{}\n\tparams.Name = file.Name\n\n\tif file.metadata != nil {\n\t\tparams.ID = file.metadata.ID\n\t}\n\n\treturn params\n}", "func AvGetFrameFilename(buf_size int, path string, number int) (int, string) {\n\tCbuf := (*C.char)(C.malloc(C.sizeof_char * C.ulong(buf_size)))\n\tdefer C.free(unsafe.Pointer(Cbuf))\n\n\tCpath := C.CString(path)\n\tdefer C.free(unsafe.Pointer(Cpath))\n\n\tret := int(C.av_get_frame_filename(Cbuf, C.int(buf_size), Cpath, C.int(number)))\n\n\treturn ret, C.GoString(Cbuf)\n}", "func loadNewVideosFromMyChannel(knownVideos *tomlKnownVideos) {\n\n\tclient := getClient(youtube.YoutubeReadonlyScope)\n\tservice, err := youtube.New(client)\n\n\t// videoMeta data does not exist if there is no local data in knownvideos.toml\n\tif knownVideos.Videos == nil {\n\t\tknownVideos.Videos = make(map[string]videoMeta)\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating YouTube client: %v\", err)\n\t}\n\n\tresponse := channelsListMine(service, \"contentDetails\")\n\n\tfor _, channel := range response.Items {\n\t\tplaylistId := channel.ContentDetails.RelatedPlaylists.Uploads\n\n\t\t// Print the playlist ID for the list of uploaded videos.\n\t\tfmt.Printf(\"Checking for new videos in list %s\\r\\n\", playlistId)\n\n\t\tnextPageToken := \"\"\n\t\tvar numItemsPerPage int64 = 35\t\t\t// max 50 https://developers.google.com/youtube/v3/docs/playlistItems/list#parameters\n\t\tfoundNewVideos := false\t\t\t\t\t// if we added videos, we will look for next page of videos\n\t\tfor {\n\t\t\t// Retrieve next set of items in the playlist.\n\t\t\t// Items are not returned in perfectly sorted order, so just go through all pages to get all items\n\t\t\t// Revisit this if it gets too slow\n\t\t\tplaylistResponse := playlistItemsList(service, \"snippet,ContentDetails\", playlistId, nextPageToken, numItemsPerPage)\n\n\t\t\tfor _, playlistItem := range playlistResponse.Items {\n\t\t\t\tfoundNewVideos = addNewVideosToList(playlistItem, knownVideos)\n\t\t\t}\n\n\t\t\tif foundNewVideos {\n\t\t\t\tfmt.Println(\"Found some new videos. Let's look for more!\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Searched %v videos and found nothing new. Let's move on.\\r\\n\",numItemsPerPage)\n\t\t\t\t// The results are not exactly ordered by publishDate, so there could be cases where we didn't find expected videos\n\t\t\t\tfmt.Println(\"If we should have found some, increase numItemsPerPage or remove \\\"!foundNewVideos ||\\\" from code\")\n\t\t\t}\n\t\t\t// Set the token to retrieve the next page of results\n\t\t\t// or exit the loop if all results have (apparently) been retrieved.\n\t\t\tnextPageToken = playlistResponse.NextPageToken\n\t\t\tif !foundNewVideos || nextPageToken == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "func (ydl *youtubeDl) GetInfo() (Info, error) {\n\t// Setup command with '-J' argument\n\tcmd := exec.Command(ydl.YoutubeDlPath, \"-J\", ydl.VideoURL)\n\tstdOut, err := cmd.StdoutPipe()\n\n\tif err != nil {\n\t\treturn Info{}, err\n\t}\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn Info{}, err\n\t}\n\n\tif err := json.NewDecoder(stdOut).Decode(&ydl.Info); err != nil {\n\t\treturn Info{}, err\n\t}\n\n\treturn ydl.Info, cmd.Wait()\n}", "func NewVFile(pwd, modded, real string, size int64, compressed, decompress bool, fx DataPack) *VFile {\n\tmdir := filepath.Dir(modded)\n\trdir := filepath.Dir(real)\n\tvf := VFile{\n\t\tCompressed: compressed,\n\t\tDecompress: decompress,\n\t\tBaseDir: pwd,\n\t\tDir: mdir,\n\t\tShadowDir: rdir,\n\t\tFileName: filepath.Base(modded),\n\t\tMod: time.Now(),\n\t\tDatasize: size,\n\t\tDataPack: fx,\n\t}\n\n\treturn &vf\n}", "func GetMediaInfo(url string) (MediaInfo, error) {\n\tvideoURL := \"\"\n\terr := errors.New(\"unsupport\")\n\tsource := GetMediaSource(url)\n\tvar mediaInfo MediaInfo\n\tswitch source {\n\tcase Weibo:\n\t\t{\n\t\t\tvar videoInfo parser.WeiboVideoInfo\n\t\t\tvideoURL, videoInfo, err = parser.ParseWeiboVideo(url)\n\t\t\tmediaInfo.URL = videoURL\n\t\t\tmediaInfo.Info = videoInfo\n\t\t\tmediaInfo.Source = SourceInfo{ID: Weibo, Name: NameWeibo}\n\t\t}\n\t}\n\treturn mediaInfo, err\n}", "func newFile(name, contents string) (*file, error) {\n\tif name == \"\" {\n\t\treturn nil, fmt.Errorf(\"files cannot have empty names\")\n\t}\n\n\treturn &file{\n\t\tname: name,\n\t\tcontents: contents,\n\t}, nil\n}", "func (*CreateVideoV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{3}\n}", "func (*VideoFormat) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{7}\n}", "func Video(props *VideoProps, children ...Element) *VideoElem {\n\trProps := &_VideoProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &VideoElem{\n\t\tElement: createElement(\"video\", rProps, children...),\n\t}\n}", "func (*MultiCreateVideoV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{5}\n}", "func (video *FakeVideo) CreateVideo(userID string) (err error) {\n\tif video.Name == \"\" {\n\t\terr = errors.New(\"the video name cannot be empty\")\n\n\t\treturn\n\t} else if video.URL == \"\" {\n\t\terr = errors.New(\"the video URL cannot be empty\")\n\n\t\treturn\n\t}\n\n\terr = nil\n\n\treturn\n}", "func (c FileCollector) Get(k string) *VFile {\n\treturn c[k]\n}", "func (vf *VFile) GetDemuxer() (av.DemuxCloser, error) {\n\tfile, err := avutil.Open(vf.Name + \".mp4\")\n\tif err != nil {\n\t\tfmt.Println(\"Error on open mp4 file;\", err.Error())\n\t\treturn nil, err\n\t}\n\treturn file, err\n}", "func (c *YoutubeController) GetYoutubeVideoDetails(videoURL *string) (*types.UserVideoItem, error) {\n\t// https://www.googleapis.com/youtube/v3/videos?id=D95qIe5pLuA&key=AIzaSyBhFXscTPZr892Uj5h2wRghkFAqTPYtcEg&part=snippet,statistics,topicDetails\n\tif videoURL == nil {\n\t\treturn nil, errors.New(\"Need url\")\n\t}\n\n\t// attempt to get the video is\n\tu, err := url.Parse(mapping.StrToV(videoURL))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar videoID *string\n\tvalues := u.Query()[\"id\"]\n\tif len(values) == 0 {\n\t\tvideoID, err = c.gateway.GetYoutubeVideoID(videoURL)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"could not get video ID\")\n\t\t}\n\t}\n\tresponse, err := c.gateway.GetYoutubeVideoDetails(videoID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// baseURL := \"https://www.googleapis.com/youtube/v3/videos?\"\n\t// url := fmt.Sprintf(\"%s&id=%s&key=%s&part=snippet,statistics,topicDetails\", baseURL, *videoID, developerKey)\n\t// req, err := http.NewRequest(\"GET\", url, nil)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\n\t// response := &types.UserVideoItem{}\n\t// client := &http.Client{}\n\t// resp, err := client.Do(req)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\t// err = json.NewDecoder(resp.Body).Decode(&response)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\t// if response == nil {\n\t// \treturn nil, errors.New(\"response is nil\")\n\t// }\n\treturn response, nil\n}", "func GetRandomVideo() string {\n\tquery := GetRandomWord()\n\n\tclient := &http.Client{\n\t\tTransport: &transport.APIKey{Key: developerKey},\n\t}\n\n\tservice, err := youtube.New(client)\n\tif err != nil {\n\t\tlog.Printf(\"Error creating new YouTube client: %v\", err)\n\t}\n\n\t// Make the API call to YouTube.\n\tcall := service.Search.List(\"id,snippet\").\n\t\tQ(query).\n\t\tMaxResults(25)\n\tresponse, err := call.Do()\n\tif err != nil {\n\t\tlog.Printf(\"Error making search API call: %v\", err)\n\t} else {\n\t\t// Iterate through each item and add it to the correct list.\n\t\tfor _, item := range response.Items {\n\t\t\tif item.Id.Kind == \"youtube#video\" {\n\t\t\t\tytv := fmt.Sprintf(\"<iframe width=\\\"560\\\" height=\\\"315\\\" src=\\\"https://www.youtube.com/embed/%s\\\" frameborder=\\\"0\\\"></iframe>\", item.Id.VideoId)\n\t\t\t\treturn ytv\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\"\n}", "func AvGetFrameFilename(b string, bs int, pa string, n int) int {\n\tcb := C.CString(b)\n\tdefer C.free(unsafe.Pointer(cb))\n\tcpa := C.CString(pa)\n\tdefer C.free(unsafe.Pointer(cpa))\n\treturn int(C.av_get_frame_filename(cb, C.int(bs), cpa, C.int(n)))\n}", "func GetVideoCatalogueByCourseHandle(es *database.ElasticService) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tsetupResponse(&w, r)\n\t\tif (*r).Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\t\tcourse := r.URL.Query()[\"course\"]\n\t\tvideos, err := es.GetUniqueStringFieldValuesInIndexWithFilter(\n\t\t\tdatabase.VideoEventDescriptionIndexName,\n\t\t\t\"video_id\",\n\t\t\t\"course_id\",\n\t\t\tcourse[0],\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error! Can't get unique videos for course: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\tb, err := json.Marshal(videos)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error! Can't convert video list to json: %v\\n\", err)\n\t\t}\n\t\tfmt.Fprintf(w, string(b))\n\t}\n}", "func ConvertVideo(sourcePath, destinationPath string, width, height int) (string, string, error) {\n\tlog.Printf(\"converting video %v to %vx%v at %v\", sourcePath, width, height, destinationPath)\n\n\targuments := make([]string, 0)\n\n\t//if runtime.GOOS != \"darwin\" {\n\t//\targuments = append(arguments, \"-f\")\n\t//}\n\n\t//arguments = append(\n\t//\targuments,\n\t//\t[]string{\n\t//\t\t\"-l\",\n\t//\t\t\"75\",\n\t//\t\t\"--\",\n\t//\t\t\"ffmpeg\",\n\t//\t\t\"-hwaccel\",\n\t//\t\t\"cuda\",\n\t//\t\t\"-c:v\",\n\t//\t\t\"h264_cuvid\",\n\t//\t\t\"-y\",\n\t//\t\t\"-i\",\n\t//\t\tsourcePath,\n\t//\t\t\"-s\",\n\t//\t\tfmt.Sprintf(\"%vx%v\", width, height),\n\t//\t\tdestinationPath,\n\t//\t}...,\n\t//)\n\n\targuments = []string{\n\t\t\"-hwaccel\",\n\t\t\"cuda\",\n\t\t\"-c:v\",\n\t\t\"h264_cuvid\",\n\t\t\"-y\",\n\t\t\"-i\",\n\t\tsourcePath,\n\t\t\"-s\",\n\t\tfmt.Sprintf(\"%vx%v\", width, height),\n\t\t\"-c:v\",\n\t\t\"h264_nvenc\",\n\t\tdestinationPath,\n\t}\n\n\t//return common.RunCommand(\n\t//\t\"cpulimit\",\n\t//\targuments...,\n\t//)\n\n\treturn common.RunCommand(\n\t\t\"ffmpeg\",\n\t\targuments...,\n\t)\n}", "func (vc VideoController) ViewVideos(w http.ResponseWriter, r *http.Request) {\n\tvar videos []models.Video\n\tif err := storage.DB.Find(&videos).Error; err != nil {\n\t\tlogrus.Error(\"Could not find videos : \", err.Error())\n\t\thttp.Error(w, \"Error finding videos\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\trender.Render(w, r, \"videos\", map[string]interface{}{\n\t\t\"Videos\": videos,\n\t})\n}", "func (h *MovieHandler) new(w http.ResponseWriter, r *http.Request) {\n\t// Render a HTML response and set status code.\n\trender.HTML(w, http.StatusOK, \"movie/new.html\", nil)\n}", "func (client *Client) GetVideoInfos(request *GetVideoInfosRequest) (_result *GetVideoInfosResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetVideoInfosResponse{}\n\t_body, _err := client.GetVideoInfosWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func openAndDisplayCPTVFileContents(cptvFileName string) {\n\n\tfile, err := os.Open(cptvFileName)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tdefer file.Close()\n\n\tr, err := cptv.NewReader(file)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Println(\"CPTV File details:\")\n\tfmt.Println(\"\\tVersion =\", r.Version())\n\tfmt.Println(\"\\tTimeStamp =\", r.Timestamp().UTC())\n\tfmt.Println(\"\\tDeviceName =\", r.DeviceName())\n\tfmt.Println(\"\\tDeviceID =\", r.DeviceID())\n\tfmt.Println(\"\\tPreviewSecs =\", r.PreviewSecs())\n\tfmt.Println(\"\\tMotionConfig =\", r.MotionConfig())\n\tfmt.Println(\"\\tLatitude =\", r.Latitude())\n\tfmt.Println(\"\\tLongitude =\", r.Longitude())\n\tfmt.Println(\"\\tlocTimeStamp =\", r.LocTimestamp().UTC())\n\tfmt.Println(\"\\tAltitude =\", r.Altitude())\n\tfmt.Println(\"\\tAccuracy =\", r.Accuracy())\n\tfmt.Println(\"\\tYResolution =\", r.ResY())\n\tfmt.Println(\"\\tXResolution =\", r.ResX())\n\n\tframeCount, err := r.FrameCount()\n\tfmt.Println(\"\\tNum Frames =\", frameCount)\n\n}", "func (c *DOM) GetFileInfoWithParams(v *DOMGetFileInfoParams) (string, error) {\n\tresp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"DOM.getFileInfo\", Params: v})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar chromeData struct {\n\t\tResult struct {\n\t\t\tPath string\n\t\t}\n\t}\n\n\tif resp == nil {\n\t\treturn \"\", &gcdmessage.ChromeEmptyResponseErr{}\n\t}\n\n\t// test if error first\n\tcerr := &gcdmessage.ChromeErrorResponse{}\n\tjson.Unmarshal(resp.Data, cerr)\n\tif cerr != nil && cerr.Error != nil {\n\t\treturn \"\", &gcdmessage.ChromeRequestErr{Resp: cerr}\n\t}\n\n\tif err := json.Unmarshal(resp.Data, &chromeData); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn chromeData.Result.Path, nil\n}", "func GetVideoInfoNV(hpVideoDevice unsafe.Pointer, pulCounterOutputPbuffer unsafe.Pointer, pulCounterOutputVideo unsafe.Pointer) unsafe.Pointer {\n\tret, _, _ := syscall.Syscall(gpGetVideoInfoNV, 3, uintptr(hpVideoDevice), uintptr(pulCounterOutputPbuffer), uintptr(pulCounterOutputVideo))\n\treturn (unsafe.Pointer)(ret)\n}", "func NewInfo(version string, t time.Time) File {\n\tvar info = struct {\n\t\tVersion string\n\t\tTime time.Time\n\t}{version, t}\n\tjs, err := json.Marshal(info)\n\tif err != nil {\n\t\t// json.Marshal only fails for bad types; there are no bad types in info.\n\t\tpanic(\"unexpected json.Marshal failure\")\n\t}\n\treturn MemFile(js, t)\n}", "func NewVideoProcessor(tempDir string) *VideoProcessor {\n\treturn &VideoProcessor{tempDir: tempDir}\n}", "func NewInfo(createResponse string, modified *time.Time) (os.FileInfo, error) {\n\n\telements := strings.SplitN(createResponse, \" \", 3)\n\tif len(elements) != 3 {\n\t\treturn nil, fmt.Errorf(\"invalid download createResponse: %v\", createResponse)\n\t}\n\tisDir := strings.HasPrefix(elements[0], \"D\")\n\tmodeLiteral := string(elements[0][1:])\n\tmode, err := strconv.ParseInt(modeLiteral, 8, 64)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"invalid mode: %v\", modeLiteral)\n\t}\n\tsizeLiteral := elements[1]\n\tsize, err := strconv.ParseInt(sizeLiteral, 10, 64)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"invalid size: %v\", modeLiteral)\n\t}\n\tname := strings.Trim(elements[2], \"\\r\\n\")\n\tif modified == nil {\n\t\tnow := time.Now()\n\t\tmodified = &now\n\t}\n\treturn file.NewInfo(name, size, os.FileMode(mode), *modified, isDir), nil\n}", "func (*CreateVideoV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{2}\n}", "func (*MultiCreateVideoV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{4}\n}", "func newFileFromParams(upload *Upload, params *common.File) *File {\n\tfile := &File{}\n\tfile.upload = upload\n\tfile.metadata = params\n\tfile.Name = params.Name\n\tfile.Size = params.Size\n\treturn file\n}", "func (v *VFile) Name() string {\n\treturn v.FileName\n}", "func (amv *AMV) RefreshInfo() error {\n\tif amv.File == \"\" {\n\t\treturn fmt.Errorf(\"Video file has not been uploaded yet for AMV %s\", amv.ID)\n\t}\n\n\tinfo, err := video.GetInfo(path.Join(Root, \"videos\", \"amvs\", amv.File))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tamv.Info = *info\n\treturn nil\n}", "func downloadVideo(url string) error {\n\tfmt.Printf(\"Starting to download %s...\\n\", url)\n\terr := exec.Command(\"youtube-dl\", \"-f\", \"bestaudio\",\n\t\t\"-o\", \"music/%(title)s.%(ext)s\",\n\t\t\"--extract-audio\",\n\t\t\"--audio-format\", \"mp3\",\n\t\t\"--embed-thumbnail\", \"--add-metadata\", url).Run()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *UnsavedPostVideoClient) Get(ctx context.Context, id int) (*UnsavedPostVideo, error) {\n\treturn c.Query().Where(unsavedpostvideo.ID(id)).Only(ctx)\n}", "func (*VideoSearchResult) Descriptor() ([]byte, []int) {\n\treturn file_box_search_proto_rawDescGZIP(), []int{6}\n}", "func (m *File) UpdateVideoInfos() error {\n\tvalues := FileInfos{}\n\n\tif err := deepcopier.Copy(&values).From(m); err != nil {\n\t\treturn err\n\t}\n\n\treturn Db().Model(File{}).Where(\"photo_id = ? AND file_video = 1\", m.PhotoID).Updates(values).Error\n}", "func GetSupportedVideoFileFormats() []string {\n\treturn []string{\".mkv\", \".mp4\", \".mov\", \".avi\"}\n}", "func DeleteVideoFile(ctx context.Context, userid int64, projectid int64, database *sql.DB) error {\n\tprefix := fmt.Sprintf(\"%s%d%s%s%d%s%s\", userdir, userid, \"/\", projectdir, projectid, \"/\", videodir)\n\tvar delimeter = \"/\"\n\n\tbucket, err := GetBucket(ctx)\n\tif err != nil {\n\t\tlog.Println(\"[ERR] failed to get bucket err : \", err)\n\t\treturn err\n\t}\n\n\tit := bucket.Objects(ctx, &storage.Query{Prefix: prefix, Delimiter: delimeter})\n\tvideolink, err := ReadVideoFileLink(projectid, database)\n\n\tfor {\n\t\tattrs, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tlog.Println(\"[LOG] iterator done!\")\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"[ERR] bucket objects err : \", err)\n\t\t\treturn err\n\t\t}\n\t\tif videolink != attrs.Name {\n\t\t\terr = bucket.Object(attrs.Name).Delete(ctx)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"[ERR] failed to delete object err : \", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (pi *PackageInfo) FileVName(file *ast.File) *spb.VName {\n\tif v := pi.fileVName[file]; v != nil {\n\t\treturn v\n\t}\n\tv := proto.Clone(pi.VName).(*spb.VName)\n\tv.Language = \"\"\n\tv.Signature = \"\"\n\tv.Path = pi.FileSet.Position(file.Pos()).Filename\n\treturn v\n}", "func (client *Client) GetVideoInfosWithOptions(request *GetVideoInfosRequest, runtime *util.RuntimeOptions) (_result *GetVideoInfosResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.VideoIds)) {\n\t\tquery[\"VideoIds\"] = request.VideoIds\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetVideoInfos\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetVideoInfosResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (Obj *ConsoleIo) GetVideoMode() *Coordinate {\n\treturn nil\n}" ]
[ "0.6311683", "0.62826", "0.62300473", "0.6010277", "0.59076375", "0.58409405", "0.57925767", "0.5765889", "0.5697564", "0.56971383", "0.5684403", "0.5634158", "0.552975", "0.5508001", "0.55029166", "0.54371196", "0.54016936", "0.5393763", "0.5386952", "0.5366957", "0.5316248", "0.5281761", "0.52751297", "0.52708346", "0.52589417", "0.5256899", "0.5254472", "0.524309", "0.5239417", "0.5228898", "0.5223714", "0.5217003", "0.5216114", "0.5212826", "0.5206463", "0.5161315", "0.5124843", "0.5103314", "0.5093387", "0.5052222", "0.5046434", "0.502293", "0.50202835", "0.501172", "0.50111157", "0.50101024", "0.5001735", "0.49850854", "0.49473146", "0.49097484", "0.4908024", "0.48914465", "0.48857117", "0.48805383", "0.48757473", "0.4867029", "0.48497787", "0.4820683", "0.4794541", "0.4792612", "0.47841278", "0.4779959", "0.4778493", "0.4743915", "0.47348106", "0.47196347", "0.47038952", "0.46946773", "0.4686154", "0.46781525", "0.46736816", "0.46643567", "0.46610743", "0.4646475", "0.46456677", "0.4639466", "0.4631748", "0.4629663", "0.4629527", "0.461611", "0.46128702", "0.46097857", "0.4600331", "0.4592671", "0.45855087", "0.45842746", "0.4571708", "0.45661822", "0.45634058", "0.4563334", "0.4556737", "0.4545", "0.45432848", "0.4542208", "0.45172036", "0.451604", "0.45133382", "0.45124713", "0.45121413", "0.45075375" ]
0.7094307
0
ReadResponse reads a server response into the received o.
func (o *GetCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetCertificatesOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewGetCertificatesUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewGetCertificatesInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: result := NewGetCertificatesDefault(response.Code()) if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } if response.Code()/100 == 2 { return result, nil } return nil, result } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *ResourceHandler) ReadResponse(dataOut unsafe.Pointer, bytesToRead int32, bytesRead *int32, callback *Callback) int32 {\n\treturn lookupResourceHandlerProxy(d.Base()).ReadResponse(d, dataOut, bytesToRead, bytesRead, callback)\n}", "func (o *GetServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *InteractionBindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewInteractionBindOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewInteractionBindNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewInteractionBindInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *InteractionUnbindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewInteractionUnbindOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewInteractionUnbindNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewInteractionUnbindInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (r *ResponseReader) ReadResponse(req *Request) (res *Response, err error) {\n\tres = CreateEmptyResponse(req)\n\t_, err = readFirstLine(r, res)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = readHeaders(r, res)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, err = readBodyContent(r, res)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn res, nil\n}", "func (c *Conn) ReadResponse(rmsg *Response) error {\n\tdata, err := c.ReadDataUnit()\n\tif err != nil {\n\t\treturn err\n\t}\n\tcolor.Printf(\"@{c}<!-- RESPONSE -->\\n%s\\n\\n\", string(data))\n\terr = xml.Unmarshal(data, rmsg)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// color.Fprintf(os.Stderr, \"@{y}%s\\n\", spew.Sprintf(\"%+v\", msg))\n\tif len(rmsg.Results) != 0 {\n\t\tr := rmsg.Results[0]\n\t\tif r.IsError() {\n\t\t\treturn r\n\t\t}\n\t}\n\treturn nil\n}", "func (o *VerifyConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewVerifyConnectionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetAvailableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetAvailableOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *ClosePositionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewClosePositionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewClosePositionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewClosePositionUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewClosePositionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 405:\n\t\tresult := NewClosePositionMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *DescribeServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDescribeServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewDescribeServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewDescribeServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 409:\n\t\tresult := NewDescribeServerConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewDescribeServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetServerSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetServerSessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetServerSessionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewGetServerSessionUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetServerSessionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewGetServerSessionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /dsmcontroller/namespaces/{namespace}/servers/{podName}/session returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "func (o *StartReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewStartOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (resp *PharosResponse) readResponse() {\n\tif !resp.hasBeenRead && resp.Response != nil && resp.Response.Body != nil {\n\t\tresp.data, resp.Error = ioutil.ReadAll(resp.Response.Body)\n\t\tresp.Response.Body.Close()\n\t\tresp.hasBeenRead = true\n\t}\n}", "func (o *HelloWorldReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHelloWorldOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewHelloWorldBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewHelloWorldInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (reader *BasicRpcReader) ReadResponse(r io.Reader, method string, requestID int32, resp proto.Message) error {\n\trrh := &hadoop.RpcResponseHeaderProto{}\n\terr := readRPCPacket(r, rrh, resp)\n\tif err != nil {\n\t\treturn err\n\t} else if int32(rrh.GetCallId()) != requestID {\n\t\treturn errors.New(\"unexpected sequence number\")\n\t} else if rrh.GetStatus() != hadoop.RpcResponseHeaderProto_SUCCESS {\n\t\treturn &NamenodeError{\n\t\t\tmethod: method,\n\t\t\tmessage: rrh.GetErrorMsg(),\n\t\t\tcode: int(rrh.GetErrorDetail()),\n\t\t\texception: rrh.GetExceptionClassName(),\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *UpdateAntivirusServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewUpdateAntivirusServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewUpdateAntivirusServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *HasEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHasEventsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewHasEventsUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewHasEventsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetV2OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewGetV2InternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SaveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewSaveNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewSaveInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *TestWriteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTestWriteOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewTestWriteUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *AllConnectionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewAllConnectionsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewAllConnectionsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewAllConnectionsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SendDataToDeviceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSendDataToDeviceOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewSendDataToDeviceBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewSendDataToDeviceInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *HealthNoopReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHealthNoopOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PutOutOfRotationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewPutOutOfRotationNoContent()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "func (o *GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *StatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewStatusOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewStatusUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewStatusForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *ReplaceServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewReplaceServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 202:\n\t\tresult := NewReplaceServerAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewReplaceServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewReplaceServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewReplaceServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func ReadResponse(r *bfe_bufio.Reader, req *Request) (*Response, error) {\n\ttp := textproto.NewReader(r)\n\tresp := &Response{\n\t\tRequest: req,\n\t}\n\n\t// Parse the first line of the response.\n\tline, 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\tf := strings.SplitN(line, \" \", 3)\n\tif len(f) < 2 {\n\t\treturn nil, &badStringError{\"malformed HTTP response\", line}\n\t}\n\treasonPhrase := \"\"\n\tif len(f) > 2 {\n\t\treasonPhrase = f[2]\n\t}\n\tresp.Status = f[1] + \" \" + reasonPhrase\n\tresp.StatusCode, err = strconv.Atoi(f[1])\n\tif err != nil {\n\t\treturn nil, &badStringError{\"malformed HTTP status code\", f[1]}\n\t}\n\n\tresp.Proto = f[0]\n\tvar ok bool\n\tif resp.ProtoMajor, resp.ProtoMinor, ok = ParseHTTPVersion(resp.Proto); !ok {\n\t\treturn nil, &badStringError{\"malformed HTTP version\", resp.Proto}\n\t}\n\n\t// Parse the response headers.\n\tmimeHeader, err := tp.ReadMIMEHeader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp.Header = Header(mimeHeader)\n\n\tfixPragmaCacheControl(resp.Header)\n\n\terr = readTransfer(resp, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (o *PostChatroomsChannelHashReadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostChatroomsChannelHashReadOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewPostChatroomsChannelHashReadForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *TogglePacketGeneratorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewTogglePacketGeneratorsCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *FrontPutBinaryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewFrontPutBinaryOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SystemPingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewSystemPingOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewSystemPingInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SendDummyAlertReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewSendDummyAlertOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewSendDummyAlertBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewSendDummyAlertNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetViewsConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetViewsConnectionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetViewsConnectionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *SyncCopyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSyncCopyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewSyncCopyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *PostPatientsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostPatientsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewPostPatientsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 405:\n\t\tresult := NewPostPatientsMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (c *Conn) readResponse(res *response_) error {\n\terr := c.readDataUnit()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = IgnoreEOF(scanResponse.Scan(c.decoder, res))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res.Result.IsError() {\n\t\treturn res.Result\n\t}\n\treturn nil\n}", "func (o *AllConnectionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n switch response.Code() {\n \n case 200:\n result := NewAllConnectionsOK()\n if err := result.readResponse(response, consumer, o.formats); err != nil {\n return nil, err\n }\n return result, nil\n \n case 400:\n result := NewAllConnectionsBadRequest()\n if err := result.readResponse(response, consumer, o.formats); err != nil {\n return nil, err\n }\n return nil, result\n \n case 404:\n result := NewAllConnectionsNotFound()\n if err := result.readResponse(response, consumer, o.formats); err != nil {\n return nil, err\n }\n return nil, result\n \n default:\n return nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n }\n}", "func (o *GetMsgVpnReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetMsgVpnOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewGetMsgVpnDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (r *Response) Read(p []byte) (n int, err error) {\n\n\tif r.Error != nil {\n\t\treturn -1, r.Error\n\t}\n\n\treturn r.RawResponse.Body.Read(p)\n}", "func (o *PostPciLinksMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostPciLinksMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostPciLinksMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *THSRAPIODFare2121Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTHSRAPIODFare2121OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewTHSRAPIODFare2121Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewTHSRAPIODFare2121NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *PostGatewayConnectNetaddressReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPostGatewayConnectNetaddressNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostGatewayConnectNetaddressDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *DNSGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDNSGetOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewDNSGetDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetGreetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetGreetStatusOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostAPIV2EventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostAPIV2EventsNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewPostAPIV2EventsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewPostAPIV2EventsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *CreateAntivirusServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCreateAntivirusServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewCreateAntivirusServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *PostCarsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostCarsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 405:\n\t\tresult := NewPostCarsMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *LogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewLogOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewLogNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *ChatGetConnectedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewChatGetConnectedOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewChatGetConnectedBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewChatGetConnectedUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewChatGetConnectedNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *WebModifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewWebModifyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 202:\n\t\tresult := NewWebModifyAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewWebModifyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetHyperflexServerModelsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetHyperflexServerModelsMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetHyperflexServerModelsMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewGetHyperflexServerModelsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *KillQueryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewKillQueryNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewKillQueryBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewKillQueryNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 422:\n\t\tresult := NewKillQueryUnprocessableEntity()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetProgressionViewReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetProgressionViewOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetProgressionViewBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *UpdateRackTopoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUpdateRackTopoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUpdateRackTopoBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *UtilTestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUtilTestOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetByUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetByUIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetByUIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetMeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetMeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewGetMeDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *Delete1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDelete1NoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDelete1NotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *RevokeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRevokeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewRevokeUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewRevokeNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostGatewayDisconnectNetaddressReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPostGatewayDisconnectNetaddressNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostGatewayDisconnectNetaddressDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetProtocolsUsingGETReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetProtocolsUsingGETOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *DestroySessionUsingPOSTReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDestroySessionUsingPOSTOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *CompleteTransactionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewCompleteTransactionNoContent()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "func (o *GetMapNameEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetMapNameEventsOK(o.writer)\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetMapNameEventsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *RecoveryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRecoveryOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewRecoveryInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetPeersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetPeersOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewGetPeersForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *InstallEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewInstallEventsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SetMemoRequiredReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSetMemoRequiredOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewSetMemoRequiredBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewSetMemoRequiredInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *UpdateRackTopoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUpdateRackTopoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUpdateRackTopoBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewUpdateRackTopoNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUpdateRackTopoInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetVoicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetVoicesOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PatchHyperflexServerModelsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPatchHyperflexServerModelsMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPatchHyperflexServerModelsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *BounceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tresult := NewBounceDefault(response.Code())\n\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.Code()/100 == 2 {\n\t\treturn result, nil\n\t}\n\treturn nil, result\n}", "func (o *PostHyperflexHxdpVersionsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostHyperflexHxdpVersionsMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostHyperflexHxdpVersionsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetObmsLibraryIdentifierReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetObmsLibraryIdentifierOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewGetObmsLibraryIdentifierNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewGetObmsLibraryIdentifierDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *DeleteApplianceRestoresMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDeleteApplianceRestoresMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDeleteApplianceRestoresMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewDeleteApplianceRestoresMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *UserQuerySessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUserQuerySessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUserQuerySessionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewUserQuerySessionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /sessionbrowser/namespaces/{namespace}/gamesession returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "func (o *GetDiscoverReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetDiscoverOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (r *overwriteConsumerReader) ReadResponse(resp runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tif r.forStatusCode == ForAllStatusCodes || resp.Code() == r.forStatusCode {\n\t\treturn r.requestReader.ReadResponse(resp, r.consumer)\n\t}\n\n\treturn r.requestReader.ReadResponse(resp, consumer)\n}", "func (o *UnclaimTrafficFilterLinkIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUnclaimTrafficFilterLinkIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUnclaimTrafficFilterLinkIDBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUnclaimTrafficFilterLinkIDInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetDebugRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetDebugRequestOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewGetDebugRequestNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *ChangeaspecificSpeedDialReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewChangeaspecificSpeedDialNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostMemoryArraysMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostMemoryArraysMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostMemoryArraysMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (c *Client) readResponse(conn net.Conn) ([]byte, error) {\n\tif c.Timeout > 0 {\n\t\t_ = conn.SetReadDeadline(time.Now().Add(c.Timeout))\n\t}\n\n\tproto := \"udp\"\n\tif _, ok := conn.(*net.TCPConn); ok {\n\t\tproto = \"tcp\"\n\t}\n\n\tif proto == \"udp\" {\n\t\tbufSize := c.UDPSize\n\t\tif bufSize == 0 {\n\t\t\tbufSize = dns.MinMsgSize\n\t\t}\n\t\tresponse := make([]byte, bufSize)\n\t\tn, err := conn.Read(response)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn response[:n], nil\n\t}\n\n\t// If we got here, this is a TCP connection\n\t// so we should read a 2-byte prefix first\n\treturn readPrefixed(conn)\n}", "func (o *PayReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPayOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewPayBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewPayNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 409:\n\t\tresult := NewPayConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested POST /platform/public/namespaces/{namespace}/payment/orders/{paymentOrderNo}/pay returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "func (o *CountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCountOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewCountBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostNodesIdentifierObmIdentifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201:\n\t\tresult := NewPostNodesIdentifierObmIdentifyCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewPostNodesIdentifierObmIdentifyNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewPostNodesIdentifierObmIdentifyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetInterpreterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetInterpreterOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetInterpreterNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *DeleteEventsEventIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewDeleteEventsEventIDNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewDeleteEventsEventIDUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewDeleteEventsEventIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *UtilityServiceReadyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUtilityServiceReadyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewUtilityServiceReadyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *HTTPGetPersistenceItemDataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHTTPGetPersistenceItemDataOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewHTTPGetPersistenceItemDataNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SubscriptionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSubscriptionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *PostEquipmentIoExpandersMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostEquipmentIoExpandersMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostEquipmentIoExpandersMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *FrontSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewFrontSessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (pr *PushedRequest) ReadResponse(ctx context.Context) (*http.Response, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\tpr.Cancel()\n\t\tpr.pushedStream.bufPipe.CloseWithError(ctx.Err())\n\t\treturn nil, ctx.Err()\n\tcase <-pr.pushedStream.peerReset:\n\t\treturn nil, pr.pushedStream.resetErr\n\tcase resErr := <-pr.pushedStream.resc:\n\t\tif resErr.err != nil {\n\t\t\tfmt.Println(resErr.err.Error())\n\t\t\tpr.Cancel()\n\t\t\tpr.pushedStream.bufPipe.CloseWithError(resErr.err)\n\t\t\treturn nil, resErr.err\n\t\t}\n\t\tresErr.res.Request = pr.Promise\n\t\tresErr.res.TLS = pr.pushedStream.cc.tlsState\n\t\treturn resErr.res, resErr.err\n\t}\n}", "func (o *GetZippedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tresult := NewGetZippedDefault(response.Code())\n\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.Code()/100 == 2 {\n\t\treturn result, nil\n\t}\n\treturn nil, result\n}", "func (o *DeleteFirmwareUpgradesMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDeleteFirmwareUpgradesMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDeleteFirmwareUpgradesMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewDeleteFirmwareUpgradesMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetEtherPhysicalPortsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetEtherPhysicalPortsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewGetEtherPhysicalPortsDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *ZoneStreamReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewZoneStreamOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *ByNamespaceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewByNamespaceOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewByNamespaceNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetRequestTrackerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetRequestTrackerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewGetRequestTrackerForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetRequestTrackerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}" ]
[ "0.7640225", "0.7607834", "0.75210214", "0.7509121", "0.74803215", "0.74724656", "0.7433606", "0.74244606", "0.7375357", "0.7367311", "0.73589337", "0.73551553", "0.7350114", "0.7347274", "0.7346054", "0.733966", "0.7336042", "0.73239547", "0.7315819", "0.73155594", "0.7310195", "0.730769", "0.72904205", "0.7287086", "0.72826135", "0.72742283", "0.7274111", "0.72655845", "0.726384", "0.7262403", "0.7255057", "0.72496617", "0.72492456", "0.72479755", "0.72409135", "0.7224629", "0.722366", "0.7219326", "0.7216009", "0.72122216", "0.72110355", "0.72099286", "0.7209348", "0.72004783", "0.71978456", "0.719778", "0.71926844", "0.7177653", "0.71745974", "0.71737057", "0.716626", "0.7155474", "0.71500206", "0.7149536", "0.7148374", "0.7143972", "0.7143686", "0.7141745", "0.71397567", "0.713703", "0.7136677", "0.7136661", "0.7135863", "0.7135147", "0.71337897", "0.71312535", "0.7124361", "0.7123878", "0.71200526", "0.7120036", "0.7119569", "0.71148854", "0.7104891", "0.7100936", "0.70989054", "0.70989", "0.70984536", "0.70977753", "0.709657", "0.70961034", "0.70941985", "0.70932794", "0.70886916", "0.70850074", "0.7083912", "0.7080819", "0.7078785", "0.70775825", "0.70765215", "0.7076268", "0.7070042", "0.70699906", "0.7068155", "0.7068122", "0.7066828", "0.70625323", "0.70621973", "0.70599294", "0.70577264", "0.7054454", "0.70509636" ]
0.0
-1
NewGetCertificatesOK creates a GetCertificatesOK with default headers values
func NewGetCertificatesOK() *GetCertificatesOK { return &GetCertificatesOK{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewGetCertificatesDefault(code int) *GetCertificatesDefault {\n\treturn &GetCertificatesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *KeyVaultClient) getCertificatesCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetCertificatesOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\tif options != nil && options.IncludePending != nil {\n\t\treqQP.Set(\"includePending\", strconv.FormatBool(*options.IncludePending))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (a *UserServiceApiService) GetCertificates(ctx _context.Context, username string) ApiGetCertificatesRequest {\n\treturn ApiGetCertificatesRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tusername: username,\n\t}\n}", "func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCertificatesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCertificatesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_certificates\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/1.0/certificates/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetCertificatesReader{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.(*GetCertificatesOK)\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 get_certificates: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func newCertGetCertificatesCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"get-certs\",\n\t\tAliases: []string{\"get\"},\n\t\tShort: \"run certificate GetCertificates gNOI RPC\",\n\t\tPreRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgApp.Config.SetLocalFlagsFromFile(cmd)\n\t\t},\n\t\tRunE: gApp.RunECertGetCertificates,\n\t\tSilenceUsage: true,\n\t}\n\tgApp.InitCertGetCertificatesFlags(cmd)\n\treturn cmd\n}", "func (a *CertificatesApiService) CertificatesGetInstance(ctx _context.Context, id string, localVarOptionals *CertificatesApiCertificatesGetInstanceOpts) (CertificateResponse, *_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 CertificateResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/certificates/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.FieldsCertificates.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields[certificates]\", parameterToString(localVarOptionals.FieldsCertificates.Value(), \"csv\"))\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, 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 == 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 == 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 == 404 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn 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}", "func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCertificatesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCertificatesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetCertificates\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/certificates\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetCertificatesReader{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.(*GetCertificatesOK), nil\n\n}", "func CreateDescribeCertificatesRequest() (request *DescribeCertificatesRequest) {\n\trequest = &DescribeCertificatesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"waf-openapi\", \"2019-09-10\", \"DescribeCertificates\", \"waf\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *CertificateOrdersClient) listCertificatesCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, options *CertificateOrdersClientListCertificatesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates\"\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 certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\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-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewCertificatesGetInstanceRequest(server string, id string, params *CertificatesGetInstanceParams) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"id\", runtime.ParamLocationPath, id)\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(\"/v1/certificates/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FieldsCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[certificates]\", runtime.ParamLocationQuery, *params.FieldsCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (client *WebAppsClient) listPublicCertificatesCreateRequest(ctx context.Context, resourceGroupName string, name string, options *WebAppsListPublicCertificatesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *KeyVaultClient) getDeletedCertificatesCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetDeletedCertificatesOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedcertificates\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\tif options != nil && options.IncludePending != nil {\n\t\treqQP.Set(\"includePending\", strconv.FormatBool(*options.IncludePending))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewCertificatesResponse(idTokenKeyPair *rsa.PrivateKey) *CertificatesResponse {\n\treturn &CertificatesResponse{\n\t\tKeys: []*CertificatesResponseKey{\n\t\t\t{\n\t\t\t\tKty: \"RSA\",\n\t\t\t\tAlg: \"RS256\",\n\t\t\t\tUse: \"sig\",\n\t\t\t\tKid: \"dummy\",\n\t\t\t\tE: base64.RawURLEncoding.EncodeToString(big.NewInt(int64(idTokenKeyPair.E)).Bytes()),\n\t\t\t\tN: base64.RawURLEncoding.EncodeToString(idTokenKeyPair.N.Bytes()),\n\t\t\t},\n\t\t},\n\t}\n}", "func (client *KeyVaultClient) getCertificateCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, options *KeyVaultClientGetCertificateOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/{certificate-version}\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\tif certificateVersion == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateVersion cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-version}\", url.PathEscape(certificateVersion))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewGetCertificateInfoOK() *GetCertificateInfoOK {\n\treturn &GetCertificateInfoOK{}\n}", "func NewListSSLCertificatesRequest(server string, params *ListSSLCertificatesParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/domain/v2alpha2/ssl-certificates\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif params.Page != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", *params.Page); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.PageSize != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page_size\", *params.PageSize); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.DnsZone != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"dns_zone\", *params.DnsZone); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.OrganizationId != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"organization_id\", *params.OrganizationId); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (a *CertificatesApiService) CertificatesCreateInstance(ctx _context.Context, certificateCreateRequest CertificateCreateRequest) (CertificateResponse, *_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 CertificateResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/certificates\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &certificateCreateRequest\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 == 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 == 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 == 409 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn 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}", "func (client *KeyVaultClient) getCertificateVersionsCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, options *KeyVaultClientGetCertificateVersionsOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/versions\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewGetSysteminfoGetcertOK() *GetSysteminfoGetcertOK {\n\treturn &GetSysteminfoGetcertOK{}\n}", "func NewCertificatesGetCollectionRequest(server string, params *CertificatesGetCollectionParams) (*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(\"/v1/certificates\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FilterCertificateType != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[certificateType]\", runtime.ParamLocationQuery, *params.FilterCertificateType); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterDisplayName != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[displayName]\", runtime.ParamLocationQuery, *params.FilterDisplayName); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterSerialNumber != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[serialNumber]\", runtime.ParamLocationQuery, *params.FilterSerialNumber); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterId != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[id]\", runtime.ParamLocationQuery, *params.FilterId); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Sort != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"sort\", runtime.ParamLocationQuery, *params.Sort); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[certificates]\", runtime.ParamLocationQuery, *params.FieldsCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Limit != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit\", runtime.ParamLocationQuery, *params.Limit); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func NewGetCertificatesNotFound() *GetCertificatesNotFound {\n\treturn &GetCertificatesNotFound{}\n}", "func (client *KeyVaultClient) getCertificateOperationCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, options *KeyVaultClientGetCertificateOperationOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/pending\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func CreateDescribeCertificatesResponse() (response *DescribeCertificatesResponse) {\n\tresponse = &DescribeCertificatesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func NewGetCertificatesUnauthorized() *GetCertificatesUnauthorized {\n\treturn &GetCertificatesUnauthorized{}\n}", "func (client *KeyVaultClient) getCertificateContactsCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetCertificateContactsOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/contacts\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewCertificatesCreateInstanceRequestWithBody(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(\"/v1/certificates\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\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}", "func NewGetOK() *GetOK {\n\treturn &GetOK{}\n}", "func NewGetConstructorOK() *GetConstructorOK {\n\treturn &GetConstructorOK{}\n}", "func NewGetSysteminfoGetcertOK(writer io.Writer) *GetSysteminfoGetcertOK {\n\treturn &GetSysteminfoGetcertOK{\n\n\t\tPayload: writer,\n\t}\n}", "func NewCertificatesCreateInstanceRequest(server string, body CertificatesCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCertificatesCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func (m *MockService) GetCertificates() *idp.CertificatesResponse {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetCertificates\")\n\tret0, _ := ret[0].(*idp.CertificatesResponse)\n\treturn ret0\n}", "func NewCertifyOK() *CertifyOK {\n\n\treturn &CertifyOK{}\n}", "func New(c *deis.Client, cert string, key string, name string) (api.Cert, error) {\n\treq := api.CertCreateRequest{Certificate: cert, Key: key, Name: name}\n\treqBody, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn api.Cert{}, err\n\t}\n\n\tres, reqErr := c.Request(\"POST\", \"/v2/certs/\", reqBody)\n\tif reqErr != nil && !deis.IsErrAPIMismatch(reqErr) {\n\t\treturn api.Cert{}, reqErr\n\t}\n\tdefer res.Body.Close()\n\n\tresCert := api.Cert{}\n\tif err = json.NewDecoder(res.Body).Decode(&resCert); err != nil {\n\t\treturn api.Cert{}, err\n\t}\n\n\treturn resCert, reqErr\n}", "func NewGetKeysOK() *GetKeysOK {\n\treturn &GetKeysOK{}\n}", "func New() *CertificateRequest {\n\treturn &CertificateRequest{\n\t\tKeyRequest: NewKeyRequest(),\n\t}\n}", "func (c *baseClient) New() *baseClient {\n\t// Copy headers\n\theader := make(http.Header)\n\tfor k, v := range c.header {\n\t\theader[k] = v\n\t}\n\n\treturn &baseClient{\n\t\thttpClient: c.httpClient,\n\t\tmethod: c.method,\n\t\turl: c.url,\n\t\theader: header,\n\t}\n}", "func NewCertificate(opts ...NewCertificateOption) *orchestrator.Certificate {\n\ttimeStamp := time.Date(2011, 7, 1, 0, 0, 0, 0, time.UTC)\n\tvar mockCertificate = &orchestrator.Certificate{\n\t\tId: testdata.MockCertificateID,\n\t\tName: testdata.MockCertificateName,\n\t\tCloudServiceId: testdata.MockCloudServiceID1,\n\t\tIssueDate: timeStamp.AddDate(-5, 0, 0).String(),\n\t\tExpirationDate: timeStamp.AddDate(5, 0, 0).String(),\n\t\tStandard: testdata.MockCertificateName,\n\t\tAssuranceLevel: testdata.AssuranceLevelHigh,\n\t\tCab: testdata.MockCertificateCab,\n\t\tDescription: testdata.MockCertificateDescription,\n\t\tStates: []*orchestrator.State{{\n\t\t\tState: testdata.MockStateState,\n\t\t\tTreeId: testdata.MockStateTreeID,\n\t\t\tTimestamp: timeStamp.String(),\n\t\t\tCertificateId: testdata.MockCertificateID,\n\t\t\tId: testdata.MockStateId,\n\t\t}},\n\t}\n\n\tfor _, o := range opts {\n\t\to(mockCertificate)\n\t}\n\n\treturn mockCertificate\n}", "func (c *Client) newCertificateRequest(req *api.CSRInfo) *csr.CertificateRequest {\n\tcr := csr.CertificateRequest{}\n\tif req != nil && req.Names != nil {\n\t\tcr.Names = req.Names\n\t}\n\tif req != nil && req.Hosts != nil {\n\t\tcr.Hosts = req.Hosts\n\t} else {\n\t\thostname, _ := os.Hostname()\n\t\tif hostname != \"\" {\n\t\t\tcr.Hosts = make([]string, 1)\n\t\t\tcr.Hosts[0] = hostname\n\t\t}\n\t}\n\tif req != nil && req.KeyRequest != nil {\n\t\tcr.KeyRequest = newCfsslBasicKeyRequest(req.KeyRequest)\n\t}\n\tif req != nil {\n\t\tcr.CA = req.CA\n\t\tcr.SerialNumber = req.SerialNumber\n\t}\n\treturn &cr\n}", "func NewGetServicesOK() *GetServicesOK {\n\n\treturn &GetServicesOK{}\n}", "func New(nodes []string, opts ...Option) (*Client, error) {\n\tvar options Options\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\tconf := api.DefaultConfig()\n\n\tconf.Scheme = options.Scheme\n\n\tif len(nodes) > 0 {\n\t\tconf.Address = nodes[0]\n\t}\n\n\ttlsConfig := api.TLSConfig{}\n\tif options.TLS.ClientCert != \"\" && options.TLS.ClientKey != \"\" {\n\t\ttlsConfig.CertFile = options.TLS.ClientCert\n\t\ttlsConfig.KeyFile = options.TLS.ClientKey\n\t}\n\n\tif options.TLS.ClientCaKeys != \"\" {\n\t\ttlsConfig.CAFile = options.TLS.ClientCaKeys\n\t}\n\n\tconf.TLSConfig = tlsConfig\n\n\tclient, err := api.NewClient(conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{client.KV()}, nil\n}", "func NewGetCertificateSitesDefault(code int) *GetCertificateSitesDefault {\n\treturn &GetCertificateSitesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetServicesDefault(code int) *GetServicesDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetServicesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func New(authToken string, locales []string) *Client {\n\tpool := x509.NewCertPool()\n\tpool.AppendCertsFromPEM([]byte(\"-----BEGIN CERTIFICATE-----\\nMIIL6TCCCtGgAwIBAgIQBigdNnW0H8yz/xj67Pj93zANBgkqhkiG9w0BAQsFADBw\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\\nd3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNz\\ndXJhbmNlIFNlcnZlciBDQTAeFw0xNDEyMDgwMDAwMDBaFw0xODAyMDYxMjAwMDBa\\nMGwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\\nYW4gRnJhbmNpc2NvMRUwEwYDVQQKEwxGYXN0bHksIEluYy4xGTAXBgNVBAMTEGEu\\nc3NsLmZhc3RseS5uZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDU\\nJUiQsaVP/vC4Mb3aJUmA9KnMQa7EJfjYLsE4F0VehrOp8jlSSXmQLELlUAwPp2F2\\nPNyB32DDOFBHZIYwFrApFEzsJdTKQUYk6xHPZOdYoIijpmfb5xRMdTjqxThGkk+k\\nhU0+ipPWiErJNRkapLgPwPD4ctd5X8rnKF8lMHIxx5Xhdg6PqZC3F7y45Nym2a3M\\n8xIKIkB77o1bkuDpGnV9ZESC/Yf9Mc4NmWrQjqQc+8yIabir+n7/YcM5UdUjZPNS\\nhgL4jLYVJ+KDRZcjIT/dXRZoPpJgRFL9NIep/eSAzQa3g659uW7tjN6tg5iQm4hw\\nksaWp+zfTAJc4IXNtlndAgMBAAGjggiBMIIIfTAfBgNVHSMEGDAWgBRRaP+QrwIH\\ndTzM2WVkYqISuFlyOzAdBgNVHQ4EFgQUwIj0Y03ka1Q28RLCtKWy4nN7FIgwggax\\nBgNVHREEggaoMIIGpIIQYS5zc2wuZmFzdGx5Lm5ldIISKi5hLnNzbC5mYXN0bHku\\nbmV0gg9mYXN0Lndpc3RpYS5jb22CEHB1cmdlLmZhc3RseS5uZXSCEm1pcnJvcnMu\\nZmFzdGx5Lm5ldIIOKi5wYXJzZWNkbi5jb22CDSouZmFzdHNzbC5uZXSCCXZveGVy\\nLmNvbYINd3d3LnZveGVyLmNvbYIOKi5maXJlYmFzZS5jb22CEHNpdGVzLnlhbW1l\\nci5jb22CGHNpdGVzLnN0YWdpbmcueWFtbWVyLmNvbYIPKi5za2ltbGlua3MuY29t\\nghMqLnNraW1yZXNvdXJjZXMuY29tghBjZG4udGhpbmdsaW5rLm1lggwqLmZpdGJp\\ndC5jb22CEiouaG9zdHMuZmFzdGx5Lm5ldIISY29udHJvbC5mYXN0bHkubmV0gg8q\\nLndpa2lhLWluYy5jb22CFSoucGVyZmVjdGF1ZGllbmNlLmNvbYILKi53aWtpYS5j\\nb22CEmYuY2xvdWQuZ2l0aHViLmNvbYIVKi5kaWdpdGFsc2Npcm9jY28ubmV0ggoq\\nLmV0c3kuY29tghAqLmV0c3lzdGF0aWMuY29tgg0qLmFkZHRoaXMuY29tghAqLmFk\\nZHRoaXNjZG4uY29tgg9mYXN0Lndpc3RpYS5uZXSCDnJhdy5naXRodWIuY29tgg93\\nd3cudXNlcmZveC5jb22CEyouYXNzZXRzLXlhbW1lci5jb22CGyouc3RhZ2luZy5h\\nc3NldHMteWFtbWVyLmNvbYIWYXNzZXRzLmh1Z2dpZXMtY2RuLm5ldIISb3JiaXQu\\nc2hhemFtaWQuY29tgg9hYm91dC5qc3Rvci5vcmeCFyouZ2xvYmFsLnNzbC5mYXN0\\nbHkubmV0gg13ZWIudm94ZXIuY29tgg9weXBpLnB5dGhvbi5vcmeCCyouMTJ3YnQu\\nY29tghJ3d3cuaG9sZGVyZGVvcmQubm+CGnNlY3VyZWQuaW5kbi5pbmZvbGlua3Mu\\nY29tghBwbGF5LnZpZHlhcmQuY29tghhwbGF5LXN0YWdpbmcudmlkeWFyZC5jb22C\\nFXNlY3VyZS5pbWcud2ZyY2RuLmNvbYIWc2VjdXJlLmltZy5qb3NzY2RuLmNvbYIQ\\nKi5nb2NhcmRsZXNzLmNvbYIVd2lkZ2V0cy5waW50ZXJlc3QuY29tgg4qLjdkaWdp\\ndGFsLmNvbYINKi43c3RhdGljLmNvbYIPcC5kYXRhZG9naHEuY29tghBuZXcubXVs\\nYmVycnkuY29tghJ3d3cuc2FmYXJpZmxvdy5jb22CEmNkbi5jb250ZW50ZnVsLmNv\\nbYIQdG9vbHMuZmFzdGx5Lm5ldIISKi5odWV2b3NidWVub3MuY29tgg4qLmdvb2Rl\\nZ2dzLmNvbYIWKi5mYXN0bHkucGljbW9ua2V5LmNvbYIVKi5jZG4ud2hpcHBsZWhp\\nbGwubmV0ghEqLndoaXBwbGVoaWxsLm5ldIIbY2RuLm1lZGlhMzQud2hpcHBsZWhp\\nbGwubmV0ghtjZG4ubWVkaWE1Ni53aGlwcGxlaGlsbC5uZXSCG2Nkbi5tZWRpYTc4\\nLndoaXBwbGVoaWxsLm5ldIIcY2RuLm1lZGlhOTEwLndoaXBwbGVoaWxsLm5ldIIO\\nKi5tb2RjbG90aC5jb22CDyouZGlzcXVzY2RuLmNvbYILKi5qc3Rvci5vcmeCDyou\\nZHJlYW1ob3N0LmNvbYIOd3d3LmZsaW50by5jb22CDyouY2hhcnRiZWF0LmNvbYIN\\nKi5oaXBtdW5rLmNvbYIaY29udGVudC5iZWF2ZXJicm9va3MuY28udWuCG3NlY3Vy\\nZS5jb21tb24uY3Nuc3RvcmVzLmNvbYIOd3d3LmpvaW5vcy5jb22CJXN0YWdpbmct\\nbW9iaWxlLWNvbGxlY3Rvci5uZXdyZWxpYy5jb22CDioubW9kY2xvdGgubmV0ghAq\\nLmZvdXJzcXVhcmUuY29tggwqLnNoYXphbS5jb22CCiouNHNxaS5uZXSCDioubWV0\\nYWNwYW4ub3JnggwqLmZhc3RseS5jb22CCXdpa2lhLmNvbYIKZmFzdGx5LmNvbYIR\\nKi5nYWR2ZW50dXJlcy5jb22CFnd3dy5nYWR2ZW50dXJlcy5jb20uYXWCFXd3dy5n\\nYWR2ZW50dXJlcy5jby51a4IJa3JlZG8uY29tghZjZG4tdGFncy5icmFpbmllbnQu\\nY29tghRteS5iaWxsc3ByaW5nYXBwLmNvbYIGcnZtLmlvMA4GA1UdDwEB/wQEAwIF\\noDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwdQYDVR0fBG4wbDA0oDKg\\nMIYuaHR0cDovL2NybDMuZGlnaWNlcnQuY29tL3NoYTItaGEtc2VydmVyLWc1LmNy\\nbDA0oDKgMIYuaHR0cDovL2NybDQuZGlnaWNlcnQuY29tL3NoYTItaGEtc2VydmVy\\nLWc1LmNybDBMBgNVHSAERTBDMDcGCWCGSAGG/WwBATAqMCgGCCsGAQUFBwIBFhxo\\ndHRwczovL3d3dy5kaWdpY2VydC5jb20vQ1BTMAgGBmeBDAECAjCBgwYIKwYBBQUH\\nAQEEdzB1MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTQYI\\nKwYBBQUHMAKGQWh0dHA6Ly9jYWNlcnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydFNI\\nQTJIaWdoQXNzdXJhbmNlU2VydmVyQ0EuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZI\\nhvcNAQELBQADggEBAKLWzbX7wSyjzE7BVMjLrHAaiz+WGSwrAPrQBJ29sqouu9gv\\nI7i2Ie6eiRb4YLMouy6D+ZNZ+RM+Hkjv+PZFxCcDRmaWi+74ha5d8O155gRJRPZ0\\nSy5SfD/8kqrJRfC+/D/KdQzOroD4sx6Qprs9lZ0IEn4CTf0YPNV+Cps37LsVyPJL\\nfjDlGIM5K3B/vtZfn2f8buQ9QyKiN0bc67GdCjih9dSrkQNkxJiEOwqiSjYtkdFO\\ndYpXF8d1rQKV7a6z2vJloDwilfXLLlUX7rA3qVu7r4EUfIsZgH7hgB4bbst7tx+7\\nPgUEq2334kKPVFpsxgsj5++k4lh7tNlakXiBUtw=\\n-----END CERTIFICATE-----\\n-----BEGIN CERTIFICATE-----\\nMIIEsTCCA5mgAwIBAgIQBOHnpNxc8vNtwCtCuF0VnzANBgkqhkiG9w0BAQsFADBs\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\\nd3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j\\nZSBFViBSb290IENBMB4XDTEzMTAyMjEyMDAwMFoXDTI4MTAyMjEyMDAwMFowcDEL\\nMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3\\nLmRpZ2ljZXJ0LmNvbTEvMC0GA1UEAxMmRGlnaUNlcnQgU0hBMiBIaWdoIEFzc3Vy\\nYW5jZSBTZXJ2ZXIgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2\\n4C/CJAbIbQRf1+8KZAayfSImZRauQkCbztyfn3YHPsMwVYcZuU+UDlqUH1VWtMIC\\nKq/QmO4LQNfE0DtyyBSe75CxEamu0si4QzrZCwvV1ZX1QK/IHe1NnF9Xt4ZQaJn1\\nitrSxwUfqJfJ3KSxgoQtxq2lnMcZgqaFD15EWCo3j/018QsIJzJa9buLnqS9UdAn\\n4t07QjOjBSjEuyjMmqwrIw14xnvmXnG3Sj4I+4G3FhahnSMSTeXXkgisdaScus0X\\nsh5ENWV/UyU50RwKmmMbGZJ0aAo3wsJSSMs5WqK24V3B3aAguCGikyZvFEohQcft\\nbZvySC/zA/WiaJJTL17jAgMBAAGjggFJMIIBRTASBgNVHRMBAf8ECDAGAQH/AgEA\\nMA4GA1UdDwEB/wQEAwIBhjAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw\\nNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2Vy\\ndC5jb20wSwYDVR0fBEQwQjBAoD6gPIY6aHR0cDovL2NybDQuZGlnaWNlcnQuY29t\\nL0RpZ2lDZXJ0SGlnaEFzc3VyYW5jZUVWUm9vdENBLmNybDA9BgNVHSAENjA0MDIG\\nBFUdIAAwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQ\\nUzAdBgNVHQ4EFgQUUWj/kK8CB3U8zNllZGKiErhZcjswHwYDVR0jBBgwFoAUsT7D\\naQP4v0cB1JgmGggC72NkK8MwDQYJKoZIhvcNAQELBQADggEBABiKlYkD5m3fXPwd\\naOpKj4PWUS+Na0QWnqxj9dJubISZi6qBcYRb7TROsLd5kinMLYBq8I4g4Xmk/gNH\\nE+r1hspZcX30BJZr01lYPf7TMSVcGDiEo+afgv2MW5gxTs14nhr9hctJqvIni5ly\\n/D6q1UEL2tU2ob8cbkdJf17ZSHwD2f2LSaCYJkJA69aSEaRkCldUxPUd1gJea6zu\\nxICaEnL6VpPX/78whQYwvwt/Tv9XBZ0k7YXDK/umdaisLRbvfXknsuvCnQsH6qqF\\n0wGjIChBWUMo0oHjqvbsezt3tkBigAVBRQHvFwY+3sAzm2fTYS5yh+Rp/BIAV0Ae\\ncPUeybQ=\\n-----END CERTIFICATE-----\\n\"))\n\treturn &Client{\n\t\tLocales: locales,\n\t\tauthToken: authToken,\n\t\tclient: &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\t\tRootCAs: pool,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\thost: fmt.Sprintf(\"https://%s\", ContentfulCDNURL),\n\t\tpool: pool,\n\t\tspaceID: \"ygx37epqlss8\",\n\t}\n}", "func NewGetCertificateSitesOK() *GetCertificateSitesOK {\n\treturn &GetCertificateSitesOK{}\n}", "func NewGetSectionOK() *GetSectionOK {\n\n\treturn &GetSectionOK{}\n}", "func newCertLoadCertificatesCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"load\",\n\t\tAliases: []string{\"load-certs\"},\n\t\tShort: \"run certificate LoadCertificates gNOI RPC\",\n\t\tPreRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgApp.Config.SetLocalFlagsFromFile(cmd)\n\t\t},\n\t\tRunE: gApp.RunELoadCerts,\n\t\tSilenceUsage: true,\n\t}\n\tgApp.InitCertLoadCertsFlags(cmd)\n\treturn cmd\n}", "func TestIntegration_Certificate_Create(t *testing.T) {\n\tc := qt.New(t)\n\ttoken := os.Getenv(\"PLANETSCALE_TOKEN\")\n\tc.Assert(token, qt.Not(qt.Equals), \"\", qt.Commentf(\"PLANETSCALE_TOKEN is not set\"))\n\n\torg := os.Getenv(\"PLANETSCALE_ORG\")\n\tc.Assert(org, qt.Not(qt.Equals), \"\", qt.Commentf(\"PLANETSCALE_ORG is not set\"))\n\n\tctx := context.Background()\n\n\tclient, err := NewClient(\n\t\tWithAccessToken(token),\n\t)\n\tc.Assert(err, qt.IsNil)\n\n\tpkey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tc.Assert(err, qt.IsNil)\n\n\tcert, err := client.Certificates.Create(ctx, &CreateCertificateRequest{\n\t\tOrganization: org,\n\t\tDatabaseName: \"fatihs-db\",\n\t\tBranch: \"development\",\n\t\tPrivateKey: pkey,\n\t})\n\tc.Assert(err, qt.IsNil)\n\n\tfmt.Printf(\"cert = %+v\\n\", cert)\n}", "func NewGetKeyPairsOK() *GetKeyPairsOK {\n\treturn &GetKeyPairsOK{}\n}", "func (client *CertificateOrdersClient) getCertificateCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, options *CertificateOrdersClientGetCertificateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}\"\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 certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.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-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func New(server *url.URL) *genclient.Fulcio {\n\trt := httptransport.New(server.Host, genclient.DefaultBasePath, []string{server.Scheme})\n\trt.Consumers[\"application/pem-certificate-chain\"] = runtime.TextConsumer()\n\treturn genclient.New(rt, strfmt.Default)\n}", "func New(cfg *config.Config) (c *Client) {\n\tc = &Client{\n\t\tapi: httpclient.NewHttpClient(),\n\t\tdebug: cfg.Debug,\n\t\tlastAt: time.Now().UTC(),\n\t\tsecret: cfg.APISecret,\n\t\turl: cfg.APIUrl,\n\t\tversion: cfg.APIVersion,\n\t\twait: 1 * time.Second,\n\t}\n\n\tc.api.Defaults(httpclient.Map{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/json\",\n\t\thttpclient.OPT_USERAGENT: \"go-crex24\",\n\t\t\"X-CREX24-API-KEY\": cfg.APIKey,\n\t})\n\tif c.debug {\n\t\tfmt.Println(\"X-CREX24-API-KEY:\", c.api.Headers[\"X-CREX24-API-KEY\"])\n\t\tfmt.Println(\"Client.api.Headers:\", c.api.Headers)\n\t}\n\treturn\n}", "func NewCreateCurrentAPISessionCertificateOK() *CreateCurrentAPISessionCertificateOK {\n\n\treturn &CreateCurrentAPISessionCertificateOK{}\n}", "func NewGetCertificatesServiceUnavailable() *GetCertificatesServiceUnavailable {\n\treturn &GetCertificatesServiceUnavailable{}\n}", "func NewGetCertificatesBadRequest() *GetCertificatesBadRequest {\n\treturn &GetCertificatesBadRequest{}\n}", "func NewGetBacsOK() *GetBacsOK {\n\treturn &GetBacsOK{}\n}", "func (client CertificateOrdersClient) GetCertificatesPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"certificateOrderName\": autorest.Encode(\"path\", certificateOrderName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2015-08-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func New(req *csr.CertificateRequest) (cert, csrPEM, key []byte, err error) {\n\tif req.CA != nil {\n\t\tif req.CA.Expiry != \"\" {\n\t\t\tCAPolicy.Default.ExpiryString = req.CA.Expiry\n\t\t\tCAPolicy.Default.Expiry, err = time.ParseDuration(req.CA.Expiry)\n\t\t}\n\n\t\tif req.CA.PathLength != 0 {\n\t\t\tsigner.MaxPathLen = req.CA.PathLength\n\t\t}\n\t}\n\n\tg := &csr.Generator{Validator: validator}\n\tcsrPEM, key, err = g.ProcessRequest(req)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to process request: %v\", err)\n\t\tkey = nil\n\t\treturn\n\t}\n\n\tpriv, err := helpers.ParsePrivateKeyPEM(key)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to parse private key: %v\", err)\n\t\treturn\n\t}\n\n\ts, err := local.NewSigner(priv, nil, signer.DefaultSigAlgo(priv), nil)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to create signer: %v\", err)\n\t\treturn\n\t}\n\ts.SetPolicy(CAPolicy)\n\n\tsignReq := signer.SignRequest{Hosts: req.Hosts, Request: string(csrPEM)}\n\tcert, err = s.Sign(signReq)\n\n\treturn\n\n}", "func (client *WebAppsClient) getPublicCertificateCreateRequest(ctx context.Context, resourceGroupName string, name string, publicCertificateName string, options *WebAppsGetPublicCertificateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif publicCertificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter publicCertificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{publicCertificateName}\", url.PathEscape(publicCertificateName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewGetKeyPairsDefault(code int) *GetKeyPairsDefault {\n\treturn &GetKeyPairsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (r *MacOSTrustedRootCertificateRequest) Get(ctx context.Context) (resObj *MacOSTrustedRootCertificate, 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}", "func (a *CertificatesApiService) CertificatesGetCollection(ctx _context.Context, localVarOptionals *CertificatesApiCertificatesGetCollectionOpts) (CertificatesResponse, *_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 CertificatesResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/certificates\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.FilterCertificateType.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[certificateType]\", parameterToString(localVarOptionals.FilterCertificateType.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FilterDisplayName.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[displayName]\", parameterToString(localVarOptionals.FilterDisplayName.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FilterSerialNumber.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[serialNumber]\", parameterToString(localVarOptionals.FilterSerialNumber.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FilterId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[id]\", parameterToString(localVarOptionals.FilterId.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Sort.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sort\", parameterToString(localVarOptionals.Sort.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FieldsCertificates.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields[certificates]\", parameterToString(localVarOptionals.FieldsCertificates.Value(), \"csv\"))\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/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 == 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 == 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\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}", "func NewGetConfigurationOK() *GetConfigurationOK {\n\treturn &GetConfigurationOK{}\n}", "func NewGetCompaniesOK() *GetCompaniesOK {\n\treturn &GetCompaniesOK{}\n}", "func NewCurrenciesGetOK() *CurrenciesGetOK {\n\treturn &CurrenciesGetOK{}\n}", "func (spec *Spec) fetchNewKeyPair() (*tls.Certificate, error) {\n\n\t// use exponential backoff rather than using cfssl's backoff implementation; that implementation\n\t// can back off up to an hour before returning control back to the invoker; that isn't\n\t// desirable. If we can't get the requests in in a timely fahsion, we'll wake up and\n\t// revisit via our own scheduling.\n\n\tb := backoff.NewExponentialBackOff()\n\tb.MaxElapsedTime = backoffMaxDelay\n\terr := backoff.Retry(\n\t\tfunc() error {\n\n\t\t\terr := spec.tr.RefreshKeys()\n\t\t\tif err != nil {\n\t\t\t\tSpecRequestFailureCount.WithLabelValues(spec.Path).Inc()\n\t\t\t\tif isAuthError(err) {\n\t\t\t\t\tlog.Errorf(\"spec %s: invalid auth key. Giving up\", spec)\n\t\t\t\t\terr = backoff.Permanent(errors.New(\"invalid auth key\"))\n\t\t\t\t} else {\n\t\t\t\t\tlog.Warningf(\"spec %s: failed fetching new cert: %s\", spec, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn err\n\t\t},\n\t\tb,\n\t)\n\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"while fetching certificate/key\")\n\t}\n\n\tpair, err := spec.tr.Provider.X509KeyPair()\n\tif err != nil {\n\t\tlog.Errorf(\"spec %s: likely internal error, fetched new cert/key but couldn't create a keypair from it: %s\", spec, err)\n\t}\n\treturn &pair, err\n}", "func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateClusterCertificatesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (c *CertificateClient) Get(ctx context.Context, idOrName string) (*Certificate, *Response, error) {\n\tif id, err := strconv.Atoi(idOrName); err == nil {\n\t\treturn c.GetByID(ctx, int(id))\n\t}\n\treturn c.GetByName(ctx, idOrName)\n}", "func NewNoClient() (authn.Keychain, error) {\n\treturn New(nil, Options{})\n}", "func (client *CertificateOrdersClient) getCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, options *CertificateOrdersClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}\"\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 certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\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-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func mkCert(a *PkiArgs) (pem.Block, pem.Block, error) {\n\tisX := a.isX\n\tisCA := a.isCA\n\tvalidFor := a.validFor\n\tvalidFrom := a.validFrom\n\tecdsaCurve := a.ecdsaCurve\n\thost := a.host\n\trsaBits := a.rsaBits\n\tparent := a.parent\n\tif len(host) == 0 {\n\t\tlog.Fatalf(\"Missing required --host parameter\")\n\t}\n\n\tpriv, err := mkKey(ecdsaCurve, rsaBits)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to generate private key: %s\", err)\n\t}\n\n\tvar notBefore time.Time\n\tif len(validFrom) == 0 {\n\t\tnotBefore = time.Now()\n\t} else {\n\t\tnotBefore, err = time.Parse(\"Jan 2 15:04:05 2006\", validFrom)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Failed to parse creation date: %s\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\tnotAfter := notBefore.Add(validFor)\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to generate serial number: %s\", err)\n\t}\n\n\ttemplate := &x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{\"xyz\"},\n\t\t},\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},\n\t\tBasicConstraintsValid: true,\n\t}\n\tif isX {\n\t\ttemplate.Subject.OrganizationalUnit = []string{\"X\"}\n\t}\n\n\thosts := strings.Split(host, \",\")\n\tfor _, h := range hosts {\n\t\tif ip := net.ParseIP(h); ip != nil {\n\t\t\ttemplate.IPAddresses = append(template.IPAddresses, ip)\n\t\t} else {\n\t\t\ttemplate.DNSNames = append(template.DNSNames, h)\n\t\t}\n\t}\n\n\tif isCA {\n\t\ttemplate.IsCA = true\n\t\ttemplate.KeyUsage |= x509.KeyUsageCertSign\n\t}\n\n\tif parent == nil {\n\t\tparent = template\n\t}\n\tderBytes, err := x509.CreateCertificate(rand.Reader, template, parent, publicKey(priv), priv)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create certificate: %s\", err)\n\t}\n\n\treturn pem.Block{Type: \"CERTIFICATE\", Bytes: derBytes}, *pemBlockForKey(priv), nil\n\n}", "func newAwsDmsCertificates(c *TrussleV1Client, namespace string) *awsDmsCertificates {\n\treturn &awsDmsCertificates{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "func NewGetVoicesOK() *GetVoicesOK {\n\treturn &GetVoicesOK{}\n}", "func (m *Manager) GetCertificates() (tls.Certificate, error) {\n\tif m.keyFileExists() && m.certFileExists() {\n\t\tlog.Println(\"Certificates already exists. Returning.\")\n\t\treturn tls.LoadX509KeyPair(\n\t\t\tm.path(m.creator.GetCertFileName()),\n\t\t\tm.path(m.creator.GetKeyFileName()),\n\t\t)\n\t}\n\n\tkey := m.creator.GenerateKey()\n\tcert := m.creator.GenerateCertificate(key)\n\tlog.Println(\"Successfully created certificates\")\n\tkeyPEM, certPEM, err := m.creator.KeyCertPEMBytes(key, cert)\n\tif err != nil {\n\t\treturn tls.Certificate{}, err\n\t}\n\n\treturn tls.X509KeyPair(certPEM, keyPEM)\n}", "func (client *KeyVaultClient) getCertificateIssuersCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetCertificateIssuersOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/issuers\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *Client) DescribeCertificatesWithChan(request *DescribeCertificatesRequest) (<-chan *DescribeCertificatesResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeCertificatesResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeCertificates(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func New(c *http.Client, r regions.Region, l locale.Locale, k, v string) (*Client, error) {\n\tif \"\" == k {\n\t\treturn nil, errors.ErrNoKeySupplied\n\t}\n\n\tif \"\" == v {\n\t\treturn nil, errors.ErrNoVersionSupplied\n\t}\n\n\tac := &Client{\n\t\tclient: &http.Client{Timeout: (10 * time.Second)},\n\t\tlocale: locale.AmericanEnglish,\n\t\tregion: regions.US,\n\t\tuserAgent: \"GoBattleNet/\" + v,\n\t\tkey: k,\n\t}\n\n\tif r.Int() > 5 {\n\t\treturn nil, errors.ErrUnsupportedArgument\n\t}\n\tif nil != c {\n\t\tac.client = c\n\t}\n\tif ac.locale != l {\n\t\tac.locale = l\n\t}\n\tif ac.region != r {\n\t\tac.region = r\n\t}\n\n\treturn ac, nil\n}", "func (client *Client) newGETRequest(url string) (*http.Request, error) {\n\trequest, err := http.NewRequest(\n\t\thttp.MethodGet,\n\t\turl,\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest.Header = http.Header{}\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\trequest.Header.Set(\"User-Agent\", client.userAgent)\n\n\treturn request, nil\n}", "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}", "func (sc *SuperChain) newCertificate(info CertInformation) *x509.Certificate {\n\treturn &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1653),\n\t\tSubject: pkix.Name{\n\t\t\tCountry: info.Country,\n\t\t\tOrganization: info.Organization,\n\t\t\tOrganizationalUnit: info.OrganizationalUnit,\n\t\t\tProvince: info.Province,\n\t\t\tStreetAddress: info.StreetAddress,\n\t\t},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().AddDate(10, 0, 0),\n\t\t//SubjectKeyId: info.SubjectKeyId,\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n\t\tKeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\t//EmailAddresses: info.EmailAddress,\n\t}\n}", "func (a *UserServiceApiService) GetCertificatesExecute(r ApiGetCertificatesRequest) (*os.File, *_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"UserServiceApiService.GetCertificates\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/users/{username}/certificates\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", _neturl.PathEscape(parameterToString(r.username, \"\")), -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\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, executionError\n}", "func NewGet(url string) *Request { return NewRequest(\"GET\", url) }", "func (s *Service) GetCertificates(parameters connection.APIRequestParameters) ([]Certificate, error) {\n\treturn connection.InvokeRequestAll(s.GetCertificatesPaginated, parameters)\n}", "func NewGetBicsOK() *GetBicsOK {\n\treturn &GetBicsOK{}\n}", "func (client *KeyVaultClient) getKeysCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetKeysOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/keys\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func newDefaultTLSConfig(cert *tls.Certificate) (*tls.Config, error) {\n\ttlsConfig := &tls.Config{\n\t\tMinVersion: tls.VersionTLS12,\n\t\t// Prioritize cipher suites sped up by AES-NI (AES-GCM)\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t},\n\t\tPreferServerCipherSuites: true,\n\t\t// Use curves which have assembly implementations\n\t\tCurvePreferences: []tls.CurveID{\n\t\t\ttls.CurveP256,\n\t\t\ttls.X25519,\n\t\t},\n\t\tCertificates: []tls.Certificate{*cert},\n\t\t// HTTP/2 must be enabled manually when using http.Serve\n\t\tNextProtos: []string{\"h2\"},\n\t}\n\ttlsConfig.BuildNameToCertificate()\n\treturn tlsConfig, nil\n}", "func NewGetCollectionsOK() *GetCollectionsOK {\n\treturn &GetCollectionsOK{}\n}", "func newCertRevokeCertificatesCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"revoke\",\n\t\tAliases: []string{\"revoke-certs\", \"rev\"},\n\t\tShort: \"run certificate RevokeCertificates gNOI RPC\",\n\t\tPreRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgApp.Config.SetLocalFlagsFromFile(cmd)\n\t\t},\n\t\tRunE: gApp.RunECertRevokeCertificates,\n\t\tSilenceUsage: true,\n\t}\n\tgApp.InitCertRevokeCertificatesFlags(cmd)\n\treturn cmd\n}", "func NewClusterNtpKeysGetOK() *ClusterNtpKeysGetOK {\n\treturn &ClusterNtpKeysGetOK{}\n}", "func (a *Client) ListDeviceCertificatesUsingGET(params *ListDeviceCertificatesUsingGETParams, authInfo runtime.ClientAuthInfoWriter) (*ListDeviceCertificatesUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListDeviceCertificatesUsingGETParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listDeviceCertificatesUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/tenant/{tenantId}/devices/{deviceId}/authentications/clientCertificate\",\n\t\tProducesMediaTypes: []string{\"*/*\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &ListDeviceCertificatesUsingGETReader{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.(*ListDeviceCertificatesUsingGETOK)\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 listDeviceCertificatesUsingGET: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func GetCertificate(cl *tls.ClientHelloInfo) (*tls.Certificate, error) {\n\tpriv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttpl := &x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{\"shrubgateway local certificate\"},\n\t\t\tOrganizationalUnit: []string{userAndHostname},\n\t\t},\n\n\t\tNotAfter: time.Now().AddDate(0, 0, 20),\n\t\tNotBefore: time.Now().AddDate(0, 0, -1),\n\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t}\n\ttpl.DNSNames = append(tpl.DNSNames, cl.ServerName)\n\n\tpub := priv.PublicKey\n\tcert, err := x509.CreateCertificate(rand.Reader, tpl, caCert, &pub, caKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprivDER, err := x509.MarshalPKCS8PrivateKey(priv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprivPEM := pem.EncodeToMemory(&pem.Block{Type: \"PRIVATE KEY\", Bytes: privDER})\n\n\tcertPEM := pem.EncodeToMemory(&pem.Block{Type: \"CERTIFICATE\", Bytes: cert})\n\n\tcertificate, err := tls.X509KeyPair(certPEM, privPEM)\n\treturn &certificate, err\n}", "func (s *Service) GetCertificatesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Certificate], error) {\n\tbody, err := s.getCertificatesPaginatedResponseBody(parameters)\n\treturn connection.NewPaginated(body, parameters, s.GetCertificatesPaginated), err\n}", "func NewObjectsGetOK() *ObjectsGetOK {\n\treturn &ObjectsGetOK{}\n}", "func (gsp *GoogleServiceProvider) PublicCertificates(c context.Context) (certs []infoS.Certificate, err error) {\n\t// Lock around our certificates. If they are already resolved, then we can\n\t// quickly return them; otherwise, we will need to load them. This lock\n\t// prevents concurrent certificate accesses from resulting in multiple\n\t// remote resource requests.\n\tv, err := gsp.Cache.GetOrCreate(c, &infoPublicCertificatesKey, func() (interface{}, time.Duration, error) {\n\t\t// Request a certificate map from the Google x509 public certificte endpoint.\n\t\t//\n\t\t// Upon success, the result will be a map of key to PEM-encoded value.\n\t\turl := fmt.Sprintf(\"https://www.googleapis.com/robot/v1/metadata/x509/%s\", gsp.ServiceAccount)\n\t\treq, err := http.NewRequest(\"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn nil, 0, errors.Annotate(err, \"could not create HTTP request\").Err()\n\t\t}\n\t\treq = req.WithContext(c)\n\t\tresp, err := http.DefaultClient.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, 0, errors.Annotate(err, \"could not send request to %s\", url).Tag(transient.Tag).Err()\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn nil, 0, errors.Annotate(err, \"received HTTP %d from %s\", resp.StatusCode, url).Tag(transient.Tag).Err()\n\t\t}\n\n\t\tvar certMap map[string]string\n\t\tetr := errTrackingReader{resp.Body, nil}\n\t\tif err := json.NewDecoder(&etr).Decode(&certMap); err != nil {\n\t\t\tif etr.err != nil {\n\t\t\t\t// I/O error, mark as transient.\n\t\t\t\treturn nil, 0, errors.Annotate(err, \"could not read HTTP response body\").Tag(transient.Tag).Err()\n\t\t\t}\n\t\t\treturn nil, 0, errors.Annotate(err, \"could not decode HTTP response body\").Err()\n\t\t}\n\n\t\t// Populate our certificate array and sort by key for determinism.\n\t\tcerts := make([]infoS.Certificate, 0, len(certMap))\n\t\tfor key, data := range certMap {\n\t\t\tcerts = append(certs, infoS.Certificate{\n\t\t\t\tKeyName: key,\n\t\t\t\tData: []byte(data),\n\t\t\t})\n\t\t}\n\t\tsort.Slice(certs, func(i, j int) bool { return certs[i].KeyName < certs[j].KeyName })\n\t\treturn certs, 0, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn v.([]infoS.Certificate), nil\n}", "func NewGetPracticesDefault(code int) *GetPracticesDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetPracticesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func List(c *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := rootURL(c)\n\tif opts != nil {\n\t\tquery, err := opts.ToCertificateListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\tpager := pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn CertificatePage{pagination.SinglePageBase(r)}\n\t})\n\tpager.Headers = RequestOpts.MoreHeaders\n\treturn pager\n}", "func NewCertificateListOK() *CertificateListOK {\n\treturn &CertificateListOK{}\n}", "func (c *Client) newGetRequest(URLStr string) (*http.Request, error) {\n\trel, err := url.Parse(URLStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.baseURL.ResolveReference(rel)\n\n\t// Create a new get request with the url provided\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set the api key on the request\n\treq.Header.Set(apiKeyHeader, c.apiKey)\n\n\t// If we specify a user agent we override the current one\n\tif c.userAgent != \"\" {\n\t\treq.Header.Set(userAgentHeader, c.userAgent)\n\t}\n\treturn req, nil\n}", "func NewGetSessionInfoOK() *GetSessionInfoOK {\n\treturn &GetSessionInfoOK{}\n}", "func (a ClustersApi) ClustersUuidCertificatesCsrsGet(uuid string, body CsrsSpec) (*APIResponse, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/clusters/{uuid}/certificates/csrs\"\n\tpath = strings.Replace(path, \"{\"+\"uuid\"+\"}\", fmt.Sprintf(\"%v\", uuid), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication (basicAuth) required\n\n\t// http basic authentication required\n\tif a.Configuration.Username != \"\" || a.Configuration.Password != \"\" {\n\t\theaderParams[\"Authorization\"] = \"Basic \" + a.Configuration.GetBasicAuthEncodedString()\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tswitch reflect.TypeOf(body) {\n\tcase reflect.TypeOf(\"\"):\n\t\tpostBody = body\n\tdefault:\n\t\tpostBody = &body\n\t}\n\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\n\treturn NewAPIResponse(httpResponse.RawResponse), err\n}" ]
[ "0.6673921", "0.6581894", "0.6295672", "0.60956526", "0.59044915", "0.58004326", "0.57990485", "0.5771036", "0.5729628", "0.5683054", "0.56229717", "0.55816126", "0.5567462", "0.54375124", "0.54330987", "0.5421873", "0.53705937", "0.5366132", "0.53463846", "0.5340534", "0.53390545", "0.53267926", "0.53062314", "0.53042793", "0.52780503", "0.5266152", "0.52646655", "0.52297926", "0.52166086", "0.52140296", "0.52023876", "0.5197531", "0.5189734", "0.5185795", "0.5184542", "0.5182922", "0.51768506", "0.51703954", "0.5130643", "0.51017874", "0.5101331", "0.51000285", "0.5089685", "0.50879866", "0.5080311", "0.5070023", "0.5066422", "0.506159", "0.5058125", "0.50280523", "0.50241756", "0.50149095", "0.501274", "0.499924", "0.49862394", "0.49749514", "0.49744248", "0.49728242", "0.49691924", "0.4946343", "0.4938088", "0.4886608", "0.48828217", "0.4882128", "0.486976", "0.4856339", "0.48476335", "0.48415643", "0.4839012", "0.48370692", "0.4836938", "0.48318937", "0.4819626", "0.48175576", "0.48140916", "0.47942108", "0.47924423", "0.4791575", "0.47781837", "0.47747046", "0.47714332", "0.47635025", "0.4754134", "0.47525483", "0.47518542", "0.47514242", "0.47491953", "0.47458163", "0.47443", "0.4743636", "0.4733429", "0.47320995", "0.4731667", "0.47266805", "0.4721831", "0.4718913", "0.47089222", "0.47076714", "0.4703364" ]
0.6889356
1
NewGetCertificatesUnauthorized creates a GetCertificatesUnauthorized with default headers values
func NewGetCertificatesUnauthorized() *GetCertificatesUnauthorized { return &GetCertificatesUnauthorized{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewGetKeysUnauthorized() *GetKeysUnauthorized {\n\treturn &GetKeysUnauthorized{}\n}", "func NewCurrenciesGetUnauthorized() *CurrenciesGetUnauthorized {\n\treturn &CurrenciesGetUnauthorized{}\n}", "func NewGetUnauthorized(body *GetUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewGetTagsUnauthorized() *GetTagsUnauthorized {\n\treturn &GetTagsUnauthorized{}\n}", "func NewUnauthorized(cause error) Unauthorized { return Unauthorized(cause.Error()) }", "func NewGetCertificateSitesUnauthorized() *GetCertificateSitesUnauthorized {\n\treturn &GetCertificateSitesUnauthorized{}\n}", "func NewUnauthorized(err error, msg ...string) *Errs {\n\tif err == nil {\n\t\terr = ErrUnauthorized\n\t}\n\treturn &Errs{\n\t\tcodeHTTP: http.StatusUnauthorized,\n\t\terr: err,\n\t\tkind: trace(2),\n\t\tmessage: msg,\n\t}\n}", "func NewObjectsGetUnauthorized() *ObjectsGetUnauthorized {\n\treturn &ObjectsGetUnauthorized{}\n}", "func NewGetVCenterUsingGETUnauthorized() *GetVCenterUsingGETUnauthorized {\n\treturn &GetVCenterUsingGETUnauthorized{}\n}", "func (client *KeyVaultClient) getCertificatesCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetCertificatesOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\tif options != nil && options.IncludePending != nil {\n\t\treqQP.Set(\"includePending\", strconv.FormatBool(*options.IncludePending))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewGetGCUnauthorized() *GetGCUnauthorized {\n\treturn &GetGCUnauthorized{}\n}", "func NewGetApisUnauthorized() *GetApisUnauthorized {\n\n\treturn &GetApisUnauthorized{}\n}", "func NewGetCollectionsUnauthorized() *GetCollectionsUnauthorized {\n\treturn &GetCollectionsUnauthorized{}\n}", "func NewGetCertificatesDefault(code int) *GetCertificatesDefault {\n\treturn &GetCertificatesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetClientUnauthorized() *GetClientUnauthorized {\n\treturn &GetClientUnauthorized{}\n}", "func NewGetCardsUnauthorized() *GetCardsUnauthorized {\n\n\treturn &GetCardsUnauthorized{}\n}", "func NewUnauthorized(err error, msg string) error {\n\treturn &unauthorized{wrap(err, msg, \"\")}\n}", "func NewGetServiceLevelUnauthorized() *GetServiceLevelUnauthorized {\n\treturn &GetServiceLevelUnauthorized{}\n}", "func NewGetLanguagesUnauthorized() *GetLanguagesUnauthorized {\n\treturn &GetLanguagesUnauthorized{}\n}", "func NewGetBicsUnauthorized() *GetBicsUnauthorized {\n\treturn &GetBicsUnauthorized{}\n}", "func NewGetBucketsUnauthorized() *GetBucketsUnauthorized {\n\treturn &GetBucketsUnauthorized{}\n}", "func (a *UserServiceApiService) GetCertificates(ctx _context.Context, username string) ApiGetCertificatesRequest {\n\treturn ApiGetCertificatesRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tusername: username,\n\t}\n}", "func NewUnauthorized(res calcsvc.Unauthorized) Unauthorized {\n\tbody := Unauthorized(res)\n\treturn body\n}", "func NewGetClustersUnauthorized() *GetClustersUnauthorized {\n\treturn &GetClustersUnauthorized{}\n}", "func NewGetConfigurationUnauthorized() *GetConfigurationUnauthorized {\n\treturn &GetConfigurationUnauthorized{}\n}", "func NewGetControllerServiceUnauthorized() *GetControllerServiceUnauthorized {\n\treturn &GetControllerServiceUnauthorized{}\n}", "func NewGetKeyPairsUnauthorized() *GetKeyPairsUnauthorized {\n\treturn &GetKeyPairsUnauthorized{}\n}", "func NewCatalogGetUnauthorized() *CatalogGetUnauthorized {\n\treturn &CatalogGetUnauthorized{}\n}", "func NewGetIntrospectionUnauthorized() *GetIntrospectionUnauthorized {\n\treturn &GetIntrospectionUnauthorized{}\n}", "func newCertGetCertificatesCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"get-certs\",\n\t\tAliases: []string{\"get\"},\n\t\tShort: \"run certificate GetCertificates gNOI RPC\",\n\t\tPreRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgApp.Config.SetLocalFlagsFromFile(cmd)\n\t\t},\n\t\tRunE: gApp.RunECertGetCertificates,\n\t\tSilenceUsage: true,\n\t}\n\tgApp.InitCertGetCertificatesFlags(cmd)\n\treturn cmd\n}", "func (client *KeyVaultClient) getDeletedCertificatesCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetDeletedCertificatesOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedcertificates\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\tif options != nil && options.IncludePending != nil {\n\t\treqQP.Set(\"includePending\", strconv.FormatBool(*options.IncludePending))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCertificatesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCertificatesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_certificates\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/1.0/certificates/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetCertificatesReader{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.(*GetCertificatesOK)\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 get_certificates: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func NewGetBacsUnauthorized() *GetBacsUnauthorized {\n\treturn &GetBacsUnauthorized{}\n}", "func NewGetDockerRegistriesUnauthorized() *GetDockerRegistriesUnauthorized {\n\treturn &GetDockerRegistriesUnauthorized{}\n}", "func NewGetScannersUnauthorized() *GetScannersUnauthorized {\n\treturn &GetScannersUnauthorized{}\n}", "func NewGetCertificatesServiceUnavailable() *GetCertificatesServiceUnavailable {\n\treturn &GetCertificatesServiceUnavailable{}\n}", "func NewGetNodeUnauthorized() *GetNodeUnauthorized {\n\treturn &GetNodeUnauthorized{}\n}", "func NewInsuranceGetUnauthorized() *InsuranceGetUnauthorized {\n\treturn &InsuranceGetUnauthorized{}\n}", "func NewWeaviateThingsGetUnauthorized() *WeaviateThingsGetUnauthorized {\n\treturn &WeaviateThingsGetUnauthorized{}\n}", "func NewCreateCurrentAPISessionCertificateUnauthorized() *CreateCurrentAPISessionCertificateUnauthorized {\n\n\treturn &CreateCurrentAPISessionCertificateUnauthorized{}\n}", "func NewGetSepainstantUnauthorized() *GetSepainstantUnauthorized {\n\treturn &GetSepainstantUnauthorized{}\n}", "func NewPcloudImagesGetallUnauthorized() *PcloudImagesGetallUnauthorized {\n\treturn &PcloudImagesGetallUnauthorized{}\n}", "func NewGetServiceClassesUnauthorized() *GetServiceClassesUnauthorized {\n\treturn &GetServiceClassesUnauthorized{}\n}", "func NewPcloudPvminstancesGetUnauthorized() *PcloudPvminstancesGetUnauthorized {\n\treturn &PcloudPvminstancesGetUnauthorized{}\n}", "func NewGetAPIUnauthorized() *GetAPIUnauthorized {\n\treturn &GetAPIUnauthorized{}\n}", "func NewGetDeltaUnauthorized() *GetDeltaUnauthorized {\n\treturn &GetDeltaUnauthorized{}\n}", "func NewGetCertificatesNotFound() *GetCertificatesNotFound {\n\treturn &GetCertificatesNotFound{}\n}", "func NewGetCompanyUnauthorized(body *GetCompanyUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewGetCloudSystemMetricsUnauthorized() *GetCloudSystemMetricsUnauthorized {\n\treturn &GetCloudSystemMetricsUnauthorized{}\n}", "func NewGetAllProjectsUsingGETUnauthorized() *GetAllProjectsUsingGETUnauthorized {\n\treturn &GetAllProjectsUsingGETUnauthorized{}\n}", "func NewGetEntriesUnauthorized() *GetEntriesUnauthorized {\n\treturn &GetEntriesUnauthorized{}\n}", "func NewUnauthorized() *AppError {\n\treturn NewUnauthorizedR(StatusText(Unauthenticated))\n}", "func NewGetScannerUnauthorized() *GetScannerUnauthorized {\n\treturn &GetScannerUnauthorized{}\n}", "func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCertificatesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCertificatesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetCertificates\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/certificates\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetCertificatesReader{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.(*GetCertificatesOK), nil\n\n}", "func NewGetBannersUnauthorized() *GetBannersUnauthorized {\n\treturn &GetBannersUnauthorized{}\n}", "func NewGetControllerStatusUnauthorized() *GetControllerStatusUnauthorized {\n\treturn &GetControllerStatusUnauthorized{}\n}", "func NewGetUsersUnauthorized() *GetUsersUnauthorized {\n\treturn &GetUsersUnauthorized{}\n}", "func NewAuthPrivilegeRequestWithoutParam() *AuthPrivilegeRequest {\n\n return &AuthPrivilegeRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/management:authPrivilege\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "func NewGetSelLogServiceUnauthorized() *GetSelLogServiceUnauthorized {\n\treturn &GetSelLogServiceUnauthorized{}\n}", "func NewReplaceCertificatesV1CertificateSigningRequestUnauthorized() *ReplaceCertificatesV1CertificateSigningRequestUnauthorized {\n\n\treturn &ReplaceCertificatesV1CertificateSigningRequestUnauthorized{}\n}", "func NewGetCoreAPIVersionsUnauthorized() *GetCoreAPIVersionsUnauthorized {\n\n\treturn &GetCoreAPIVersionsUnauthorized{}\n}", "func NewGetCustomerGroupsUnauthorized() *GetCustomerGroupsUnauthorized {\n\treturn &GetCustomerGroupsUnauthorized{}\n}", "func NewGetGatewaysUnauthorized() *GetGatewaysUnauthorized {\n\treturn &GetGatewaysUnauthorized{}\n}", "func NewGetCertificateVerificationDetailsUnauthorized() *GetCertificateVerificationDetailsUnauthorized {\n\treturn &GetCertificateVerificationDetailsUnauthorized{}\n}", "func NewGetModelUnauthorized() *GetModelUnauthorized {\n\treturn &GetModelUnauthorized{}\n}", "func NewGetTerraformConfigurationSourcesUsingGET1Unauthorized() *GetTerraformConfigurationSourcesUsingGET1Unauthorized {\n\treturn &GetTerraformConfigurationSourcesUsingGET1Unauthorized{}\n}", "func NewGetClusterUnauthorized() *GetClusterUnauthorized {\n\n\treturn &GetClusterUnauthorized{}\n}", "func NewGetVulnerabilitiesAdditionUnauthorized() *GetVulnerabilitiesAdditionUnauthorized {\n\treturn &GetVulnerabilitiesAdditionUnauthorized{}\n}", "func NewCertificatesResponse(idTokenKeyPair *rsa.PrivateKey) *CertificatesResponse {\n\treturn &CertificatesResponse{\n\t\tKeys: []*CertificatesResponseKey{\n\t\t\t{\n\t\t\t\tKty: \"RSA\",\n\t\t\t\tAlg: \"RS256\",\n\t\t\t\tUse: \"sig\",\n\t\t\t\tKid: \"dummy\",\n\t\t\t\tE: base64.RawURLEncoding.EncodeToString(big.NewInt(int64(idTokenKeyPair.E)).Bytes()),\n\t\t\t\tN: base64.RawURLEncoding.EncodeToString(idTokenKeyPair.N.Bytes()),\n\t\t\t},\n\t\t},\n\t}\n}", "func NewPutNmsRefreshcertificateUnauthorized() *PutNmsRefreshcertificateUnauthorized {\n\treturn &PutNmsRefreshcertificateUnauthorized{}\n}", "func NewGetInternalconfigUnauthorized() *GetInternalconfigUnauthorized {\n\treturn &GetInternalconfigUnauthorized{}\n}", "func NewGetDatalinksUnauthorized() *GetDatalinksUnauthorized {\n\treturn &GetDatalinksUnauthorized{}\n}", "func NewGetAccessPoliciesUnauthorized() *GetAccessPoliciesUnauthorized {\n\treturn &GetAccessPoliciesUnauthorized{}\n}", "func NewGetCertificatesForbidden() *GetCertificatesForbidden {\n\treturn &GetCertificatesForbidden{}\n}", "func NewGetUserUnauthorized() *GetUserUnauthorized {\n\n\treturn &GetUserUnauthorized{}\n}", "func NewGetChannelsUnauthorized() *GetChannelsUnauthorized {\n\treturn &GetChannelsUnauthorized{}\n}", "func NewGetBicsIDUnauthorized() *GetBicsIDUnauthorized {\n\treturn &GetBicsIDUnauthorized{}\n}", "func NewGetScopeUnauthorized() *GetScopeUnauthorized {\n\treturn &GetScopeUnauthorized{}\n}", "func NewGetNamespaceUnauthorized() *GetNamespaceUnauthorized {\n\treturn &GetNamespaceUnauthorized{}\n}", "func NewGetNamespaceUnauthorized() *GetNamespaceUnauthorized {\n\treturn &GetNamespaceUnauthorized{}\n}", "func newCertRevokeCertificatesCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"revoke\",\n\t\tAliases: []string{\"revoke-certs\", \"rev\"},\n\t\tShort: \"run certificate RevokeCertificates gNOI RPC\",\n\t\tPreRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgApp.Config.SetLocalFlagsFromFile(cmd)\n\t\t},\n\t\tRunE: gApp.RunECertRevokeCertificates,\n\t\tSilenceUsage: true,\n\t}\n\tgApp.InitCertRevokeCertificatesFlags(cmd)\n\treturn cmd\n}", "func NewGetAllPodConfigClientUnauthorized() *GetAllPodConfigClientUnauthorized {\n\treturn &GetAllPodConfigClientUnauthorized{}\n}", "func NewGetCustomersUnauthorized() *GetCustomersUnauthorized {\n\treturn &GetCustomersUnauthorized{}\n}", "func NewGetDomainUsingGETUnauthorized() *GetDomainUsingGETUnauthorized {\n\treturn &GetDomainUsingGETUnauthorized{}\n}", "func NewGetTagUnauthorized() *GetTagUnauthorized {\n\treturn &GetTagUnauthorized{}\n}", "func NewGetDocumentUnauthorized() *GetDocumentUnauthorized {\n\n\treturn &GetDocumentUnauthorized{}\n}", "func NewGetEventsCollectionUnauthorized() *GetEventsCollectionUnauthorized {\n\treturn &GetEventsCollectionUnauthorized{}\n}", "func NewGetCertificatesBadRequest() *GetCertificatesBadRequest {\n\treturn &GetCertificatesBadRequest{}\n}", "func (client *KeyVaultClient) getCertificateCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, options *KeyVaultClientGetCertificateOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/{certificate-version}\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\tif certificateVersion == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateVersion cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-version}\", url.PathEscape(certificateVersion))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewGetCatalogEntriesUnauthorized() *GetCatalogEntriesUnauthorized {\n\treturn &GetCatalogEntriesUnauthorized{}\n}", "func (client *WebAppsClient) listPublicCertificatesCreateRequest(ctx context.Context, resourceGroupName string, name string, options *WebAppsListPublicCertificatesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *CertificateOrdersClient) listCertificatesCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, options *CertificateOrdersClientListCertificatesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates\"\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 certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\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-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewGetConfigurationSourceTreeUsingGETUnauthorized() *GetConfigurationSourceTreeUsingGETUnauthorized {\n\treturn &GetConfigurationSourceTreeUsingGETUnauthorized{}\n}", "func NewGetOrganizationsUnauthorized() *GetOrganizationsUnauthorized {\n\treturn &GetOrganizationsUnauthorized{}\n}", "func NewGetOneKeyspaceUnauthorized() *GetOneKeyspaceUnauthorized {\n\treturn &GetOneKeyspaceUnauthorized{}\n}", "func NewGetVSphereComputeResourcesUnauthorized() *GetVSphereComputeResourcesUnauthorized {\n\n\treturn &GetVSphereComputeResourcesUnauthorized{}\n}", "func NewDeleteCertificatesV1beta1CertificateSigningRequestUnauthorized() *DeleteCertificatesV1beta1CertificateSigningRequestUnauthorized {\n\treturn &DeleteCertificatesV1beta1CertificateSigningRequestUnauthorized{}\n}", "func (a *CertificatesApiService) CertificatesGetInstance(ctx _context.Context, id string, localVarOptionals *CertificatesApiCertificatesGetInstanceOpts) (CertificateResponse, *_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 CertificateResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/certificates/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.FieldsCertificates.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields[certificates]\", parameterToString(localVarOptionals.FieldsCertificates.Value(), \"csv\"))\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, 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 == 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 == 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 == 404 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn 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}", "func (client *KeyVaultClient) getCertificateVersionsCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, options *KeyVaultClientGetCertificateVersionsOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/versions\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewGetCertificatesOK() *GetCertificatesOK {\n\treturn &GetCertificatesOK{}\n}" ]
[ "0.6069156", "0.60184765", "0.5984533", "0.594668", "0.5893783", "0.5880136", "0.5875142", "0.5855541", "0.5835556", "0.582625", "0.5818686", "0.57626474", "0.57351273", "0.57169944", "0.5695136", "0.5680493", "0.5669121", "0.56593114", "0.5657335", "0.56566775", "0.5648874", "0.56372565", "0.5633948", "0.5628551", "0.5625127", "0.5618198", "0.56130034", "0.56031734", "0.55847085", "0.5575607", "0.5554253", "0.55370057", "0.5510337", "0.5463634", "0.5457734", "0.5422504", "0.53938055", "0.53878814", "0.53820604", "0.5368315", "0.53628826", "0.5355188", "0.53435844", "0.53336686", "0.5317821", "0.53115416", "0.5303545", "0.52975225", "0.5294346", "0.52895737", "0.5286209", "0.5277181", "0.52713543", "0.5260665", "0.5245815", "0.522805", "0.5220469", "0.5219038", "0.52146953", "0.52113795", "0.5200149", "0.51974565", "0.5174095", "0.5172459", "0.51721394", "0.516086", "0.5150971", "0.51498127", "0.5146589", "0.5137632", "0.5136588", "0.5132896", "0.5126398", "0.5105706", "0.51029736", "0.50765425", "0.5076108", "0.50689626", "0.50688696", "0.50688696", "0.50529283", "0.5051219", "0.505104", "0.5045925", "0.5045504", "0.50424457", "0.50368243", "0.503549", "0.50285", "0.5023293", "0.5022322", "0.5020985", "0.50178444", "0.5013786", "0.50137365", "0.5007023", "0.50054455", "0.49945876", "0.49903664", "0.49875233" ]
0.729196
0
NewGetCertificatesDefault creates a GetCertificatesDefault with default headers values
func NewGetCertificatesDefault(code int) *GetCertificatesDefault { return &GetCertificatesDefault{ _statusCode: code, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewGetCertificateSitesDefault(code int) *GetCertificateSitesDefault {\n\treturn &GetCertificateSitesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetServicesDefault(code int) *GetServicesDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetServicesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetCertificateVerificationDetailsDefault(code int) *GetCertificateVerificationDetailsDefault {\n\treturn &GetCertificateVerificationDetailsDefault{\n\t\t_statusCode: code,\n\t}\n}", "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}", "func NewFetcherDefault(l *logrusx.Logger, cancelAfter time.Duration, ttl time.Duration, opts ...FetcherOption) *FetcherDefault {\n\tf := &FetcherDefault{\n\t\tcancelAfter: cancelAfter,\n\t\tl: l,\n\t\tttl: ttl,\n\t\tkeys: make(map[string]jose.JSONWebKeySet),\n\t\tfetchedAt: make(map[string]time.Time),\n\t\tclient: httpx.NewResilientClient(httpx.ResilientClientWithConnectionTimeout(15 * time.Second)).StandardClient(),\n\t\tmux: cloudstorage.NewURLMux(),\n\t}\n\tfor _, o := range opts {\n\t\to(f)\n\t}\n\treturn f\n}", "func (a *UserServiceApiService) GetCertificates(ctx _context.Context, username string) ApiGetCertificatesRequest {\n\treturn ApiGetCertificatesRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tusername: username,\n\t}\n}", "func (client *KeyVaultClient) getCertificatesCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetCertificatesOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\tif options != nil && options.IncludePending != nil {\n\t\treqQP.Set(\"includePending\", strconv.FormatBool(*options.IncludePending))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (c MethodsCollection) DefaultGet() pDefaultGet {\n\treturn pDefaultGet{\n\t\tMethod: c.MustGet(\"DefaultGet\"),\n\t}\n}", "func newDefault(compilers Compilers) *Context {\n\tc := &Context{compilers, options{}}\n\t_ = defaultOptions(c)\n\treturn c\n}", "func newDefaultTLSConfig(cert *tls.Certificate) (*tls.Config, error) {\n\ttlsConfig := &tls.Config{\n\t\tMinVersion: tls.VersionTLS12,\n\t\t// Prioritize cipher suites sped up by AES-NI (AES-GCM)\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t},\n\t\tPreferServerCipherSuites: true,\n\t\t// Use curves which have assembly implementations\n\t\tCurvePreferences: []tls.CurveID{\n\t\t\ttls.CurveP256,\n\t\t\ttls.X25519,\n\t\t},\n\t\tCertificates: []tls.Certificate{*cert},\n\t\t// HTTP/2 must be enabled manually when using http.Serve\n\t\tNextProtos: []string{\"h2\"},\n\t}\n\ttlsConfig.BuildNameToCertificate()\n\treturn tlsConfig, nil\n}", "func NewSigningCertDefault(code int) *SigningCertDefault {\n\treturn &SigningCertDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *IpsecCaCertificateGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewGetKeyPairsDefault(code int) *GetKeyPairsDefault {\n\treturn &GetKeyPairsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetNodesDefault(code int) *GetNodesDefault {\n\treturn &GetNodesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetLibcVersionDefault(code int) *GetLibcVersionDefault {\n\treturn &GetLibcVersionDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *SecurityCertificateCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := SecurityCertificateCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func Default(u []*url.URL, s Handler, verbose bool) *GGet {\n\treturn &GGet{URLS: u, Strategy: s, r: &httpRetriever{}, Verbose: verbose}\n}", "func NewGetHyperflexVcenterConfigPoliciesDefault(code int) *GetHyperflexVcenterConfigPoliciesDefault {\n\treturn &GetHyperflexVcenterConfigPoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (a *CertificatesApiService) CertificatesGetInstance(ctx _context.Context, id string, localVarOptionals *CertificatesApiCertificatesGetInstanceOpts) (CertificateResponse, *_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 CertificateResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/certificates/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.FieldsCertificates.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields[certificates]\", parameterToString(localVarOptionals.FieldsCertificates.Value(), \"csv\"))\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, 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 == 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 == 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 == 404 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn 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}", "func NewDefaultClient(_ *http.Request) (Client, http.Header, error) {\n\treturn newClientWithOptions()\n}", "func (h *handler) newDefaultPubSubClient(ctx context.Context) (cev2.Client, error) {\n\t// Make a pubsub protocol for the CloudEvents client.\n\tp, err := pubsub.New(ctx,\n\t\tpubsub.WithProjectIDFromDefaultEnv(),\n\t\tpubsub.WithTopicIDFromDefaultEnv())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Use the pubsub prototol to make a new CloudEvents client.\n\treturn cev2.NewClientObserved(p,\n\t\tcev2.WithUUIDs(),\n\t\tcev2.WithTimeNow(),\n\t\tcev2.WithTracePropagation,\n\t)\n}", "func NewGetVulnerabilitiesDefault(code int) *GetVulnerabilitiesDefault {\n\treturn &GetVulnerabilitiesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetCertificatesOK() *GetCertificatesOK {\n\treturn &GetCertificatesOK{}\n}", "func NewGetCertificatesOK() *GetCertificatesOK {\n\treturn &GetCertificatesOK{}\n}", "func setDefaultCredentials(t *testing.T, p *KeyMgrBasedProvider, caKey crypto.PrivateKey, caCert *x509.Certificate) (crypto.PrivateKey, *x509.Certificate) {\n\tkey, err := p.CreateDefaultKeyPair(keymgr.ECDSA256)\n\tAssertOk(t, err, \"Error creating default keypair\")\n\tcert := getCert(t, \"client\", key, caKey, caCert)\n\terr = p.SetDefaultCertificate(cert)\n\tAssertOk(t, err, \"Error setting default certificate\")\n\treturn key, cert\n}", "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}", "func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCertificatesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCertificatesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_certificates\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/1.0/certificates/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetCertificatesReader{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.(*GetCertificatesOK)\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 get_certificates: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func NewGetPingDefault(code int) *GetPingDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetPingDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetPracticesDefault(code int) *GetPracticesDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetPracticesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func DefaultGetHTTPClient() *http.Client {\n\tif InsecureTLS {\n\t\treturn &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true}}}\n\t}\n\treturn &http.Client{}\n}", "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}", "func NewGetVersionDefault(code int) *GetVersionDefault {\n\treturn &GetVersionDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetNetworkPoolsDefault(code int) *GetNetworkPoolsDefault {\n\treturn &GetNetworkPoolsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetMeDefault(code int) *GetMeDefault {\n\treturn &GetMeDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetMeetupsDefault(code int) *GetMeetupsDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetMeetupsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetTemplatesLibraryIdentifierDefault(code int) *GetTemplatesLibraryIdentifierDefault {\n\treturn &GetTemplatesLibraryIdentifierDefault{\n\t\t_statusCode: code,\n\t}\n}", "func Default() *WebClient {\n\t// From a zapcore.Core, it's easy to construct a Logger.\n\tlog := logger.Console()\n\n\treturn &WebClient{\n\t\tAuthentication: false,\n\t\tTransactionID: time.Now().String(),\n\t\tUserAgent: \"testAgent\",\n\t\tContentType: \"application/json; charset=utf-8\",\n\t\tAccept: AcceptJson,\n\t\tDebug: true,\n\t\tlog: log,\n\t}\n}", "func UnsafeNewDefaultClient() (*Client, error) {\n\treturn dialClient(DefaultAddr())\n}", "func NewGetPciLinksDefault(code int) *GetPciLinksDefault {\n\treturn &GetPciLinksDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetLicenseSmartlicenseTokensDefault(code int) *GetLicenseSmartlicenseTokensDefault {\n\treturn &GetLicenseSmartlicenseTokensDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client IdentityClient) getTagDefault(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/tagDefaults/{tagDefaultId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response GetTagDefaultResponse\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}", "func NewGetHostGroupsDefault(code int) *GetHostGroupsDefault {\n\treturn &GetHostGroupsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client IdentityClient) GetTagDefault(ctx context.Context, request GetTagDefaultRequest) (response GetTagDefaultResponse, 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.getTagDefault, 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 = GetTagDefaultResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = GetTagDefaultResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(GetTagDefaultResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into GetTagDefaultResponse\")\n\t}\n\treturn\n}", "func DefaultClientCertPool(client AccessCache, clusterName string) (*x509.CertPool, int64, error) {\n\treturn ClientCertPool(client, clusterName, types.HostCA, types.UserCA)\n}", "func newCertGetCertificatesCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"get-certs\",\n\t\tAliases: []string{\"get\"},\n\t\tShort: \"run certificate GetCertificates gNOI RPC\",\n\t\tPreRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgApp.Config.SetLocalFlagsFromFile(cmd)\n\t\t},\n\t\tRunE: gApp.RunECertGetCertificates,\n\t\tSilenceUsage: true,\n\t}\n\tgApp.InitCertGetCertificatesFlags(cmd)\n\treturn cmd\n}", "func NewGetCwfNetworkIDHaPairsDefault(code int) *GetCwfNetworkIDHaPairsDefault {\n\treturn &GetCwfNetworkIDHaPairsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *SecurityCertificateCollectionGetParams) WithDefaults() *SecurityCertificateCollectionGetParams {\n\to.SetDefaults()\n\treturn o\n}", "func NewClientDefault(endpoint string) *Client {\n\treturn NewClient(endpoint, DefaultStreamOptions)\n}", "func NewGetPublishersDefault(code int) *GetPublishersDefault {\n\treturn &GetPublishersDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDefaultCertificationConfig() *NewCertConfig {\n\treturn &NewCertConfig{\n\t\tIsCA: false,\n\t\tIsWaldcard: true,\n\n\t\tLifeTime: DefaultCertLifeTime,\n\t\tKeyType: DefaultKeyType,\n\t\tKeyLength: DefaultKeyLength,\n\n\t\tCertTemplate: GetCertTemplate(nil, nil),\n\t}\n}", "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}", "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}", "func DefaultHeadersEnforcer() *HeadersEnforcer {\n\treturn &HeadersEnforcer{\n\t\tCheckers: []*HeaderChecker{XGoogClientHeaderChecker},\n\t}\n}", "func NewGetHyperflexAutoSupportPoliciesDefault(code int) *GetHyperflexAutoSupportPoliciesDefault {\n\treturn &GetHyperflexAutoSupportPoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetHyperflexNodeProfilesDefault(code int) *GetHyperflexNodeProfilesDefault {\n\treturn &GetHyperflexNodeProfilesDefault{\n\t\t_statusCode: code,\n\t}\n}", "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}", "func NewGetCloudServiceNamePcaPcaServiceNameUsageDefault(code int) *GetCloudServiceNamePcaPcaServiceNameUsageDefault {\n\treturn &GetCloudServiceNamePcaPcaServiceNameUsageDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *KeyVaultClient) getDeletedCertificatesCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientGetDeletedCertificatesOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedcertificates\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\tif options != nil && options.IncludePending != nil {\n\t\treqQP.Set(\"includePending\", strconv.FormatBool(*options.IncludePending))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (a *Client) GetCertificates(params *GetCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCertificatesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCertificatesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetCertificates\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/certificates\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetCertificatesReader{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.(*GetCertificatesOK), nil\n\n}", "func NewGetVnicEthNetworkPoliciesDefault(code int) *GetVnicEthNetworkPoliciesDefault {\n\treturn &GetVnicEthNetworkPoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "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}", "func NewGetV0AuthCallbackDefault(code int) *GetV0AuthCallbackDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetV0AuthCallbackDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetIaasUcsdInfosDefault(code int) *GetIaasUcsdInfosDefault {\n\treturn &GetIaasUcsdInfosDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetProviderRegistersDefault(code int) *GetProviderRegistersDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetProviderRegistersDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetMsgVpnDefault(code int) *GetMsgVpnDefault {\n\treturn &GetMsgVpnDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetCertificatesNotFound() *GetCertificatesNotFound {\n\treturn &GetCertificatesNotFound{}\n}", "func DefaultClientOptions(endpoint, mtlsEndpoint, scope, userAgent string) ([]option.ClientOption, error) {\n\tvar o []option.ClientOption\n\t// Check the environment variables for the bigtable emulator.\n\t// Dial it directly and don't pass any credentials.\n\tif addr := os.Getenv(\"BIGTABLE_EMULATOR_HOST\"); addr != \"\" {\n\t\tconn, err := grpc.Dial(addr, grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"emulator grpc.Dial: %w\", err)\n\t\t}\n\t\to = []option.ClientOption{option.WithGRPCConn(conn)}\n\t} else {\n\t\to = []option.ClientOption{\n\t\t\tinternaloption.WithDefaultEndpoint(endpoint),\n\t\t\tinternaloption.WithDefaultMTLSEndpoint(mtlsEndpoint),\n\t\t\toption.WithScopes(scope),\n\t\t\toption.WithUserAgent(userAgent),\n\t\t}\n\t}\n\treturn o, nil\n}", "func DefaultHTTPClientFactory(cc *cli.Context) (*http.Client, error) {\n\tif cc == nil {\n\t\tlogrus.Panic(\"cli context has not been set\")\n\t}\n\tvar c http.Client\n\tcookieJar, _ := cookiejar.New(nil)\n\n\tif cc.GlobalIsSet(\"apiSession\") {\n\t\tvar cookies []*http.Cookie\n\t\tcookie := &http.Cookie{\n\t\t\tName: \"SESSION\",\n\t\t\tValue: cc.GlobalString(\"apiSession\"),\n\t\t}\n\t\tcookies = append(cookies, cookie)\n\t\tu, _ := url.Parse(os.Getenv(\"SPINNAKER_API\"))\n\t\tcookieJar.SetCookies(u, cookies)\n\t}\n\n\tc = http.Client{\n\t\tTimeout: time.Duration(cc.GlobalInt(\"clientTimeout\")) * time.Second,\n\t\tJar: cookieJar,\n\t}\n\n\tvar certPath string\n\tvar keyPath string\n\n\n\tif cc.GlobalIsSet(\"certPath\") {\n\t\tcertPath = cc.GlobalString(\"certPath\")\n\t} else if os.Getenv(\"SPINNAKER_CLIENT_CERT\") != \"\" {\n\t\tcertPath = os.Getenv(\"SPINNAKER_CLIENT_CERT\")\n\t} else {\n\t\tcertPath = \"\"\n\t}\n\tif cc.GlobalIsSet(\"keyPath\") {\n\t\tkeyPath = cc.GlobalString(\"keyPath\")\n\t} else if os.Getenv(\"SPINNAKER_CLIENT_KEY\") != \"\" {\n\t\tkeyPath = os.Getenv(\"SPINNAKER_CLIENT_KEY\")\n\t} else {\n\t\tkeyPath = \"\"\n\t}\n\tif cc.GlobalIsSet(\"iapToken\") {\n\t\tiapToken = cc.GlobalString(\"iapToken\")\n\t} else if os.Getenv(\"SPINNAKER_IAP_TOKEN\") != \"\" {\n\t\tiapToken = os.Getenv(\"SPINNAKER_IAP_TOKEN\")\n\t} else {\n\t\tiapToken = \"\"\n\t}\n\tc.Transport = &http.Transport{\n\t\tTLSClientConfig: &tls.Config{},\n\t}\n\n\tif certPath != \"\" && keyPath != \"\" {\n\t\tlogrus.Debug(\"Configuring TLS with pem cert/key pair\")\n\t\tcert, err := tls.LoadX509KeyPair(certPath, keyPath)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"loading x509 keypair\")\n\t\t}\n\n\t\tclientCA, err := ioutil.ReadFile(certPath)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"loading client CA\")\n\t\t}\n\n\t\tclientCertPool := x509.NewCertPool()\n\t\tclientCertPool.AppendCertsFromPEM(clientCA)\n\n\t\tc.Transport.(*http.Transport).TLSClientConfig.MinVersion = tls.VersionTLS12\n\t\tc.Transport.(*http.Transport).TLSClientConfig.PreferServerCipherSuites = true\n\t\tc.Transport.(*http.Transport).TLSClientConfig.Certificates = []tls.Certificate{cert}\n\t\tc.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = true\n\t}\n\n\tif cc.GlobalIsSet(\"insecure\") {\n\t\tc.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = true\n\t}\n\n\treturn &c, nil\n}", "func NewGetCardsDefault(code int) *GetCardsDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetCardsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDefaultContext() *ContextImpl {\n\treturn &ContextImpl{\n\t\tenv: make(map[string]string),\n\t\ttest: make(map[string]string),\n\t\ttestNumber: 0,\n\t\tcorrelationId: \"\",\n\t}\n}", "func DefaultCertProfile() *CertProfile {\n\treturn &CertProfile{\n\t\tDescription: \"default profile with Server and Client auth\",\n\t\tUsage: []string{\"signing\", \"key encipherment\", \"server auth\", \"client auth\"},\n\t\tExpiry: csr.Duration(8760 * time.Hour),\n\t\tBackdate: csr.Duration(10 * time.Minute),\n\t}\n}", "func NewDefaultClient(svcURL ServiceURL, containerName ContainerName) (*container.Client, error) {\n\treturn newCredInfoFromEnv().NewClient(svcURL, containerName)\n}", "func defaultClient(skipverify bool) *http.Client {\n\tclient := &http.Client{}\n\tclient.Transport = defaultTransport(skipverify)\n\treturn client\n}", "func GetDefaultHeaders() map[string]string {\n\treturn map[string]string{\n\t\t\"content-type\": \"application/json\",\n\t}\n}", "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}", "func NewGetProductsByIdsDefault(code int) *GetProductsByIdsDefault {\n\treturn &GetProductsByIdsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *KeyVaultClient) getCertificateVersionsCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, options *KeyVaultClientGetCertificateVersionsOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/versions\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Maxresults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.Maxresults), 10))\n\t}\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (o *BucketsCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := BucketsCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *IpsecCaCertificateGetParams) WithDefaults() *IpsecCaCertificateGetParams {\n\to.SetDefaults()\n\treturn o\n}", "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}", "func NewGetLocationsDefault(code int) *GetLocationsDefault {\n\treturn &GetLocationsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (s *defaultServicesrvc) Default(ctx context.Context, p *defaultservice.DefaultPayload) (err error) {\n\ts.logger.Print(\"defaultService.default\")\n\treturn\n}", "func NewDescribeDefault(code int) *DescribeDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &DescribeDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetAdapterConfigPoliciesDefault(code int) *GetAdapterConfigPoliciesDefault {\n\treturn &GetAdapterConfigPoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetPollersDefault(code int) *GetPollersDefault {\n\treturn &GetPollersDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewGetPassesDefault(code int) *GetPassesDefault {\n\treturn &GetPassesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDescribeClustersDefault(code int) *DescribeClustersDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &DescribeClustersDefault{\n\t\t_statusCode: code,\n\t}\n}", "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}", "func (client *KeyVaultClient) getCertificateCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, certificateVersion string, options *KeyVaultClientGetCertificateOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/{certificate-version}\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\tif certificateVersion == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateVersion cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-version}\", url.PathEscape(certificateVersion))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewDefault() Configuration {\n\tcfg := Configuration{\n\t\tEnableSyslog: false,\n\t\tEnableSSL: false,\n\t\tHttpRequestTimeout: 5,\n\t\tConnectTimeout: 5,\n\t\tClientTimeout: 50,\n\t\tClientFinTimeout: 50,\n\t\tServerTimeout: 50,\n\t\tTunnelTimeout: 3600,\n\t\tHttpKeepAliveTimeout: 60,\n\t}\n\n\treturn cfg\n}", "func ClientDefault(certPath, keyPath, caPath string) *tls.Config {\n\t// Load our TLS key pair to use for authentication\n\tcert, err := tls.LoadX509KeyPair(certPath, keyPath)\n\tif err != nil {\n\t\tlog.Fatalln(\"Unable to load cert\", err)\n\t}\n\n\t// Load our CA certificate\n\tclientCACert, err := ioutil.ReadFile(caPath)\n\tif err != nil {\n\t\tlog.Fatal(\"Unable to open cert\", err)\n\t}\n\n\t// Append client certificate to cert pool\n\tclientCertPool := x509.NewCertPool()\n\tclientCertPool.AppendCertsFromPEM(clientCACert)\n\n\t// Build default TLS configuration\n\tconfig := &tls.Config{\n\t\t// Perfect Forward Secrecy + ECDSA only\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\t},\n\t\t// Force server cipher suites\n\t\tPreferServerCipherSuites: true,\n\t\t// TLS 1.2 only\n\t\tMinVersion: tls.VersionTLS12,\n\t\t// Client certificate to use\n\t\tCertificates: []tls.Certificate{cert},\n\t\t// Root CA of the client certificate\n\t\tRootCAs: clientCertPool,\n\t}\n\n\t// Parse CommonName and SubjectAlternateName\n\tconfig.BuildNameToCertificate()\n\n\t// Return configuration\n\treturn config\n}", "func NewGetNetworkInterfacesDefault(code int) *GetNetworkInterfacesDefault {\n\treturn &GetNetworkInterfacesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func DefaultHTTPGet(url string) (*http.Response, error) {\n\treturn GetHTTPClient().Get(url)\n}", "func NewDefaultKubernetesAPI(cli *servicecatalog.SDK) *ServiceCatalogAPI {\n\treturn &ServiceCatalogAPI{\n\t\tSDK: cli,\n\t\tbrokersInProgress: make(map[string]bool),\n\t\tlock: &sync.Mutex{},\n\t}\n}", "func (c *HAProxyController) handleDefaultCert() {\n\tsecretAnn := c.Store.GetValueFromAnnotations(\"ssl-certificate\", c.Store.ConfigMaps.Main.Annotations)\n\tif secretAnn == \"\" {\n\t\treturn\n\t}\n\t_, err := c.Cfg.Certificates.HandleTLSSecret(c.Store, haproxy.SecretCtx{\n\t\tSecretPath: secretAnn,\n\t\tSecretType: haproxy.FT_DEFAULT_CERT,\n\t})\n\tlogger.Error(err)\n}", "func NewGetServerConfigImportsDefault(code int) *GetServerConfigImportsDefault {\n\treturn &GetServerConfigImportsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (a *CertificatesApiService) CertificatesGetCollection(ctx _context.Context, localVarOptionals *CertificatesApiCertificatesGetCollectionOpts) (CertificatesResponse, *_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 CertificatesResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/certificates\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.FilterCertificateType.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[certificateType]\", parameterToString(localVarOptionals.FilterCertificateType.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FilterDisplayName.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[displayName]\", parameterToString(localVarOptionals.FilterDisplayName.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FilterSerialNumber.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[serialNumber]\", parameterToString(localVarOptionals.FilterSerialNumber.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FilterId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"filter[id]\", parameterToString(localVarOptionals.FilterId.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Sort.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sort\", parameterToString(localVarOptionals.Sort.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.FieldsCertificates.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields[certificates]\", parameterToString(localVarOptionals.FieldsCertificates.Value(), \"csv\"))\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/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 == 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 == 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\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}", "func NewDefaultSelector() (*DefaultSelector, error) {\n\n\ts := &DefaultSelector{\n\t\tsources: make(map[string]*source),\n\t}\n\n\treturn s, nil\n}", "func DefaultHTTPClient() *http.Client {\n\tclient := cleanhttp.DefaultPooledClient()\n\tsetMinimumTLSVersion(client)\n\treturn client\n}", "func NewGetServiceClassesDefault(code int) *GetServiceClassesDefault {\n\treturn &GetServiceClassesDefault{\n\t\t_statusCode: code,\n\t}\n}" ]
[ "0.6492068", "0.6038393", "0.5947412", "0.5921476", "0.5890825", "0.5858678", "0.5837032", "0.5766716", "0.5745298", "0.57406324", "0.5736804", "0.5718784", "0.56776184", "0.5644565", "0.560516", "0.55997556", "0.55843914", "0.5572067", "0.55519444", "0.5492463", "0.54901046", "0.54817057", "0.54792464", "0.54792464", "0.5479154", "0.54649884", "0.5448181", "0.54389495", "0.54325634", "0.543256", "0.5432271", "0.5420124", "0.53930676", "0.53779125", "0.53529775", "0.53517854", "0.5350131", "0.5320173", "0.5308873", "0.53017855", "0.53016704", "0.5298467", "0.5297436", "0.5287823", "0.5268112", "0.52672756", "0.52628505", "0.5258945", "0.525816", "0.5248441", "0.52439415", "0.52402216", "0.52329785", "0.52300334", "0.5210169", "0.5205889", "0.5199131", "0.5197574", "0.5197412", "0.5179675", "0.5164667", "0.5164037", "0.51635635", "0.51558214", "0.5145377", "0.5139226", "0.51317984", "0.5129985", "0.5129982", "0.5111214", "0.50949514", "0.5090779", "0.50784224", "0.5077831", "0.5074081", "0.50646013", "0.50595385", "0.50507766", "0.5048311", "0.5044536", "0.5043769", "0.5036719", "0.50343454", "0.50340503", "0.503396", "0.50281864", "0.5027625", "0.50209713", "0.50204587", "0.50117123", "0.5011373", "0.50055134", "0.5000771", "0.4990097", "0.4985291", "0.49835315", "0.4981703", "0.4981031", "0.4980314", "0.49799347" ]
0.77617687
0
Code gets the status code for the get certificates default response
func (o *GetCertificatesDefault) Code() int { return o._statusCode }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *SigningCertDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetCertificateSitesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetCertificateVerificationDetailsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *PostClustersUUIDCertificatesPemkeyDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetCloudServiceNamePcaPcaServiceNameUsageDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetHyperflexVcenterConfigPoliciesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *CreateSecurityListDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetTemplatesLibraryIdentifierDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetIaasUcsdInfosDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetServicesServiceIDOperationsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *SecurityKeyManagerKeyServersCreateDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetKeyPairsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetHyperflexAutoSupportPoliciesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *IscsiCredentialsCollectionGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetLibcVersionDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetMeAPICredentialCredentialIDApplicationDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetDomainDataExtensionDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetAdapterConfigPoliciesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetHyperflexSysConfigPoliciesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetSSHPortalConnectionsIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetLicenseSmartlicenseTokensDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetHyperflexNodeProfilesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetFegLTENetworkIDSubscriberConfigBaseNamesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetSSHPoliciesMoidDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *NvmeServiceCollectionGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *QueryCombinedDeviceControlPolicyMembersDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *DNSGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetJobPolicyDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *LoginMessagesCollectionGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *ExtrasConfigContextsReadDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetCwfNetworkIDHaPairsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetMeDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetLocationsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetMsgVpnDistributedCachesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetObmsLibraryIdentifierDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetManagementControllersMoidDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetAppsAppIDOperationsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetProductsOffersDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *DescribeDNSServerOK) Code() int {\n\treturn 200\n}", "func (o *GetClusterOidcDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetStorageFlexUtilControllersDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetPolicyUUIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *PostOauthClientListDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetPciLinksDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *CatalogGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetPassesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetCatalogItemsUUIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetMsgVpnDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *RetrieveEmailsByCIDOK) Code() int {\n\treturn 200\n}", "func (o *GetProductsByIdsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *AddAPIDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetDatasourceByIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetVpsServiceNameActiveOptionsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *LdapGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetIOAUsersDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetServiceClassesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetProductListsByIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *CreateAntivirusServerDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetMsgVpnTopicEndpointDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *NvmeSubsystemMapCollectionGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *DeleteAPIKeyDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *ListVirtualCircuitsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetPublishersDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetTokenDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *ClusterNtpKeysGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetAuthRoleDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetRenterDownloadsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetIamAccountsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetVersionDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *NetgroupsSettingsCollectionGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *AccountingInfoDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetPollersDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetNodesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *DeleteCategoriesNameValueDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *AddTokenToServiceAccountDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetPollersIdentifierDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetVulnerabilitiesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetAPIFeaturesNameDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetStoragePureControllersMoidDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *ListSiteFilesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetOrganizationsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *DeleteCrossConnectDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetSitesByIDStoresByIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetTimestampResponseDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *FpolicyPolicyCreateDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetNiaapiApicSweolsMoidDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *VerifyConnectionOK) Code() int {\n\treturn 200\n}", "func (o *GetSummarySystemDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetRestapiV10DictionaryLanguageDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetVnicEthNetworkPoliciesDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetAvailableExtensionsUUIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *CreateSettingsReportingEulaItemDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *PortsetCollectionGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetCloudProjectServiceNameCreditDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetUserDetailsDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *FindVmsByFiltersDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetCustomObjectsByIDByIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *NvmeNamespaceCollectionGetDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetClusterByIDDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *GetHardwareDefault) Code() int {\n\treturn o._statusCode\n}" ]
[ "0.8140133", "0.8008336", "0.78887284", "0.74027616", "0.7359055", "0.73479146", "0.7278959", "0.7273327", "0.72344834", "0.72084475", "0.72031283", "0.71784645", "0.7156647", "0.7154274", "0.71473926", "0.71391135", "0.71152544", "0.7111224", "0.71073437", "0.71015143", "0.7099215", "0.7097732", "0.7089377", "0.70890856", "0.7083771", "0.7082634", "0.7069814", "0.7053151", "0.70523864", "0.7050802", "0.7048442", "0.70471615", "0.70459396", "0.70393944", "0.70388633", "0.7036431", "0.70352465", "0.7032265", "0.7023499", "0.70228034", "0.7018063", "0.70133764", "0.70051724", "0.69984585", "0.6992835", "0.69915074", "0.69824207", "0.69798243", "0.6977972", "0.69720125", "0.6970051", "0.69641703", "0.6963886", "0.69614553", "0.6961191", "0.6953277", "0.69403964", "0.69393486", "0.6936922", "0.6936469", "0.69359064", "0.69329697", "0.6929622", "0.6925449", "0.6925012", "0.69234365", "0.6921902", "0.6921749", "0.69166803", "0.6910096", "0.69004387", "0.6898842", "0.68837464", "0.6882525", "0.6881277", "0.6877345", "0.6870386", "0.6869587", "0.68690145", "0.6868657", "0.68649083", "0.6861547", "0.6861449", "0.6860687", "0.68597597", "0.6854306", "0.6852433", "0.6852194", "0.6849326", "0.6842219", "0.6841423", "0.683764", "0.6837558", "0.6833831", "0.68315125", "0.68275356", "0.68254477", "0.681525", "0.6809001", "0.68030435" ]
0.85207206
0
Deprecated: Use Build_Status.Descriptor instead.
func (Build_Status) EnumDescriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{3, 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ChangeStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v8_resources_change_status_proto_rawDescGZIP(), []int{0}\n}", "func (*Status) Descriptor() ([]byte, []int) {\n\treturn file_internal_status_v1_status_proto_rawDescGZIP(), []int{0}\n}", "func (*StatusList_Status) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{17, 0}\n}", "func (*BuildPredicate) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{8}\n}", "func (*InstanceStatus) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{29}\n}", "func (*RunDurationStatus) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{16}\n}", "func (*StatusAnnotation) Descriptor() ([]byte, []int) {\n\treturn file_udpa_annotations_status_proto_rawDescGZIP(), []int{0}\n}", "func (PackageVersionStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_udpa_annotations_status_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgTeamFanContentStatus_TeamStatus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{382, 0}\n}", "func (*ScheduleBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{6}\n}", "func (*StatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_servers_grpc_proto_grpcservice_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{5}\n}", "func (*PreparePlatformsStatus) Descriptor() ([]byte, []int) {\n\treturn file_idx_idx_proto_rawDescGZIP(), []int{3}\n}", "func (TargetState_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*StatusOk) Descriptor() ([]byte, []int) {\n\treturn file_Notification_proto_rawDescGZIP(), []int{1}\n}", "func (*S2CStatusChange) Descriptor() ([]byte, []int) {\n\treturn file_chat_proto_rawDescGZIP(), []int{11}\n}", "func (MergeStatus_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{31, 0}\n}", "func (RegistrationStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{1}\n}", "func (*ProvisioningApprovalRequest_Status) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha2_provisioning_approval_request_proto_rawDescGZIP(), []int{0, 1}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Status) Descriptor() ([]byte, []int) {\n\treturn file_graphsrv_proto_rawDescGZIP(), []int{0}\n}", "func (*StatusMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateTaskStatusContent) Descriptor() ([]byte, []int) {\n\treturn file_proto_activity_activity_proto_rawDescGZIP(), []int{2}\n}", "func (*MergeStatus) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{31}\n}", "func (*SharedMemoryControlRequest_Status) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{6, 3}\n}", "func (*Status) Descriptor() ([]byte, []int) {\n\treturn file_svr_chart_v1_chart_db_proto_rawDescGZIP(), []int{1}\n}", "func (*RevocationStatus) Descriptor() ([]byte, []int) {\n\treturn file_sa_proto_rawDescGZIP(), []int{42}\n}", "func (*HealthCheckStatus) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{0}\n}", "func (*InstrumentGroupStatus) Descriptor() ([]byte, []int) {\n\treturn file_openfeed_proto_rawDescGZIP(), []int{4}\n}", "func (Task_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*CheckerStatusV1) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{14}\n}", "func (*StatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{6}\n}", "func (*AgentStatus) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{18}\n}", "func (*GetBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{0}\n}", "func (*Status) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{5}\n}", "func (*BuildRange) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{9}\n}", "func (*JobStatus) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{21}\n}", "func (Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{0}\n}", "func (*OnlineStatus) Descriptor() ([]byte, []int) {\n\treturn file_chat_chat_proto_rawDescGZIP(), []int{3}\n}", "func (*CBroadcast_GetBuildClipStatus_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{34}\n}", "func (CheckStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{0}\n}", "func (ProjectState) EnumDescriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{15}\n}", "func (*CMsgTeamFanContentStatus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{382}\n}", "func (Order_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_nowa_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*Build) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_build_proto_rawDescGZIP(), []int{0}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*ProgramStatus) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{1}\n}", "func (*HealthCheckStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{2}\n}", "func (ProjectState) EnumDescriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{12}\n}", "func (*PatchAnnotationsStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{5}\n}", "func (Cluster_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_clickhouse_v1_cluster_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*GetCertificateStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_majordomo_proto_rawDescGZIP(), []int{22}\n}", "func (*CancelBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{7}\n}", "func (MenuItem_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_nowa_proto_rawDescGZIP(), []int{1, 0}\n}", "func (Container_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_v1_proto_rawDescGZIP(), []int{1, 0}\n}", "func (WebhookCall_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{7, 0}\n}", "func (Connector_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_kafka_v1_connector_proto_rawDescGZIP(), []int{10, 1}\n}", "func (WebhookCall_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*StatusList) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{17}\n}", "func (*StatusServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{9}\n}", "func (*Entity_CompatibilityStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{11, 0}\n}", "func (*ContainerStatus) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{16}\n}", "func (*AgentStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{17}\n}", "func (Severity) EnumDescriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{8}\n}", "func (*CMsgSetTeamFanContentStatus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{383}\n}", "func (*StatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{0}\n}", "func (*TaskRunStatus) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{8}\n}", "func (Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{1}\n}", "func (*HttpStatus) Descriptor() ([]byte, []int) {\n\treturn file_envoy_type_http_status_proto_rawDescGZIP(), []int{0}\n}", "func (*Status) Descriptor() ([]byte, []int) {\n\treturn file_quickkvpb_store_proto_rawDescGZIP(), []int{1}\n}", "func (*Build) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_api_bigquery_v1_attempt_proto_rawDescGZIP(), []int{2}\n}", "func (TryJob_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{1, 1}\n}", "func (ClientBatchListResponse_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_protobuf_client_batch_pb2_client_batch_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*SharedMemoryControlResponse_Status) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*ExperimentStatusEnum) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_enums_experiment_status_proto_rawDescGZIP(), []int{0}\n}", "func (*StatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_communication_proto_rawDescGZIP(), []int{4}\n}", "func (*Topic_StatusCode) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_topic_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*RequestStatus) Descriptor() ([]byte, []int) {\n\treturn file_request_status_proto_rawDescGZIP(), []int{0}\n}", "func (ListMessageTasksWithStatusRequest_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_service_message_task_proto_rawDescGZIP(), []int{9, 0}\n}", "func (*RepositoryVisibilityEnum) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{8}\n}", "func (Photo_MapsPublishStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_streetview_publish_v1_resources_proto_rawDescGZIP(), []int{6, 1}\n}", "func (*JobStatus) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{4}\n}", "func (GetExperimentStatusReply_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_keepsake_proto_rawDescGZIP(), []int{17, 0}\n}", "func (AssignmentFailure_Cause) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_backend_proto_rawDescGZIP(), []int{8, 0}\n}", "func (*ProjectMemberChange) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{83}\n}", "func (*GetTeamByShortName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{3}\n}", "func (NetworkLoadBalancer_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Project) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{76}\n}", "func (*DropBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{16}\n}", "func (*PubSubStatus) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{1}\n}", "func (*GetStatusCodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{26}\n}", "func (AdminMessage_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_openfeed_proto_rawDescGZIP(), []int{3, 0}\n}", "func (OperationMetadata_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*UpdateMessageTaskStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_message_task_proto_rawDescGZIP(), []int{4}\n}", "func (Build_BuildStep_Step) EnumDescriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{3, 0, 0}\n}", "func (GerritChange_SubmitStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_api_bigquery_v1_attempt_proto_rawDescGZIP(), []int{1, 0}\n}", "func (ManualRoll_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{7, 1}\n}", "func (*CMsgGCToClientEventStatusChanged) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{142}\n}", "func (*ProjectMemberChange) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{80}\n}" ]
[ "0.709652", "0.6562848", "0.6507734", "0.6481547", "0.64709866", "0.6410277", "0.6404652", "0.6358333", "0.6292383", "0.6284252", "0.6269581", "0.62691456", "0.624844", "0.6243975", "0.62367517", "0.62326294", "0.6232093", "0.62300944", "0.6227971", "0.6221214", "0.6218086", "0.62065", "0.6201542", "0.62011147", "0.6199456", "0.61973894", "0.61871225", "0.61735433", "0.6169824", "0.6169004", "0.6167833", "0.6167497", "0.61649835", "0.61627823", "0.6155957", "0.61543435", "0.6152023", "0.61427486", "0.61412525", "0.61360973", "0.61319166", "0.61318654", "0.61291313", "0.6125967", "0.6111708", "0.61047506", "0.61036944", "0.6103348", "0.6096201", "0.6095503", "0.6089841", "0.6087129", "0.607974", "0.60791415", "0.6074427", "0.606255", "0.6062003", "0.60574317", "0.60560995", "0.6049441", "0.60455877", "0.6045054", "0.6044168", "0.6043464", "0.604076", "0.6036559", "0.6035728", "0.60324657", "0.60227233", "0.60217065", "0.60171556", "0.6010065", "0.59990615", "0.5998619", "0.59812254", "0.5980391", "0.59798896", "0.5976112", "0.5971766", "0.596757", "0.59665537", "0.59618324", "0.59616953", "0.59614617", "0.59592515", "0.59581196", "0.5956448", "0.59556866", "0.5955208", "0.59472764", "0.59450674", "0.5943277", "0.594004", "0.59372234", "0.59364074", "0.59339017", "0.59328455", "0.59319115", "0.5931813", "0.5931319" ]
0.68893224
1
Deprecated: Use Build_BuildStep_Step.Descriptor instead.
func (Build_BuildStep_Step) EnumDescriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{3, 0, 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ExampleScenario_Process_Step) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_example_scenario_proto_rawDescGZIP(), []int{0, 3, 0}\n}", "func (*Build_BuildStep) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*Step) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{3}\n}", "func (*Step) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_synthetics_proto_rawDescGZIP(), []int{3}\n}", "func (*StepState) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{9}\n}", "func (*MigrationProgressEvent_PrepareStepDetails) Descriptor() ([]byte, []int) {\n\treturn file_google_datastore_admin_v1_migration_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*StepSpec) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_synthetics_proto_rawDescGZIP(), []int{4}\n}", "func (*Step) Descriptor() ([]byte, []int) {\n\treturn file_src_grpc_pipeline_proto_rawDescGZIP(), []int{4}\n}", "func (*Event_Path_Step) Descriptor() ([]byte, []int) {\n\treturn file_ml_metadata_proto_metadata_store_proto_rawDescGZIP(), []int{4, 0, 0}\n}", "func (*RouteLegStep) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{5}\n}", "func (*OperationMetadata_Step) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{1, 0}\n}", "func (MigrationStep) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_datastore_admin_v1_migration_proto_rawDescGZIP(), []int{1}\n}", "func (*StepFrame) Descriptor() ([]byte, []int) {\n\treturn file_game_game_proto_rawDescGZIP(), []int{3}\n}", "func (*PlanChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*GenerateProductMixIdeasRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsgDotaScenario_Building) Descriptor() ([]byte, []int) {\n\treturn file_dota_scenariomessages_proto_rawDescGZIP(), []int{6, 10}\n}", "func (*PlanChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*RouteLegStep_RouteLegStepLocalizedValues) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{5, 0}\n}", "func (*MigrationProgressEvent_RedirectWritesStepDetails) Descriptor() ([]byte, []int) {\n\treturn file_google_datastore_admin_v1_migration_proto_rawDescGZIP(), []int{1, 1}\n}", "func (*Debuggee) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{6}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*ExampleScenario_Process_Step_Operation) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_example_scenario_proto_rawDescGZIP(), []int{0, 3, 0, 0}\n}", "func (*GetTeamByShortName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{3}\n}", "func (*BuildPredicate) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{8}\n}", "func (*PlannedProduct) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{14}\n}", "func (*ExampleScenario_Process_Step_Alternative) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_example_scenario_proto_rawDescGZIP(), []int{0, 3, 0, 1}\n}", "func (*Targeting) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{12}\n}", "func (*PlanChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0}\n}", "func (*PlannableTargeting) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{6}\n}", "func (*Components) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{1}\n}", "func (*OldSystemTaskDetail) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{3}\n}", "func (*PlanChange_Current) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*Revision) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{0}\n}", "func (*RouteLegStepTravelAdvisory) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{3}\n}", "func (*ProjectMemberChange) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{83}\n}", "func (*Build) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_api_bigquery_v1_attempt_proto_rawDescGZIP(), []int{2}\n}", "func (*ProjectMemberChange) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{80}\n}", "func (*ProductMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{5}\n}", "func (*Trigger) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{37}\n}", "func (*RunWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_instances_proto_rawDescGZIP(), []int{15}\n}", "func (*LightstepConfig) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_trace_v3_lightstep_proto_rawDescGZIP(), []int{0}\n}", "func (*Pipeline) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{2}\n}", "func (*Run) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{1}\n}", "func (*TransformationStages) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_transformation_transformation_proto_rawDescGZIP(), []int{4}\n}", "func (*Projectile) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{7}\n}", "func (*BatchDedicatedResources) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1beta1_machine_resources_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*Action_Requirement) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{14, 0}\n}", "func (*DeferredArtifactPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{46}\n}", "func (*DeleteRevisionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{25}\n}", "func (*RouteLeg_StepsOverview) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*ScheduleBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{6}\n}", "func (*Workload) Descriptor() ([]byte, []int) {\n\treturn file_source_extensions_common_workload_discovery_discovery_proto_rawDescGZIP(), []int{0}\n}", "func (*ArtifactInformation) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{48}\n}", "func (*Ref) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{15}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (*SideInput) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{39}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (x *fastReflection_EventCreateBatch) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_EventCreateBatch\n}", "func (*CheckpointWorkload) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{0}\n}", "func (StandardRequirements_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{56, 0}\n}", "func (*ClassificationModule) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visualinspection_v1beta1_module_proto_rawDescGZIP(), []int{6}\n}", "func (*PlannableLocation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{2}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*RouteLegStepTransitDetails) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{6}\n}", "func (*CMsgDotaScenario_Entity) Descriptor() ([]byte, []int) {\n\treturn file_dota_scenariomessages_proto_rawDescGZIP(), []int{6, 11}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*Breakpoint) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{5}\n}", "func (*ValidateRefRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{31}\n}", "func (*GetConceptLanguageRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{48}\n}", "func (*Run) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{2}\n}", "func (IamSetupStep) EnumDescriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{0}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*ObjectDetectionModule) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visualinspection_v1beta1_module_proto_rawDescGZIP(), []int{4}\n}", "func (*SetStateSpec) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{16}\n}", "func (Run_State) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*PatchConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{50}\n}", "func (*CMsgDotaScenario_Team) Descriptor() ([]byte, []int) {\n\treturn file_dota_scenariomessages_proto_rawDescGZIP(), []int{6, 3}\n}", "func (*OldSystemTask) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{2}\n}", "func (*DistributionChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_distribution_change_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*GetTeamById) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*InstanceWorkflow) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_instances_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteTeam) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{5}\n}", "func (*GenerateProductMixIdeasResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{9}\n}", "func (*BuildInfra_Recipe) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_build_proto_rawDescGZIP(), []int{1, 3}\n}", "func (Build_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*HookExecution) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{21}\n}", "func (Breakpoint_Action) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{5, 0}\n}", "func (*LocalizationRefinementModule) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visualinspection_v1beta1_module_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*PlatformCategory) Descriptor() ([]byte, []int) {\n\treturn file_protos_platformProduct_proto_rawDescGZIP(), []int{5}\n}", "func (*StandardArtifacts) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{40}\n}", "func (*DistributionChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_distribution_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*BatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3}\n}", "func (*DevicePipeline) Descriptor() ([]byte, []int) {\n\treturn file_src_grpc_pipeline_proto_rawDescGZIP(), []int{3}\n}" ]
[ "0.6538765", "0.65263826", "0.65126556", "0.6457255", "0.64488053", "0.6425982", "0.6421707", "0.6384156", "0.6375354", "0.60371774", "0.60193056", "0.600345", "0.59762996", "0.5976226", "0.59348834", "0.591339", "0.588161", "0.58551365", "0.58263856", "0.5812678", "0.5803728", "0.58033", "0.5801248", "0.5800573", "0.5787155", "0.57806563", "0.5774339", "0.5768991", "0.5768263", "0.57459486", "0.57252544", "0.5718707", "0.5708659", "0.57026625", "0.5699061", "0.5696587", "0.56803966", "0.56786865", "0.5667544", "0.5655181", "0.5642044", "0.5636143", "0.56345576", "0.56321", "0.563046", "0.5617055", "0.56167245", "0.5613827", "0.561129", "0.56038797", "0.5601496", "0.5599691", "0.5596782", "0.5594225", "0.55835956", "0.55789775", "0.5573986", "0.5573425", "0.55730224", "0.5570728", "0.5564613", "0.55563027", "0.55527514", "0.55512863", "0.5544969", "0.5544946", "0.55405605", "0.5540139", "0.55386883", "0.55343723", "0.55325985", "0.5530938", "0.55273", "0.55262506", "0.55256546", "0.55256546", "0.5524368", "0.5514814", "0.5511206", "0.5511111", "0.5510882", "0.5510014", "0.5507151", "0.5505248", "0.5501524", "0.54996455", "0.5498548", "0.5497348", "0.5496937", "0.54960394", "0.54920614", "0.5485403", "0.5485066", "0.54818195", "0.5480964", "0.5479289", "0.5478199", "0.54777634", "0.54774886", "0.5477189" ]
0.6232996
9
Deprecated: Use GetLogsRequest.ProtoReflect.Descriptor instead.
func (*GetLogsRequest) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*LogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{12}\n}", "func (*LogRequest) Descriptor() ([]byte, []int) {\n\treturn file_logs_proto_rawDescGZIP(), []int{1}\n}", "func (*GetWorkflowInstanceLogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_ingress_get_instance_logs_proto_rawDescGZIP(), []int{0}\n}", "func (*GetLogEntriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{4}\n}", "func (*LogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{9}\n}", "func (*LogMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{59}\n}", "func (*TailLogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{12}\n}", "func (*LogTraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{7}\n}", "func (*RecentMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{16}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*MemberLoginLogDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{61}\n}", "func (*ExportLogsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_experimental2_proto_collector_logs_v1_logs_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*GetChangesRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_pb_watcher_proto_rawDescGZIP(), []int{1}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*MemberLoginLogListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{56}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*MemberLoginLogUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{59}\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*ListCommitsLogRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{23}\n}", "func (*SubscribeDownloadLogFileRequest) Descriptor() ([]byte, []int) {\n\treturn file_log_files_proto_rawDescGZIP(), []int{2}\n}", "func (*LogRequest) Descriptor() ([]byte, []int) {\n\treturn file_pb_packet_packet_proto_rawDescGZIP(), []int{1}\n}", "func (*InputDisconnect) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{10}\n}", "func (*GetByTargetRequest) Descriptor() ([]byte, []int) {\n\treturn file_audit_proto_rawDescGZIP(), []int{2}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*GetMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_lte_protos_sms_orc8r_proto_rawDescGZIP(), []int{4}\n}", "func (*GetLogConsistencyProofRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{1}\n}", "func (*FindWebhookCallRequest) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{9}\n}", "func (*ConfigRequest_V1_System_Log) Descriptor() ([]byte, []int) {\n\treturn file_config_deployment_config_request_proto_rawDescGZIP(), []int{0, 0, 0, 1}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*GetTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteHTTPAccessLogPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_http_access_log_policy_proto_rawDescGZIP(), []int{8}\n}", "func (*GetLogAuditProofRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{3}\n}", "func (*GetEntriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_log_files_proto_rawDescGZIP(), []int{0}\n}", "func (*GetLogsResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{2}\n}", "func (*CollectRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{0}\n}", "func (*SaveLogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_nearby_share_service_proto_rawDescGZIP(), []int{12}\n}", "func (*ConfigRequest_V1_System_GatherLogs) Descriptor() ([]byte, []int) {\n\treturn file_config_deployment_config_request_proto_rawDescGZIP(), []int{0, 0, 0, 2}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_telemetry_telemetry_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberLoginLogAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{54}\n}", "func (*LoadStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_load_stats_v3_lrs_proto_rawDescGZIP(), []int{0}\n}", "func (*LogEntryProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{8}\n}", "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_v2_trace_proto_rawDescGZIP(), []int{4}\n}", "func (*WebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{0}\n}", "func (*GetChannelMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{9}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*UpdateHTTPAccessLogPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_http_access_log_policy_proto_rawDescGZIP(), []int{5}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_collector_collector_proto_rawDescGZIP(), []int{3}\n}", "func (*DiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{2}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (*WatchLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{7}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*FindWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{3}\n}", "func (*FindWebhookCallRequest) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{7}\n}", "func (*SetWorkflowEventLoggingRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{36}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_comments_proto_rawDescGZIP(), []int{3}\n}", "func (*GetModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{94}\n}", "func (*InstancesTruncateLogRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{34}\n}", "func (*CBroadcast_WebRTCStopped_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{47}\n}", "func (*FindEnabledHTTPAccessLogPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_http_access_log_policy_proto_rawDescGZIP(), []int{6}\n}", "func (*EventsRequest) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{23}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{14}\n}", "func (*MetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "func (*CDOTABroadcastMsg_LANLobbyRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_broadcastmessages_proto_rawDescGZIP(), []int{1}\n}", "func (*ListConversationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{6}\n}", "func (*StateMachineLogEntryProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{6}\n}", "func (*ListChannelMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{56}\n}", "func (*GetWatchlistRequest) Descriptor() ([]byte, []int) {\n\treturn file_golang_pkg_proto_movies_movies_proto_rawDescGZIP(), []int{1}\n}", "func (*ChannelActivity) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteWalletLedgerRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{10}\n}", "func (*LogHeadRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{0}\n}", "func (*InputAccept) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{3}\n}", "func (*GetWorkflowInstanceLogsResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_ingress_get_instance_logs_proto_rawDescGZIP(), []int{1}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{46}\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (*GetFlowsRequest) Descriptor() ([]byte, []int) {\n\treturn file_observer_observer_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*GetMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{11}\n}", "func (*QueryRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_micro_mall_logistics_proto_logistics_business_logistics_business_proto_rawDescGZIP(), []int{3}\n}", "func (*DelRequest) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{8}\n}", "func (*GetDebugEventsRequest) Descriptor() ([]byte, []int) {\n\treturn file_observer_observer_proto_rawDescGZIP(), []int{6}\n}", "func (*ListTrendingMetricsViewsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{172}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_newfindmaxpb_newfindmaxpb_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgClientToGCRequestEventPointLogResponseV2_LogEntry) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{195, 0}\n}", "func (*WatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{0}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{142}\n}", "func (*DescribePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*GetDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{3}\n}", "func (*QueryPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_permission_pb_request_proto_rawDescGZIP(), []int{0}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*MarginLevelsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_trading_proto_rawDescGZIP(), []int{49}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*FindWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{2}\n}", "func (*ListLeaderboardRecordsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{61}\n}", "func (*CreateHTTPAccessLogPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_http_access_log_policy_proto_rawDescGZIP(), []int{3}\n}" ]
[ "0.6980138", "0.68969274", "0.6882508", "0.68544525", "0.6782681", "0.67215997", "0.66705775", "0.655103", "0.6456645", "0.6423279", "0.6388427", "0.63671786", "0.63276255", "0.63096905", "0.6298179", "0.6296077", "0.62869066", "0.6286843", "0.62805337", "0.62641364", "0.62611914", "0.6259864", "0.62493914", "0.62443185", "0.6241589", "0.62392175", "0.6235132", "0.6231907", "0.6231085", "0.6228094", "0.6226723", "0.62237537", "0.62216073", "0.62164754", "0.6209784", "0.6203855", "0.61912775", "0.6166309", "0.6154033", "0.6150414", "0.61473316", "0.6144167", "0.61433655", "0.612932", "0.612368", "0.6122067", "0.612204", "0.61212873", "0.61204165", "0.6118889", "0.6114713", "0.6107031", "0.6097134", "0.60967225", "0.60925287", "0.6091751", "0.60855573", "0.60759133", "0.60723406", "0.6066761", "0.6064683", "0.60602933", "0.6057054", "0.60502124", "0.6047058", "0.6043469", "0.60424185", "0.60387355", "0.6028579", "0.6023907", "0.6021079", "0.6019569", "0.6017406", "0.60172343", "0.60145974", "0.60141045", "0.60140026", "0.60102236", "0.6008872", "0.6006728", "0.60020113", "0.5999933", "0.5999696", "0.59992504", "0.59946644", "0.5993312", "0.5992767", "0.599067", "0.59880495", "0.598289", "0.5982648", "0.5977291", "0.5976843", "0.5969294", "0.5968779", "0.5968675", "0.5965748", "0.59656745", "0.59655577", "0.5961588" ]
0.7080634
0
Deprecated: Use Log.ProtoReflect.Descriptor instead.
func (*Log) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_v2_trace_proto_rawDescGZIP(), []int{4}\n}", "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{5}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*GrpcLogRecord) Descriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0}\n}", "func (*LogEntryProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{8}\n}", "func (*StateMachineLogEntryProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{6}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{14}\n}", "func (*InputDisconnect) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{10}\n}", "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_logs_proto_rawDescGZIP(), []int{0}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*LogTraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{7}\n}", "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_proto_fandncloud_service_user_user_proto_rawDescGZIP(), []int{2}\n}", "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_trf_proto_rawDescGZIP(), []int{1}\n}", "func (*StackTrace) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{2}\n}", "func (*LogRequest) Descriptor() ([]byte, []int) {\n\treturn file_logs_proto_rawDescGZIP(), []int{1}\n}", "func (*TruncatableString) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{4}\n}", "func (*Logging) Descriptor() ([]byte, []int) {\n\treturn file_google_api_logging_proto_rawDescGZIP(), []int{0}\n}", "func (*GrpcLogRecord_Address) Descriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*LogEntry) Descriptor() ([]byte, []int) {\n\treturn file_confact_proto_rawDescGZIP(), []int{4}\n}", "func (*YAMLLog) Descriptor() ([]byte, []int) {\n\treturn file_logging_Logging_proto_rawDescGZIP(), []int{4}\n}", "func (*ChannelActivity) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{0}\n}", "func (*LogMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{59}\n}", "func (*GrpcLogRecord_Metadata) Descriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*OpLog) Descriptor() ([]byte, []int) {\n\treturn file_proto_meme_proto_rawDescGZIP(), []int{11}\n}", "func (*Span) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*LogRecord) Descriptor() ([]byte, []int) {\n\treturn file_logrecord_proto_rawDescGZIP(), []int{0}\n}", "func (*TraceContext) Descriptor() ([]byte, []int) {\n\treturn file_logging_Logging_proto_rawDescGZIP(), []int{5}\n}", "func (GrpcLogRecord_LogLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*ConstantSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{3}\n}", "func (*LogEntry) Descriptor() ([]byte, []int) {\n\treturn file_log_entry_proto_rawDescGZIP(), []int{0}\n}", "func (*LogData) Descriptor() ([]byte, []int) {\n\treturn file_logging_Logging_proto_rawDescGZIP(), []int{0}\n}", "func (*Labels) Descriptor() ([]byte, []int) {\n\treturn file_tlogpb_tlog_proto_rawDescGZIP(), []int{1}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*ClickLog) Descriptor() ([]byte, []int) {\n\treturn file_attribution_proto_click_click_proto_rawDescGZIP(), []int{0}\n}", "func (*LogTags) Descriptor() ([]byte, []int) {\n\treturn file_logging_Logging_proto_rawDescGZIP(), []int{6}\n}", "func (*AccessLog) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_als_als_proto_rawDescGZIP(), []int{1}\n}", "func (*TextLog) Descriptor() ([]byte, []int) {\n\treturn file_logging_Logging_proto_rawDescGZIP(), []int{2}\n}", "func (*Span_Link) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_tlogpb_tlog_proto_rawDescGZIP(), []int{3}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*Record) Descriptor() ([]byte, []int) {\n\treturn file_tlogpb_tlog_proto_rawDescGZIP(), []int{0}\n}", "func (*Metric) Descriptor() ([]byte, []int) {\n\treturn file_tlogpb_tlog_proto_rawDescGZIP(), []int{4}\n}", "func (Breakpoint_LogLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{5, 1}\n}", "func (*LogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{12}\n}", "func (*LogLine) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{13}\n}", "func (*VideoFormat) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{7}\n}", "func (LogRecord_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_logrecord_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (LogType) EnumDescriptor() ([]byte, []int) {\n\treturn file_app_log_config_proto_rawDescGZIP(), []int{0}\n}", "func (*ListenerTracingSettings) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{0}\n}", "func (*ListenerTracingSettings) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{0}\n}", "func (GrpcLogRecord_EventLogger) EnumDescriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*GrpcLogRecord_MetadataEntry) Descriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*TailLogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{12}\n}", "func (*InputAccept) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{3}\n}", "func (*OperationLog) Descriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{13}\n}", "func (*KibanaLog) Descriptor() ([]byte, []int) {\n\treturn file_KibanaLog_proto_rawDescGZIP(), []int{0}\n}", "func (*LogMessage) Descriptor() ([]byte, []int) {\n\treturn file_rootfs_server_proto_rawDescGZIP(), []int{3}\n}", "func (*FileAccessLog) Descriptor() ([]byte, []int) {\n\treturn file_envoy_extensions_access_loggers_file_v3_file_proto_rawDescGZIP(), []int{0}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*RateLimitingSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{4}\n}", "func (LogSubType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_proto_global_Global_proto_rawDescGZIP(), []int{10}\n}", "func (GrpcLogRecord_Address_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2, 0}\n}", "func (*LoggingCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{4}\n}", "func (*LogDataBody) Descriptor() ([]byte, []int) {\n\treturn file_logging_Logging_proto_rawDescGZIP(), []int{1}\n}", "func (*Telemetry) Descriptor() ([]byte, []int) {\n\treturn file_protocol_proto_rawDescGZIP(), []int{0}\n}", "func (*Logs) Descriptor() ([]byte, []int) {\n\treturn file_healthzdata_proto_rawDescGZIP(), []int{2}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*LogRequest) Descriptor() ([]byte, []int) {\n\treturn file_pb_packet_packet_proto_rawDescGZIP(), []int{1}\n}", "func (*TLS) Descriptor() ([]byte, []int) {\n\treturn file_observer_observer_proto_rawDescGZIP(), []int{11}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*LogSigner) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{13}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*MemberLoginLogAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{54}\n}", "func (*JSONLog) Descriptor() ([]byte, []int) {\n\treturn file_logging_Logging_proto_rawDescGZIP(), []int{3}\n}", "func (*ConstantSampler) Descriptor() ([]byte, []int) {\n\treturn file_opencensus_proto_trace_v1_trace_config_proto_rawDescGZIP(), []int{2}\n}", "func (*BuildInfra_LogDog) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_build_proto_rawDescGZIP(), []int{1, 2}\n}", "func (*Span_Attributes) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*StackTrace_StackFrame) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*Span_TimeEvents) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ConfigRequest_V1_System_Log) Descriptor() ([]byte, []int) {\n\treturn file_config_deployment_config_request_proto_rawDescGZIP(), []int{0, 0, 0, 1}\n}", "func (*LogResponse) Descriptor() ([]byte, []int) {\n\treturn file_logs_proto_rawDescGZIP(), []int{2}\n}", "func (*LogLevels_LogLevel) Descriptor() ([]byte, []int) {\n\treturn file_config_v1_resources_proto_rawDescGZIP(), []int{19, 0}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*TracingCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{3}\n}", "func (*CMsgClientToGCRequestEventPointLogV2) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{194}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (*Debuggee) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{6}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberLoginLogDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{61}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}" ]
[ "0.7199215", "0.69935876", "0.68729717", "0.68710613", "0.6862393", "0.68234396", "0.6817299", "0.6796917", "0.6786407", "0.67126983", "0.6701977", "0.66704184", "0.66656363", "0.6657015", "0.6647747", "0.66426694", "0.6640284", "0.66365796", "0.6628686", "0.66264296", "0.6599537", "0.65861326", "0.6570837", "0.65385795", "0.65296733", "0.64826435", "0.6479565", "0.6476149", "0.64381725", "0.6426479", "0.6416644", "0.64109975", "0.64063984", "0.6404817", "0.64010787", "0.6395618", "0.63908976", "0.6390455", "0.6380445", "0.6375188", "0.6372992", "0.6356114", "0.6355109", "0.6353578", "0.63508767", "0.63437414", "0.6335021", "0.6329097", "0.63262814", "0.631302", "0.6312339", "0.63105863", "0.63105863", "0.6307197", "0.63018626", "0.6293402", "0.6282713", "0.62816256", "0.6271836", "0.6271657", "0.62666994", "0.6263738", "0.6263076", "0.6262039", "0.6252896", "0.6249733", "0.62475437", "0.6245981", "0.62431264", "0.62395847", "0.62382704", "0.6234397", "0.623131", "0.6225088", "0.6223639", "0.6222497", "0.6221596", "0.62141174", "0.6211656", "0.62115383", "0.62056327", "0.62012476", "0.6200747", "0.62004435", "0.61979276", "0.6195316", "0.61944145", "0.61930764", "0.61912674", "0.61797297", "0.6179645", "0.61739635", "0.61701155", "0.617003", "0.61693126", "0.61667824", "0.6157803", "0.61577624", "0.6157299", "0.615247" ]
0.65925056
21
Deprecated: Use GetLogsResponse.ProtoReflect.Descriptor instead.
func (*GetLogsResponse) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{2} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*GetWorkflowInstanceLogsResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_ingress_get_instance_logs_proto_rawDescGZIP(), []int{1}\n}", "func (*LogsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{15}\n}", "func (*GetLogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{0}\n}", "func (*LogResponse) Descriptor() ([]byte, []int) {\n\treturn file_logs_proto_rawDescGZIP(), []int{2}\n}", "func (*GetWorkflowInstanceLogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_ingress_get_instance_logs_proto_rawDescGZIP(), []int{0}\n}", "func (*LogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{12}\n}", "func (*LogsResponse) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{13}\n}", "func (*LogEntriesResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{8}\n}", "func (*TailLogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{12}\n}", "func (*GetLogEntriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{4}\n}", "func (*GetByTargetResponse) Descriptor() ([]byte, []int) {\n\treturn file_audit_proto_rawDescGZIP(), []int{3}\n}", "func (*LogRequest) Descriptor() ([]byte, []int) {\n\treturn file_logs_proto_rawDescGZIP(), []int{1}\n}", "func (*DownloadLogFileResponse) Descriptor() ([]byte, []int) {\n\treturn file_log_files_proto_rawDescGZIP(), []int{3}\n}", "func (*LogsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{9}\n}", "func (*RecentMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{17}\n}", "func (*LogMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{59}\n}", "func (*GetChangesResponse) Descriptor() ([]byte, []int) {\n\treturn file_internal_pb_watcher_proto_rawDescGZIP(), []int{3}\n}", "func (*MemberLoginLogDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{62}\n}", "func (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*CMsgClientToGCRequestEventPointLogResponseV2_LogEntry) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{195, 0}\n}", "func (*ListCommitsLogRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{23, 0}\n}", "func (*GetMetricsInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{44}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{1}\n}", "func (*InputDisconnect) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{10}\n}", "func (*GetTeamById_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*DiagnoseResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{17}\n}", "func (*ExportLogsServiceResponse) Descriptor() ([]byte, []int) {\n\treturn file_experimental2_proto_collector_logs_v1_logs_service_proto_rawDescGZIP(), []int{1}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*GetEntriesResponse) Descriptor() ([]byte, []int) {\n\treturn file_log_files_proto_rawDescGZIP(), []int{1}\n}", "func (*LogTraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{7}\n}", "func (*MemberLoginLogUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{60}\n}", "func (*ListMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{15}\n}", "func (*ExportLogsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_experimental2_proto_collector_logs_v1_logs_service_proto_rawDescGZIP(), []int{0}\n}", "func (*ChannelActivity) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberLoginLogListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{58}\n}", "func (*Log) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_v2_trace_proto_rawDescGZIP(), []int{4}\n}", "func (*LogEntryProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{8}\n}", "func (*GetByTargetRequest) Descriptor() ([]byte, []int) {\n\treturn file_audit_proto_rawDescGZIP(), []int{2}\n}", "func (*FindWebhookCallRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{9, 0}\n}", "func (*CollectResponse) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{1}\n}", "func (*GetWorkflowInstanceLogsResponse_WorkflowInstanceLog) Descriptor() ([]byte, []int) {\n\treturn file_pkg_ingress_get_instance_logs_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*GetChannelMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{10}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*GetMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_lte_protos_sms_orc8r_proto_rawDescGZIP(), []int{5}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{11}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (GrpcLogRecord_LogLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateTelemetryReportedResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{30}\n}", "func (*GetVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{31}\n}", "func (*LoadStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_load_stats_v3_lrs_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*GetTeamByName_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*ListMyTeams_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{4, 0}\n}", "func (*ApplyResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{1}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*WatchLimitsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{8}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{4}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*GetStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{45}\n}", "func (*Logs) Descriptor() ([]byte, []int) {\n\treturn file_healthzdata_proto_rawDescGZIP(), []int{2}\n}", "func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{28}\n}", "func (*StateMachineLogEntryProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{6}\n}", "func (*FindWebhookCallRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*ShowResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteTeam_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*GetPinnedMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{26}\n}", "func (Breakpoint_LogLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{5, 1}\n}", "func (*DiffResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{3}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{1}\n}", "func (*ListenResponse) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{9}\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (*MemberLoginLogDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{61}\n}", "func (*DelResponse) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{9}\n}", "func (*GrpcLogRecord) Descriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0}\n}", "func (*TelemetryResponse) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_telemetry_telemetry_proto_rawDescGZIP(), []int{1}\n}", "func (*GetChangesRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_pb_watcher_proto_rawDescGZIP(), []int{1}\n}", "func (*FindWebhookRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{17}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*RecentMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{16}\n}", "func (*MemberLoginLogAddResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{55}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*GetBalancerBandwidthResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{19}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*ListTeamsResponse) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_audience_team_list_proto_rawDescGZIP(), []int{0}\n}", "func (*LoadStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_load_stats_v3_lrs_proto_rawDescGZIP(), []int{0}\n}", "func (*MetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{25}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryParamsResponse\n}", "func (*FindEnabledHTTPAccessLogPolicyResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_http_access_log_policy_proto_rawDescGZIP(), []int{7}\n}", "func (*ListCommitsLogRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{23}\n}", "func (*AccessLog) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_als_als_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteHTTPAccessLogPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_http_access_log_policy_proto_rawDescGZIP(), []int{8}\n}" ]
[ "0.67771554", "0.6775314", "0.6723621", "0.6604199", "0.6549098", "0.65428793", "0.6526813", "0.65262115", "0.6493679", "0.6492091", "0.6385987", "0.63841695", "0.6358732", "0.6336511", "0.6313342", "0.6294378", "0.62908053", "0.6284281", "0.6270296", "0.62702745", "0.626294", "0.62622565", "0.6261599", "0.6259707", "0.62586236", "0.62574756", "0.62373865", "0.62319106", "0.6230733", "0.61971587", "0.61963934", "0.6190785", "0.61899316", "0.6189217", "0.6181604", "0.61717093", "0.6168326", "0.61616373", "0.6134415", "0.6132479", "0.61284804", "0.61282957", "0.6124627", "0.6124162", "0.61222166", "0.611697", "0.6115079", "0.6111239", "0.61096126", "0.6102022", "0.6096578", "0.6092406", "0.60915774", "0.60907316", "0.60896623", "0.6084952", "0.60830307", "0.6080564", "0.60797375", "0.6079406", "0.60789347", "0.6078733", "0.6073466", "0.6072217", "0.6069978", "0.6068446", "0.6061561", "0.60579073", "0.60565567", "0.60560954", "0.6051666", "0.6047873", "0.60424125", "0.6039724", "0.6039225", "0.6033287", "0.60317767", "0.60300654", "0.6024387", "0.6019295", "0.6018109", "0.6015886", "0.601534", "0.6011212", "0.60068995", "0.6001512", "0.59995097", "0.599697", "0.59963924", "0.59957784", "0.59953994", "0.599525", "0.5991054", "0.5986573", "0.59851426", "0.5984734", "0.5984066", "0.59825784", "0.5981673", "0.5981525" ]
0.69374895
0
Deprecated: Use Build.ProtoReflect.Descriptor instead.
func (*Build) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{3} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*DirectiveCreateValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{7}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{13}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*Builder) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_luci_notify_api_config_notify_proto_rawDescGZIP(), []int{4}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func GetMethodDescFromProto(call, proto string, imports []string) (*desc.MethodDescriptor, error) {\n\tp := &protoparse.Parser{ImportPaths: imports}\n\n\tfilename := proto\n\tif filepath.IsAbs(filename) {\n\t\tfilename = filepath.Base(proto)\n\t}\n\n\tfds, err := p.ParseFiles(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfileDesc := fds[0]\n\n\tfiles := map[string]*desc.FileDescriptor{}\n\tfiles[fileDesc.GetName()] = fileDesc\n\n\treturn getMethodDesc(call, files)\n}", "func (*MetadataUpdateEventProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{7}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*ValidatorUpdates) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_v1alpha1_abci_proto_rawDescGZIP(), []int{6}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\tp := &descriptorpb.FieldDescriptorProto{\n\t\tName: proto.String(string(field.Name())),\n\t\tNumber: proto.Int32(int32(field.Number())),\n\t\tLabel: descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(),\n\t\tOptions: proto.Clone(field.Options()).(*descriptorpb.FieldOptions),\n\t}\n\tif field.IsExtension() {\n\t\tp.Extendee = fullNameOf(field.ContainingMessage())\n\t}\n\tif field.Kind().IsValid() {\n\t\tp.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum()\n\t}\n\tif field.Enum() != nil {\n\t\tp.TypeName = fullNameOf(field.Enum())\n\t}\n\tif field.Message() != nil {\n\t\tp.TypeName = fullNameOf(field.Message())\n\t}\n\tif field.HasJSONName() {\n\t\t// A bug in older versions of protoc would always populate the\n\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t// When it did so, it would always use the camel-cased field name.\n\t\tif field.IsExtension() {\n\t\t\tp.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))\n\t\t} else {\n\t\t\tp.JsonName = proto.String(field.JSONName())\n\t\t}\n\t}\n\tif field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {\n\t\tp.Proto3Optional = proto.Bool(true)\n\t}\n\tif field.HasDefault() {\n\t\tdef, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)\n\t\tif err != nil && field.DefaultEnumValue() != nil {\n\t\t\tdef = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values\n\t\t} else if err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%v: %v\", field.FullName(), err))\n\t\t}\n\t\tp.DefaultValue = proto.String(def)\n\t}\n\tif oneof := field.ContainingOneof(); oneof != nil {\n\t\tp.OneofIndex = proto.Int32(int32(oneof.Index()))\n\t}\n\treturn p\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func ProtoFromMessageDescriptor(d protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\ttype canProto interface {\n\t\tMessageDescriptorProto() *descriptorpb.DescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MessageDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.DescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToDescriptorProto(d)\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*Message5867) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{29}\n}", "func (*WithWellKnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_testing_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{4}\n}", "func (*Verdict) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_addressvalidation_v1_address_validation_service_proto_rawDescGZIP(), []int{5}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*GetDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{3}\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*Message7919) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{21}\n}", "func (*StaleReadRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{24}\n}", "func (*Code) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_pb_ports_proto_rawDescGZIP(), []int{2}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*ExternalGrpcNode) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (*ListenApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{22}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*DirectiveDelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{9}\n}", "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_protomessage_proto_rawDescGZIP(), []int{0}\n}", "func (*GoDetails) Descriptor() ([]byte, []int) {\n\treturn file_kythe_proto_go_proto_rawDescGZIP(), []int{0}\n}", "func (*InstallSnapshotRequestProto_NotificationProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{19, 1}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*DirectiveEditValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{8}\n}", "func (*GetTeamByName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2}\n}" ]
[ "0.7110397", "0.6782216", "0.6755781", "0.6748305", "0.6746196", "0.6737942", "0.6732", "0.6713757", "0.6671591", "0.6668535", "0.666032", "0.6652873", "0.6651386", "0.66458035", "0.66384566", "0.6637527", "0.66262925", "0.66226614", "0.66176975", "0.66142386", "0.6613548", "0.66123706", "0.65950084", "0.65944356", "0.65900457", "0.6569413", "0.65616024", "0.65583175", "0.6553963", "0.65511256", "0.6538593", "0.65328366", "0.65314096", "0.6523375", "0.65126455", "0.6508661", "0.65078276", "0.65011615", "0.6494462", "0.6489686", "0.64885026", "0.6482539", "0.6480418", "0.6478661", "0.6476458", "0.64713645", "0.6470299", "0.64658475", "0.6464269", "0.64625454", "0.6458967", "0.64575744", "0.6457542", "0.6456393", "0.64548284", "0.6454823", "0.6451469", "0.6446682", "0.6446656", "0.6445123", "0.64434814", "0.644303", "0.64398754", "0.6439078", "0.64386994", "0.64369303", "0.64365953", "0.6433339", "0.64329934", "0.64282537", "0.6425469", "0.64240223", "0.642217", "0.6419803", "0.6418855", "0.6418473", "0.64173335", "0.6416548", "0.64148825", "0.6413844", "0.6409873", "0.6409361", "0.6407804", "0.6406226", "0.6403723", "0.64032567", "0.64030707", "0.6399242", "0.63885903", "0.6385261", "0.63850445", "0.6384681", "0.6381134", "0.6378155", "0.6377999", "0.6375922", "0.6374438", "0.63725996", "0.63713104", "0.63696307", "0.63661456" ]
0.0
-1
Deprecated: Use Workload.ProtoReflect.Descriptor instead.
func (*Workload) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{4} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*PlanChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{4}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*StaleReadRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{24}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*PlanChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*MetadataUpdateEventProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{7}\n}", "func (*Message7919) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{21}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*ExternalGrpcNode) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_protomessage_proto_rawDescGZIP(), []int{0}\n}", "func (*Message5867) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{29}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*PlanChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0}\n}", "func (*StrategyChange) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*WithWellKnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_testing_proto_rawDescGZIP(), []int{1}\n}", "func (*Metrics) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "func (*GetTeamByName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2}\n}", "func (*AddProducerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*GetBalancerBandwidthResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{19}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*Message5907) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{32}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (*ValidatorUpdates) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_v1alpha1_abci_proto_rawDescGZIP(), []int{6}\n}", "func (*InstallSnapshotRequestProto_NotificationProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{19, 1}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*Real) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*Undefined) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*Performance) Descriptor() ([]byte, []int) {\n\treturn file_commissionService_proto_rawDescGZIP(), []int{2}\n}", "func (*GetTeamById) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{8}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}" ]
[ "0.70579666", "0.6961384", "0.68675095", "0.68013924", "0.6792158", "0.67439556", "0.6737295", "0.6733113", "0.6725434", "0.66982156", "0.6695541", "0.6694044", "0.6693092", "0.6690302", "0.6681497", "0.6674056", "0.66696936", "0.66685706", "0.66622573", "0.6642004", "0.6621721", "0.6619564", "0.65925753", "0.6591879", "0.6587691", "0.65872055", "0.65867126", "0.6585039", "0.65845543", "0.657996", "0.65795934", "0.65707767", "0.6564393", "0.6555236", "0.654903", "0.65484226", "0.6548253", "0.6547996", "0.6544828", "0.6542793", "0.6540417", "0.6537646", "0.6534044", "0.65329933", "0.65289015", "0.6526632", "0.65263116", "0.65235585", "0.6521822", "0.6518402", "0.651541", "0.6514698", "0.65131915", "0.65128744", "0.65116096", "0.650796", "0.6505212", "0.65035605", "0.65018535", "0.64995587", "0.6499271", "0.6494673", "0.64906913", "0.64882195", "0.64861363", "0.64849585", "0.6484445", "0.6481472", "0.6480988", "0.64807254", "0.6480491", "0.64800185", "0.6478888", "0.6476487", "0.64757913", "0.6475647", "0.64753795", "0.6473846", "0.6473481", "0.6472751", "0.6470277", "0.64698786", "0.64676154", "0.6466986", "0.6464013", "0.64636064", "0.64613646", "0.6460262", "0.64585525", "0.64581645", "0.6451589", "0.6451589", "0.6451473", "0.6451392", "0.6451057", "0.64494985", "0.64404136", "0.6440204", "0.64371985", "0.64368343", "0.6435015" ]
0.0
-1
Deprecated: Use Deploy.ProtoReflect.Descriptor instead.
func (*Deploy) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{5} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func (*ListenApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{22}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*Code) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_pb_ports_proto_rawDescGZIP(), []int{2}\n}", "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (*Verdict) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_addressvalidation_v1_address_validation_service_proto_rawDescGZIP(), []int{5}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{40}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*Undefined) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*WithWellKnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_testing_proto_rawDescGZIP(), []int{1}\n}", "func (*Builder) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_luci_notify_api_config_notify_proto_rawDescGZIP(), []int{4}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (*ExternalGrpcNode) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*GetTeamByName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2}\n}", "func (*PublishDiagnosticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{100}\n}", "func (*DirectiveCreateValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{7}\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (*DiagnoseRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{14}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*PedidoPyme) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{1}\n}", "func (*InstallSnapshotRequestProto_NotificationProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{19, 1}\n}", "func (*SemanticTokensDelta) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{223}\n}", "func (*DelegateAction) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gateway_api_v1_virtual_service_proto_rawDescGZIP(), []int{4}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (*CreateVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{12}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*PrivateApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{24}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*MetadataUpdateEventProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{7}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*AddInstanceInstruction) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{12}\n}", "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*ValidatorUpdates) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_v1alpha1_abci_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteTeam) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6}\n}", "func (*PatchConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{50}\n}", "func (*CreateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{39}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*PortInfo) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*ResourceManifest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gkehub_v1_membership_proto_rawDescGZIP(), []int{4}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*CredentialsKVProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{1}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*AddInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_myshoes_proto_rawDescGZIP(), []int{0}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*GetDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateAlterResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{2}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_RpcCommandOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RpcCommandOptions\n}", "func (*PostModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{93}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.68666863", "0.68479204", "0.68307376", "0.6748314", "0.66728127", "0.6655355", "0.6609381", "0.6605088", "0.6574494", "0.6573353", "0.65668595", "0.6566753", "0.6563264", "0.6558198", "0.6556901", "0.65430534", "0.65411764", "0.653797", "0.6531416", "0.65288347", "0.65256697", "0.65220046", "0.6512846", "0.65121704", "0.6495259", "0.64939445", "0.64909595", "0.6486482", "0.64842355", "0.64816415", "0.6480869", "0.64805156", "0.64768994", "0.6468201", "0.64661634", "0.64636564", "0.64596385", "0.6459246", "0.64568883", "0.645209", "0.64498466", "0.64486015", "0.64474094", "0.6443531", "0.6443292", "0.64421344", "0.64396524", "0.64352566", "0.64326245", "0.64288807", "0.6428012", "0.64222836", "0.6422005", "0.64204687", "0.6420192", "0.64160925", "0.64152455", "0.64135814", "0.6411985", "0.64085525", "0.64067584", "0.6403122", "0.64008707", "0.6397394", "0.6397066", "0.63960195", "0.63903916", "0.6389972", "0.638981", "0.6386616", "0.6384172", "0.63828003", "0.6380144", "0.63786554", "0.63776517", "0.6375066", "0.63747877", "0.63743424", "0.6371822", "0.6369598", "0.6368567", "0.6364953", "0.63582844", "0.63563794", "0.63552654", "0.6354678", "0.63531095", "0.6353041", "0.63520104", "0.6345703", "0.6345627", "0.63455725", "0.63444334", "0.6343532", "0.6343532", "0.63407785", "0.6340297", "0.6340186", "0.63385755", "0.6333161", "0.63302207" ]
0.0
-1
Deprecated: Use DeployRequest.ProtoReflect.Descriptor instead.
func (*DeployRequest) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{6} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*GetDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{10}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*DeployModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{15}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*ProjectUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{70}\n}", "func (*ProjectUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{73}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*WatchProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{5}\n}", "func (*CreateVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{12}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*RemoveProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{6}\n}", "func (*PublishDiagnosticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{100}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateOrDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{5}\n}", "func (*UndeployModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{16}\n}", "func (*NewVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{1}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*PatchWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{143}\n}", "func (*UpdateProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{10}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{40}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{10}\n}", "func (*DescribePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*ReleaseIPRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_authorization_proto_rawDescGZIP(), []int{0}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*AddPermissionToRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{7}\n}", "func (*UntagRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{23}\n}", "func (*DeleteProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{11}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{17}\n}", "func (*CreateProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{9}\n}", "func (*UpdateVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{13}\n}", "func (*MoneyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_swap_swap_proto_rawDescGZIP(), []int{0}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{21}\n}", "func (*WebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{0}\n}", "func (*CheckPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_permission_pb_request_proto_rawDescGZIP(), []int{2}\n}", "func (*PublishRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*DeleteMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*WatchProvisioningApprovalRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{7}\n}", "func (*PortRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{1}\n}", "func (*VersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_buildserver_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{5}\n}", "func (*CreatePermssionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (*PaqueteRequest) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{2}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*UpgradeRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{142}\n}", "func (*OriginalDetectIntentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{15}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*VersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_provider_v1alpha1_service_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{5}\n}", "func (*NotificationRequest) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_notification_proto_rawDescGZIP(), []int{2}\n}", "func (*RemovePermissionFromRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{8}\n}", "func (*ToggleFavoriteTranslationRequest) Descriptor() ([]byte, []int) {\n\treturn file_translation_proto_rawDescGZIP(), []int{5}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "func (*UpdateProvisionerRequest) Descriptor() ([]byte, []int) {\n\treturn file_majordomo_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateHookRequest) Descriptor() ([]byte, []int) {\n\treturn file_hook_proto_rawDescGZIP(), []int{4}\n}", "func (*BatchRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*CleanupRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{14}\n}", "func (*TaskUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{2}\n}", "func (*ReleaseUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{4}\n}", "func (*CreateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{39}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{2}\n}", "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{2}\n}", "func (*GeneratedRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_auth_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{11}\n}", "func (*CreateNotificationRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_user_proto_rawDescGZIP(), []int{11}\n}", "func (*DropBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{9}\n}", "func (*DescribeProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{8}\n}", "func (*GetProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchAnnotationsStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{5}\n}", "func (x *fastReflection_AddressStringToBytesRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesRequest\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{5}\n}", "func (*ReleaseReferenceUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{8}\n}", "func (*AttachBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{14}\n}", "func (*BatchUpdateReferencesRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_icas_icas_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*UpdateWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*DeleteDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{41}\n}", "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_todo_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateMachineRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{20}\n}" ]
[ "0.7148673", "0.6898422", "0.6895993", "0.68517065", "0.6839759", "0.6834874", "0.6826073", "0.6820216", "0.67964286", "0.67963547", "0.67949593", "0.67943704", "0.67740935", "0.6769741", "0.67669743", "0.67584205", "0.6746688", "0.6740941", "0.6735982", "0.6723503", "0.6718148", "0.6706863", "0.6706585", "0.6703728", "0.67016685", "0.6695944", "0.6689707", "0.66887254", "0.6679216", "0.6679216", "0.6672675", "0.6672539", "0.6668531", "0.6665475", "0.66605234", "0.6654655", "0.66509116", "0.6648545", "0.66394377", "0.66392815", "0.6633522", "0.6631451", "0.66292334", "0.6625169", "0.66243476", "0.6622346", "0.66206473", "0.66198415", "0.6618391", "0.6616472", "0.6615531", "0.6614197", "0.6612162", "0.6608537", "0.6608277", "0.6601536", "0.65976524", "0.6597634", "0.6596999", "0.65910304", "0.65906", "0.65883815", "0.65861166", "0.65834475", "0.65825164", "0.6581161", "0.65788823", "0.65781045", "0.6574688", "0.65676236", "0.65666264", "0.656622", "0.6562585", "0.6556003", "0.6553698", "0.6551031", "0.65496176", "0.65460885", "0.654461", "0.6539024", "0.6538093", "0.6537845", "0.65375924", "0.65345603", "0.6530653", "0.6529008", "0.65243673", "0.6523339", "0.65226704", "0.6522483", "0.65213645", "0.6521237", "0.6520458", "0.65191126", "0.65181607", "0.6516862", "0.65164495", "0.65140814", "0.6513905", "0.6510763" ]
0.72387356
0
Deprecated: Use DeployResponse.ProtoReflect.Descriptor instead.
func (*DeployResponse) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{7} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*GetDeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{11}\n}", "func (*RefreshProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{3}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*RemoveProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{7}\n}", "func (*ApiVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{14}\n}", "func (*CreateAlterResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateTelemetryReportedResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{30}\n}", "func (*ModifyResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{11}\n}", "func (*GetDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteTeam_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*ApplyResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{1}\n}", "func (*DiagnoseResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{17}\n}", "func (*DeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*NewVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{2}\n}", "func (*ListenResponse) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{9}\n}", "func (*UpdateProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{11}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{1}\n}", "func (*RefreshResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{17}\n}", "func (*GetVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{31}\n}", "func (*GetTeamByName_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*UpdateOrDeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{8}\n}", "func (*InvokeResponse) Descriptor() ([]byte, []int) {\n\treturn file_runtime_proto_rawDescGZIP(), []int{19}\n}", "func (*UpdateEndpointApiResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{4}\n}", "func (*DropBuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{17}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{17}\n}", "func (x *fastReflection_AddressStringToBytesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesResponse\n}", "func (*BuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_build_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{2}\n}", "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{20}\n}", "func (*UpdateProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{22}\n}", "func (*GetTeamById_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*DeregisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{9}\n}", "func (*DescribeProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{9}\n}", "func (*DescribeResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{5}\n}", "func (*CreateEndpointApiResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{6}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{1}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*SetTeam_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{5, 0}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{7}\n}", "func (*MultiWorkflowVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{144}\n}", "func (*RemoveFaultResponse) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{18}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{6}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{4}\n}", "func (*ApplyWorkspaceEditResponse) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{87}\n}", "func (*RegisterCloudAgentResponse) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{18}\n}", "func (*DeleteProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{24}\n}", "func (*FindWebhookCallRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{9, 0}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{11}\n}", "func (*FindWebhookCallRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*BatchResponse_Response) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{4, 0}\n}", "func (*UpdateRemoteMirrorResponse) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{1}\n}", "func (*HealthCheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_files_domain_probes_proto_rawDescGZIP(), []int{1}\n}", "func (*ReportResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteEndpointApiResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{4}\n}", "func (*CleanupResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{15}\n}", "func (*RemoveProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{6}\n}", "func (*CollectResponse) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{1}\n}", "func (*SingleWorkflowVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{145}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*ComputeRepositoryDiffRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22, 0}\n}", "func (*RemoveTeamUser_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{9, 0}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{15}\n}", "func (*PublishResponsePB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_tserver_proto_rawDescGZIP(), []int{17}\n}", "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_provider_v1alpha1_service_proto_rawDescGZIP(), []int{1}\n}", "func (*FindWebhookRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*DefinitionResponse) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{25}\n}", "func (*WatchProvisioningApprovalRequestResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{6}\n}", "func (*GetFavoriteTranslationResponse) Descriptor() ([]byte, []int) {\n\treturn file_translation_proto_rawDescGZIP(), []int{4}\n}", "func (*GetTagRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{29, 0}\n}", "func (*GenerateProductMixIdeasResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{9}\n}", "func (*AttachBuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{15}\n}", "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_buildserver_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{8}\n}", "func (*GetMetricsInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{44}\n}", "func (*UndeployModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{16}\n}", "func (*FindWebhookRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*PatchAnnotationsStatusResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{6}\n}", "func (*MoneyResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_swap_swap_proto_rawDescGZIP(), []int{1}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{8}\n}", "func (*AppendPermissionResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{6}\n}", "func (*GetProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{26}\n}", "func (*Response) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{3}\n}", "func (*DropTeamResponse) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{23}\n}", "func (*ImplementationResponse) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{27}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{11}\n}", "func (*DecodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_videoservice_proto_rawDescGZIP(), []int{0}\n}", "func (*DelResponse) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{9}\n}", "func (*RemoveVideoV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{6}\n}", "func (*RevokeCertificateResponse) Descriptor() ([]byte, []int) {\n\treturn file_majordomo_proto_rawDescGZIP(), []int{19}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*UpgradeResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{7}\n}", "func (*SingleModelVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{90}\n}", "func (*WebhookResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{1}\n}" ]
[ "0.7121267", "0.6866655", "0.6855944", "0.68453705", "0.6826713", "0.68237144", "0.67623264", "0.67576504", "0.67543536", "0.6743352", "0.6738096", "0.67246354", "0.6718585", "0.6708257", "0.6700073", "0.6693668", "0.6681162", "0.6654237", "0.6650286", "0.6646552", "0.6638721", "0.66358787", "0.66344863", "0.6629597", "0.6611485", "0.66114604", "0.66065234", "0.6604341", "0.66034025", "0.66025096", "0.6601343", "0.66005236", "0.6597195", "0.6590611", "0.6589724", "0.658945", "0.65847147", "0.658032", "0.65760213", "0.6564433", "0.6560655", "0.6559842", "0.6555939", "0.65549123", "0.65526694", "0.65493256", "0.65490717", "0.65471876", "0.6545533", "0.6543576", "0.65384924", "0.6535635", "0.65331376", "0.65330863", "0.6525259", "0.6524949", "0.65248346", "0.6524098", "0.65223116", "0.6518375", "0.65171164", "0.6515862", "0.6514422", "0.6511952", "0.65085685", "0.6507127", "0.65065163", "0.65059114", "0.65029716", "0.6502207", "0.6501437", "0.65013707", "0.65007156", "0.6499353", "0.64983493", "0.64973044", "0.64928675", "0.649226", "0.6490535", "0.64901555", "0.64896744", "0.64887047", "0.6487798", "0.6487752", "0.64858013", "0.64844245", "0.6478804", "0.64778304", "0.6477009", "0.6476933", "0.64764434", "0.64712787", "0.6468862", "0.6468186", "0.64677113", "0.64676964", "0.64673805", "0.6466686", "0.6465633", "0.6465381" ]
0.7064234
1
Deprecated: Use DestroyRequest.ProtoReflect.Descriptor instead.
func (*DestroyRequest) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{8} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*DestroyRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{18}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_myshoes_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_message_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_storage_server_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_githubcard_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{13}\n}", "func (*CleanupRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_application_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteInputRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{60}\n}", "func (*MemcacheDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_memcache_service_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteKeyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{73}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_vote_proto_rawDescGZIP(), []int{4}\n}", "func (*ExternalIDPRemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{162}\n}", "func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_syncano_codebox_script_v1_script_proto_rawDescGZIP(), []int{5}\n}", "func (*RemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{27}\n}", "func (*UnregisterClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_proto_cluster_cluster_proto_rawDescGZIP(), []int{3}\n}", "func (*AccountDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_crypto_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteEntityRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{19}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteSecretRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_secrets_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteCardRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_stripe_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteContextRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_metadata_service_proto_rawDescGZIP(), []int{21}\n}", "func (*MemberDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{7}\n}", "func (*ReleaseDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*DeleteContactRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_essentialcontacts_v1_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteProvisionerRequest) Descriptor() ([]byte, []int) {\n\treturn file_majordomo_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{81}\n}", "func (*DelRequest) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "func (*DeleteModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{41}\n}", "func (*DeleteCustomerRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_mailchimp_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteFriendRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteAuthorizedCertificateRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{35}\n}", "func (*DeleteModelVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{89}\n}", "func (*MemberReceiveAddressDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{88}\n}", "func (*DeleteRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*RemoveCertificateV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_certificate_api_ocp_certificate_api_proto_rawDescGZIP(), []int{10}\n}", "func (*RemoveVacancyV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_vacancy_api_ocp_vacancy_api_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{31}\n}", "func (*DeleteConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{10}\n}", "func (*TagDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_tag_proto_rawDescGZIP(), []int{11}\n}", "func (*MemberTagDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{115}\n}", "func (*MemberStatisticsInfoDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{106}\n}", "func (*RemovePermissionFromRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteIngressRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{27}\n}", "func (*DeviceDecommissioningConfigDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{14}\n}", "func (*DeletePeopleRequest) Descriptor() ([]byte, []int) {\n\treturn file_people_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteSlotRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteOrganizationRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_organization_service_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteLeaderboardRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{31}\n}", "func (*CMsgDOTADestroyLobbyRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{257}\n}", "func (*DeleteEndpointRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{11}\n}", "func (*SharedMemoryControlRequest_Unregister) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{6, 1}\n}", "func (*DeleteHelmContextReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteTournamentRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{33}\n}", "func (*DeleteTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{132}\n}", "func (*RemoveCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{10}\n}", "func (*MemberAddressDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{16}\n}", "func (*DeleteMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteStorageObjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{9}\n}", "func (*StorageDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_storage_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_mconf_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteEventRequest) Descriptor() ([]byte, []int) {\n\treturn file_event_service_proto_rawDescGZIP(), []int{6}\n}", "func (*DestroyResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteProcessRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{3}\n}", "func (*DeregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteCheckerV1Request) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_server_pb_UserService_proto_rawDescGZIP(), []int{7}\n}", "func (*BlobDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{23}\n}", "func (*DeleteServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteInputsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{61}\n}", "func (*DeleteClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteAddressRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_vpc_v1_address_service_proto_rawDescGZIP(), []int{9}\n}" ]
[ "0.75601995", "0.7386896", "0.7382054", "0.73815745", "0.72943044", "0.72917724", "0.7288927", "0.7261807", "0.7261722", "0.7215507", "0.7200923", "0.7155578", "0.71381027", "0.7105107", "0.70943505", "0.70937586", "0.7078442", "0.7074016", "0.7062596", "0.70535356", "0.7053375", "0.7035547", "0.703534", "0.70153123", "0.70058364", "0.6999466", "0.69873595", "0.6973748", "0.6971633", "0.69663656", "0.69661105", "0.69608", "0.6957474", "0.6953136", "0.69508696", "0.69481677", "0.694517", "0.69251496", "0.69110423", "0.69096977", "0.689481", "0.68943673", "0.6885293", "0.6884484", "0.6877253", "0.68664944", "0.6866127", "0.6865856", "0.68640226", "0.68626356", "0.6845563", "0.6835098", "0.68345946", "0.68336755", "0.68319815", "0.6830091", "0.6828333", "0.6826958", "0.68265647", "0.6819596", "0.6819522", "0.68174607", "0.6809935", "0.6801892", "0.68016505", "0.67988837", "0.67904675", "0.6788744", "0.6783653", "0.6782362", "0.676937", "0.6765684", "0.67612505", "0.6759177", "0.6750117", "0.6748643", "0.6747889", "0.67471373", "0.6744868", "0.67431813", "0.674121", "0.67376477", "0.6735652", "0.6732042", "0.6728614", "0.6726611", "0.67192763", "0.67165166", "0.67159235", "0.6713065", "0.67120695", "0.6709552", "0.67032975", "0.6701396", "0.6701151", "0.6695169", "0.66945225", "0.6691673", "0.66911405", "0.66895264" ]
0.75851226
0
Deprecated: Use DestroyResponse.ProtoReflect.Descriptor instead.
func (*DestroyResponse) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{9} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{11}\n}", "func (*DestroyResponse) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteInstanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_myshoes_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{11}\n}", "func (*DestroyRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{9}\n}", "func (*DestroyRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_githubcard_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_docker_api_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_storage_server_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteInstanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_application_proto_rawDescGZIP(), []int{15}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{10}\n}", "func (*CleanupResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{15}\n}", "func (*UnregisterClusterResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_proto_cluster_cluster_proto_rawDescGZIP(), []int{4}\n}", "func (*RemoveResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{28}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_myshoes_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteTeam_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*MemcacheDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_memcache_service_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_syncano_codebox_script_v1_script_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_vote_proto_rawDescGZIP(), []int{5}\n}", "func (*DelResponse) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{9}\n}", "func (*DeregisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{9}\n}", "func (*RemoveCertificateV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_certificate_api_ocp_certificate_api_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteEndpointApiResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{3}\n}", "func (*MemberDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{8}\n}", "func (*RemoveVacancyV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_vacancy_api_ocp_vacancy_api_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{12}\n}", "func (*ReleaseDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{12}\n}", "func (*RemoveVideoV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteCardResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_stripe_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteEndpointResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{12}\n}", "func (*MemberStatisticsInfoDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{107}\n}", "func (*MemberReceiveAddressDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{89}\n}", "func (*RemoveCheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteInstanceResult) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{15}\n}", "func (*DeleteInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{18}\n}", "func (*DeleteTagRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{31, 0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{14}\n}", "func (*SharedMemoryControlRequest_Unregister) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{6, 1}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{8}\n}", "func (*MemberTagDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{116}\n}", "func (*VodDeleteTranscodesResponse) Descriptor() ([]byte, []int) {\n\treturn file_vod_response_response_vod_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{3}\n}", "func (*TagDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_tag_proto_rawDescGZIP(), []int{12}\n}", "func (*CMsgDOTADestroyLobbyResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{258}\n}", "func (*NodeGroupDecreaseTargetSizeResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{25}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_message_service_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberAddressDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{17}\n}", "func (*CAccountHardware_DeRegisterSteamController_Response) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_accounthardware_steamclient_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteConversationResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{11}\n}", "func (*RemoveTeamUser_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{9, 0}\n}", "func (*DeviceDecommissioningConfigDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{15}\n}", "func (*CreateAlterResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*RemoveXAttrResponse) Descriptor() ([]byte, []int) {\n\treturn file_IOService_proto_rawDescGZIP(), []int{53}\n}", "func (*CleanupRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{14}\n}", "func (*RemoveFaultResponse) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteCheckerV1Response) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteCustomerResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_mailchimp_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{19}\n}", "func (*DeleteInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_application_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_storage_server_proto_rawDescGZIP(), []int{2}\n}", "func (*MemberLevelDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{53}\n}", "func (*CMsgGCToClientRemoveFilteredPlayerResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{329}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_githubcard_proto_rawDescGZIP(), []int{11}\n}", "func (*CandidatesResponse_Deleted) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{44, 0}\n}", "func (*DeleteFeedbackResponse) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{7}\n}", "func (*BlobDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{24}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{13}\n}", "func (*ClearResponse) Descriptor() ([]byte, []int) {\n\treturn file_mocking_service_proto_rawDescGZIP(), []int{9}\n}", "func (*UnregisterClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_proto_cluster_cluster_proto_rawDescGZIP(), []int{3}\n}", "func (*ExternalIDPRemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{162}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteSubscriptionResponse) Descriptor() ([]byte, []int) {\n\treturn file_toit_api_data_proto_rawDescGZIP(), []int{5}\n}", "func (*RevokeFactoryCertificateResponse) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{16}\n}", "func (*DeleteEntityRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{2}\n}", "func (*TagConfigDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_tag_v2_services_gen_proto_rawDescGZIP(), []int{23}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteTodoResponse) Descriptor() ([]byte, []int) {\n\treturn file_myorg_todo_v1_delete_todo_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteUserResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_hezzel_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteUserResponse) Descriptor() ([]byte, []int) {\n\treturn file_view_grpc_blog_api_proto_rawDescGZIP(), []int{9}\n}", "func (*MemcacheDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_memcache_service_proto_rawDescGZIP(), []int{7}\n}", "func (*RemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{27}\n}", "func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{6}\n}", "func (*InterfaceDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_jnx_interfaces_service_proto_rawDescGZIP(), []int{15}\n}" ]
[ "0.74642533", "0.74526274", "0.7451862", "0.7409049", "0.7398202", "0.73805666", "0.730645", "0.73018694", "0.7274931", "0.7266494", "0.7260945", "0.72382426", "0.7175983", "0.71438515", "0.71404934", "0.71261877", "0.71247005", "0.712207", "0.7098555", "0.7096834", "0.70865625", "0.70808923", "0.70757383", "0.7060987", "0.70558274", "0.7054485", "0.7050203", "0.7039433", "0.7022349", "0.70007443", "0.6997965", "0.6990975", "0.6969205", "0.6965175", "0.6956631", "0.69546056", "0.6953857", "0.6950103", "0.6942563", "0.6930884", "0.6922872", "0.6922362", "0.6906727", "0.69062054", "0.6897121", "0.68849677", "0.6879343", "0.6863434", "0.68574196", "0.6854614", "0.6854169", "0.6851204", "0.6849087", "0.684795", "0.6846115", "0.6843346", "0.68336385", "0.68279684", "0.681757", "0.6812421", "0.6811854", "0.6801103", "0.6800902", "0.6796025", "0.67802894", "0.6775147", "0.677343", "0.6768187", "0.67651325", "0.676142", "0.6759348", "0.67560697", "0.6753815", "0.67527413", "0.6750529", "0.6740271", "0.6740068", "0.67396855", "0.6732658", "0.6732105", "0.67294735", "0.6727699", "0.6726016", "0.6721358", "0.6718639", "0.6715806", "0.670747", "0.6693367", "0.6687699", "0.6684861", "0.6682192", "0.6678354", "0.6674309", "0.66732633", "0.6662713", "0.6656927", "0.6656556", "0.66537255", "0.6653632", "0.66403353" ]
0.7565316
0
Deprecated: Use GetDeployRequest.ProtoReflect.Descriptor instead.
func (*GetDeployRequest) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{10} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*DeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*GetDeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{11}\n}", "func (*DeployModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{15}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateOrDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{5}\n}", "func (*RemoveProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{6}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*UndeployModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{16}\n}", "func (*ProjectUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{70}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*DropBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{16}\n}", "func (*ProjectUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{73}\n}", "func (*DescribeProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{10}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{15}\n}", "func (*CreateVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{12}\n}", "func (*Deploy) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{5}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*PublishRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{4}\n}", "func (*UntagRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{23}\n}", "func (*PublishDiagnosticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{100}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{40}\n}", "func (*GetProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{25}\n}", "func (*WatchProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{5}\n}", "func (*PortRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{1}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*ReleaseIPRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_authorization_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{142}\n}", "func (*DeleteProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{11}\n}", "func (*NewVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{1}\n}", "func (*GetTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{1}\n}", "func (*ListDeploysRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{12}\n}", "func (*PatchWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{143}\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{41}\n}", "func (*GetBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*CreateProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{2}\n}", "func (*MoneyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_swap_swap_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*DeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{17}\n}", "func (*ApplyWorkspaceEditRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{86}\n}", "func (*GetDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{38}\n}", "func (*GetWorkflowVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{141}\n}", "func (*DeleteProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{23}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*ApplyTransitionRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_rpc_dealer_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{8}\n}", "func (*GetDeleteDisconnectedServicesConfigReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{17}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*ConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_config_deployment_config_request_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{21}\n}", "func (*CheckPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_permission_pb_request_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{5}\n}", "func (*PaqueteRequest) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{2}\n}", "func (*CreateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{39}\n}", "func (*AttachBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{14}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*GetChangesRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_pb_watcher_proto_rawDescGZIP(), []int{1}\n}", "func (*DeviceDecommissioningConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{8}\n}", "func (*GetProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{2}\n}", "func (*PublishRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_tserver_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateTenantRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{15}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*DescribePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*CreateProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{9}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{15}\n}", "func (*VersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_buildserver_proto_rawDescGZIP(), []int{3}\n}", "func (*TaskUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{2}\n}", "func (*ProjectCreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{72}\n}", "func (*WebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{0}\n}", "func (*DeployConversationModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2_conversation_model_proto_rawDescGZIP(), []int{12}\n}", "func (*UpdateBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{5}\n}", "func (*UpgradeRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{6}\n}", "func (*CleanupRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{14}\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{0}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{10}\n}", "func (*ProjectCreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{69}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*UpdateVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{13}\n}", "func (*GetWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{128}\n}", "func (*GetEndpointApisRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{9}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{2}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*VersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_provider_v1alpha1_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*ReleaseUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{4}\n}", "func (*HealthCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_files_domain_probes_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.72786355", "0.682282", "0.6817533", "0.677981", "0.6772555", "0.6766996", "0.6664852", "0.66581535", "0.66398555", "0.65850013", "0.6574423", "0.65621", "0.65616363", "0.6551827", "0.65510404", "0.6542477", "0.65312535", "0.65200293", "0.65163493", "0.65010864", "0.64914054", "0.6488789", "0.6472676", "0.6469933", "0.6468211", "0.64639145", "0.64604515", "0.6459698", "0.6456798", "0.6456798", "0.6456598", "0.6448781", "0.64477044", "0.64364016", "0.6434603", "0.64305764", "0.64287263", "0.6425382", "0.6424282", "0.64220494", "0.64186984", "0.6416379", "0.6415442", "0.64044577", "0.64041597", "0.639931", "0.63949656", "0.63936824", "0.6384486", "0.6381713", "0.63813156", "0.63809806", "0.63782424", "0.63773745", "0.6375915", "0.6375685", "0.6370699", "0.63697654", "0.6368276", "0.6367797", "0.63627344", "0.63624036", "0.6360209", "0.6359369", "0.63574", "0.63558125", "0.6354337", "0.6354057", "0.6353957", "0.6353092", "0.6352255", "0.6350599", "0.6346076", "0.63422555", "0.63419753", "0.63415325", "0.63399076", "0.6338546", "0.6337658", "0.63328093", "0.63321376", "0.63315356", "0.6326956", "0.63254935", "0.6324496", "0.63236445", "0.63228047", "0.63197845", "0.6316646", "0.6314928", "0.6314584", "0.6313199", "0.631266", "0.63072294", "0.6305566", "0.6303568", "0.63029546", "0.629823", "0.6297561", "0.6296247" ]
0.74900305
0
Deprecated: Use GetDeployResponse.ProtoReflect.Descriptor instead.
func (*GetDeployResponse) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{11} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*GetDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{10}\n}", "func (*DeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{7}\n}", "func (*DeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{3}\n}", "func (*RemoveProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateOrDeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{8}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*Deploy) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{5}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*ApplyResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{1}\n}", "func (*DropBuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{17}\n}", "func (*UpdateProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{11}\n}", "func (*DescribeProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{9}\n}", "func (*ApiVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{14}\n}", "func (*CreateAlterResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{2}\n}", "func (*RemoveProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{6}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*UndeployModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{16}\n}", "func (*GetTeamByName_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*GetResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{16}\n}", "func (*DeleteTeam_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateOrDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateTelemetryReportedResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{30}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{17}\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{1}\n}", "func (*GetListResponse) Descriptor() ([]byte, []int) {\n\treturn file_parser_company_proto_rawDescGZIP(), []int{15}\n}", "func (*DeployModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{15}\n}", "func (*DeleteProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{24}\n}", "func (*GetProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{26}\n}", "func (*DescribeProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{8}\n}", "func (*CreateEndpointApiResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{6}\n}", "func (*BuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_build_proto_rawDescGZIP(), []int{0}\n}", "func (*ApplyWorkspaceEditResponse) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{87}\n}", "func (*DeleteEndpointApiResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{3}\n}", "func (*DropBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateEndpointApiResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{4}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{1}\n}", "func (*RefreshResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{17}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*CreateProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{3}\n}", "func (*GetChangesResponse) Descriptor() ([]byte, []int) {\n\treturn file_internal_pb_watcher_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{22}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{6}\n}", "func (*NewVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{2}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{1}\n}", "func (*GetByTargetResponse) Descriptor() ([]byte, []int) {\n\treturn file_audit_proto_rawDescGZIP(), []int{3}\n}", "func (*GetDeleteDisconnectedServicesConfigReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{17}\n}", "func (*PipelineGetTriggerResponse) Descriptor() ([]byte, []int) {\n\treturn file_src_grpc_pipeline_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{2}\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{2}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*ListDeploysResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{13}\n}", "func (*AttachBuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{15}\n}", "func (*ComputeRepositoryDiffRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22, 0}\n}", "func (*GetEndpointApisResponse) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{10}\n}", "func (*GetTeamById_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ModifyResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{11}\n}", "func (x *fastReflection_AddressStringToBytesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesResponse\n}", "func (*UpdateDeleteDisconnectedServicesConfigRes) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{18}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*CreateEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{18}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*WatchProvisioningApprovalRequestResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{6}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{8}\n}", "func (*DiagnoseResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{17}\n}", "func (*GetDisconnectedServicesConfigReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{41}\n}", "func (*PatchWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{143}\n}", "func (*CreateProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{18}\n}", "func (*PublishRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_tserver_proto_rawDescGZIP(), []int{16}\n}", "func (*GetVersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{31}\n}", "func (*UpdateProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{10}\n}", "func (*UpdateDisconnectedServicesConfigRes) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{14}\n}", "func (*UpdateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{40}\n}", "func (*PublishDiagnosticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{100}\n}", "func (*DeviceDecommissioningConfigResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{142}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*InvokeResponse) Descriptor() ([]byte, []int) {\n\treturn file_runtime_proto_rawDescGZIP(), []int{19}\n}", "func (*HealthCheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_files_domain_probes_proto_rawDescGZIP(), []int{1}\n}", "func (*CheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{1}\n}", "func (*DidChangeConfigurationRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{72}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{20}\n}", "func (*DescribeResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{11}\n}", "func (*PublishResponse) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{5}\n}", "func (*ApplyTransitionRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_rpc_dealer_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{9}\n}", "func (*ListenResponse) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{9}\n}", "func (*CleanupResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{15}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{5}\n}", "func (*ReleaseListResponse) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{17}\n}" ]
[ "0.7237045", "0.71529084", "0.69752675", "0.6861519", "0.68175745", "0.6730994", "0.6698575", "0.6676893", "0.66670185", "0.6647017", "0.663408", "0.6623999", "0.662113", "0.6615102", "0.659689", "0.6579911", "0.6570671", "0.6556984", "0.654907", "0.65446687", "0.65294075", "0.6529154", "0.6525244", "0.6517981", "0.65027875", "0.6501643", "0.6501235", "0.6496313", "0.64956784", "0.64951444", "0.64923495", "0.64894754", "0.6488549", "0.6488149", "0.6485011", "0.6481845", "0.64763194", "0.646998", "0.64676595", "0.64622945", "0.6462267", "0.64603144", "0.64481574", "0.64453655", "0.64439356", "0.64409024", "0.6426765", "0.64218223", "0.6420524", "0.6419736", "0.6414905", "0.6412501", "0.6412223", "0.6411461", "0.6408737", "0.64066434", "0.6406409", "0.6401619", "0.63994604", "0.6398236", "0.6394235", "0.6392883", "0.6389264", "0.6385981", "0.63839304", "0.63822204", "0.63691217", "0.6364134", "0.63623655", "0.636217", "0.636205", "0.63569534", "0.63555604", "0.63547444", "0.63526696", "0.6351832", "0.63510203", "0.6350178", "0.634733", "0.6343944", "0.6343605", "0.6342089", "0.6341145", "0.63400006", "0.63388294", "0.6338554", "0.633713", "0.6336053", "0.6335903", "0.63330513", "0.63321847", "0.63222784", "0.63219166", "0.63213736", "0.63188756", "0.6315694", "0.63137305", "0.63134557", "0.63130844", "0.6312672" ]
0.744295
0
Deprecated: Use ListDeploysRequest.ProtoReflect.Descriptor instead.
func (*ListDeploysRequest) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{12} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListDeploysResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{13}\n}", "func (*DeviceDecommissioningRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{4}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{4}\n}", "func (*SupplyDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_supply_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*ReleaseNameListRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{21}\n}", "func (*DropBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{16}\n}", "func (*ProductsListRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_proto_productslist_products_list_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "func (*ListWeaveScopePodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_weavescope_services_proto_rawDescGZIP(), []int{1}\n}", "func (*ListBrokerOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{21}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*DeleteProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{11}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*ListPodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{7}\n}", "func (*DeviceDecommissioningConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{155}\n}", "func (*ListVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{9}\n}", "func (*RevokeTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{17}\n}", "func (*DropTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{22}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_manage_grpc_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{3}\n}", "func (*ReleaseListRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{16}\n}", "func (*DeleteWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{142}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateTodosRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{13}\n}", "func (*ListPaymentsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_stripe_proto_rawDescGZIP(), []int{9}\n}", "func (*GetDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{10}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*DeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{6}\n}", "func (*DepositsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_trading_proto_rawDescGZIP(), []int{136}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*ListTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{153}\n}", "func (*DeviceDecommissioningConfigDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{5}\n}", "func (*DeviceDecommissioningConfigSetRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{12}\n}", "func (*TriggersListRequest) Descriptor() ([]byte, []int) {\n\treturn file_triggers_list_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_message_service_proto_rawDescGZIP(), []int{0}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{4}\n}", "func (*DelRequest) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{8}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*ListNetworkTargetsRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*TasksListRequest) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{10}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{6}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*ListTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{12}\n}", "func (*SupplyListRequest) Descriptor() ([]byte, []int) {\n\treturn file_supply_proto_rawDescGZIP(), []int{0}\n}", "func (*TodoListRequest) Descriptor() ([]byte, []int) {\n\treturn file_todoapp_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateWithdrawRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_temporal_service_proto_rawDescGZIP(), []int{4}\n}", "func (*WaitListsRequest) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{77}\n}", "func (*MoneyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_swap_swap_proto_rawDescGZIP(), []int{0}\n}", "func (*ListTensorboardsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{2}\n}", "func (*TodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_todolist_proto_rawDescGZIP(), []int{0}\n}", "func (*AddItemToGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_mconf_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{14}\n}", "func (*ListWeaveScopeHostsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_weavescope_services_proto_rawDescGZIP(), []int{0}\n}", "func (*ListReleaseNameRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{18}\n}", "func (*DeleteMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*CreateTodosRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteCommitRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{19}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateOrDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{5}\n}", "func (*ListProvisioningApprovalRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{3}\n}", "func (*DeviceOnboardingConfigDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{28}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_todo_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "func (*UpdateServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_Ultimate_Super_WebDev_Corp_gateway_services_customer_customer_proto_rawDescGZIP(), []int{4}\n}", "func (*BulkDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{16}\n}", "func (*WatchProvisioningApprovalRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{7}\n}", "func (*ListCustomersRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_billing_v1_customer_service_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{10}\n}", "func (*UntagRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{23}\n}", "func (*GetIosPlistRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{9}\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_myorg_todo_v1_delete_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*ReleaseDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{11}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{14}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*ListWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{140}\n}", "func (*ListTenantsRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{9}\n}", "func (*ListCommitsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{16}\n}", "func (*ListRefsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{15}\n}", "func (*DeleteBrokerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{7}\n}" ]
[ "0.67853445", "0.65476483", "0.64584935", "0.6455673", "0.6449114", "0.6418166", "0.6413626", "0.6401487", "0.6399172", "0.63953704", "0.6353639", "0.6351792", "0.6351627", "0.6341344", "0.63409567", "0.63385093", "0.6334627", "0.6332729", "0.63214546", "0.63178736", "0.6314782", "0.6307622", "0.6303694", "0.6295633", "0.6281995", "0.62797993", "0.6272131", "0.6269844", "0.6268151", "0.6265662", "0.62618154", "0.6261267", "0.62551725", "0.6239942", "0.62398535", "0.6238426", "0.6234154", "0.6228513", "0.6228315", "0.62279874", "0.6225393", "0.62229717", "0.6222018", "0.6217792", "0.6211892", "0.6211842", "0.62105626", "0.620931", "0.62090266", "0.62063515", "0.62054956", "0.62048286", "0.6202317", "0.6201975", "0.6201452", "0.62002367", "0.619718", "0.61962754", "0.6195733", "0.619259", "0.6191255", "0.61900544", "0.6188453", "0.61870545", "0.6185676", "0.6183622", "0.61823696", "0.61809886", "0.61804724", "0.61770016", "0.61761385", "0.6173286", "0.61697847", "0.6164209", "0.6162092", "0.6160349", "0.6160237", "0.6159898", "0.61597854", "0.61543715", "0.61543393", "0.61540604", "0.61539364", "0.61537963", "0.61536705", "0.61501133", "0.61498606", "0.61491454", "0.6142673", "0.6141909", "0.61417216", "0.61407554", "0.61390847", "0.61390334", "0.6137529", "0.6131726", "0.6131507", "0.6126199", "0.61236835", "0.61233824" ]
0.7730358
0
Deprecated: Use ListDeploysResponse.ProtoReflect.Descriptor instead.
func (*ListDeploysResponse) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{13} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListDeploysRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{12}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{1}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*ProductsListResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_proto_productslist_products_list_proto_rawDescGZIP(), []int{1}\n}", "func (*DeviceDecommissioningResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{5}\n}", "func (*DropBuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{17}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{8}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{15}\n}", "func (*GetListResponse) Descriptor() ([]byte, []int) {\n\treturn file_parser_company_proto_rawDescGZIP(), []int{15}\n}", "func (*GetDeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{11}\n}", "func (*ListServicesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{5}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{6}\n}", "func (*ReleaseNameListResponse) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{22}\n}", "func (*DeviceDecommissioningRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{4}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{17}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{1}\n}", "func (*MultiScopeDepsResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{110}\n}", "func (*ListPodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{7}\n}", "func (*DropTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{22}\n}", "func (*ReleaseListResponse) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{17}\n}", "func (*ListPodsResponse) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{8}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{3}\n}", "func (*ProdListResponse) Descriptor() ([]byte, []int) {\n\treturn file_ProdModel_proto_rawDescGZIP(), []int{2}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{7}\n}", "func (*ListServicesResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_manage_grpc_service_proto_rawDescGZIP(), []int{2}\n}", "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{4}\n}", "func (*DropTeamResponse) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{23}\n}", "func (*DropBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{16}\n}", "func (*ListVersionsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{10}\n}", "func (*DistributorTeamResponse) Descriptor() ([]byte, []int) {\n\treturn file_distributorService_proto_rawDescGZIP(), []int{7}\n}", "func (*DeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{7}\n}", "func (*DeviceDecommissioningConfigResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteTeam_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*TriggersListResponse) Descriptor() ([]byte, []int) {\n\treturn file_triggers_list_proto_rawDescGZIP(), []int{1}\n}", "func (*ApplyResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*ListBrokerOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{22}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateTodosResponse) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{14}\n}", "func (*RevokeTokensResponse) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{18}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{13}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteCommitRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{19, 0}\n}", "func (*ListServicesResponse) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{5}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*CreateAlterResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{2}\n}", "func (*TodoListResponse) Descriptor() ([]byte, []int) {\n\treturn file_todoapp_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{11}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_manage_grpc_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DelResponse) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{9}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{1}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{7}\n}", "func (*RemoveProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{7}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{4}\n}", "func (*ListTeamsResponse) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_audience_team_list_proto_rawDescGZIP(), []int{0}\n}", "func (*ListChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{27}\n}", "func (*GetDeployRequest) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{10}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*DeviceDecommissioningConfigDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{15}\n}", "func (*ListBrokerOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{21}\n}", "func (*ReleaseListResponseData) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{20}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*WatchProvisioningApprovalRequestsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateOrDeployResponse) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{8}\n}", "func (*ListPackagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1beta2_package_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRefsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{16}\n}", "func (*ListTagsRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{28, 0}\n}", "func (*UpdateServicesResponse) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{6}\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{1}\n}", "func (*ListCommitsRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{16, 0}\n}", "func (*ListVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{9}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*BulkDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{17}\n}", "func (*DistributionChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_distribution_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*DeleteWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{142}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{9}\n}", "func (*ListNetworkTargetsResponse) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{5}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*ListReleaseNameResponse) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{19}\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{1}\n}", "func (*CandidatesResponse_Deleted) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{44, 0}\n}", "func (*ListTensorboardsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{3}\n}", "func (*WaitListsResponse) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{80}\n}", "func (*ReleaseNameListRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{21}\n}", "func (*ListWeaveScopePodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_weavescope_services_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{8}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*DeviceDecommissioningConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{8}\n}", "func (*ListPaymentsResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_stripe_proto_rawDescGZIP(), []int{11}\n}", "func (*RevokeTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{17}\n}", "func (*ProvisionedDeviceResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_services_gen_proto_rawDescGZIP(), []int{33}\n}", "func (*SupplyDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_supply_proto_rawDescGZIP(), []int{3}\n}", "func (*DepositsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_trading_proto_rawDescGZIP(), []int{137}\n}" ]
[ "0.7476867", "0.6653061", "0.65947485", "0.6594367", "0.6592491", "0.6581841", "0.65633315", "0.65538716", "0.6549871", "0.65398", "0.6517948", "0.65141034", "0.65115786", "0.650747", "0.6504962", "0.65036434", "0.649952", "0.64931285", "0.6483941", "0.64838636", "0.6483145", "0.6481091", "0.64773506", "0.6469898", "0.6464013", "0.6453563", "0.6452925", "0.6448957", "0.6441253", "0.6435324", "0.642184", "0.64210075", "0.6413952", "0.64122975", "0.6411734", "0.6411613", "0.64029384", "0.6401683", "0.63970715", "0.639524", "0.63913095", "0.638512", "0.63838184", "0.63828206", "0.63785696", "0.6371126", "0.63686955", "0.63624054", "0.6358142", "0.6356765", "0.6355938", "0.6353715", "0.6350275", "0.63478523", "0.63433874", "0.6342656", "0.633777", "0.6337492", "0.63354295", "0.63350207", "0.6334787", "0.6325519", "0.63235116", "0.6314627", "0.6313117", "0.63112575", "0.63108176", "0.63066655", "0.630326", "0.63019294", "0.6299122", "0.6298449", "0.629668", "0.6295093", "0.6294901", "0.62942284", "0.6290276", "0.6286465", "0.6281417", "0.6279897", "0.6276154", "0.6275956", "0.62752086", "0.62715936", "0.62714607", "0.6270125", "0.6267494", "0.6266553", "0.6266159", "0.6262988", "0.6262733", "0.6262237", "0.62592036", "0.6258513", "0.6257153", "0.6257048", "0.625541", "0.6252637", "0.6252434", "0.6251829" ]
0.7557179
0
Deprecated: Use Build_BuildStep.ProtoReflect.Descriptor instead.
func (*Build_BuildStep) Descriptor() ([]byte, []int) { return file_scarlet_fairy_proto_rawDescGZIP(), []int{3, 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*Build) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_api_bigquery_v1_attempt_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*Trigger) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{37}\n}", "func (*GetBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{0}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*ScheduleBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{6}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*BuildPredicate) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{8}\n}", "func (*WebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{5}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "func (*Build) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_build_proto_rawDescGZIP(), []int{0}\n}", "func (*Step) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_synthetics_proto_rawDescGZIP(), []int{3}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (*OriginalDetectIntentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{2}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (*Components) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{1}\n}", "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{50}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*Ref) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{15}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*StateMachineLogEntryProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{6}\n}", "func (*AttachBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{14}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*Build) Descriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{3}\n}", "func (*BuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_build_proto_rawDescGZIP(), []int{0}\n}", "func (*Webhook) Descriptor() ([]byte, []int) {\n\treturn file_google_actions_sdk_v2_webhook_proto_rawDescGZIP(), []int{0}\n}", "func (*PTransform) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{3}\n}", "func (*PatchWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{143}\n}", "func (*ValidateRefRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{31}\n}", "func (*ProjectMemberChange) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{83}\n}", "func (x *fastReflection_Input) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Input\n}", "func (*Debuggee) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*GenerateProductMixIdeasRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{7}\n}", "func (*RebuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{2}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*StackTrace) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (*MessageWithComponents) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{61}\n}", "func (*Step) Descriptor() ([]byte, []int) {\n\treturn file_src_grpc_pipeline_proto_rawDescGZIP(), []int{4}\n}", "func (*ValidatorUpdates) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_v1alpha1_abci_proto_rawDescGZIP(), []int{6}\n}", "func (*StandardRequirements) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{56}\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (*DropBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{16}\n}", "func (*ParDoPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{8}\n}", "func (*BatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3}\n}", "func (*MavenPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{45}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*PlanChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*StandardPTransforms) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4}\n}", "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "func (*ProjectMemberChange) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{80}\n}", "func (*GetWorkflowVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{141}\n}", "func (*StandardCoders) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{29}\n}", "func (*GetConceptLanguageRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{48}\n}", "func (Build_BuildStep_Step) EnumDescriptor() ([]byte, []int) {\n\treturn file_scarlet_fairy_proto_rawDescGZIP(), []int{3, 0, 0}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*Projectile) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{7}\n}", "func (*GetTeamById) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1}\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (*CMsgBuildID) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{108}\n}", "func (*FindWebhookCallRequest) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{7}\n}", "func (*DirectiveCreateValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{7}\n}", "func (*WebhookCall) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{7}\n}", "func (*StandardRunnerProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{55}\n}", "func (*Builder) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_luci_notify_api_config_notify_proto_rawDescGZIP(), []int{4}\n}", "func (*RunWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_instances_proto_rawDescGZIP(), []int{15}\n}", "func (*ProcessPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{52}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{0}\n}", "func (*Verdict) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_addressvalidation_v1_address_validation_service_proto_rawDescGZIP(), []int{5}\n}", "func (*WebhookCall) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateTeam) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{6}\n}", "func (*DirectiveEditValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{8}\n}", "func (*PyPIPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{44}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*FindWebhookCallRequest) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{9}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*ListenerTracingSettings) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{0}\n}", "func (*ListenerTracingSettings) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{0}\n}", "func (*GetTeamByShortName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{3}\n}" ]
[ "0.6772591", "0.6694213", "0.665921", "0.6650857", "0.66302425", "0.6603067", "0.6588671", "0.6562589", "0.6562447", "0.65470326", "0.65448946", "0.6543843", "0.65401256", "0.65181", "0.6514851", "0.6499349", "0.64956385", "0.64868706", "0.6485157", "0.6476954", "0.6472948", "0.6465923", "0.64649516", "0.64625084", "0.6461326", "0.6457125", "0.64567053", "0.64506066", "0.64477456", "0.6445788", "0.642065", "0.6420023", "0.6419471", "0.64082754", "0.6405356", "0.640391", "0.63962334", "0.63961816", "0.63915056", "0.63870466", "0.6380457", "0.63799715", "0.63787305", "0.63772744", "0.6377099", "0.63704145", "0.6369503", "0.63692194", "0.6369079", "0.6367311", "0.6363126", "0.6362388", "0.63609487", "0.63560444", "0.6354562", "0.6345391", "0.634253", "0.6341966", "0.6340901", "0.6338081", "0.63377476", "0.6337739", "0.6337549", "0.63351536", "0.6334966", "0.6331126", "0.63305646", "0.6330549", "0.6327851", "0.6327648", "0.6327343", "0.63218", "0.63174725", "0.6317119", "0.6317119", "0.63166994", "0.63146037", "0.6314469", "0.63141197", "0.63073707", "0.6304856", "0.63025093", "0.6301182", "0.62997997", "0.6297699", "0.62973213", "0.62971807", "0.6296218", "0.62947077", "0.6294317", "0.629385", "0.6293485", "0.6292062", "0.6291584", "0.62900406", "0.6289713", "0.6288547", "0.62873715", "0.62873715", "0.6282994" ]
0.6746801
1
////////////// Benchmarks // //////////////
func BenchmarkCloneByMakeCap_0_AndAppendN(b *testing.B) { benchmarkCloneByMakeCapAndAppendN(b.N, 0) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func writeBenchmarkResult(method *methodType, c *chk.C, tm timer) {\n\t_, _, testCode := instrumentation.GetPackageAndNameAndBoundaries(method.Info.Func.Pointer())\n\n\tt := method.Info.Type.In(0)\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\tpName := t.Name()\n\n\ttestTags := opentracing.Tags{\n\t\t\"span.kind\": \"test\",\n\t\t\"test.name\": method.Info.Name,\n\t\t\"test.suite\": pName,\n\t\t\"test.framework\": \"gopkg.in/check.v1\",\n\t\t\"test.language\": \"go\",\n\t\t\"test.type\": \"benchmark\",\n\t}\n\topts := []opentracing.StartSpanOption{\n\t\ttestTags,\n\t\topentracing.StartTime(tm.start),\n\t}\n\n\tif testCode != \"\" {\n\t\ttestTags[\"test.code\"] = testCode\n\t}\n\n\tspan, _ := opentracing.StartSpanFromContextWithTracer(context.Background(), instrumentation.Tracer(), method.Info.Name, opts...)\n\tspan.SetBaggageItem(\"trace.kind\", \"test\")\n\tavg := math.Round((float64(tm.duration.Nanoseconds())/float64(c.N))*100) / 100\n\tmeanAllocsPerOp := math.Round((float64(tm.netAllocs)/float64(c.N))*100) / 100\n\tmeanAllocedBytesPerOp := math.Round((float64(tm.netBytes)/float64(c.N))*100) / 100\n\n\tspan.SetTag(\"benchmark.runs\", c.N)\n\tspan.SetTag(\"benchmark.duration.mean\", avg)\n\tspan.SetTag(\"benchmark.memory.mean_allocations\", meanAllocsPerOp)\n\tspan.SetTag(\"benchmark.memory.mean_bytes_allocations\", meanAllocedBytesPerOp)\n\n\treason := getTestReason(c)\n\tstatus := getTestStatus(c)\n\tswitch status {\n\tcase testSucceeded:\n\t\tif !getTestMustFail(c) {\n\t\t\tspan.SetTag(\"test.status\", tags.TestStatus_PASS)\n\t\t\treason = \"\"\n\t\t} else {\n\t\t\tspan.SetTag(\"test.status\", tags.TestStatus_FAIL)\n\t\t\tspan.SetTag(\"error\", true)\n\t\t}\n\tcase testFailed:\n\t\tif getTestMustFail(c) {\n\t\t\tspan.SetTag(\"test.status\", tags.TestStatus_PASS)\n\t\t\treason = \"\"\n\t\t} else {\n\t\t\tspan.SetTag(\"test.status\", tags.TestStatus_FAIL)\n\t\t\tspan.SetTag(\"error\", true)\n\t\t\tif reason == \"\" {\n\t\t\t\treason = \"Test failed\"\n\t\t\t}\n\t\t}\n\tcase testSkipped:\n\t\tspan.SetTag(\"test.status\", tags.TestStatus_SKIP)\n\tcase testPanicked, testFixturePanicked:\n\t\tspan.SetTag(\"test.status\", tags.TestStatus_FAIL)\n\t\tspan.SetTag(\"error\", true)\n\tcase testMissed:\n\t\tspan.SetTag(\"test.status\", tags.TestStatus_SKIP)\n\tdefault:\n\t\tspan.SetTag(\"test.status\", status)\n\t\tspan.SetTag(\"error\", true)\n\t}\n\n\tif reason != \"\" {\n\t\teventType := tags.EventTestFailure\n\t\tif status == testSkipped {\n\t\t\teventType = tags.EventTestSkip\n\t\t}\n\t\tspan.LogFields(\n\t\t\tlog.String(tags.EventType, eventType),\n\t\t\tlog.String(tags.EventMessage, reason),\n\t\t\tlog.String(\"log.internal_level\", \"Fatal\"),\n\t\t\tlog.String(\"log.logger\", \"testing\"),\n\t\t)\n\t}\n\n\tspan.FinishWithOptions(opentracing.FinishOptions{\n\t\tFinishTime: tm.start.Add(tm.duration),\n\t})\n}", "func Benchmark_5_0_1kB(b *testing.B) { benchmarkNoFaults(6, 1024, b) }", "func Benchmark_11_0_1kB(b *testing.B) { benchmarkNoFaults(12, 1024, b) }", "func Benchmark(b *testing.B) {\n\tBenchmarkCoreSimple(b)\n}", "func (api *PrivateLightServerAPI) Benchmark(setups []map[string]interface{}, passCount, length int) ([]map[string]interface{}, error) {\n\tbenchmarks := make([]requestBenchmark, len(setups))\n\tfor i, setup := range setups {\n\t\tif t, ok := setup[\"type\"].(string); ok {\n\t\t\tgetInt := func(field string, def int) int {\n\t\t\t\tif value, ok := setup[field].(float64); ok {\n\t\t\t\t\treturn int(value)\n\t\t\t\t}\n\t\t\t\treturn def\n\t\t\t}\n\t\t\tgetBool := func(field string, def bool) bool {\n\t\t\t\tif value, ok := setup[field].(bool); ok {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\treturn def\n\t\t\t}\n\t\t\tswitch t {\n\t\t\tcase \"header\":\n\t\t\t\tbenchmarks[i] = &benchmarkBlockHeaders{\n\t\t\t\t\tamount: getInt(\"amount\", 1),\n\t\t\t\t\tskip: getInt(\"skip\", 1),\n\t\t\t\t\tbyHash: getBool(\"byHash\", false),\n\t\t\t\t\treverse: getBool(\"reverse\", false),\n\t\t\t\t}\n\t\t\tcase \"body\":\n\t\t\t\tbenchmarks[i] = &benchmarkBodiesOrReceipts{receipts: false}\n\t\t\tcase \"receipts\":\n\t\t\t\tbenchmarks[i] = &benchmarkBodiesOrReceipts{receipts: true}\n\t\t\tcase \"proof\":\n\t\t\t\tbenchmarks[i] = &benchmarkProofsOrCode{code: false}\n\t\t\tcase \"code\":\n\t\t\t\tbenchmarks[i] = &benchmarkProofsOrCode{code: true}\n\t\t\tcase \"cht\":\n\t\t\t\tbenchmarks[i] = &benchmarkHelperTrie{\n\t\t\t\t\tbloom: false,\n\t\t\t\t\treqCount: getInt(\"amount\", 1),\n\t\t\t\t}\n\t\t\tcase \"bloom\":\n\t\t\t\tbenchmarks[i] = &benchmarkHelperTrie{\n\t\t\t\t\tbloom: true,\n\t\t\t\t\treqCount: getInt(\"amount\", 1),\n\t\t\t\t}\n\t\t\tcase \"txSend\":\n\t\t\t\tbenchmarks[i] = &benchmarkTxSend{}\n\t\t\tcase \"txStatus\":\n\t\t\t\tbenchmarks[i] = &benchmarkTxStatus{}\n\t\t\tdefault:\n\t\t\t\treturn nil, ErrUnknownBenchmarkType\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, ErrUnknownBenchmarkType\n\t\t}\n\t}\n\trs := api.server.protocolManager.runBenchmark(benchmarks, passCount, time.Millisecond*time.Duration(length))\n\tresult := make([]map[string]interface{}, len(setups))\n\tfor i, r := range rs {\n\t\tres := make(map[string]interface{})\n\t\tif r.err == nil {\n\t\t\tres[\"totalCount\"] = r.totalCount\n\t\t\tres[\"avgTime\"] = r.avgTime\n\t\t\tres[\"maxInSize\"] = r.maxInSize\n\t\t\tres[\"maxOutSize\"] = r.maxOutSize\n\t\t} else {\n\t\t\tres[\"error\"] = r.err.Error()\n\t\t}\n\t\tresult[i] = res\n\t}\n\treturn result, nil\n}", "func main() {\n\tbigSlowOperation()\n}", "func speedtest1_run(tls *libc.TLS) { /* speedtest1.c:532:6: */\n\tbp := tls.Alloc(8)\n\tdefer tls.Free(8)\n\n\tvar i int32\n\tvar n int32\n\tvar len int32\n\tif g.bSqlOnly != 0 {\n\t\treturn\n\t}\n\n\tg.nResult = 0\n\tfor sqlite3.Xsqlite3_step(tls, g.pStmt) == 100 {\n\t\tn = sqlite3.Xsqlite3_column_count(tls, g.pStmt)\n\t\tfor i = 0; i < n; i++ {\n\t\t\tvar z uintptr = sqlite3.Xsqlite3_column_text(tls, g.pStmt, i)\n\t\t\tif z == uintptr(0) {\n\t\t\t\tz = ts + 2732 /* \"nil\" */\n\t\t\t}\n\t\t\tlen = int32(libc.Xstrlen(tls, z))\n\t\t\tif g.bVerify != 0 {\n\t\t\t\tvar eType int32 = sqlite3.Xsqlite3_column_type(tls, g.pStmt, i)\n\t\t\t\t// var zPrefix [2]uint8 at bp, 2\n\n\t\t\t\t*(*uint8)(unsafe.Pointer(bp /* &zPrefix[0] */ + uintptr(0))) = uint8('\\n')\n\t\t\t\t*(*uint8)(unsafe.Pointer(bp /* &zPrefix[0] */ + uintptr(1))) = uint8(*(*int8)(unsafe.Pointer(ts + 2736 /* \"-IFTBN\" */ + uintptr(eType))))\n\t\t\t\tif g.nResByte != 0 {\n\t\t\t\t\tHashUpdate(tls, bp /* &zPrefix[0] */, uint32(2))\n\t\t\t\t} else {\n\t\t\t\t\tHashUpdate(tls, (bp /* &zPrefix[0] */ + uintptr(1)), uint32(1))\n\t\t\t\t}\n\t\t\t\tif eType == 2 {\n\t\t\t\t\t// Omit the value of floating-point results from the verification\n\t\t\t\t\t// hash. The only thing we record is the fact that the result was\n\t\t\t\t\t// a floating-point value.\n\t\t\t\t\t*(*u64)(unsafe.Pointer(uintptr(unsafe.Pointer(&g)) + 88 /* &.nResByte */)) += (uint64(2))\n\t\t\t\t} else if eType == 4 {\n\t\t\t\t\tvar nBlob int32 = sqlite3.Xsqlite3_column_bytes(tls, g.pStmt, i)\n\t\t\t\t\tvar iBlob int32\n\t\t\t\t\t// var zChar [2]uint8 at bp+2, 2\n\n\t\t\t\t\tvar aBlob uintptr = sqlite3.Xsqlite3_column_blob(tls, g.pStmt, i)\n\t\t\t\t\tfor iBlob = 0; iBlob < nBlob; iBlob++ {\n\t\t\t\t\t\t*(*uint8)(unsafe.Pointer(bp + 2 /* &zChar[0] */ + uintptr(0))) = uint8(*(*int8)(unsafe.Pointer(ts + 2743 /* \"0123456789abcdef\" */ + uintptr((int32(*(*uint8)(unsafe.Pointer(aBlob + uintptr(iBlob)))) >> 4)))))\n\t\t\t\t\t\t*(*uint8)(unsafe.Pointer(bp + 2 /* &zChar[0] */ + uintptr(1))) = uint8(*(*int8)(unsafe.Pointer(ts + 2743 /* \"0123456789abcdef\" */ + uintptr((int32(*(*uint8)(unsafe.Pointer(aBlob + uintptr(iBlob)))) & 15)))))\n\t\t\t\t\t\tHashUpdate(tls, bp+2 /* &zChar[0] */, uint32(2))\n\t\t\t\t\t}\n\t\t\t\t\t*(*u64)(unsafe.Pointer(uintptr(unsafe.Pointer(&g)) + 88 /* &.nResByte */)) += (u64((nBlob * 2) + 2))\n\t\t\t\t} else {\n\t\t\t\t\tHashUpdate(tls, z, uint32(len))\n\t\t\t\t\t*(*u64)(unsafe.Pointer(uintptr(unsafe.Pointer(&g)) + 88 /* &.nResByte */)) += (u64(len + 2))\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (uint32(g.nResult + len)) < (uint32(unsafe.Sizeof([3000]int8{})) - uint32(2)) {\n\t\t\t\tif g.nResult > 0 {\n\t\t\t\t\t*(*int8)(unsafe.Pointer((uintptr(unsafe.Pointer(&g)) + 100 /* &.zResult */) + uintptr(libc.PostIncInt32(&g.nResult, 1)))) = int8(' ')\n\t\t\t\t}\n\t\t\t\tlibc.Xmemcpy(tls, ((uintptr(unsafe.Pointer(&g)) + 100 /* &.zResult */) + uintptr(g.nResult)), z, (uint32(len + 1)))\n\t\t\t\t*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&g)) + 96 /* &.nResult */)) += (len)\n\t\t\t}\n\t\t}\n\t}\n\tif g.bReprepare != 0 {\n\t\t// var pNew uintptr at bp+4, 4\n\n\t\tsqlite3.Xsqlite3_prepare_v2(tls, g.db, sqlite3.Xsqlite3_sql(tls, g.pStmt), -1, bp+4 /* &pNew */, uintptr(0))\n\t\tsqlite3.Xsqlite3_finalize(tls, g.pStmt)\n\t\tg.pStmt = *(*uintptr)(unsafe.Pointer(bp + 4 /* pNew */))\n\t} else {\n\t\tsqlite3.Xsqlite3_reset(tls, g.pStmt)\n\t}\n\tspeedtest1_shrink_memory(tls)\n}", "func Benchmark_3_0_1kB(b *testing.B) { benchmarkNoFaults(4, 1024, b) }", "func benchmark(funcName string, number int, w http.ResponseWriter) {\n listofTime := [41]int64{}\n\n for j := 0; j < 40; j++ {\n start := time.Now().UnixNano()\n factorial(number)\n\n // End time\n end := time.Now().UnixNano()\n // Results\n difference := end - start\n listofTime[j] = difference\n\n }\n // Average Time\n sum := int64(0)\n for i := 0; i < len(listofTime); i++ {\n // adding the values of\n // array to the variable sum\n sum += listofTime[i]\n }\n // avg to find the average\n avg := (float64(sum)) / (float64(len(listofTime)))\n\n // Throughput Rate\n throughput := 40/avg\n\n // Response\n fmt.Fprintf(w, \"Time taken by %s function is %v ops/ns \\n\", funcName, throughput)\n}", "func BenchmarkMain(b *testing.B) {\n\tfor n:=0; n < b.N; n++ {\n\t\tmain()\n\t}\n}", "func BenchmarkRun(b *testing.B) {\n\trng := rand.New(rand.NewSource(1))\n\tctx := context.Background()\n\trunGC := func(eng storage.Engine, old bool, spec randomRunGCTestSpec) (Info, error) {\n\t\trunGCFunc := Run\n\t\tif old {\n\t\t\trunGCFunc = runGCOld\n\t\t}\n\t\tsnap := eng.NewSnapshot()\n\t\tpolicy := zonepb.GCPolicy{TTLSeconds: spec.ttl}\n\t\treturn runGCFunc(ctx, spec.ds.desc(), snap, spec.now,\n\t\t\tCalculateThreshold(spec.now, policy), intentAgeThreshold,\n\t\t\tpolicy,\n\t\t\tNoopGCer{},\n\t\t\tfunc(ctx context.Context, intents []roachpb.Intent) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tfunc(ctx context.Context, txn *roachpb.Transaction) error {\n\t\t\t\treturn nil\n\t\t\t})\n\t}\n\tmakeTest := func(old bool, spec randomRunGCTestSpec) func(b *testing.B) {\n\t\treturn func(b *testing.B) {\n\t\t\teng := storage.NewDefaultInMemForTesting()\n\t\t\tdefer eng.Close()\n\t\t\tms := spec.ds.dist(b.N, rng).setupTest(b, eng, *spec.ds.desc())\n\t\t\tb.SetBytes(int64(float64(ms.Total()) / float64(b.N)))\n\t\t\tb.ResetTimer()\n\t\t\t_, err := runGC(eng, old, spec)\n\t\t\tb.StopTimer()\n\t\t\trequire.NoError(b, err)\n\t\t}\n\t}\n\tspecsWithTTLs := func(\n\t\tds distSpec, now hlc.Timestamp, ttls []int32,\n\t) (specs []randomRunGCTestSpec) {\n\t\tfor _, ttl := range ttls {\n\t\t\tspecs = append(specs, randomRunGCTestSpec{\n\t\t\t\tds: ds,\n\t\t\t\tnow: now,\n\t\t\t\tttl: ttl,\n\t\t\t})\n\t\t}\n\t\treturn specs\n\t}\n\tts100 := hlc.Timestamp{WallTime: (100 * time.Second).Nanoseconds()}\n\tttls := []int32{0, 25, 50, 75, 100}\n\tspecs := specsWithTTLs(fewVersionsTinyRows, ts100, ttls)\n\tspecs = append(specs, specsWithTTLs(someVersionsMidSizeRows, ts100, ttls)...)\n\tspecs = append(specs, specsWithTTLs(lotsOfVersionsMidSizeRows, ts100, ttls)...)\n\tfor _, old := range []bool{true, false} {\n\t\tb.Run(fmt.Sprintf(\"old=%v\", old), func(b *testing.B) {\n\t\t\tfor _, spec := range specs {\n\t\t\t\tb.Run(fmt.Sprint(spec.ds), makeTest(old, spec))\n\t\t\t}\n\t\t})\n\t}\n}", "func main() {\n\t//Trace code ----------------------------\n\t//trace.Start(os.Stderr)\n\t//defer trace.Stop()\n\t//---------------------------------------\n\tvar istream string\n\t//Pprof variables -----------------------\n\t//var cpuprofile = flag.String(\"cpuprofile\", \"\", \"write cpu profile to `file`\")\n\t//var memprofile = flag.String(\"memprofile\", \"\", \"write memory profile to `file`\")\n\tflag.StringVar(&istream, \"file\", \"\", \"Specify input file. Default is emptyfile\")\n\tflag.Parse()\n\t/*\n\t//Pprof code -----------------------\n\tif *cpuprofile != \"\" {\n\t\tf, err := os.Create(*cpuprofile)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"could not create CPU profile: \", err)\n\t\t}\n\t\tdefer f.Close() // error handling omitted for example\n\t\tif err := pprof.StartCPUProfile(f); err != nil {\n\t\t\tlog.Fatal(\"could not start CPU profile: \", err)\n\t\t}\n\t\tdefer pprof.StopCPUProfile()\n\t}*/\n\t//----------------------------------\n\truntime.GOMAXPROCS(0)\n\tmaxProcs := runtime.GOMAXPROCS(0)\n\tnumCPU := runtime.NumCPU()\n\tfmt.Println(\"maxProcs: \", maxProcs, \" numCPU: \", numCPU)\n\tstart := time.Now()\n seqKmst(istream)\n\tt := time.Since(start)\n\tfmt.Println(\"TotalExecutionTime,\", t, \",\", t.Microseconds(), \",\", t.Milliseconds(), \",\", t.Seconds())\n /*\n\t//Pprof code ---------------------\n\tif *memprofile != \"\" {\n\t\tf, err := os.Create(*memprofile)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"could not create memory profile: \", err)\n\t\t}\n\t\tdefer f.Close() // error handling omitted for example\n\t\truntime.GC() // get up-to-date statistics\n\t\tif err := pprof.WriteHeapProfile(f); err != nil {\n\t\t\tlog.Fatal(\"could not write memory profile: \", err)\n\t\t}\n\t}\n\t*/\n\t//-------------------------------\n\n\n}", "func benchmark(rounds int) {\n\tfmt.Println(\"Benchmarking\")\n\tvar wg sync.WaitGroup\n\twg.Add(2)\n\n\tstatsCh := make(chan bool)\n\tgo initControllerPubTest(&wg, statsCh, rounds)\n\n\t//Testing:\n\t// Subscriber listening the stats published by the Gnfs\n\tgo initControllerStatsSubTest(&wg, statsCh)\n\twg.Wait()\n}", "func main() {\n\trand.Seed(time.Now().UnixNano())\n\tstart := time.Now()\n\tresult := First(\"golang\",\n\t\tfakeSearch(\"replica 1\"),\n\t\tfakeSearch(\"replica 2\"))\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%+v\\n\", result)\n\tfmt.Println(elapsed)\n}", "func main() {\n\tflag.Parse()\n\t// To test that the sequential version gathers the same blobs in commits\n\tif *test {\n\t\tblobsInCommitsSequential := getBlobsInCommitSequential(false)\n\t\tblobsInCommits := getBlobsInCommit(false)\n\t\tif diff := cmp.Diff(&blobsInCommits, &blobsInCommitsSequential); diff != \"\" {\n\t\t\tfmt.Println(fmt.Errorf(\"blobs mismatch (-want +got):\\n%s\", diff))\n\t\t\tos.Exit(1)\n\t\t}\n\t\tos.Exit(0)\n\t}\n\n\tgo http.ListenAndServe(\":1234\", nil)\n\t// if *cpuprofile != \"\" {\n\t// \tf, err := os.Create(*cpuprofile)\n\t// \tif err != nil {\n\t// \t\tlog.Fatal(err)\n\t// \t}\n\t// \tpprof.StartCPUProfile(f)\n\t// \tdefer pprof.StopCPUProfile()\n\t// }\n\tadditions := GetAdditions(false)\n\t_ = additions\n}", "func Benchmark(b *testing.B) {\n\tcfgFilename := getCfgFilename()\n\tcfgs := GetConfigs(cfgFilename)\n\n\tfor i := 0; i < b.N; i++ {\n\t\tshowGitStatuses(cfgs)\n\t}\n}", "func main() {\n\tbenchMark()\n\tlevelDemo()\n}", "func benchCode() string {\n consoleCommand := `go test -bench . -benchtime=1s` // Single place to alter the command line command\n output := ``\n\n output += breakspace + cBold + cCyan + \" Golang Function Benchmarks:\" + cClr\n output += breakspace + cYellow + \" > \" + cClr + consoleCommand + breakspace\n\n output += breakspace\n\n testOutput, _ := exec.Command( \"cmd\", \"/c\", consoleCommand ).Output()\n\n // Alternative code:\n //cmd.Stdout = os.Stdout\n //cmd.Run()\n\n return output + statusColorize( string(testOutput) )\n}", "func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark) {}", "func (b *Engine) run() {\n\t// mines blocks from difficulty to when it takes longer than 60 seconds to mine block\n\tb.logger.Log(\"Benchmark: starting benchmark\")\n\tdone := false\n\tclose := make(chan struct{})\n\tdifficulty := 10 //! difficulty starts at 10\n\tgo func() {\n\t\tvar wg sync.WaitGroup\n\t\tfor done == false {\n\t\t\tfor i := 0; i < 3; i++ { //? runs 3 difficulties in parralel to increase benchmark speed\n\t\t\t\twg.Add(1)\n\t\t\t\tgo func(myDifficulty int) { //? mines block of myDifficulty 5 times and adds average time and difficulty\n\t\t\t\t\tvar avg []float64\n\t\t\t\t\tvar mu sync.Mutex\n\t\t\t\t\tvar mineWG sync.WaitGroup\n\t\t\t\t\tfor j := 0; j < 5; j++ {\n\t\t\t\t\t\tmineWG.Add(1)\n\t\t\t\t\t\tgo func() {\n\t\t\t\t\t\t\tstart := time.Now()\n\t\t\t\t\t\t\tblock := b.block(uint8(myDifficulty))\n\t\t\t\t\t\t\tend := time.Now()\n\t\t\t\t\t\t\tblock.DeleteFile()\n\t\t\t\t\t\t\tdiff := end.Sub(start).Seconds()\n\t\t\t\t\t\t\tmu.Lock()\n\t\t\t\t\t\t\tavg = append(avg, diff)\n\t\t\t\t\t\t\tmu.Unlock()\n\t\t\t\t\t\t\tmineWG.Done()\n\t\t\t\t\t\t}()\n\t\t\t\t\t}\n\t\t\t\t\tmineWG.Wait()\n\t\t\t\t\tvar avgSum float64\n\t\t\t\t\tfor _, val := range avg {\n\t\t\t\t\t\tavgSum += val\n\t\t\t\t\t}\n\t\t\t\t\taverage := avgSum / float64(len(avg))\n\t\t\t\t\tif average > float64(60) { // a minute\n\t\t\t\t\t\tdone = true\n\t\t\t\t\t\tclose <- struct{}{}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif done == true {\n\t\t\t\t\t\t\twg.Done()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tb.addBenchmark(NewBenchmark(average, uint8(myDifficulty)))\n\t\t\t\t\t}\n\t\t\t\t\tb.logger.Log(\"Bechmark: completed benchmark for difficulty \" + strconv.FormatInt(int64(myDifficulty), 10))\n\t\t\t\t\twg.Done()\n\t\t\t\t}(difficulty)\n\t\t\t\tdifficulty++\n\t\t\t}\n\t\t\twg.Wait()\n\t\t}\n\t}()\n\n\t<-close //wait for close signal\n\n\tscore := float64(b.GetData()[len(b.GetData())-1].GetDifficulty()) - 10 //! 10 is subtracted to allow the score start from 1 since difficulty starts at 10\n\tscoreDecimal := 1 - b.GetData()[len(b.GetData())-1].GetAvgTime()/100 // determine decimal part of score\n\tb.setScore(score + scoreDecimal)\n\tb.logger.Info(\"Benchmark: benchmark done\")\n}", "func TestFetch(t *testing.T) {\n baseUri := \"http://localhost:8080\" \n //baseUri := \"https://dex.binance.org\"\n for key, value := range helpers.FetchTestCases {\n fmt.Println(key)\n start := time.Now()\n for i := 0; i < 50; i++ {\n result, err := BinanceRequest(key, baseUri , value)\n if i%1000 == 0 {\n fmt.Println(string(result))\n }\n if err != nil {\n t.Error(err)\n }\n }\n end := time.Now()\n elapsed := end.Sub(start)\n fmt.Println(elapsed)\n fmt.Println(50000/int(elapsed.Milliseconds()))\n}\n}", "func benchmarker(n int, f action) (err error) {\n\tfor i := 0; i < n; i++ {\n\t\tif err = f(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func main() {\n\n\t//flag.Parse()\n\tcpuprofile := \"\" // \"cpu.prof\"\n\tmemprofile := \"\" // \"mem.prof\"\n\n\tif cpuprofile != \"\" {\n\t\tf, err := os.Create(cpuprofile)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"could not create CPU profile: \", err)\n\t\t}\n\t\tif err := pprof.StartCPUProfile(f); err != nil {\n\t\t\tlog.Fatal(\"could not start CPU profile: \", err)\n\t\t}\n\t\tdefer pprof.StopCPUProfile()\n\t}\n\n\n\tfmt.Println(\"Starting Buddhabrot.go....\")\n\t// print('CPU_Number: ' + str(multiprocessing.cpu_count()))\n\n\tstart := time.Now()\n\tbuddhabrot(c_filename, c_NX, c_NY, c_NMAX, c_TMAX)\n\tt := time.Now()\n\telapsed := t.Sub(start)\n\n\tfmt.Println(\"elapsed time: %t \", elapsed)\n\n\tfmt.Println(\"...ending Buddhabrot.go .\")\n\n\n\n\tif memprofile != \"\" {\n\t\tf, err := os.Create(memprofile)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"could not create memory profile: \", err)\n\t\t}\n\t\truntime.GC() // get up-to-date statistics\n\t\tif err := pprof.WriteHeapProfile(f); err != nil {\n\t\t\tlog.Fatal(\"could not write memory profile: \", err)\n\t\t}\n\t\tf.Close()\n\t}\n\n\n}", "func BenchmarkChecking(b *testing.B) {\n\tcapacity := uint32(1e9)\n\tp := float64(0.001)\n\tsamples := uint32(100000)\n\tfilter, testValues := GenerateExampleFilter(capacity, p, samples)\n\tfingerprint := make([]uint32, filter.k)\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tvalue := testValues[rand.Int()%len(testValues)]\n\t\tfilter.Fingerprint(value, fingerprint)\n\t\tif !filter.CheckFingerprint(fingerprint) {\n\t\t\tb.Error(\"Did not find test value in filter!\")\n\t\t}\n\t}\n}", "func runBechmark() {\n\tvar seed int64 = 222383033\n\tvar solution = []byte(\"abc\")\n\tvar alphabet = []byte(\"abcdefghijklmnopqrstuvwxyz \")\n\tvar mutationRate float32 = 0.2\n\tvar populationSize = 10000\n\tvar numberOfThreads = 4\n\n\tvar solutionSteps = 2\n\n\t//length of array is the number of repeating\n\ttimeForThreads := make([]int64, 10)\n\n\t//teste den GA erhöhe die länge von solution um 2 zeichen\n\tfor i := 0; i < len(timeForThreads); i++ {\n\t\t//build new longer solution\n\t\tsolution = make([]byte, solutionSteps*(i+1))\n\t\tfor j := 0; j < solutionSteps*(i+1); j++ {\n\t\t\tsolution[j] = alphabet[j]\n\t\t}\n\t\t//test 10 times\n\t\ttimeForThreads[i] = benchmarkGA(solution, alphabet, populationSize, mutationRate, seed, numberOfThreads)\n\t}\n\n\tfor i := 0; i < len(timeForThreads); i++ {\n\t\tprintln(timeForThreads[i])\n\t}\n}", "func BenchmarkAlgorithmOne(b *testing.B) {\n\tvar output bytes.Buffer\n\tin := []byte(\"his name is elvis, super star.\")\n\tfind := []byte(\"elvis\")\n\trepl := []byte(\"Elvis\")\n\n\tb.ResetTimer()\n\tfmt.Println(\"N = \",b.N)\n\n\tfor i := 0; i < b.N; i++ {\n\t\toutput.Reset()\n\t\talgOne(in, find, repl, &output)\n\t}\n}", "func (f Factory) RunStoreBenchmarks(b *testing.B) {\n\tb.Run(\"BenchmarkCreateLink\", f.BenchmarkCreateLink)\n\tb.Run(\"BenchmarkCreateLinkParallel\", f.BenchmarkCreateLinkParallel)\n\n\tb.Run(\"FindSegments100\", f.BenchmarkFindSegments100)\n\tb.Run(\"FindSegments1000\", f.BenchmarkFindSegments1000)\n\tb.Run(\"FindSegments10000\", f.BenchmarkFindSegments10000)\n\tb.Run(\"FindSegmentsMapID100\", f.BenchmarkFindSegmentsMapID100)\n\tb.Run(\"FindSegmentsMapID1000\", f.BenchmarkFindSegmentsMapID1000)\n\tb.Run(\"FindSegmentsMapID10000\", f.BenchmarkFindSegmentsMapID10000)\n\tb.Run(\"FindSegmentsMapIDs100\", f.BenchmarkFindSegmentsMapIDs100)\n\tb.Run(\"FindSegmentsMapIDs1000\", f.BenchmarkFindSegmentsMapIDs1000)\n\tb.Run(\"FindSegmentsMapIDs10000\", f.BenchmarkFindSegmentsMapIDs10000)\n\tb.Run(\"FindSegmentsPrevLinkHash100\", f.BenchmarkFindSegmentsPrevLinkHash100)\n\tb.Run(\"FindSegmentsPrevLinkHash1000\", f.BenchmarkFindSegmentsPrevLinkHash1000)\n\tb.Run(\"FindSegmentsPrevLinkHash10000\", f.BenchmarkFindSegmentsPrevLinkHash10000)\n\tb.Run(\"FindSegmentsTags100\", f.BenchmarkFindSegmentsTags100)\n\tb.Run(\"FindSegmentsTags1000\", f.BenchmarkFindSegmentsTags1000)\n\tb.Run(\"FindSegmentsTags10000\", f.BenchmarkFindSegmentsTags10000)\n\tb.Run(\"FindSegmentsMapIDTags100\", f.BenchmarkFindSegmentsMapIDTags100)\n\tb.Run(\"FindSegmentsMapIDTags1000\", f.BenchmarkFindSegmentsMapIDTags1000)\n\tb.Run(\"FindSegmentsMapIDTags10000\", f.BenchmarkFindSegmentsMapIDTags10000)\n\tb.Run(\"FindSegmentsPrevLinkHashTags100\", f.BenchmarkFindSegmentsPrevLinkHashTags100)\n\tb.Run(\"FindSegmentsPrevLinkHashTags1000\", f.BenchmarkFindSegmentsPrevLinkHashTags1000)\n\tb.Run(\"FindSegmentsPrevLinkHashTags10000\", f.BenchmarkFindSegmentsPrevLinkHashTags10000)\n\tb.Run(\"FindSegments100Parallel\", f.BenchmarkFindSegments100Parallel)\n\tb.Run(\"FindSegments1000Parallel\", f.BenchmarkFindSegments1000Parallel)\n\tb.Run(\"FindSegments10000Parallel\", f.BenchmarkFindSegments10000Parallel)\n\tb.Run(\"FindSegmentsMapID100Parallel\", f.BenchmarkFindSegmentsMapID100Parallel)\n\tb.Run(\"FindSegmentsMapID1000Parallel\", f.BenchmarkFindSegmentsMapID1000Parallel)\n\tb.Run(\"FindSegmentsMapID10000Parallel\", f.BenchmarkFindSegmentsMapID10000Parallel)\n\tb.Run(\"FindSegmentsMapIDs100Parallel\", f.BenchmarkFindSegmentsMapIDs100Parallel)\n\tb.Run(\"FindSegmentsMapIDs1000Parallel\", f.BenchmarkFindSegmentsMapIDs1000Parallel)\n\tb.Run(\"FindSegmentsMapIDs10000Parallel\", f.BenchmarkFindSegmentsMapIDs10000Parallel)\n\tb.Run(\"FindSegmentsPrevLinkHash100Parallel\", f.BenchmarkFindSegmentsPrevLinkHash100Parallel)\n\tb.Run(\"FindSegmentsPrevLinkHash1000Parallel\", f.BenchmarkFindSegmentsPrevLinkHash1000Parallel)\n\tb.Run(\"FindSegmentsPrevLinkHash10000ParalleRunBenchmarksl\", f.BenchmarkFindSegmentsPrevLinkHash10000Parallel)\n\tb.Run(\"FindSegmentsTags100Parallel\", f.BenchmarkFindSegmentsTags100Parallel)\n\tb.Run(\"FindSegmentsTags1000Parallel\", f.BenchmarkFindSegmentsTags1000Parallel)\n\tb.Run(\"FindSegmentsTags10000Parallel\", f.BenchmarkFindSegmentsTags10000Parallel)\n\tb.Run(\"FindSegmentsMapIDTags100Parallel\", f.BenchmarkFindSegmentsMapIDTags100Parallel)\n\tb.Run(\"FindSegmentsMapIDTags1000Parallel\", f.BenchmarkFindSegmentsMapIDTags1000Parallel)\n\tb.Run(\"FindSegmentsMapIDTags10000Parallel\", f.BenchmarkFindSegmentsMapIDTags10000Parallel)\n\tb.Run(\"FindSegmentsPrevLinkHashTags100Parallel\", f.BenchmarkFindSegmentsPrevLinkHashTags100Parallel)\n\tb.Run(\"FindSegmentsPrevLinkHashTags1000Parallel\", f.BenchmarkFindSegmentsPrevLinkHashTags1000Parallel)\n\tb.Run(\"FindSegmentsPrevLinkHashTags10000Parallel\", f.BenchmarkFindSegmentsPrevLinkHashTags10000Parallel)\n\n\tb.Run(\"GetMapIDs100\", f.BenchmarkGetMapIDs100)\n\tb.Run(\"GetMapIDs1000\", f.BenchmarkGetMapIDs1000)\n\tb.Run(\"GetMapIDs10000\", f.BenchmarkGetMapIDs10000)\n\tb.Run(\"GetMapIDs100Parallel\", f.BenchmarkGetMapIDs100Parallel)\n\tb.Run(\"GetMapIDs1000Parallel\", f.BenchmarkGetMapIDs1000Parallel)\n\tb.Run(\"GetMapIDs10000Parallel\", f.BenchmarkGetMapIDs10000Parallel)\n\n\tb.Run(\"GetSegment\", f.BenchmarkGetSegment)\n\tb.Run(\"GetSegmentParallel\", f.BenchmarkGetSegmentParallel)\n}", "func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark)", "func testset_main(tls *libc.TLS) { /* speedtest1.c:694:6: */\n\tbp := tls.Alloc(2968)\n\tdefer tls.Free(2968)\n\n\tvar i int32 // Loop counter\n\tvar n int32 // iteration count\n\tvar sz int32 // Size of the tables\n\tvar maxb int32 // Maximum swizzled value\n\tvar x1 uint32 = uint32(0)\n\tvar x2 uint32 = uint32(0) // Parameters\n\tvar len int32 = 0 // Length of the zNum[] string\n\t// var zNum [2000]int8 at bp+968, 2000\n\t// A number name\n\n\tsz = libc.AssignInt32(&n, (g.szTest * 500))\n\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(0))) = int8(0)\n\tmaxb = int32(roundup_allones(tls, uint32(sz)))\n\tspeedtest1_begin_test(tls, 100, ts+2760 /* \"%d INSERTs into ...\" */, libc.VaList(bp, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_exec(tls, ts+2802, /* \"CREATE%s TABLE t...\" */\n\t\tlibc.VaList(bp+16, isTemp(tls, 9), g.zNN, g.zNN, g.zNN))\n\tspeedtest1_prepare(tls, ts+2860 /* \"INSERT INTO t1 V...\" */, libc.VaList(bp+56, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\tspeedtest1_numbername(tls, x1, bp+968 /* &zNum[0] */, int32(unsafe.Sizeof([2000]int8{})))\n\t\tsqlite3.Xsqlite3_bind_int64(tls, g.pStmt, 1, sqlite3_int64(x1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, i)\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 3, bp+968 /* &zNum[0] */, -1, uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = sz\n\tspeedtest1_begin_test(tls, 110, ts+2913 /* \"%d ordered INSER...\" */, libc.VaList(bp+72, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_exec(tls,\n\t\tts+2950, /* \"CREATE%s TABLE t...\" */\n\t\tlibc.VaList(bp+88, isTemp(tls, 5), g.zNN, g.zPK, g.zNN, g.zNN, g.zWR))\n\tspeedtest1_prepare(tls, ts+3013 /* \"INSERT INTO t2 V...\" */, libc.VaList(bp+144, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\tspeedtest1_numbername(tls, x1, bp+968 /* &zNum[0] */, int32(unsafe.Sizeof([2000]int8{})))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, i)\n\t\tsqlite3.Xsqlite3_bind_int64(tls, g.pStmt, 2, sqlite3_int64(x1))\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 3, bp+968 /* &zNum[0] */, -1, uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = sz\n\tspeedtest1_begin_test(tls, 120, ts+3058 /* \"%d unordered INS...\" */, libc.VaList(bp+160, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_exec(tls,\n\t\tts+3097, /* \"CREATE%s TABLE t...\" */\n\t\tlibc.VaList(bp+176, isTemp(tls, 3), g.zNN, g.zPK, g.zNN, g.zNN, g.zWR))\n\tspeedtest1_prepare(tls, ts+3160 /* \"INSERT INTO t3 V...\" */, libc.VaList(bp+232, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\tspeedtest1_numbername(tls, x1, bp+968 /* &zNum[0] */, int32(unsafe.Sizeof([2000]int8{})))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, i)\n\t\tsqlite3.Xsqlite3_bind_int64(tls, g.pStmt, 1, sqlite3_int64(x1))\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 3, bp+968 /* &zNum[0] */, -1, uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = 25\n\tspeedtest1_begin_test(tls, 130, ts+3205 /* \"%d SELECTS, nume...\" */, libc.VaList(bp+248, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+3244 /* \"SELECT count(*),...\" */, libc.VaList(bp+264, n))\n\tfor i = 1; i <= n; i++ {\n\t\tif ((i - 1) % g.nRepeat) == 0 {\n\t\t\tx1 = (speedtest1_random(tls) % uint32(maxb))\n\t\t\tx2 = (((speedtest1_random(tls) % uint32(10)) + (uint32(sz / 5000))) + x1)\n\t\t}\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, int32(x2))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = 10\n\tspeedtest1_begin_test(tls, 140, ts+3349 /* \"%d SELECTS, LIKE...\" */, libc.VaList(bp+280, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+3377 /* \"SELECT count(*),...\" */, libc.VaList(bp+296, n))\n\tfor i = 1; i <= n; i++ {\n\t\tif ((i - 1) % g.nRepeat) == 0 {\n\t\t\tx1 = (speedtest1_random(tls) % uint32(maxb))\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(0))) = int8('%')\n\t\t\tlen = speedtest1_numbername(tls, uint32(i), (bp + 968 /* &zNum[0] */ + uintptr(1)), (int32(uint32(unsafe.Sizeof([2000]int8{})) - uint32(2))))\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(len))) = int8('%')\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr((len + 1)))) = int8(0)\n\t\t}\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 1, bp+968 /* &zNum[0] */, (len + 1), uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = 10\n\tspeedtest1_begin_test(tls, 142, ts+3472 /* \"%d SELECTS w/ORD...\" */, libc.VaList(bp+312, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+3505 /* \"SELECT a, b, c F...\" */, libc.VaList(bp+328, n))\n\tfor i = 1; i <= n; i++ {\n\t\tif ((i - 1) % g.nRepeat) == 0 {\n\t\t\tx1 = (speedtest1_random(tls) % uint32(maxb))\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(0))) = int8('%')\n\t\t\tlen = speedtest1_numbername(tls, uint32(i), (bp + 968 /* &zNum[0] */ + uintptr(1)), (int32(uint32(unsafe.Sizeof([2000]int8{})) - uint32(2))))\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(len))) = int8('%')\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr((len + 1)))) = int8(0)\n\t\t}\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 1, bp+968 /* &zNum[0] */, (len + 1), uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = 10 // g.szTest/5;\n\tspeedtest1_begin_test(tls, 145, ts+3569 /* \"%d SELECTS w/ORD...\" */, libc.VaList(bp+344, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+3612 /* \"SELECT a, b, c F...\" */, libc.VaList(bp+360, n))\n\tfor i = 1; i <= n; i++ {\n\t\tif ((i - 1) % g.nRepeat) == 0 {\n\t\t\tx1 = (speedtest1_random(tls) % uint32(maxb))\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(0))) = int8('%')\n\t\t\tlen = speedtest1_numbername(tls, uint32(i), (bp + 968 /* &zNum[0] */ + uintptr(1)), (int32(uint32(unsafe.Sizeof([2000]int8{})) - uint32(2))))\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(len))) = int8('%')\n\t\t\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr((len + 1)))) = int8(0)\n\t\t}\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 1, bp+968 /* &zNum[0] */, (len + 1), uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 150, ts+3685 /* \"CREATE INDEX fiv...\" */, 0)\n\tspeedtest1_exec(tls, ts+3709 /* \"BEGIN;\" */, 0)\n\tspeedtest1_exec(tls, ts+3716 /* \"CREATE UNIQUE IN...\" */, 0)\n\tspeedtest1_exec(tls, ts+3750 /* \"CREATE INDEX t1c...\" */, 0)\n\tspeedtest1_exec(tls, ts+3777 /* \"CREATE UNIQUE IN...\" */, 0)\n\tspeedtest1_exec(tls, ts+3811 /* \"CREATE INDEX t2c...\" */, 0)\n\tspeedtest1_exec(tls, ts+3843 /* \"CREATE INDEX t3b...\" */, 0)\n\tspeedtest1_exec(tls, ts+3873 /* \"COMMIT;\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = (sz / 5)\n\tspeedtest1_begin_test(tls, 160, ts+3881 /* \"%d SELECTS, nume...\" */, libc.VaList(bp+376, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+3918 /* \"SELECT count(*),...\" */, libc.VaList(bp+392, n))\n\tfor i = 1; i <= n; i++ {\n\t\tif ((i - 1) % g.nRepeat) == 0 {\n\t\t\tx1 = (speedtest1_random(tls) % uint32(maxb))\n\t\t\tx2 = (((speedtest1_random(tls) % uint32(10)) + (uint32(sz / 5000))) + x1)\n\t\t}\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, int32(x2))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = (sz / 5)\n\tspeedtest1_begin_test(tls, 161, ts+4023 /* \"%d SELECTS, nume...\" */, libc.VaList(bp+408, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+4055 /* \"SELECT count(*),...\" */, libc.VaList(bp+424, n))\n\tfor i = 1; i <= n; i++ {\n\t\tif ((i - 1) % g.nRepeat) == 0 {\n\t\t\tx1 = (speedtest1_random(tls) % uint32(maxb))\n\t\t\tx2 = (((speedtest1_random(tls) % uint32(10)) + (uint32(sz / 5000))) + x1)\n\t\t}\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, int32(x2))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = (sz / 5)\n\tspeedtest1_begin_test(tls, 170, ts+4160 /* \"%d SELECTS, text...\" */, libc.VaList(bp+440, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+4194 /* \"SELECT count(*),...\" */, libc.VaList(bp+456, n))\n\tfor i = 1; i <= n; i++ {\n\t\tif ((i - 1) % g.nRepeat) == 0 {\n\t\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\t\tlen = speedtest1_numbername(tls, x1, bp+968 /* &zNum[0] */, (int32(uint32(unsafe.Sizeof([2000]int8{})) - uint32(1))))\n\t\t}\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 1, bp+968 /* &zNum[0] */, len, uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = sz\n\tspeedtest1_begin_test(tls, 180, ts+4306 /* \"%d INSERTS with ...\" */, libc.VaList(bp+472, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_exec(tls,\n\n\t\tts+4336, /* \"CREATE%s TABLE t...\" */\n\t\tlibc.VaList(bp+488, isTemp(tls, 1), g.zNN, g.zPK, g.zNN, g.zNN, g.zWR))\n\tspeedtest1_exec(tls, ts+4407 /* \"CREATE INDEX t4b...\" */, 0)\n\tspeedtest1_exec(tls, ts+4433 /* \"CREATE INDEX t4c...\" */, 0)\n\tspeedtest1_exec(tls, ts+4459 /* \"INSERT INTO t4 S...\" */, 0)\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = sz\n\tspeedtest1_begin_test(tls, 190, ts+4491 /* \"DELETE and REFIL...\" */, libc.VaList(bp+544, n))\n\tspeedtest1_exec(tls, ts+4519 /* \"DELETE FROM t2;\" */, 0)\n\tspeedtest1_exec(tls, ts+4535 /* \"INSERT INTO t2 S...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 200, ts+4568 /* \"VACUUM\" */, 0)\n\tspeedtest1_exec(tls, ts+4568 /* \"VACUUM\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 210, ts+4575 /* \"ALTER TABLE ADD ...\" */, 0)\n\tspeedtest1_exec(tls, ts+4609 /* \"ALTER TABLE t2 A...\" */, 0)\n\tspeedtest1_exec(tls, ts+4649 /* \"SELECT sum(d) FR...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = (sz / 5)\n\tspeedtest1_begin_test(tls, 230, ts+4671 /* \"%d UPDATES, nume...\" */, libc.VaList(bp+560, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\t\tts+4708 /* \"UPDATE t2 SET d=...\" */, libc.VaList(bp+576, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = (speedtest1_random(tls) % uint32(maxb))\n\t\tx2 = (((speedtest1_random(tls) % uint32(10)) + (uint32(sz / 5000))) + x1)\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, int32(x2))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = sz\n\tspeedtest1_begin_test(tls, 240, ts+4767 /* \"%d UPDATES of in...\" */, libc.VaList(bp+592, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\t\tts+4797 /* \"UPDATE t2 SET d=...\" */, libc.VaList(bp+608, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = ((speedtest1_random(tls) % uint32(sz)) + uint32(1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 250, ts+4841 /* \"One big UPDATE o...\" */, libc.VaList(bp+624, sz))\n\tspeedtest1_exec(tls, ts+4882 /* \"UPDATE t2 SET d=...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 260, ts+4902 /* \"Query added colu...\" */, 0)\n\tspeedtest1_exec(tls, ts+4649 /* \"SELECT sum(d) FR...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = (sz / 5)\n\tspeedtest1_begin_test(tls, 270, ts+4935 /* \"%d DELETEs, nume...\" */, libc.VaList(bp+640, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\t\tts+4972 /* \"DELETE FROM t2 W...\" */, libc.VaList(bp+656, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = ((speedtest1_random(tls) % uint32(maxb)) + uint32(1))\n\t\tx2 = (((speedtest1_random(tls) % uint32(10)) + (uint32(sz / 5000))) + x1)\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, int32(x2))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = sz\n\tspeedtest1_begin_test(tls, 280, ts+5026 /* \"%d DELETEs of in...\" */, libc.VaList(bp+672, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\t\tts+5056 /* \"DELETE FROM t3 W...\" */, libc.VaList(bp+688, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = ((speedtest1_random(tls) % uint32(sz)) + uint32(1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 290, ts+5095 /* \"Refill two %d-ro...\" */, libc.VaList(bp+704, sz))\n\tspeedtest1_exec(tls, ts+5134 /* \"REPLACE INTO t2(...\" */, 0)\n\tspeedtest1_exec(tls, ts+5178 /* \"REPLACE INTO t3(...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 300, ts+5222 /* \"Refill a %d-row ...\" */, libc.VaList(bp+720, sz))\n\tspeedtest1_exec(tls, ts+4519 /* \"DELETE FROM t2;\" */, 0)\n\tspeedtest1_exec(tls,\n\t\tts+5263 /* \"INSERT INTO t2(a...\" */, 0)\n\tspeedtest1_exec(tls,\n\t\tts+5328 /* \"INSERT INTO t2(a...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tn = (sz / 5)\n\tspeedtest1_begin_test(tls, 310, ts+5393 /* \"%d four-ways joi...\" */, libc.VaList(bp+736, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_prepare(tls,\n\n\t\tts+5412 /* \"SELECT t1.c FROM...\" */, 0)\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = ((speedtest1_random(tls) % uint32(sz)) + uint32(1))\n\t\tx2 = (((speedtest1_random(tls) % uint32(10)) + x1) + uint32(4))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(x1))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, int32(x2))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 320, ts+5525 /* \"subquery in resu...\" */, libc.VaList(bp+752, n))\n\tspeedtest1_prepare(tls,\n\n\t\tts+5548 /* \"SELECT sum(a), m...\" */, 0)\n\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, (est_square_root(tls, g.szTest) * 50))\n\tspeedtest1_run(tls)\n\tspeedtest1_end_test(tls)\n\n\tsz = libc.AssignInt32(&n, (g.szTest * 700))\n\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(0))) = int8(0)\n\tmaxb = int32(roundup_allones(tls, (uint32(sz / 3))))\n\tspeedtest1_begin_test(tls, 400, ts+5666 /* \"%d REPLACE ops o...\" */, libc.VaList(bp+768, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_exec(tls, ts+5691, /* \"CREATE%s TABLE t...\" */\n\t\tlibc.VaList(bp+784, isTemp(tls, 9), g.zNN))\n\tspeedtest1_prepare(tls, ts+5739 /* \"REPLACE INTO t5 ...\" */, libc.VaList(bp+808, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\tspeedtest1_numbername(tls, uint32(i), bp+968 /* &zNum[0] */, int32(unsafe.Sizeof([2000]int8{})))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(sqlite3_int64(x1)))\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 2, bp+968 /* &zNum[0] */, -1, uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\tspeedtest1_begin_test(tls, 410, ts+5783 /* \"%d SELECTS on an...\" */, libc.VaList(bp+824, n))\n\tspeedtest1_prepare(tls, ts+5804 /* \"SELECT b FROM t5...\" */, libc.VaList(bp+840, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 1, int32(sqlite3_int64(x1)))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_end_test(tls)\n\n\tsz = libc.AssignInt32(&n, (g.szTest * 700))\n\t*(*int8)(unsafe.Pointer(bp + 968 /* &zNum[0] */ + uintptr(0))) = int8(0)\n\tmaxb = int32(roundup_allones(tls, (uint32(sz / 3))))\n\tspeedtest1_begin_test(tls, 500, ts+5846 /* \"%d REPLACE on TE...\" */, libc.VaList(bp+856, n))\n\tspeedtest1_exec(tls, ts+2796 /* \"BEGIN\" */, 0)\n\tspeedtest1_exec(tls, ts+5868, /* \"CREATE%s TABLE t...\" */\n\t\tlibc.VaList(bp+872, isTemp(tls, 9), g.zNN,\n\t\t\tfunc() uintptr {\n\t\t\t\tif sqlite3.Xsqlite3_libversion_number(tls) >= 3008002 {\n\t\t\t\t\treturn ts + 5915 /* \"WITHOUT ROWID\" */\n\t\t\t\t}\n\t\t\t\treturn ts + 2152 /* \"\" */\n\t\t\t}()))\n\tspeedtest1_prepare(tls, ts+5929 /* \"REPLACE INTO t6 ...\" */, libc.VaList(bp+904, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\tspeedtest1_numbername(tls, x1, bp+968 /* &zNum[0] */, int32(unsafe.Sizeof([2000]int8{})))\n\t\tsqlite3.Xsqlite3_bind_int(tls, g.pStmt, 2, i)\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 1, bp+968 /* &zNum[0] */, -1, uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_exec(tls, ts+2906 /* \"COMMIT\" */, 0)\n\tspeedtest1_end_test(tls)\n\tspeedtest1_begin_test(tls, 510, ts+5973 /* \"%d SELECTS on a ...\" */, libc.VaList(bp+920, n))\n\tspeedtest1_prepare(tls, ts+5997 /* \"SELECT b FROM t6...\" */, libc.VaList(bp+936, n))\n\tfor i = 1; i <= n; i++ {\n\t\tx1 = swizzle(tls, uint32(i), uint32(maxb))\n\t\tspeedtest1_numbername(tls, x1, bp+968 /* &zNum[0] */, int32(unsafe.Sizeof([2000]int8{})))\n\t\tsqlite3.Xsqlite3_bind_text(tls, g.pStmt, 1, bp+968 /* &zNum[0] */, -1, uintptr(0))\n\t\tspeedtest1_run(tls)\n\t}\n\tspeedtest1_end_test(tls)\n\tspeedtest1_begin_test(tls, 520, ts+6039 /* \"%d SELECT DISTIN...\" */, libc.VaList(bp+952, n))\n\tspeedtest1_exec(tls, ts+6058 /* \"SELECT DISTINCT ...\" */, 0)\n\tspeedtest1_exec(tls, ts+6085 /* \"SELECT DISTINCT ...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 980, ts+6112 /* \"PRAGMA integrity...\" */, 0)\n\tspeedtest1_exec(tls, ts+6112 /* \"PRAGMA integrity...\" */, 0)\n\tspeedtest1_end_test(tls)\n\n\tspeedtest1_begin_test(tls, 990, ts+6135 /* \"ANALYZE\" */, 0)\n\tspeedtest1_exec(tls, ts+6135 /* \"ANALYZE\" */, 0)\n\tspeedtest1_end_test(tls)\n}", "func BenchmarkSearchShort(b *testing.B) { benchmarkSearch(b, testData[0]) }", "func main() {\n flag.Parse()\n if *cpuprofile != \"\" {\n f, err := os.Create(*cpuprofile)\n if err != nil {\n log.Fatal(err)\n }\n pprof.StartCPUProfile(f)\n defer pprof.StopCPUProfile()\n }\n\n rand.Seed(time.Now().Unix())\n // numprocs, numprocsdef := 0, 0\n \n hw_threads := runtime.NumCPU()\n // if *threads < hw_threads {\n // hw_threads = *threads\n // }\n // numprocsdef =\n runtime.GOMAXPROCS(hw_threads)\n// numprocsdef = runtime.GOMAXPROCS(4)\n numprocs := runtime.GOMAXPROCS(0)\n\n if *server {\n distr.StartServer(clientType)\n return\n }\n\n\n\n\n log.Printf(\"====================================================\\n\")\n hostname, _ := os.Hostname()\n log.Printf(\"Starting go load generator with %d HW threads at %s \\n\", numprocs, hostname)\n duration, err := time.ParseDuration(*p_duration)\n if(err != nil){\n panic(err)\n }\n // log.Printf(\"Hitting %s at %d reqs/s by %d clients during %v.\", *p_addr, *p_rate, *threads, duration)\n parameters := core.TestParameters{ Addr: *p_addr, Rate: float64(*p_rate),Duration: duration,Clients: *threads, SaveSamples: (*dataOutput != \"\"), SampleFile: *dataOutput}\n\n var globalResult result.Result\n if *commander {\n serverfilecontents, err := ioutil.ReadFile(*serverfile)\n if err != nil {\n panic(err)\n }\n lines := strings.Split(string(serverfilecontents), \"\\n\")\n var servers []string\n for _, line := range lines {\n if strings.TrimSpace(line) != \"\" {\n servers = append(servers, line)\n }\n }\n\n log.Printf(\"Using serverfile %s with contents (%d) %v\\n\", *serverfile, len(servers), servers)\n globalResult = distr.StartCommander( parameters, servers, clientType)\n\n } else {\n globalResult = core.StartTest( parameters, clientType)\n result.PrintResult(globalResult, *threads)\n if(parameters.SaveSamples){\n result.SaveToFile(&globalResult, parameters.SampleFile)\n }\n\n }\n \n // if totalResponses > 0\n // log.Printf(\"TOTAL %d responses in %v, Rate: %v, avgLatency: %v\\n\", totalResponses, duration, float64(totalResponses)/duration.Seconds(), time.Duration(avgLatency))\n \n}", "func benchmarkGA(solution []byte, alphabet []byte, populationSize int, mutationRate float32, seed int64, numberOfThreds int) int64 {\n\n\tga := FindwordGA.FindwordGA{}\n\n\tvar duration time.Duration\n\n\tfor i := 0; i < 10; i++ {\n\t\tga = FindwordGA.FindwordGA{}\n\t\tga.InitPopulation(solution, alphabet, populationSize, mutationRate, seed, numberOfThreds)\n\t\tga.Run()\n\t\tfmt.Println(ga.Duration.String())\n\t\tduration += ga.Duration\n\t}\n\n\treturn duration.Nanoseconds() / 10\n}", "func BenchmarkSort(b *testing.B) {\n\tb.StopTimer()\n\titem := algorithm.Generate(0, 10000000, 5000)\n\tb.StartTimer()\n\tfor i:=0;i<b.N ;i++ {\n\t\tSort(item, 0, len(item)-1)\n\t}\n}", "func perf(elapsed, total, inputs, tput, index, collectors, failureCollectors, offlineCollectors float64) {\n\tpdata = fmt.Sprintf(\"time=%f;;;; total=%.f;;;; sources=%.f;;;; throughput=%.f;;;; index_failures=%.f;;;; collectors=%.f;;;; collector_failure=%.f;;;; collector_offline=%.f;;;;\", elapsed, total, inputs, tput, index, collectors, failureCollectors, offlineCollectors)\n}", "func RunBenchmarks(b *testing.B, coll *docstore.Collection) {\n\tdefer coll.Close()\n\tclearCollection(b, coll)\n\tb.Run(\"BenchmarkSingleActionPut\", func(b *testing.B) {\n\t\tbenchmarkSingleActionPut(10, b, coll)\n\t})\n\tb.Run(\"BenchmarkSingleActionGet\", func(b *testing.B) {\n\t\tbenchmarkSingleActionGet(10, b, coll)\n\t})\n\tb.Run(\"BenchmarkActionListPut\", func(b *testing.B) {\n\t\tbenchmarkActionListPut(50, b, coll)\n\t})\n\tb.Run(\"BenchmarkActionListGet\", func(b *testing.B) {\n\t\tbenchmarkActionListGet(100, b, coll)\n\t})\n\tclearCollection(b, coll)\n}", "func TestApiSpeed (t *testing.T) {\n\tgo setUpApi() \t//run the service asynchronously\n\n\tclient := http.Client{\n\t\tTimeout: time.Second * 2,\n\t} //Initialize the client\n\n\n\tfor i := 10990; i < 11010 ; i++{\n\t\tstart:= time.Now()\n\t\tcallApiWithCount(i,client)\n\t\telapsed := time.Since(start)\n\t\tt.Logf(\"%v took %s\\n\", i, elapsed)\n\t}\n\n}", "func main() {\n\tstart := time.Now()\n\n\tdata := readInData()\n\n\t// Can't use go routines because I actually need checkGroupsOfOne to finish before checkGroupsOfTwo\n\t// I'm going to keep a map of what functional dependencies I got from one and then not print them if that's what\n\t// I get from two\n\trelArr := checkGroupsOfOne(data)\n\tcheckGroupOfTwo(data, relArr)\n\n\tt := time.Now()\n\telapsed := t.Sub(start)\n\tfmt.Println(elapsed)\n}", "func (r BenchmarkResult) MemString() string {}", "func BenchmarkWrite(b *testing.B) {\n\tb.ReportAllocs()\n\n\tfor i := 0; i < b.N; i++ {\n\t\tbuf := MakeGame([]byte(playerID), firstBoard)\n\t\tif i == 0 {\n\t\t\tb.SetBytes(int64(len(buf)))\n\t\t}\n\t}\n}", "func TestCreateProcessAverageReport(t *testing.T) {\n\n timeSlice := float64(TIMESLICE)\n processName := \"proc5\"\n\n testtable := []struct {\n tname string\n }{\n {\n tname: \"ok\",\n },\n }\n\n CreateDummyProcessMetrics(testNodeMetricsMap)\n\n for _, tc := range testtable {\n\n t.Run(tc.tname, func(t *testing.T) {\n\n var buffer bytes.Buffer\n writer := bufio.NewWriter(&buffer)\n\n err := json.NewEncoder(writer).Encode(CreateProcessAverageReport(testNodeMetricsMap, processName, timeSlice))\n if err != nil {\n t.Fatalf(\"failed writing json: %s\", err)\n }\n writer.Flush()\n\n goldenPath := filepath.Join(\"testdata\", filepath.FromSlash(t.Name()) + \".golden\")\n\n\n if *update {\n\n t.Log(\"update golden file\")\n if err := ioutil.WriteFile(goldenPath, buffer.Bytes(), 0644); err != nil {\n t.Fatalf(\"failed to update golden file %s: %s\", goldenPath, err)\n }\n\n }\n\n\n goldenData, err := ioutil.ReadFile(goldenPath)\n\n if err != nil {\n t.Fatalf(\"failed reading .golden file %s: %s\", goldenPath, err)\n }\n\n t.Log(string(buffer.Bytes()))\n\n if !bytes.Equal(buffer.Bytes(), goldenData) {\n t.Errorf(\"bytes do not match .golden file %s\", goldenPath)\n }\n\n })\n }\n\n}", "func (r BenchmarkResult) AllocsPerOp() int64 {}", "func BenchmarkVersion(b *testing.B) {\n\tb.Run(\"gintest\", func(b *testing.B) {\n\t\t// for i := 0; i < b.N; i++ {\n\t\t// \tsend(b, \"http://127.0.0.1:11000/microgin/version\", \"\")\n\t\t// }\n\n\t\t// 并发测试\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tfor pb.Next() {\n\t\t\t\tsend(b, \"http://127.0.0.1:11000/microgin/version\", \"\")\n\t\t\t}\n\t\t})\n\t})\n\n\tb.Run(\"beegotest\", func(b *testing.B) {\n\t\t// for i := 0; i < b.N; i++ {\n\t\t// \tsend(b, \"http://127.0.0.1:11001/beegotest\", \"\")\n\t\t// }\n\n\t\t// 并发测试\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tfor pb.Next() {\n\t\t\t\tsend(b, \"http://127.0.0.1:11001/beegotest\", \"\")\n\t\t\t}\n\t\t})\n\t})\n\n\tb.Run(\"microgin\", func(b *testing.B) {\n\t\t// for i := 0; i < b.N; i++ {\n\t\t// \tsend(b, server+\"/microgin/version\", \"\")\n\t\t// }\n\n\t\t// 并发测试\n\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\tfor pb.Next() {\n\t\t\t\tsend(b, server+\"/microgin/version\", \"\")\n\t\t\t}\n\t\t})\n\t})\n}", "func BenchmarkQuickSort(b *testing.B) {\n\ttestArr := []int{6, 1, 2, 7, 9, 3, 4, 5, 10, 8}\n\tfor i := 0; i < b.N; i++ {\n\t\tsort.QuickSort2(testArr)\n\t}\n}", "func stats() {\n\tfor {\n\t\tcnt := atomic.LoadInt32(&counter)\n\t\tif cnt < 1000000 {\n\t\t\tfmt.Printf(\"#\\n# Elapsed: %s - Counter: %d\\n#\\n\", time.Now().Sub(startTime).String(), cnt)\n\t\t} else {\n\t\t\tfmt.Printf(\"#\\n# Elapsed: %s - Counter: %d\\n# Hit Ctrl-C to terminate the program\\n#\\n\", time.Now().Sub(startTime).String(), cnt)\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n}", "func stats() {\n\tfor {\n\t\tcnt := atomic.LoadInt32(&counter)\n\t\tif cnt < 1000000 {\n\t\t\tfmt.Printf(\"#\\n# Elapsed: %s - Counter: %d\\n#\\n\", time.Now().Sub(startTime).String(), cnt)\n\t\t} else {\n\t\t\tfmt.Printf(\"#\\n# Elapsed: %s - Counter: %d\\n# Hit Ctrl-C to terminate the program\\n#\\n\", time.Now().Sub(startTime).String(), cnt)\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n}", "func benchmarkCommand(b *testing.B, cmd string, args ...interface{}) {\n\ttestingSetUp()\n\tdefer testingTearDown()\n\tfor i := 0; i < b.N; i++ {\n\t\tconn := testPool.NewConn()\n\t\tif _, err := conn.Do(cmd, args...); err != nil {\n\t\t\t_ = conn.Close()\n\t\t\tb.Fatal(err)\n\t\t}\n\t\t_ = conn.Close()\n\t}\n}", "func testQueryMem(t *testing.T, dst interface{}, query string) {\n\ts, err := ConnectSWbemServices()\n\tif err != nil {\n\t\tt.Fatalf(\"ConnectSWbemServices: %s\", err)\n\t}\n\n\tstart := time.Now()\n\tfmt.Printf(\"Benchmark Iterations: %d (Private Memory should stabilize around 7MB after ~3000)\\n\", memReps)\n\n\tvar privateMB, allocMB, allocTotalMB float64\n\tfor i := 0; i < memReps; i++ {\n\t\tif err := s.Query(query, dst); err != nil {\n\t\t\tt.Fatalf(\"Failed to perform query %q; %s\", query, err)\n\t\t}\n\n\t\tif i%100 == 0 {\n\t\t\tprivateMB, allocMB, allocTotalMB = wbemConnGetMemoryUsageMB(t, s)\n\t\t\tfmt.Printf(\"Time: %4ds Count: %5d \", time.Now().Sub(start)/time.Second, i)\n\t\t\tprintlnMemUsage(privateMB, allocMB, allocTotalMB)\n\t\t}\n\t}\n\n\tif errClose := s.Close(); errClose != nil {\n\t\tt.Fatalf(\"Close: %s\", errClose)\n\t}\n\n\tfmt.Printf(\"Final Time: %4ds \", time.Now().Sub(start)/time.Second)\n\tprintlnMemUsage(privateMB, allocMB, allocTotalMB)\n}", "func Benchmark_GetMiner(b *testing.B) {\r\n\tst, _ := miner.MakeMiningPoolData(100000000)\r\n\t//assert.NoError(t, err)\r\n\tfor i := 0; i < b.N; i++ { //use b.N for looping\r\n\t\tdl := rand.Intn(st)\r\n\t\tminer.GetMiner(dl)\r\n\t}\r\n}", "func speedtest1_end_test(tls *libc.TLS) { /* speedtest1.c:399:6: */\n\tbp := tls.Alloc(24)\n\tdefer tls.Free(24)\n\n\tvar iElapseTime sqlite3_int64 = (speedtest1_timestamp(tls) - g.iStart)\n\tif g.doCheckpoint != 0 {\n\t\tspeedtest1_exec(tls, ts+2549 /* \"PRAGMA wal_check...\" */, 0)\n\t}\n\tif !(g.bSqlOnly != 0) {\n\t\t*(*sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&g)) + 16 /* &.iTotal */)) += (iElapseTime)\n\t\tlibc.Xprintf(tls, ts+2572 /* \"%4d.%03ds\\n\" */, libc.VaList(bp, (int32(iElapseTime/int64(1000))), (int32(iElapseTime%int64(1000)))))\n\t}\n\tif g.pStmt != 0 {\n\t\tsqlite3.Xsqlite3_finalize(tls, g.pStmt)\n\t\tg.pStmt = uintptr(0)\n\t}\n}", "func benchmarkCopy(samples, gauges, counters int, b *testing.B) {\n\tss := newTestSink(0*time.Second, nil)\n\tfor i := 0; i < samples; i++ {\n\t\tss.AddSample([]string{fmt.Sprintf(\"%d\", i)}, float32(i)*0.3)\n\t}\n\tfor i := 0; i < gauges; i++ {\n\t\tss.SetGauge([]string{fmt.Sprintf(\"%d\", i)}, float32(i)*0.3)\n\t}\n\tfor i := 0; i < counters; i++ {\n\t\tss.IncrCounter([]string{fmt.Sprintf(\"%d\", i)}, float32(i)*0.3)\n\t}\n\n\tvar n int\n\tfor i := 0; i < b.N; i++ {\n\t\t_, s, g, c := ss.deep()\n\t\t// do something with the copy so that the compiler doesn't optimize it away\n\t\tn = len(s) + len(g) + len(c)\n\t}\n\tb.Logf(\"%d\", n)\n}", "func Benchmark(fmtt string, args ...string) func() {\n\tstarted := time.Now()\n\treturn func() {\n\t\tTrace.Pipeline(fmt.Sprintf(fmtt, args) + \": \" + string(time.Since(started)))\n\t}\n}", "func TestAuxOverhead(t *testing.T) {\n\tvec := NewVector()\n\tfor i := 0; i < 1e5; i++ {\n\t\tv := int(rand.Uint32())\n\t\tvec.Add(v)\n\t}\n\n\trawsize := float64(vec.bits.Size())\n\toverhead := float64(vec.Size()) - rawsize\n\tpercentage := (overhead / rawsize) * 100\n\n\tfmt.Printf(\"=== OVERHEAD: %.2f%%\\n\", percentage)\n}", "func speedtest1_final(tls *libc.TLS) { /* speedtest1.c:413:6: */\n\tbp := tls.Alloc(72)\n\tdefer tls.Free(72)\n\n\tif !(g.bSqlOnly != 0) {\n\t\tlibc.Xprintf(tls, ts+2583 /* \" TOTAL%.*s...\" */, libc.VaList(bp, (60-5), uintptr(unsafe.Pointer(&zDots)),\n\t\t\t(int32(g.iTotal/int64(1000))), (int32(g.iTotal%int64(1000)))))\n\t}\n\tif g.bVerify != 0 {\n\t\tvar i int32\n\t\tlibc.Xprintf(tls, ts+2611 /* \"Verification Has...\" */, libc.VaList(bp+40, g.nResByte))\n\t\tHashUpdate(tls, ts+2636 /* \"\\n\" */, uint32(1))\n\t\tHashFinal(tls)\n\t\tfor i = 0; i < 24; i++ {\n\t\t\tlibc.Xprintf(tls, ts+2638 /* \"%02x\" */, libc.VaList(bp+56, int32(*(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&g)) + 3104 /* &.hash */ + 259 /* &.r */) + uintptr(i))))))\n\t\t}\n\t\tif (g.hashFile != 0) && (g.hashFile != (libc.X__acrt_iob_func(tls, uint32(1)))) {\n\t\t\tlibc.Xfclose(tls, g.hashFile)\n\t\t}\n\t\tlibc.Xprintf(tls, ts+2636 /* \"\\n\" */, 0)\n\t}\n}", "func (bm *DockerBenchmarker) RunBenchmark() {\n\n\t// CIS 4.1 Create a user for the container\n\tbm.CheckNonRootUser()\n\n\t// CIS 4.2 Use trusted base images for containers\n\tbm.CheckTrustedBaseImages()\n\n\t// CIS 4.3 Do not install unnecessary packages in the container\n\tbm.CheckDisallowedPackages()\n\n\t// CIS 4.6 add HEALTHCHECK instruction to the container image\n\tbm.CheckHealthCheck()\n\n\t// CIS 4.7 Do not use update instructions alone in the Dockerfile\n\tbm.CheckRunUpdateOnly()\n\n\t// CIS 4.9 Use COPY instead of ADD in Dockerfile\n\tbm.CheckAdd()\n\n\t// CIS 4.10 Do not store secrets in Dockerfiles\n\tbm.CheckSecretsInsideImage()\n}", "func BenchmarkPing(b *testing.B) {\n\tbenchmarkCommand(b, \"PING\")\n}", "func BenchmarkThirt(b *testing.B) {\n\tinput := 987654321\n\tfor index := 0; index < b.N; index++ {\n\t\tThirt(input)\n\t}\n}", "func main() {\n\n\tdivisorGreater(2)\n\tdivisorGreater(1)\n\tdivisorGreater(8128)\n\tdivisorGreater(0)\n\n\t/*\n\trun_btree()\n\n\trun_binsearch(binsearch_inplace)\n\trun_binsearch(binsearch)\n\n\trun_qsort()\n\t*/\n}", "func BenchmarkDB(b *testing.B) {\n\tdefer testDB.Remove()\n\tfor _, n := range []int{1000, 10000, 100000} {\n\t\tname := fmt.Sprintf(\"%d entries\", n)\n\t\tb.Run(name, benchmarkDB(n))\n\t\tbenchmarkPrintDBFileSize(name)\n\t}\n}", "func speedTestMemory(url string) (speedTestData, error) {\n\n\t// Setup the data struct with defaults\n\tvar data = new(speedTestData)\n\tdata.Milliseconds = -1\n\tdata.Bytes = -1\n\tdata.URL = url\n\tdata.Date = time.Now()\n\n\t// Log the START milliseconds\n\tvar startTime = time.Now().UnixNano() / 1000000\n\n\t// Setup HTTP client\n\tvar httpClient = &http.Client{\n\t\tTimeout: time.Minute * 2,\n\t}\n\n\t// Download the file\n\tresp, err := httpClient.Get(url)\n\tif err != nil {\n\t\treturn *data, err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Read the file into memory\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn *data, err\n\t}\n\n\t// Log the END milliseconds\n\tvar endTime = time.Now().UnixNano() / 1000000\n\n\t// Populate the result struct with data and return\n\tdata.Bytes = len(body)\n\tdata.Milliseconds = int(endTime - startTime)\n\treturn *data, nil\n}", "func fprintStats(w io.Writer, q *QueryBenchmarker) {\n\tmaxKeyLength := 0\n\tkeys := make([]string, 0, len(q.statMapping))\n\tfor k := range q.statMapping {\n\t\tif len(k) > maxKeyLength {\n\t\t\tmaxKeyLength = len(k)\n\t\t}\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\tfor _, k := range keys {\n\t\tv := q.statMapping[k]\n\t\tminRate := 1e3 / v.Min\n\t\tmeanRate := 1e3 / v.Mean\n\t\tmaxRate := 1e3 / v.Max\n\t\tpaddedKey := fmt.Sprintf(\"%s\", k)\n\t\tfor len(paddedKey) < maxKeyLength {\n\t\t\tpaddedKey += \" \"\n\t\t}\n\t\tkStats := make(map[string]interface{})\n\t\tkStats[\"min\"] = v.Min\n\t\tkStats[\"minRate\"] = minRate\n\t\tkStats[\"mean\"] = v.Mean\n\t\tkStats[\"meanRate\"] = meanRate\n\t\tkStats[\"max\"] = v.Max\n\t\tkStats[\"maxRate\"] = maxRate\n\t\tkStats[\"count\"] = v.Count\n\t\tkStats[\"sum\"] = v.Sum / 1e3\n\t\tq.json[k] = kStats\n\t\tif !q.doJson {\n\t\t\t_, err := fmt.Fprintf(w, \"%s : min: %8.2fms (%7.2f/sec), mean: %8.2fms (%7.2f/sec), max: %7.2fms (%6.2f/sec), count: %8d, sum: %5.1fsec \\n\", paddedKey, v.Min, minRate, v.Mean, meanRate, v.Max, maxRate, v.Count, v.Sum/1e3)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n\tq.json[\"totalQueries\"] = q.totalQueries\n\tq.json[\"wallClockTime\"] = q.wallTook.Seconds()\n\tq.json[\"queryRate\"] = float64(q.totalQueries) / float64(q.wallTook.Seconds())\n\tq.json[\"workers\"] = q.workers\n\tq.json[\"batchSize\"] = q.batchSize\n\tif q.doJson {\n\t\tfor k, v := range q.json {\n\t\t\tif _, err := json.Marshal(v); err != nil {\n\t\t\t\tq.json[k] = \"\"\n\t\t\t}\n\t\t}\n\t\tb, err := json.Marshal(q.json)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error:\", err)\n\t\t}\n\t\tos.Stdout.Write(b)\n\t}\n}", "func MyBenchmark[Key comparable](b *testing.B, buildKey func(id int) Key) {\n\tcount := 100_000\n\tmyMap := make(map[Key]string, count)\n\tkeys := make([]Key, count)\n\tfor i := 0; i < count; i++ {\n\t\tkey := buildKey(i)\n\t\tmyMap[key] = \"hello\"\n\t\tkeys[i] = key\n\t}\n\n\tb.ResetTimer()\n\n\tfor n := 0; n < b.N; n++ {\n\t\tfor _, key := range keys {\n\t\t\tif myMap[key] != \"hello\" {\n\t\t\t\tb.Fatalf(\"value is %s, expected hello\", myMap[key])\n\t\t\t}\n\t\t}\n\t}\n}", "func TestBenchlistAdd(t *testing.T) {\n\tvdrs := validators.NewSet()\n\tvdr0 := validators.GenerateRandomValidator(50)\n\tvdr1 := validators.GenerateRandomValidator(50)\n\tvdr2 := validators.GenerateRandomValidator(50)\n\tvdr3 := validators.GenerateRandomValidator(50)\n\tvdr4 := validators.GenerateRandomValidator(50)\n\n\terrs := wrappers.Errs{}\n\terrs.Add(\n\t\tvdrs.AddWeight(vdr0.ID(), vdr0.Weight()),\n\t\tvdrs.AddWeight(vdr1.ID(), vdr1.Weight()),\n\t\tvdrs.AddWeight(vdr2.ID(), vdr2.Weight()),\n\t\tvdrs.AddWeight(vdr3.ID(), vdr3.Weight()),\n\t\tvdrs.AddWeight(vdr4.ID(), vdr4.Weight()),\n\t)\n\tif errs.Errored() {\n\t\tt.Fatal(errs.Err)\n\t}\n\n\tthreshold := 3\n\tduration := time.Minute\n\tmaxPortion := 0.5\n\tbenchIntf, err := NewBenchlist(\n\t\tlogging.NoLog{},\n\t\tvdrs,\n\t\tthreshold,\n\t\tminimumFailingDuration,\n\t\tduration,\n\t\tmaxPortion,\n\t\t\"\",\n\t\tprometheus.NewRegistry(),\n\t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tb := benchIntf.(*benchlist)\n\tdefer b.timer.Stop()\n\tnow := time.Now()\n\tb.clock.Set(now)\n\n\t// Nobody should be benched at the start\n\tb.lock.Lock()\n\tassert.False(t, b.isBenched(vdr0.ID()))\n\tassert.False(t, b.isBenched(vdr1.ID()))\n\tassert.False(t, b.isBenched(vdr2.ID()))\n\tassert.False(t, b.isBenched(vdr3.ID()))\n\tassert.False(t, b.isBenched(vdr4.ID()))\n\tassert.Len(t, b.failureStreaks, 0)\n\tassert.Equal(t, b.benchedQueue.Len(), 0)\n\tassert.Equal(t, b.benchlistSet.Len(), 0)\n\tb.lock.Unlock()\n\n\t// Register [threshold - 1] failures in a row for vdr0\n\tfor i := 0; i < threshold-1; i++ {\n\t\tb.RegisterFailure(vdr0.ID())\n\t}\n\n\t// Still shouldn't be benched due to not enough consecutive failure\n\tassert.False(t, b.isBenched(vdr0.ID()))\n\tassert.Equal(t, b.benchedQueue.Len(), 0)\n\tassert.Equal(t, b.benchlistSet.Len(), 0)\n\tassert.Len(t, b.failureStreaks, 1)\n\tfs := b.failureStreaks[vdr0.ID()]\n\tassert.Equal(t, threshold-1, fs.consecutive)\n\tassert.True(t, fs.firstFailure.Equal(now))\n\n\t// Register another failure\n\tb.RegisterFailure(vdr0.ID())\n\n\t// Still shouldn't be benched because not enough time (any in this case)\n\t// has passed since the first failure\n\tb.lock.Lock()\n\tassert.False(t, b.isBenched(vdr0.ID()))\n\tassert.Equal(t, b.benchedQueue.Len(), 0)\n\tassert.Equal(t, b.benchlistSet.Len(), 0)\n\tb.lock.Unlock()\n\n\t// Move the time up\n\tnow = now.Add(minimumFailingDuration).Add(time.Second)\n\tb.lock.Lock()\n\tb.clock.Set(now)\n\tb.lock.Unlock()\n\n\t// Register another failure\n\tb.RegisterFailure(vdr0.ID())\n\n\t// Now this validator should be benched\n\tb.lock.Lock()\n\tassert.True(t, b.isBenched(vdr0.ID()))\n\tassert.Equal(t, b.benchedQueue.Len(), 1)\n\tassert.Equal(t, b.benchlistSet.Len(), 1)\n\n\tnext := b.benchedQueue[0]\n\tassert.Equal(t, vdr0.ID(), next.validatorID)\n\tassert.True(t, !next.benchedUntil.After(now.Add(duration)))\n\tassert.True(t, !next.benchedUntil.Before(now.Add(duration/2)))\n\tassert.Len(t, b.failureStreaks, 0)\n\tb.lock.Unlock()\n\n\t// Give another validator [threshold-1] failures\n\tfor i := 0; i < threshold-1; i++ {\n\t\tb.RegisterFailure(vdr1.ID())\n\t}\n\n\t// Advance the time\n\tb.lock.Lock()\n\tnow = now.Add(minimumFailingDuration)\n\tb.lock.Unlock()\n\n\t// Register another failure\n\tb.RegisterResponse(vdr1.ID())\n\n\t// vdr1 shouldn't be benched\n\t// The response should have cleared its consecutive failures\n\tb.lock.Lock()\n\tassert.True(t, b.isBenched(vdr0.ID()))\n\tassert.False(t, b.isBenched(vdr1.ID()))\n\tassert.Equal(t, b.benchedQueue.Len(), 1)\n\tassert.Equal(t, b.benchlistSet.Len(), 1)\n\tassert.Len(t, b.failureStreaks, 0)\n\tb.lock.Unlock()\n\n\t// Register another failure for vdr0, who is benched\n\tb.RegisterFailure(vdr0.ID())\n\n\t// A failure for an already benched validator should not count against it\n\tb.lock.Lock()\n\tassert.Len(t, b.failureStreaks, 0)\n\tb.lock.Unlock()\n}", "func speedtest1_numbername(tls *libc.TLS, n uint32, zOut uintptr, nOut int32) int32 { /* speedtest1.c:312:5: */\n\tbp := tls.Alloc(48)\n\tdefer tls.Free(48)\n\n\tvar i int32 = 0\n\n\tif n >= uint32(1000000000) {\n\t\ti = i + (speedtest1_numbername(tls, (n / uint32(1000000000)), (zOut + uintptr(i)), (nOut - i)))\n\t\tsqlite3.Xsqlite3_snprintf(tls, (nOut - i), (zOut + uintptr(i)), ts+2217 /* \" billion\" */, 0)\n\t\ti = i + (int32(libc.Xstrlen(tls, (zOut + uintptr(i)))))\n\t\tn = (n % uint32(1000000000))\n\t}\n\tif n >= uint32(1000000) {\n\t\tif (i != 0) && (i < (nOut - 1)) {\n\t\t\t*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&i, 1)))) = int8(' ')\n\t\t}\n\t\ti = i + (speedtest1_numbername(tls, (n / uint32(1000000)), (zOut + uintptr(i)), (nOut - i)))\n\t\tsqlite3.Xsqlite3_snprintf(tls, (nOut - i), (zOut + uintptr(i)), ts+2226 /* \" million\" */, 0)\n\t\ti = i + (int32(libc.Xstrlen(tls, (zOut + uintptr(i)))))\n\t\tn = (n % uint32(1000000))\n\t}\n\tif n >= uint32(1000) {\n\t\tif (i != 0) && (i < (nOut - 1)) {\n\t\t\t*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&i, 1)))) = int8(' ')\n\t\t}\n\t\ti = i + (speedtest1_numbername(tls, (n / uint32(1000)), (zOut + uintptr(i)), (nOut - i)))\n\t\tsqlite3.Xsqlite3_snprintf(tls, (nOut - i), (zOut + uintptr(i)), ts+2235 /* \" thousand\" */, 0)\n\t\ti = i + (int32(libc.Xstrlen(tls, (zOut + uintptr(i)))))\n\t\tn = (n % uint32(1000))\n\t}\n\tif n >= uint32(100) {\n\t\tif (i != 0) && (i < (nOut - 1)) {\n\t\t\t*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&i, 1)))) = int8(' ')\n\t\t}\n\t\tsqlite3.Xsqlite3_snprintf(tls, (nOut - i), (zOut + uintptr(i)), ts+2245 /* \"%s hundred\" */, libc.VaList(bp, ones[(n/uint32(100))]))\n\t\ti = i + (int32(libc.Xstrlen(tls, (zOut + uintptr(i)))))\n\t\tn = (n % uint32(100))\n\t}\n\tif n >= uint32(20) {\n\t\tif (i != 0) && (i < (nOut - 1)) {\n\t\t\t*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&i, 1)))) = int8(' ')\n\t\t}\n\t\tsqlite3.Xsqlite3_snprintf(tls, (nOut - i), (zOut + uintptr(i)), ts+2256 /* \"%s\" */, libc.VaList(bp+16, tens[(n/uint32(10))]))\n\t\ti = i + (int32(libc.Xstrlen(tls, (zOut + uintptr(i)))))\n\t\tn = (n % uint32(10))\n\t}\n\tif n > uint32(0) {\n\t\tif (i != 0) && (i < (nOut - 1)) {\n\t\t\t*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&i, 1)))) = int8(' ')\n\t\t}\n\t\tsqlite3.Xsqlite3_snprintf(tls, (nOut - i), (zOut + uintptr(i)), ts+2256 /* \"%s\" */, libc.VaList(bp+32, ones[n]))\n\t\ti = i + (int32(libc.Xstrlen(tls, (zOut + uintptr(i)))))\n\t}\n\tif i == 0 {\n\t\tsqlite3.Xsqlite3_snprintf(tls, (nOut - i), (zOut + uintptr(i)), ts+2259 /* \"zero\" */, 0)\n\t\ti = i + (int32(libc.Xstrlen(tls, (zOut + uintptr(i)))))\n\t}\n\treturn i\n}", "func benchGenerate(n int, b *testing.B) {\n\ttemp := []string{}\n\tfor i := 0; i < b.N; i++ {\n\t\tcf := New()\n\t\t_ = cf.SetFormat(\"#xxxx\")\n\t\ttemp, _ = cf.Generate(n)\n\t}\n\tresult = temp\n}", "func CommonIsPrimeBenchmark(b *testing.B, checker primes.Checker) {\n\tfor i := 0; i < b.N; i++ {\n\t\tfor j := 0; j < 1000; j++ {\n\t\t\tchecker.IsPrime(j)\n\t\t}\n\t}\n}", "func TestAbCommonResults(t *testing.T) {\n\tvar tool AbTool\n\n\tcfg.Cfg.Verbose = true\n\tconfig := &cfg.Config{}\n\tconfig.Ab.Keepalive = false\n\tconfig.Ab.Concurency = 1\n\tconfig.Ab.Requests = 1\n\ttool = AbTool{&config.Ab}\n\tresult, err := tool.BenchCommand(\"test\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_ = result.Command()\n\t_ = result.Params()\n\tdata := []byte(\"\")\n\tresult.Parse(data)\n\tdata = []byte(AB_RESULT)\n\tresult.Parse(data)\n}", "func Benchmark(f func(b *B)) BenchmarkResult {}", "func TestCreateProcessHistoryReport(t *testing.T) {\n\n timeSlice := float64(TIMESLICE)\n\n testtable := []struct {\n tname string\n }{\n {\n tname: \"ok\",\n },\n }\n\n CreateDummyProcessMetricsHistory(&testProcessMetricsArray)\n\n for _, tc := range testtable {\n\n t.Run(tc.tname, func(t *testing.T) {\n\n var buffer bytes.Buffer\n writer := bufio.NewWriter(&buffer)\n\n err := json.NewEncoder(writer).Encode(CreateProcessHistoryReport(testProcessMetricsArray, timeSlice))\n if err != nil {\n t.Fatalf(\"failed writing json: %s\", err)\n }\n writer.Flush()\n\n goldenPath := filepath.Join(\"testdata\", filepath.FromSlash(t.Name()) + \".golden\")\n\n\n if *update {\n\n t.Log(\"update golden file\")\n if err := ioutil.WriteFile(goldenPath, buffer.Bytes(), 0644); err != nil {\n t.Fatalf(\"failed to update golden file %s: %s\", goldenPath, err)\n }\n\n }\n\n\n goldenData, err := ioutil.ReadFile(goldenPath)\n\n if err != nil {\n t.Fatalf(\"failed reading .golden file %s: %s\", goldenPath, err)\n }\n\n t.Log(string(buffer.Bytes()))\n\n if !bytes.Equal(buffer.Bytes(), goldenData) {\n t.Errorf(\"bytes do not match .golden file %s\", goldenPath)\n }\n\n })\n }\n\n}", "func TestCreateNodeAverageReport(t *testing.T) {\n\n timeSlice := float64(TIMESLICE)\n\n testtable := []struct {\n tname string\n }{\n {\n tname: \"ok\",\n },\n }\n\n CreateDummyNodeMetrics(testNodeMetricsMap)\n\n for _, tc := range testtable {\n\n t.Run(tc.tname, func(t *testing.T) {\n\n var buffer bytes.Buffer\n writer := bufio.NewWriter(&buffer)\n\n err := json.NewEncoder(writer).Encode(CreateNodeAverageReport(testNodeMetricsMap, timeSlice))\n if err != nil {\n t.Fatalf(\"failed writing json: %s\", err)\n }\n writer.Flush()\n\n goldenPath := filepath.Join(\"testdata\", filepath.FromSlash(t.Name()) + \".golden\")\n\n\n if *update {\n\n t.Log(\"update golden file\")\n if err := ioutil.WriteFile(goldenPath, buffer.Bytes(), 0644); err != nil {\n t.Fatalf(\"failed to update golden file %s: %s\", goldenPath, err)\n }\n\n }\n\n\n goldenData, err := ioutil.ReadFile(goldenPath)\n\n if err != nil {\n t.Fatalf(\"failed reading .golden file %s: %s\", goldenPath, err)\n }\n\n t.Log(string(buffer.Bytes()))\n\n if !bytes.Equal(buffer.Bytes(), goldenData) {\n t.Errorf(\"bytes do not match .golden file %s\", goldenPath)\n }\n\n })\n }\n\n}", "func TestIndexBlobManagerStress(t *testing.T) {\n\tt.Parallel()\n\ttestutil.SkipNonDeterministicTestUnderCodeCoverage(t)\n\n\tif testing.Short() {\n\t\treturn\n\t}\n\n\tfor i := range actionsTestIndexBlobManagerStress {\n\t\tactionsTestIndexBlobManagerStress[i].weight = rand.Intn(100)\n\t\tt.Logf(\"weight[%v] = %v\", i, actionsTestIndexBlobManagerStress[i].weight)\n\t}\n\n\tvar (\n\t\tfakeTimeFunc = faketime.AutoAdvance(fakeLocalStartTime, 100*time.Millisecond)\n\t\tdeadline time.Time // when (according to fakeTimeFunc should the test finish)\n\t\tlocalTimeDeadline time.Time // when (according to clock.Now, the test should finish)\n\t)\n\n\tlocalTimeDeadline = clock.Now().Add(30 * time.Second)\n\n\tif os.Getenv(\"CI\") != \"\" {\n\t\t// when running on CI, simulate 4 hours, this takes about ~15-20 seconds.\n\t\tdeadline = fakeTimeFunc().Add(4 * time.Hour)\n\t} else {\n\t\t// otherwise test only 1 hour, which still provides decent coverage, takes about 3-5 seconds.\n\t\tdeadline = fakeTimeFunc().Add(1 * time.Hour)\n\t}\n\n\t// shared storage\n\tst := blobtesting.NewMapStorage(blobtesting.DataMap{}, nil, fakeTimeFunc)\n\n\tvar eg errgroup.Group\n\n\tnumActors := 2\n\n\tfor actorID := 0; actorID < numActors; actorID++ {\n\t\tactorID := actorID\n\t\tloggedSt := logging.NewWrapper(st, testlogging.Printf(func(m string, args ...interface{}) {\n\t\t\tt.Logf(fmt.Sprintf(\"@%v actor[%v]:\", fakeTimeFunc().Format(\"150405.000\"), actorID)+m, args...)\n\t\t}, \"\"), \"\")\n\t\tcontentPrefix := fmt.Sprintf(\"a%v\", actorID)\n\n\t\teg.Go(func() error {\n\t\t\tnumWritten := 0\n\t\t\tdeletedContents := map[string]bool{}\n\t\t\tctx := testlogging.ContextWithLevelAndPrefixFunc(t, testlogging.LevelDebug, func() string {\n\t\t\t\treturn fmt.Sprintf(\"@%v actor[%v]:\", fakeTimeFunc().Format(\"150405.000\"), actorID)\n\t\t\t})\n\n\t\t\tm := newIndexBlobManagerForTesting(t, loggedSt, fakeTimeFunc)\n\n\t\t\t// run stress test until the deadline, aborting early on any failure\n\t\t\tfor fakeTimeFunc().Before(deadline) && clock.Now().Before(localTimeDeadline) {\n\t\t\t\tswitch pickRandomActionTestIndexBlobManagerStress() {\n\t\t\t\tcase actionRead:\n\t\t\t\t\tif err := verifyFakeContentsWritten(ctx, t, m, numWritten, contentPrefix, deletedContents); err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"actor[%v] error verifying contents\", actorID)\n\t\t\t\t\t}\n\n\t\t\t\tcase actionWrite:\n\t\t\t\t\tif err := writeFakeContents(ctx, t, m, contentPrefix, rand.Intn(10)+5, &numWritten, fakeTimeFunc); err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"actor[%v] write error\", actorID)\n\t\t\t\t\t}\n\n\t\t\t\tcase actionDelete:\n\t\t\t\t\tif err := deleteFakeContents(ctx, t, m, contentPrefix, numWritten, deletedContents, fakeTimeFunc); err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"actor[%v] delete error\", actorID)\n\t\t\t\t\t}\n\n\t\t\t\tcase actionUndelete:\n\t\t\t\t\tif err := undeleteFakeContents(ctx, t, m, deletedContents, fakeTimeFunc); err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"actor[%v] undelete error\", actorID)\n\t\t\t\t\t}\n\n\t\t\t\tcase actionCompact:\n\t\t\t\t\t// compaction by more than one actor is unsafe, do it only if actorID == 0\n\t\t\t\t\tif actorID != 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif err := fakeCompaction(ctx, t, m, false); err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"actor[%v] compaction error\", actorID)\n\t\t\t\t\t}\n\n\t\t\t\tcase actionCompactAndDropDeleted:\n\t\t\t\t\t// compaction by more than one actor is unsafe, do it only if actorID == 0\n\t\t\t\t\tif actorID != 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif err := fakeCompaction(ctx, t, m, true); err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"actor[%v] compaction error\", actorID)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tif err := eg.Wait(); err != nil {\n\t\tt.Errorf(\"err: %+v\", err)\n\t}\n}", "func Bench(cfg Cfg) Results {\n\t// Synchronization variables for benchEnqueuer and benchDequeuer.\n\tbegin := make(chan struct{})\n\tvar wg sync.WaitGroup\n\n\t// Begin all enqueuers.\n\tenqDiv, enqRem := cfg.Messages/cfg.Enqueuers, cfg.Messages%cfg.Enqueuers\n\tenqTimings := make([]*[]int64, 0, cfg.Enqueuers)\n\tfor i := 0; i < cfg.Enqueuers; i++ {\n\t\tenqueues := enqDiv\n\t\tif enqRem > 0 {\n\t\t\tenqueues++\n\t\t\tenqRem--\n\t\t}\n\t\tbencher := &benchEnqueuer{\n\t\t\tenqImpl: cfg.Impl,\n\t\t\tenqueues: enqueues,\n\t\t\tenqTimings: make([]int64, 0, cfg.Messages),\n\t\t}\n\t\tenqTimings = append(enqTimings, &bencher.enqTimings)\n\t\twg.Add(1)\n\t\tgo bencher.run(begin, &wg)\n\t}\n\n\t// Begin all dequeuers.\n\tdeqDiv, deqRem := cfg.Messages/cfg.Dequeuers, cfg.Messages%cfg.Dequeuers\n\ttimings := make([]*[]int64, 0, cfg.Dequeuers)\n\tdeqTimings := make([]*[]int64, 0, cfg.Dequeuers)\n\tfor i := 0; i < cfg.Dequeuers; i++ {\n\t\tdequeues := deqDiv\n\t\tif deqRem > 0 {\n\t\t\tdequeues++\n\t\t\tdeqRem--\n\t\t}\n\t\tbencher := &benchDequeuer{\n\t\t\tdeqImpl: cfg.Impl,\n\t\t\tdequeues: dequeues,\n\t\t\ttimings: make([]int64, 0, cfg.Messages),\n\t\t\tdeqTimings: make([]int64, 0, cfg.Messages),\n\t\t}\n\t\ttimings = append(timings, &bencher.timings)\n\t\tdeqTimings = append(deqTimings, &bencher.deqTimings)\n\t\twg.Add(1)\n\t\tgo bencher.run(begin, &wg)\n\t}\n\n\tstart := etime.Now()\n\t// Start all enqueuers and dequeuers.\n\tclose(begin)\n\t// Wait for all to finish.\n\twg.Wait()\n\tend := etime.Now()\n\ttotal := end - start - nowOverhead\n\n\tb := Results{\n\t\tGOMAXPROCS: runtime.GOMAXPROCS(0),\n\t\tEnqueuers: cfg.Enqueuers,\n\t\tDequeuers: cfg.Dequeuers,\n\t\tEnqueueTimings: make([][]int64, 0, len(enqTimings)),\n\t\tDequeueTimings: make([][]int64, 0, len(deqTimings)),\n\t\tThroughputTimings: make([][]int64, 0, len(timings)),\n\t\tTotalTiming: total,\n\t}\n\n\tfor _, timingPtr := range enqTimings {\n\t\ttiming := *timingPtr\n\t\tb.EnqueueTimings = append(b.EnqueueTimings, timing)\n\t}\n\tfor _, timingPtr := range deqTimings {\n\t\ttiming := *timingPtr\n\t\tb.DequeueTimings = append(b.DequeueTimings, timing)\n\t}\n\tfor _, timingPtr := range timings {\n\t\ttiming := *timingPtr\n\t\tb.ThroughputTimings = append(b.ThroughputTimings, timing)\n\t}\n\treturn b\n}", "func runTest1(n int) []int64 {\n\tcreateBlockchain()\n\tt := []int64{}\n\tif verbose {\n\t\tbalance1, _ := utxos.FindSpendableOutputs(HashPubKey(wallet1.PublicKey), 9999999)\n\t\tbalance2, _ := utxos.FindSpendableOutputs(HashPubKey(wallet2.PublicKey), 9999999)\n\t\tfmt.Printf(\"%d %d %d\\n\", len(chain.blocks), balance1, balance2)\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\tnewTransaction(10) // Send 10\n\t\ttxs := prepareTXs()\n\t\tt0 := time.Now()\n\n\t\tblock := mine(txs, chain.CurrentBlock().Hash)\n\t\tchain.blocks = append(chain.blocks, &block)\n\n\t\tt = append(t, time.Now().Sub(t0).Milliseconds())\n\t\tutxos.Update(txs)\n\t\tif verbose {\n\t\t\tbalance1, _ := utxos.FindSpendableOutputs(HashPubKey(wallet1.PublicKey), 9999999)\n\t\t\tbalance2, _ := utxos.FindSpendableOutputs(HashPubKey(wallet2.PublicKey), 9999999)\n\t\t\tfmt.Printf(\"%d %d %d\\n\", len(chain.blocks), balance1, balance2)\n\t\t}\n\t\ttxBuffer = []*Transaction{}\n\n\t\tif block.Nonce%2 == 1 {\n\t\t\tslave1Score++\n\t\t} else {\n\t\t\tslave2Score++\n\t\t}\n\t\tif len(chain.blocks)%100 == 0 {\n\t\t\tfmt.Println(\"Length of chain:\", len(chain.blocks))\n\t\t}\n\t}\n\n\treturn t\n}", "func TestScrape_CpuUtilization(t *testing.T) {\n\ttype testCase struct {\n\t\tname string\n\t\tmetricsConfig metadata.MetricsBuilderConfig\n\t\texpectedMetricCount int\n\t\ttimes bool\n\t\tutilization bool\n\t\tutilizationIndex int\n\t}\n\n\ttestCases := []testCase{\n\t\t{\n\t\t\tname: \"Standard\",\n\t\t\tmetricsConfig: metadata.DefaultMetricsBuilderConfig(),\n\t\t\texpectedMetricCount: 1,\n\t\t\ttimes: true,\n\t\t\tutilization: false,\n\t\t},\n\t\t{\n\t\t\tname: \"SystemCPUTime metric is disabled\",\n\t\t\ttimes: false,\n\t\t\tutilization: true,\n\t\t\texpectedMetricCount: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"all metrics are enabled\",\n\t\t\ttimes: true,\n\t\t\tutilization: true,\n\t\t\texpectedMetricCount: 2,\n\t\t\tutilizationIndex: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"all metrics are disabled\",\n\t\t\ttimes: false,\n\t\t\tutilization: false,\n\t\t\texpectedMetricCount: 0,\n\t\t},\n\t}\n\n\tfor _, test := range testCases {\n\t\ttest := test\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tsettings := test.metricsConfig\n\t\t\tif test.metricsConfig.Metrics == (metadata.MetricsConfig{}) {\n\t\t\t\tsettings = metadata.DefaultMetricsBuilderConfig()\n\t\t\t\tsettings.Metrics.SystemCPUTime.Enabled = test.times\n\t\t\t\tsettings.Metrics.SystemCPUUtilization.Enabled = test.utilization\n\t\t\t}\n\n\t\t\tscraper := newCPUScraper(context.Background(), receivertest.NewNopCreateSettings(), &Config{MetricsBuilderConfig: settings})\n\t\t\terr := scraper.start(context.Background(), componenttest.NewNopHost())\n\t\t\trequire.NoError(t, err, \"Failed to initialize cpu scraper: %v\", err)\n\n\t\t\t_, err = scraper.scrape(context.Background())\n\t\t\trequire.NoError(t, err, \"Failed to scrape metrics: %v\", err)\n\t\t\t// 2nd scrape will trigger utilization metrics calculation\n\t\t\tmd, err := scraper.scrape(context.Background())\n\t\t\trequire.NoError(t, err, \"Failed to scrape metrics: %v\", err)\n\n\t\t\tassert.Equal(t, test.expectedMetricCount, md.MetricCount())\n\t\t\tif md.ResourceMetrics().Len() == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmetrics := md.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics()\n\t\t\tinternal.AssertSameTimeStampForAllMetrics(t, metrics)\n\t\t\tif test.times {\n\t\t\t\ttimesMetrics := metrics.At(0)\n\t\t\t\tassertCPUMetricValid(t, timesMetrics, 0)\n\t\t\t\tif runtime.GOOS == \"linux\" {\n\t\t\t\t\tassertCPUMetricHasLinuxSpecificStateLabels(t, timesMetrics)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif test.utilization {\n\t\t\t\tutilizationMetrics := metrics.At(test.utilizationIndex)\n\t\t\t\tassertCPUUtilizationMetricValid(t, utilizationMetrics, 0)\n\t\t\t\tif runtime.GOOS == \"linux\" {\n\t\t\t\t\tassertCPUUtilizationMetricHasLinuxSpecificStateLabels(t, utilizationMetrics)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func main() {\n\tendpoint := \"http://51.83.237.20:9338\"\n\tshardInfos, err := GetBlockChainInfo(endpoint)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(shardInfos)\n\tt := time.Now().Unix()\n\tfor _, shardInfo := range shardInfos {\n\t\tgo func(shardID byte, height uint64) {\n\t\t\tcoinCount := 0\n\t\t\tfor i := uint64(1); i <= 200; i++ {\n\t\t\t\ttxList, err := RetrieveShardBlockTxs(endpoint, shardID, i)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\tfor _, tx := range txList {\n\t\t\t\t\t// for _, coin := range tx.Proof.GetInputCoins() {\n\t\t\t\t\t// \tcoin.CoinDetails.GetSerialNumber()\n\t\t\t\t\t// \t// coin.CoinDetails.GetSerialNumber().ToBytesS()\n\t\t\t\t\t// }\n\t\t\t\t\tfor _, _ = range tx.Proof.GetOutputCoins() {\n\t\t\t\t\t\t// coin.CoinDetails.HashH().String()\n\t\t\t\t\t\tcoinCount++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Println(shardID, coinCount)\n\t\t\tfmt.Println(time.Now().Unix() - t)\n\t\t}(shardInfo.ShardID, shardInfo.Height)\n\t}\n\tselect {}\n}", "func calcRuntime(t time.Time, f string) {\n\t//now := time.Now()\n\t//log.Printf(\"%s cost %f millisecond\\n\", f, now.Sub(t).Seconds() * 1000)\n\t//log.Printf()\n}", "func (runner *CpuTestRunner) run(cmd string, args ...string) ([]byte, error) {\n\trunner.executions++\n\n\tif runner.executions%2 == 0 {\n\t\treturn []byte(runner.stat2), runner.err1\n\t} else {\n\t\treturn []byte(runner.stat1), runner.err2\n\t}\n\n}", "func BenchmarkLoad(b *testing.B) {\n\tll := linkedList{}\n\ts := newStack()\n\tfor i := 0; i < b.N; i++ {\n\t\tll.load(ask, s)\n\t}\n}", "func BenchmarkCode(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tcodeBuilder.Generate(length)\n\t}\n}", "func BenchmarkThresh(b *testing.B) {\n\tbuf := make([]byte, 4096*1024*64)\n\tfor i := 0; i < len(buf); i++ {\n\t\tbuf[i] = byte(i % 256)\n\t}\n\tb.ResetTimer()\n\tThresh(buf, 100)\n}", "func compare(gold [][]Recommendation, results string) AggregatedMeasurement {\n glog.Infof(\"Processing results [%s]\\n\", results)\n measures := loadMeasure(results)\n if len(gold) != len(measures) {\n glog.Fatalf(\"Gold=%v Measures=%v\", len(gold), len(measures))\n }\n es, j := int64(0), float64(0)\n for i, im := range measures {\n es += int64(im.ElapsedTime)\n j += jaccard(gold[i], im.Recs)\n }\n return AggregatedMeasurement{ Name: results, Jaccard: j/float64(len(measures)), ElapsedTime: time.Duration(es/int64(len(measures))) }\n}", "func benchmarkCallers(b *testing.B, stackDepth, maxStackDepth int) {\n\t// recurseNThenCallClosure sends to readyDoneSignal once when it's ready, then once more when it's done.\n\treadyDoneSignal := make(chan bool)\n\tgo recurseNThenCallClosure(stackDepth, func() {\n\t\tfor i := 0; i < b.N; i++ {\n\t\t\t// Take our stack trace.\n\t\t\tbuffer := make([]uintptr, maxStackDepth)\n\t\t\t_ = runtime.Callers(1, buffer)\n\t\t}\n\t}, readyDoneSignal)\n\t<-readyDoneSignal // ready\n\tb.ResetTimer()\n\t<-readyDoneSignal // done\n}", "func logMemstatsSample() {\n\tl := log.WithField(\"process\", \"memstats\")\n\n\truntime.GC() // get up-to-date statistics\n\n\tmemStats := new(runtime.MemStats)\n\truntime.ReadMemStats(memStats)\n\n\tvar gcStats debug.GCStats\n\tdebug.ReadGCStats(&gcStats)\n\n\ts := memStats\n\n\tl.Infof(\"# runtime.MemStats\")\n\tl.Infof(\"# Alloc = %d\", s.Alloc)\n\tl.Infof(\"# TotalAlloc = %d\", s.TotalAlloc)\n\tl.Infof(\"# Sys = %d\", s.Sys)\n\tl.Infof(\"# Lookups = %d\", s.Lookups)\n\tl.Infof(\"# Mallocs = %d\", s.Mallocs)\n\tl.Infof(\"# Frees = %d\", s.Frees)\n\tl.Infof(\"# HeapAlloc = %d\", s.HeapAlloc)\n\tl.Infof(\"# HeapSys = %d\", s.HeapSys)\n\tl.Infof(\"# HeapIdle = %d\", s.HeapIdle)\n\tl.Infof(\"# HeapInuse = %d\", s.HeapInuse)\n\tl.Infof(\"# HeapReleased = %d\", s.HeapReleased)\n\tl.Infof(\"# HeapObjects = %d\", s.HeapObjects)\n\tl.Infof(\"# Stack = %d / %d\", s.StackInuse, s.StackSys)\n\tl.Infof(\"# NumGoroutine = %d\", runtime.NumGoroutine())\n\n\t// Record GC pause history, most recent 5 entries\n\tl.Infof(\"# Stop-the-world Pause time\")\n\n\tfor i, v := range gcStats.Pause {\n\t\tl.Infof(\"# gcStats.Pause[%d] = %d ns\", i, v)\n\n\t\tif i == 5 {\n\t\t\tbreak\n\t\t}\n\t}\n}", "func BenchmarkSimpleChecking(b *testing.B) {\n\tcapacity := uint32(1e9)\n\tp := float64(0.001)\n\tsamples := uint32(100000)\n\tfilter, testValues := GenerateExampleFilter(capacity, p, samples)\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tvalue := testValues[rand.Int()%len(testValues)]\n\t\tif !filter.Check(value) {\n\t\t\tb.Error(\"Did not find test value in filter!\")\n\t\t}\n\t}\n}", "func BenchmarkSolution(b *testing.B) {\n\tfor name, f := range tests {\n\t\t// TODO: pick a reasonable value for n to benchmark f(n)\n\t\tn := int(math.Pow10(10))\n\t\tRunBenchmark(name, b, f, n)\n\t}\n}", "func BenchmarkBuild(b *testing.B) {\n\tgarbleBin := filepath.Join(b.TempDir(), \"garble\")\n\tif runtime.GOOS == \"windows\" {\n\t\tgarbleBin += \".exe\"\n\t}\n\n\tif err := exec.Command(\"go\", \"build\", \"-o=\"+garbleBin).Run(); err != nil {\n\t\tb.Fatalf(\"building garble: %v\", err)\n\t}\n\n\tfor _, name := range [...]string{\"Cache\", \"NoCache\"} {\n\t\tb.Run(name, func(b *testing.B) {\n\t\t\tbuildArgs := []string{\"build\", \"-o=\" + b.TempDir()}\n\t\t\tswitch name {\n\t\t\tcase \"Cache\":\n\t\t\t\tbuildArgs = append(buildArgs, \"./testdata/bench-cache\")\n\n\t\t\t\t// Ensure the build cache is warm,\n\t\t\t\t// for the sake of consistent results.\n\t\t\t\tcmd := exec.Command(garbleBin, buildArgs...)\n\t\t\t\tif out, err := cmd.CombinedOutput(); err != nil {\n\t\t\t\t\tb.Fatalf(\"%v: %s\", err, out)\n\t\t\t\t}\n\t\t\tcase \"NoCache\":\n\t\t\t\tbuildArgs = append(buildArgs, \"./testdata/bench-nocache\")\n\t\t\tdefault:\n\t\t\t\tb.Fatalf(\"unknown name: %q\", name)\n\t\t\t}\n\n\t\t\t// We collect extra metrics.\n\t\t\tvar userTime, systemTime int64\n\n\t\t\tb.ResetTimer()\n\t\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\t\tfor pb.Next() {\n\t\t\t\t\tcmd := exec.Command(garbleBin, buildArgs...)\n\t\t\t\t\tif name == \"NoCache\" {\n\t\t\t\t\t\tgocache, err := os.MkdirTemp(b.TempDir(), \"gocache-*\")\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tb.Fatal(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcmd.Env = append(os.Environ(), \"GOCACHE=\"+gocache)\n\t\t\t\t\t}\n\t\t\t\t\tif out, err := cmd.CombinedOutput(); err != nil {\n\t\t\t\t\t\tb.Fatalf(\"%v: %s\", err, out)\n\t\t\t\t\t}\n\n\t\t\t\t\tuserTime += int64(cmd.ProcessState.UserTime())\n\t\t\t\t\tsystemTime += int64(cmd.ProcessState.SystemTime())\n\t\t\t\t}\n\t\t\t})\n\t\t\tb.ReportMetric(float64(userTime)/float64(b.N), \"user-ns/op\")\n\t\t\tb.ReportMetric(float64(systemTime)/float64(b.N), \"sys-ns/op\")\n\t\t\tinfo, err := os.Stat(garbleBin)\n\t\t\tif err != nil {\n\t\t\t\tb.Fatal(err)\n\t\t\t}\n\t\t\tb.ReportMetric(float64(info.Size()), \"bin-B\")\n\t\t})\n\t}\n}", "func (cfg Config) datasetTest(t *xdelta.TestGroup, p, q xdelta.Program) {\n\tdir, err := os.Open(xdataset)\n\tif err != nil {\n\t\tt.Panic(err)\n\t}\n\tdents, err := dir.Readdir(-1)\n\tif err != nil {\n\t\tt.Panic(err)\n\t}\n\tpaths := make([]string, len(dents))\n\tvar total int64\n\tfor i, d := range dents {\n\t\tif !d.Mode().IsRegular() {\n\t\t\tcontinue\n\t\t}\n\t\tpaths[i] = fmt.Sprint(xdataset, \"/\", d.Name())\n\t\ttotal += d.Size()\n\t}\n\tmeansize := total / int64(len(dents))\n\tlargest := uint(20)\n\tfor ; largest <= 31 && 1<<largest < meansize; largest++ {}\n\n\tsort.Strings(paths)\n\n\ttestSum := map[uint]*TestOutput{}\n\tcompSum := map[uint]*TestOutput{}\n\n\tfor _, in1 := range paths {\n\t\tfor _, in2 := range paths {\n\t\t\tif in1 == in2 { continue }\n\n\t\t\t// 1/4, 1/2, and 1 of the power-of-2 rounded-up mean size\n\t\t\tfor b := largest - 2; b <= largest; b++ {\n\t\t\t\tif _, has := testSum[b]; !has {\n\t\t\t\t\ttestSum[b] = &TestOutput{}\n\t\t\t\t\tcompSum[b] = &TestOutput{}\n\t\t\t\t}\n\t\t\t\tc1 := cfg\n\t\t\t\tc1.srcbuf_size = 1<<b\n\t\t\t\tptest := &PairTest{c1, p, in1, in2, TestOutput{-1, 0, 0, 0, 0}}\n\t\t\t\tptest.datasetPairTest(t, 1<<b);\n\t\t\t\tqtest := &PairTest{c1, q, in1, in2, TestOutput{-1, 0, 0, 0, 0}}\n\t\t\t\tqtest.datasetPairTest(t, 1<<b)\n\n\t\t\t\ttestSum[b].Add(ptest.TestOutput)\n\t\t\t\tcompSum[b].Add(qtest.TestOutput)\n\n \t\t\t\tfmt.Printf(\"%s, %s: %.2f%% %+d/%d\\n\\tE:%.2f%%/%s(%.2f%%/%s) D:%.2f%%/%s(%.2f%%/%s) [B=%d]\\n\",\n\t\t\t\t\tpath.Base(in1), path.Base(in2),\n\t\t\t\t\tfloat64(ptest.encoded - qtest.encoded) * 100.0 / float64(qtest.encoded),\n\t\t\t\t\tptest.encoded - qtest.encoded,\n\t\t\t\t\tqtest.encoded,\n\t\t\t\t\t(ptest.encDuration - qtest.encDuration).Seconds() * 100.0 / qtest.encDuration.Seconds(),\n\t\t\t\t\tqtest.encDuration,\n\t\t\t\t\t(ptest.decDuration - qtest.decDuration).Seconds() * 100.0 / qtest.decDuration.Seconds(),\n\t\t\t\t\tqtest.encDuration,\n\t\t\t\t\t(ptest.encSysDuration - qtest.encSysDuration).Seconds() * 100.0 / qtest.encSysDuration.Seconds(),\n\t\t\t\t\tqtest.encSysDuration,\n\t\t\t\t\t(ptest.decSysDuration - qtest.decSysDuration).Seconds() * 100.0 / qtest.decSysDuration.Seconds(),\n\t\t\t\t\tqtest.decSysDuration,\n\t\t\t\t\t1<<b)\n\t\t\t}\n\t\t}\n\t}\n\tvar keys []uint\n\tfor k, _ := range testSum {\n\t\tkeys = append(keys, k)\n\t}\n\tfor _, k := range keys {\t\t\n\t\tfmt.Printf(\"B=%v\\nTEST: %v\\nCOMP: %v\\n\", 1<<k, testSum[k], compSum[k])\n\t}\n}", "func benchmarkBreachDepressions(parent *BreachDepressions) {\n\tprintln(\"Benchmarking BreachDepressions...\")\n\n\tvar progress, oldProgress, col, row, i, n int\n\tvar colN, rowN, r, c, flatindex int\n\tvar dir byte\n\tneedsFilling := false\n\tvar z, zN, lowestNeighbour float64\n\tvar zTest, zN2 float64\n\tvar gc gridCell\n\tvar p int64\n\tvar breachDepth, maxPathBreachDepth float64\n\tvar numCellsInPath int32\n\tvar isPit, isEdgeCell bool\n\tvar isActive bool\n\tdX := [8]int{1, 1, 1, 0, -1, -1, -1, 0}\n\tdY := [8]int{-1, 0, 1, 1, 1, 0, -1, -1}\n\tbackLink := [8]byte{5, 6, 7, 8, 1, 2, 3, 4}\n\t//outPointer := [9]float64{0, 1, 2, 4, 8, 16, 32, 64, 128}\n\tmaxLengthOrDepthUsed := false\n\tif parent.maxDepth > 0 || parent.maxLength > 0 {\n\t\tmaxLengthOrDepthUsed = true\n\t}\n\tif maxLengthOrDepthUsed && parent.maxDepth == -1 {\n\t\tparent.maxDepth = math.MaxFloat64\n\t}\n\tif maxLengthOrDepthUsed && parent.maxLength == -1 {\n\t\tparent.maxLength = math.MaxInt32\n\t}\n\tperformConstrainedBreaching := parent.constrainedBreaching\n\tif !maxLengthOrDepthUsed && performConstrainedBreaching {\n\t\tperformConstrainedBreaching = false\n\t}\n\tprintln(\"Reading DEM data...\")\n\tdem, err := raster.CreateRasterFromFile(parent.inputFile)\n\tif err != nil {\n\t\tprintln(err.Error())\n\t}\n\trows := dem.Rows\n\tcolumns := dem.Columns\n\trowsLessOne := rows - 1\n\tnumCellsTotal := rows * columns\n\tnodata := dem.NoDataValue\n\tminVal := dem.GetMinimumValue()\n\televDigits := len(strconv.Itoa(int(dem.GetMaximumValue() - minVal)))\n\televMultiplier := math.Pow(10, float64(8-elevDigits))\n\tSMALL_NUM := 1 / elevMultiplier\n\tPOS_INF := math.Inf(1)\n\n\tprintln(\"The tool will now be run 10 times...\")\n\tvar benchTimes [10]time.Duration\n\tfor bt := 0; bt < 10; bt++ {\n\n\t\tprintln(\"Run\", (bt + 1), \"...\")\n\n\t\tstartTime := time.Now()\n\n\t\tnumSolvedCells := 0\n\t\tnumPits := 0\n\t\tnumPitsSolved := 0\n\t\tnumValidCells := 0\n\n\t\toutput := make([][]float64, rows+2)\n\t\tpits := make([][]bool, rows+2)\n\t\tinQueue := make([][]bool, rows+2)\n\t\tflowdir := make([][]byte, rows+2)\n\n\t\tfor i = 0; i < rows+2; i++ {\n\t\t\toutput[i] = make([]float64, columns+2)\n\t\t\tpits[i] = make([]bool, columns+2)\n\t\t\tinQueue[i] = make([]bool, columns+2)\n\t\t\tflowdir[i] = make([]byte, columns+2)\n\t\t}\n\n\t\t//\t\toutput := structures.Create2dFloat64Array(rows+2, columns+2)\n\t\t//\t\tpits := structures.Create2dBoolArray(rows+2, columns+2)\n\t\t//\t\tinQueue := structures.Create2dBoolArray(rows+2, columns+2)\n\t\t//\t\tflowdir := structures.Create2dByteArray(rows+2, columns+2)\n\n\t\tpq := NewPQueue()\n\t\t//floodorder := NewQueue()\n\t\tvar floodorder []int\n\t\t//floodorder := make([]int, numCellsTotal)\n\t\tfloodOrderTail := 0\n\n\t\t// find the pit cells and initialize the grids\n\t\tprintf(\"\\rBreaching DEM (1 of 2): %v%%\", 0)\n\t\toldProgress = 0\n\t\tfor row = 0; row < rows; row++ {\n\t\t\tfor col = 0; col < columns; col++ {\n\t\t\t\tz = dem.Value(row, col) // input[row+1][col+1]\n\t\t\t\toutput[row+1][col+1] = z\n\t\t\t\tflowdir[row+1][col+1] = 0\n\t\t\t\tif z != nodata {\n\t\t\t\t\tisPit = true\n\t\t\t\t\tisEdgeCell = false\n\t\t\t\t\tlowestNeighbour = POS_INF\n\t\t\t\t\tfor n = 0; n < 8; n++ {\n\t\t\t\t\t\tzN = dem.Value(row+dY[n], col+dX[n]) //input[row+dY[n]+1][col+dX[n]+1]\n\t\t\t\t\t\tif zN != nodata && zN < z {\n\t\t\t\t\t\t\tisPit = false\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if zN == nodata {\n\t\t\t\t\t\t\tisEdgeCell = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif zN < lowestNeighbour {\n\t\t\t\t\t\t\t\tlowestNeighbour = zN\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\tif isEdgeCell {\n\t\t\t\t\t\tgc = newGridCell(row+1, col+1, 0)\n\t\t\t\t\t\tp = int64(int64(z*elevMultiplier) * 100000)\n\t\t\t\t\t\tpq.Push(gc, p)\n\t\t\t\t\t\tinQueue[row+1][col+1] = true\n\t\t\t\t\t}\n\t\t\t\t\tif isPit {\n\t\t\t\t\t\tif !isEdgeCell {\n\t\t\t\t\t\t\tpits[row+1][col+1] = true\n\t\t\t\t\t\t\tnumPits++\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* raising a pit cell to just lower than the\n\t\t\t\t\t\t * elevation of its lowest neighbour will\n\t\t\t\t\t\t * reduce the length and depth of the trench\n\t\t\t\t\t\t * that is necessary to eliminate the pit\n\t\t\t\t\t\t * by quite a bit on average.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif lowestNeighbour != POS_INF {\n\t\t\t\t\t\t\toutput[row+1][col+1] = lowestNeighbour - SMALL_NUM\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\tnumValidCells++\n\t\t\t\t} else {\n\t\t\t\t\tnumSolvedCells++\n\t\t\t\t}\n\t\t\t}\n\t\t\tprogress = int(100.0 * row / rowsLessOne)\n\t\t\tif progress != oldProgress {\n\t\t\t\tprintf(\"\\rBreaching DEM (1 of 2): %v%%\", progress)\n\t\t\t\toldProgress = progress\n\t\t\t}\n\t\t}\n\n\t\tfor row = 0; row < rows+2; row++ {\n\t\t\toutput[row][0] = nodata\n\t\t\toutput[row][columns+1] = nodata\n\t\t\tflowdir[row][0] = 0\n\t\t\tflowdir[row][columns+1] = 0\n\t\t}\n\n\t\tfor col = 0; col < columns+2; col++ {\n\t\t\toutput[0][col] = nodata\n\t\t\toutput[rows+1][col] = nodata\n\t\t\tflowdir[0][col] = 0\n\t\t\tflowdir[rows+1][col] = 0\n\t\t}\n\n\t\t// now breach\n\t\tprintf(\"\\r \")\n\t\toldProgress = int(100.0 * numSolvedCells / numCellsTotal)\n\t\tprintf(\"\\rBreaching DEM (2 of 2): %v%%\", oldProgress)\n\n\t\tif !maxLengthOrDepthUsed {\n\t\t\t// Perform a complete breaching solution; there will be no subseqent filling\n\t\t\tfor numPitsSolved < numPits {\n\t\t\t\tgc = pq.Pop()\n\t\t\t\trow = gc.row\n\t\t\t\tcol = gc.column\n\t\t\t\tflatindex = gc.flatIndex\n\t\t\t\tfor i = 0; i < 8; i++ {\n\t\t\t\t\trowN = row + dY[i]\n\t\t\t\t\tcolN = col + dX[i]\n\t\t\t\t\tzN = output[rowN][colN]\n\t\t\t\t\tif zN != nodata && !inQueue[rowN][colN] {\n\t\t\t\t\t\tflowdir[rowN][colN] = backLink[i]\n\t\t\t\t\t\tif pits[rowN][colN] {\n\t\t\t\t\t\t\tnumPitsSolved++\n\t\t\t\t\t\t\t// trace the flowpath back until you find a lower cell\n\t\t\t\t\t\t\tzTest = zN\n\t\t\t\t\t\t\tr = rowN\n\t\t\t\t\t\t\tc = colN\n\t\t\t\t\t\t\tisActive = true\n\t\t\t\t\t\t\tfor isActive {\n\t\t\t\t\t\t\t\tzTest -= SMALL_NUM // ensures a small increment slope\n\t\t\t\t\t\t\t\tdir = flowdir[r][c]\n\t\t\t\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\t\t\t\tr += dY[dir-1]\n\t\t\t\t\t\t\t\t\tc += dX[dir-1]\n\t\t\t\t\t\t\t\t\tzN2 = output[r][c]\n\t\t\t\t\t\t\t\t\tif zN2 <= zTest || zN2 == nodata {\n\t\t\t\t\t\t\t\t\t\t// a lower grid cell or edge has been found\n\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\toutput[r][c] = zTest\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\t// a pit has been located, likely at the edge\n\t\t\t\t\t\t\t\t\tisActive = false\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\tnumSolvedCells++\n\t\t\t\t\t\tn = 0\n\t\t\t\t\t\tif pits[rowN][colN] {\n\t\t\t\t\t\t\tn = flatindex + 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgc = newGridCell(rowN, colN, n)\n\t\t\t\t\t\tp = int64(int64(zN*elevMultiplier)*100000 + (int64(n) % 100000))\n\t\t\t\t\t\tpq.Push(gc, p)\n\t\t\t\t\t\tinQueue[rowN][colN] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprogress = int(100.0 * numSolvedCells / numCellsTotal)\n\t\t\t\tif progress != oldProgress {\n\t\t\t\t\tprintf(\"\\rBreaching DEM (2 of 2): %v%%\", progress)\n\t\t\t\t\toldProgress = progress\n\t\t\t\t}\n\t\t\t}\n\t\t} else if !performConstrainedBreaching {\n\t\t\t// Perform selective breaching. Sinks that can be removed within the\n\t\t\t// specified constraints of the max breach length and depth will\n\t\t\t// be breached. Otherwise they will be removed during a subsequent\n\t\t\t// filling operation.\n\t\t\tfloodorder = make([]int, numValidCells)\n\t\t\tfor pq.Len() > 0 {\n\t\t\t\tgc = pq.Pop()\n\t\t\t\trow = gc.row\n\t\t\t\tcol = gc.column\n\t\t\t\tif parent.postBreachFilling {\n\t\t\t\t\t//floodorder.Push(row, col)\n\t\t\t\t\tfloodorder[floodOrderTail] = row*columns + col\n\t\t\t\t\tfloodOrderTail++\n\t\t\t\t}\n\t\t\t\tflatindex = gc.flatIndex\n\t\t\t\tfor i = 0; i < 8; i++ {\n\t\t\t\t\trowN = row + dY[i]\n\t\t\t\t\tcolN = col + dX[i]\n\t\t\t\t\tzN = output[rowN][colN]\n\t\t\t\t\tif zN != nodata && !inQueue[rowN][colN] {\n\t\t\t\t\t\tflowdir[rowN][colN] = backLink[i]\n\t\t\t\t\t\tif pits[rowN][colN] {\n\t\t\t\t\t\t\tnumPitsSolved++\n\t\t\t\t\t\t\t// trace the flowpath back until you find a lower cell\n\t\t\t\t\t\t\t// or a constraint is encountered\n\t\t\t\t\t\t\tnumCellsInPath = 0\n\t\t\t\t\t\t\tmaxPathBreachDepth = 0\n\n\t\t\t\t\t\t\tzTest = zN\n\t\t\t\t\t\t\tr = rowN\n\t\t\t\t\t\t\tc = colN\n\t\t\t\t\t\t\tisActive = true\n\t\t\t\t\t\t\tfor isActive {\n\t\t\t\t\t\t\t\tzTest -= SMALL_NUM // ensures a small increment slope\n\t\t\t\t\t\t\t\tdir = flowdir[r][c]\n\t\t\t\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\t\t\t\tr += dY[dir-1]\n\t\t\t\t\t\t\t\t\tc += dX[dir-1]\n\t\t\t\t\t\t\t\t\tzN2 = output[r][c]\n\t\t\t\t\t\t\t\t\tif zN2 <= zTest || zN2 == nodata {\n\t\t\t\t\t\t\t\t\t\t// a lower grid cell has been found\n\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tbreachDepth = dem.Value(r-1, c-1) - zTest //input[r][c] - zTest\n\t\t\t\t\t\t\t\t\t\tif breachDepth > maxPathBreachDepth {\n\t\t\t\t\t\t\t\t\t\t\tmaxPathBreachDepth = breachDepth\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} else {\n\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnumCellsInPath++\n\t\t\t\t\t\t\t\tif numCellsInPath > parent.maxLength {\n\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif maxPathBreachDepth > parent.maxDepth {\n\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif numCellsInPath <= parent.maxLength && maxPathBreachDepth <= parent.maxDepth {\n\t\t\t\t\t\t\t\t// breach it completely\n\t\t\t\t\t\t\t\tzTest = zN\n\t\t\t\t\t\t\t\tr = rowN\n\t\t\t\t\t\t\t\tc = colN\n\t\t\t\t\t\t\t\tisActive = true\n\t\t\t\t\t\t\t\tfor isActive {\n\t\t\t\t\t\t\t\t\tzTest -= SMALL_NUM // ensures a small increment slope\n\t\t\t\t\t\t\t\t\tdir = flowdir[r][c]\n\t\t\t\t\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\t\t\t\t\tr += dY[dir-1]\n\t\t\t\t\t\t\t\t\t\tc += dX[dir-1]\n\t\t\t\t\t\t\t\t\t\tzN2 = output[r][c]\n\t\t\t\t\t\t\t\t\t\tif zN2 <= zTest || zN2 == nodata {\n\t\t\t\t\t\t\t\t\t\t\t// a lower grid cell has been found\n\t\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\toutput[r][c] = zTest\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// it will be removed by filling in the next step.\n\t\t\t\t\t\t\t\tneedsFilling = true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnumSolvedCells++\n\t\t\t\t\t\tn = 0\n\t\t\t\t\t\tif pits[rowN][colN] {\n\t\t\t\t\t\t\tn = flatindex + 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgc = newGridCell(rowN, colN, n)\n\t\t\t\t\t\tp = int64(int64(zN*elevMultiplier)*100000 + (int64(n) % 100000))\n\t\t\t\t\t\tpq.Push(gc, p)\n\t\t\t\t\t\tinQueue[rowN][colN] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprogress = int(100.0 * numSolvedCells / numCellsTotal)\n\t\t\t\tif progress != oldProgress {\n\t\t\t\t\tprintf(\"\\rBreaching DEM (2 of 2): %v%%\", progress)\n\t\t\t\t\toldProgress = progress\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfloodorder = make([]int, numValidCells)\n\t\t\t// perform constrained breaching\n\t\t\tvar outletHeight float64\n\t\t\tvar outletDist, targetDist, j int32\n\t\t\tvar zOrig float64\n\t\t\tfor pq.Len() > 0 {\n\t\t\t\t//item := heap.Pop(&pq).(*Item)\n\t\t\t\t//gc = item.value\n\t\t\t\tgc = pq.Pop()\n\t\t\t\trow = gc.row\n\t\t\t\tcol = gc.column\n\t\t\t\tif parent.postBreachFilling {\n\t\t\t\t\t//floodorder.Push(row, col)\n\t\t\t\t\tfloodorder[floodOrderTail] = row*columns + col\n\t\t\t\t\tfloodOrderTail++\n\t\t\t\t}\n\t\t\t\tflatindex = gc.flatIndex\n\t\t\t\t//z = output[row][col]\n\t\t\t\tfor i = 0; i < 8; i++ {\n\t\t\t\t\trowN = row + dY[i]\n\t\t\t\t\tcolN = col + dX[i]\n\t\t\t\t\tzN = output[rowN][colN]\n\t\t\t\t\tif zN != nodata && !inQueue[rowN][colN] {\n\t\t\t\t\t\tflowdir[rowN][colN] = backLink[i]\n\t\t\t\t\t\tif pits[rowN][colN] {\n\t\t\t\t\t\t\tnumPitsSolved++\n\t\t\t\t\t\t\t// trace the flowpath back until you find a lower cell\n\t\t\t\t\t\t\t// or a constraint is encountered\n\t\t\t\t\t\t\tnumCellsInPath = 0\n\t\t\t\t\t\t\tmaxPathBreachDepth = 0\n\n\t\t\t\t\t\t\tzTest = zN\n\t\t\t\t\t\t\tr = rowN\n\t\t\t\t\t\t\tc = colN\n\t\t\t\t\t\t\toutletHeight = -math.MaxFloat64\n\t\t\t\t\t\t\toutletDist = 0\n\t\t\t\t\t\t\tisActive = true\n\t\t\t\t\t\t\tfor isActive {\n\t\t\t\t\t\t\t\tzTest -= SMALL_NUM // ensures a small increment slope\n\t\t\t\t\t\t\t\tdir = flowdir[r][c]\n\t\t\t\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\t\t\t\tr += dY[dir-1]\n\t\t\t\t\t\t\t\t\tc += dX[dir-1]\n\t\t\t\t\t\t\t\t\tzN2 = output[r][c]\n\t\t\t\t\t\t\t\t\tif zN2 <= zTest || zN2 == nodata {\n\t\t\t\t\t\t\t\t\t\t// a lower grid cell has been found\n\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tzOrig = dem.Value(r-1, c-1) //input[r][c]\n\t\t\t\t\t\t\t\t\t\tbreachDepth = zOrig - zTest\n\t\t\t\t\t\t\t\t\t\tif breachDepth > maxPathBreachDepth {\n\t\t\t\t\t\t\t\t\t\t\tmaxPathBreachDepth = breachDepth\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif zOrig > outletHeight {\n\t\t\t\t\t\t\t\t\t\t\toutletHeight = zOrig\n\t\t\t\t\t\t\t\t\t\t\toutletDist = numCellsInPath\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} else {\n\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnumCellsInPath++\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif numCellsInPath <= parent.maxLength && maxPathBreachDepth <= parent.maxDepth {\n\t\t\t\t\t\t\t\t// breach it completely\n\t\t\t\t\t\t\t\tzTest = zN\n\t\t\t\t\t\t\t\tr = rowN\n\t\t\t\t\t\t\t\tc = colN\n\t\t\t\t\t\t\t\tisActive = true\n\t\t\t\t\t\t\t\tfor isActive {\n\t\t\t\t\t\t\t\t\tzTest -= SMALL_NUM // ensures a small increment slope\n\t\t\t\t\t\t\t\t\tdir = flowdir[r][c]\n\t\t\t\t\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\t\t\t\t\tr += dY[dir-1]\n\t\t\t\t\t\t\t\t\t\tc += dX[dir-1]\n\t\t\t\t\t\t\t\t\t\tzN2 = output[r][c]\n\t\t\t\t\t\t\t\t\t\tif zN2 <= zTest || zN2 == nodata {\n\t\t\t\t\t\t\t\t\t\t\t// a lower grid cell has been found\n\t\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\toutput[r][c] = zTest\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// ***Constrained Breaching***\n\t\t\t\t\t\t\t\t// it will be completely removed by filling in the next step...\n\t\t\t\t\t\t\t\tneedsFilling = true\n\t\t\t\t\t\t\t\t// but in the meantime, lower the outlet as much as you can.\n\n\t\t\t\t\t\t\t\tzTest = outletHeight - parent.maxDepth\n\t\t\t\t\t\t\t\ttargetDist = numCellsInPath\n\n\t\t\t\t\t\t\t\tif numCellsInPath > parent.maxLength {\n\t\t\t\t\t\t\t\t\tif outletDist < parent.maxLength/2 {\n\t\t\t\t\t\t\t\t\t\ttargetDist = parent.maxLength\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ttargetDist = outletDist + parent.maxLength/2\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tr = rowN\n\t\t\t\t\t\t\t\t\tc = colN\n\t\t\t\t\t\t\t\t\tfor j = 0; j < targetDist; j++ {\n\t\t\t\t\t\t\t\t\t\tdir = flowdir[r][c]\n\t\t\t\t\t\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\t\t\t\t\t\tr += dY[dir-1]\n\t\t\t\t\t\t\t\t\t\t\tc += dX[dir-1]\n\t\t\t\t\t\t\t\t\t\t\tzTest = output[r][c]\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif outletHeight-zTest > parent.maxDepth {\n\t\t\t\t\t\t\t\t\t\tzTest = outletHeight - parent.maxDepth\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tr = rowN\n\t\t\t\t\t\t\t\tc = colN\n\t\t\t\t\t\t\t\tisActive = true\n\t\t\t\t\t\t\t\tnumCellsInPath = 0\n\t\t\t\t\t\t\t\tfor isActive {\n\t\t\t\t\t\t\t\t\tdir = flowdir[r][c]\n\t\t\t\t\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\t\t\t\t\tr += dY[dir-1]\n\t\t\t\t\t\t\t\t\t\tc += dX[dir-1]\n\t\t\t\t\t\t\t\t\t\tzN2 = output[r][c]\n\t\t\t\t\t\t\t\t\t\tif zN2 <= zN || zN2 == nodata {\n\t\t\t\t\t\t\t\t\t\t\t// a lower grid cell has been found\n\t\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tif output[r][c] > zTest {\n\t\t\t\t\t\t\t\t\t\t\t\toutput[r][c] = zTest\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} else {\n\t\t\t\t\t\t\t\t\t\tisActive = false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tnumCellsInPath++\n\t\t\t\t\t\t\t\t\tif numCellsInPath > targetDist {\n\t\t\t\t\t\t\t\t\t\tisActive = false\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\tnumSolvedCells++\n\t\t\t\t\t\tn = 0\n\t\t\t\t\t\tif pits[rowN][colN] {\n\t\t\t\t\t\t\tn = flatindex + 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgc = newGridCell(rowN, colN, n)\n\t\t\t\t\t\tp = int64(int64(zN*elevMultiplier)*100000 + (int64(n) % 100000))\n\t\t\t\t\t\tpq.Push(gc, p)\n\t\t\t\t\t\tinQueue[rowN][colN] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprogress = int(100.0 * numSolvedCells / numCellsTotal)\n\t\t\t\tif progress != oldProgress {\n\t\t\t\t\tprintf(\"\\rBreaching DEM (2 of 2): %v%%\", progress)\n\t\t\t\t\toldProgress = progress\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpits = nil\n\t\tinQueue = nil\n\n\t\tif parent.postBreachFilling && needsFilling {\n\t\t\t// Fill the DEM.\n\t\t\tprintf(\"\\r \")\n\n\t\t\tnumSolvedCells = 0\n\t\t\t//for numSolvedCells < numCellsTotal {\n\t\t\t//\trow, col = floodorder.Pop()\n\t\t\tfor c := 0; c < numValidCells; c++ {\n\t\t\t\trow = floodorder[c] / columns\n\t\t\t\tcol = floodorder[c] % columns\n\t\t\t\tif row >= 0 && col >= 0 {\n\t\t\t\t\tz = output[row][col]\n\t\t\t\t\tdir = flowdir[row][col]\n\t\t\t\t\tif dir > 0 {\n\t\t\t\t\t\trowN = row + dY[dir-1]\n\t\t\t\t\t\tcolN = col + dX[dir-1]\n\t\t\t\t\t\tzN = output[rowN][colN]\n\t\t\t\t\t\tif zN != nodata {\n\t\t\t\t\t\t\tif z <= zN+SMALL_NUM {\n\t\t\t\t\t\t\t\toutput[row][col] = zN + SMALL_NUM\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\tnumSolvedCells++\n\t\t\t\tprogress = int(100.0 * numSolvedCells / numValidCells)\n\t\t\t\tif progress != oldProgress {\n\t\t\t\t\tprintf(\"\\rFilling DEM: %v%%\", progress)\n\t\t\t\t\toldProgress = progress\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbenchTimes[bt] = time.Since(startTime)\n\t\tprintf(\" Elapsed time (s): %v\\n\", benchTimes[bt].Seconds())\n\t}\n\tprintln(\"\")\n\tprintln(\"Elapsed times (in sec.) of the 10 runs:\")\n\tavgVal := 0.0\n\tfor i := 0; i < 10; i++ {\n\t\tprintln(benchTimes[i].Seconds())\n\t\tavgVal += benchTimes[i].Seconds()\n\t}\n\n\tprintln(\"Average Time: \", avgVal/10.0)\n\n\tprintln(\"Operation complete!\")\n\n}", "func (tc *TestCase) Benchmark(client *QueryClient) error {\n\t_, err := exec(client, tc.Query, tc.BindVars)\n\treturn err\n}", "func Benchmarks(b *testing.B, ctor func() Queue) {\n\tcaps := Detect(ctor())\n\tif !caps.Any(CapQueue) {\n\t\tb.Fatal(\"does not implement any of queue interfaces\")\n\t}\n\tb.Helper()\n\n\tbenchCommon(b, caps, ctor)\n\n\t// blocking implementations\n\n\tif caps.Has(CapBlockSPSC) {\n\t\tb.Run(\"b/SPSC\", func(b *testing.B) { b.Helper(); benchSPSC(b, caps, ctor) })\n\t}\n\tif caps.Has(CapBlockMPSC) {\n\t\tb.Run(\"b/MPSC\", func(b *testing.B) { b.Helper(); benchMPSC(b, caps, ctor) })\n\t}\n\tif caps.Has(CapBlockSPMC) {\n\t\tb.Run(\"b/SPMC\", func(b *testing.B) { b.Helper(); benchSPMC(b, caps, ctor) })\n\t}\n\tif caps.Has(CapBlockMPMC) {\n\t\tb.Run(\"b/MPMC\", func(b *testing.B) { b.Helper(); benchMPMC(b, caps, ctor) })\n\t}\n\n\t// non-blocking implementations\n\n\tif caps.Has(CapNonblockSPSC) {\n\t\tb.Run(\"n/SPSC\", func(b *testing.B) { b.Helper(); benchNonblockSPSC(b, caps, ctor) })\n\t}\n\tif caps.Has(CapNonblockMPSC) {\n\t\tb.Run(\"n/MPSC\", func(b *testing.B) { b.Helper(); benchNonblockMPSC(b, caps, ctor) })\n\t}\n\tif caps.Has(CapNonblockSPMC) {\n\t\tb.Run(\"n/SPMC\", func(b *testing.B) { b.Helper(); benchNonblockSPMC(b, caps, ctor) })\n\t}\n\tif caps.Has(CapNonblockMPMC) {\n\t\tb.Run(\"n/MPMC\", func(b *testing.B) { b.Helper(); benchNonblockMPMC(b, caps, ctor) })\n\t}\n}", "func BenchmarkQuickSortWorstEq128(b *testing.B) {\n\tl := genListEq(128)\n\tbenchmarkSort(b, QuickSort, l)\n}", "func BenchmarkMemTool(b *testing.B) {\n\tvar blk [4096]byte\n\tb.ReportAllocs()\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tClear(unsafe.Pointer(&blk), 4096)\n\t}\n}", "func BenchmarkCoreSimple(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tDoTheThing()\n\t}\n}", "func benchmarkSnapshot(b *testing.B, fileSize uint64) {\n\t// Create the file.\n\tsf := newBlankTestFile()\n\trc := sf.staticMetadata.staticErasureCode\n\t// Add a host key to the table.\n\tsf.addRandomHostKeys(1)\n\t// Add numPieces to each chunk.\n\tfor i := uint64(0); i < sf.NumChunks(); i++ {\n\t\tfor j := uint64(0); j < uint64(rc.NumPieces()); j++ {\n\t\t\tif err := sf.AddPiece(types.SiaPublicKey{}, i, j, crypto.Hash{}); err != nil {\n\t\t\t\tb.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n\t// Reset the timer.\n\tb.ResetTimer()\n\n\t// Create snapshots as fast as possible.\n\tfor i := 0; i < b.N; i++ {\n\t\t_, err := sf.Snapshot(modules.RootSiaPath())\n\t\tif err != nil {\n\t\t\tb.Fatal(err)\n\t\t}\n\t}\n}", "func Memcmp(s1 *byte, s2 *byte, n int64) int32 {\n\tvar p2_016, p1_015, incdec_ptr, incdec_ptr5 *byte\n\tvar tobool14, cmp, tobool bool\n\tvar v0, v1 byte\n\tvar conv, conv1, sub, retval_0 int32\n\tvar dec17_in, dec17 int64\n\n\t_, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = tobool14, dec17_in, p2_016, p1_015, dec17, v0, v1, cmp, conv, conv1, sub, incdec_ptr, incdec_ptr5, tobool, retval_0\n\n\ttobool14 = n == 0\n\tif tobool14 {\n\t\tretval_0 = 0\n\t\tgoto cleanup\n\t} else {\n\t\tdec17_in, p2_016, p1_015 = n, s2, s1\n\t\tgoto while_body\n\t}\n\nwhile_body:\n\tdec17 = dec17_in - 1\n\tv0 = *p1_015\n\tv1 = *p2_016\n\tcmp = v0 == v1\n\tif cmp {\n\t\tgoto if_end\n\t} else {\n\t\tgoto if_then\n\t}\n\nif_then:\n\tconv = int32(uint32(v0))\n\tconv1 = int32(uint32(v1))\n\tsub = conv - conv1\n\tretval_0 = sub\n\tgoto cleanup\n\nif_end:\n\tincdec_ptr = (*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(p1_015)) + 1*unsafe.Sizeof(*(*byte)(nil))))\n\tincdec_ptr5 = (*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(p2_016)) + 1*unsafe.Sizeof(*(*byte)(nil))))\n\ttobool = dec17 == 0\n\tif tobool {\n\t\tretval_0 = 0\n\t\tgoto cleanup\n\t} else {\n\t\tdec17_in, p2_016, p1_015 = dec17, incdec_ptr5, incdec_ptr\n\t\tgoto while_body\n\t}\n\ncleanup:\n\treturn retval_0\n}", "func BenchmarkString(t *testing.B) {\n\tt.ResetTimer()\n\tvar toolRand Rand\n\tfor i:=0; i< t.N; i++ {\n\t\t_ = toolRand.String(10)\n\t}\n}", "func BenchmarkQuickSortWorstAsc128(b *testing.B) {\n\tl := genListAsc(128)\n\tbenchmarkSort(b, QuickSort, l)\n}", "func benchGetStackFramePointsCommonDepth(b *testing.B, depth int) {\n\n\tb.ReportAllocs()\n\tb.ResetTimer()\n\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = getStackFramePoints(0, depth)\n\t}\n}", "func printStats(start time.Time, numFiles int64, totalFileSize int64, numErrors int) {\n\tfileSizeMB := totalFileSize / 1024 / 1024\n\texecTime := time.Since(start).Seconds()\n\tfmt.Println()\n\tfmt.Println(\"-------------- RUNTIME STATS -----------------\")\n\tfmt.Printf(\"hornet version : %s\\n\", version)\n\tfmt.Printf(\"date : %s\\n\", time.Now().Format(time.RFC1123))\n\tfmt.Printf(\"elapsed time : %f s\\n\", execTime)\n\tfmt.Printf(\"# file errors : %d\\n\", numErrors)\n\tfmt.Printf(\"files processed : %d\\n\", numFiles)\n\tfmt.Printf(\"data processed : %d MB\\n\", fileSizeMB)\n\tfmt.Printf(\"throughput : %f MB/s\\n\", float64(fileSizeMB)/execTime)\n}", "func main() {\n\ttestsize := 10000\n\tt0 := time.Now()\n\tStatePass(testsize)\n\tt1 := time.Now()\n\tfmt.Println(\"StatePass: \", t1.Sub(t0))\n\t\n\tt2 := time.Now()\n\tstream := Stream(testsize)\n\tfor {\n\t\tif _, ok := <- stream; !ok {\n\t\t\tbreak\n\t\t}\n\t}\n\tt3 := time.Now()\t\n\tfmt.Println(\"Stream: \", t3.Sub(t2))\n}", "func benchGeneratePS(n int, b *testing.B) {\n\ttemp := []string{}\n\tfor i := 0; i < b.N; i++ {\n\t\tcf := New()\n\t\t_ = cf.SetFormat(\"#xxxx\")\n\t\t_ = cf.SetPrefix(\"Codes: (\")\n\t\t_ = cf.SetSuffix(\" )\")\n\t\ttemp, _ = cf.Generate(n)\n\t}\n\tresult = temp\n}", "func benchGlyph(b *testing.B, colorModel byte, loose bool, height int, op draw.Op) {\n\twidth, data := scaledBenchmarkGlyphData(height)\n\tz := NewRasterizer(width, height)\n\n\tbounds := z.Bounds()\n\tif loose {\n\t\tbounds.Max.X++\n\t}\n\tdst, src := draw.Image(nil), image.Image(nil)\n\tswitch colorModel {\n\tcase 'A':\n\t\tdst = image.NewAlpha(bounds)\n\t\tsrc = image.Opaque\n\tcase 'N':\n\t\tdst = image.NewNRGBA(bounds)\n\t\tsrc = image.NewUniform(color.NRGBA{0x40, 0x80, 0xc0, 0xff})\n\tcase 'R':\n\t\tdst = image.NewRGBA(bounds)\n\t\tsrc = image.NewUniform(color.RGBA{0x40, 0x80, 0xc0, 0xff})\n\tdefault:\n\t\tb.Fatal(\"unsupported color model\")\n\t}\n\tbounds = z.Bounds()\n\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tz.Reset(width, height)\n\t\tz.DrawOp = op\n\t\tfor _, d := range data {\n\t\t\tswitch d.n {\n\t\t\tcase 0:\n\t\t\t\tz.MoveTo(d.px, d.py)\n\t\t\tcase 1:\n\t\t\t\tz.LineTo(d.px, d.py)\n\t\t\tcase 2:\n\t\t\t\tz.QuadTo(d.px, d.py, d.qx, d.qy)\n\t\t\t}\n\t\t}\n\t\tz.Draw(dst, bounds, src, image.Point{})\n\t}\n}" ]
[ "0.64081115", "0.62164116", "0.6205476", "0.62025577", "0.6129468", "0.61243784", "0.60892284", "0.6086002", "0.6082841", "0.6081933", "0.6067134", "0.60595524", "0.6053396", "0.60456127", "0.603301", "0.6025344", "0.60241866", "0.6019437", "0.6013965", "0.601314", "0.6006612", "0.5993066", "0.59461516", "0.59437335", "0.59356964", "0.5913328", "0.5903827", "0.5886444", "0.5882533", "0.587208", "0.5840779", "0.5835336", "0.58194685", "0.5813779", "0.5778128", "0.57640886", "0.5764068", "0.5750124", "0.5748842", "0.5742834", "0.57417583", "0.574094", "0.57215065", "0.5709447", "0.5709447", "0.5695721", "0.5690301", "0.5688369", "0.5688125", "0.5687791", "0.56801367", "0.56732434", "0.5667197", "0.56648636", "0.5652021", "0.56417423", "0.5640336", "0.56357443", "0.5632934", "0.5631457", "0.56250775", "0.56233233", "0.5621401", "0.5616718", "0.5614926", "0.56055284", "0.56047523", "0.5591641", "0.558893", "0.5587535", "0.5583481", "0.5575726", "0.55754733", "0.5571721", "0.55608404", "0.554852", "0.5548334", "0.55447555", "0.55379254", "0.5533824", "0.55328244", "0.5531114", "0.5521702", "0.5516087", "0.5515853", "0.5514489", "0.5514124", "0.5513834", "0.5500523", "0.5497049", "0.5495812", "0.5494867", "0.5486771", "0.54837507", "0.5483684", "0.54735696", "0.5472043", "0.5470115", "0.5466073", "0.5458244", "0.54548234" ]
0.0
-1
HTMLFileCallback creates static files based on a HTML template.
func HTMLFileCallback(c Config, tmpl *template.Template) Callback { outputPath := strings.TrimSuffix(c.Path, "/") return func(path, url string) error { fullpath := outputPath + "/" + path if err := os.MkdirAll(fullpath, 0700); err != nil { return err } w, err := os.Create(fullpath + "/index.html") if err != nil { return err } if c.DisableMetaFetch { return tmpl.Execute(w, redirectHTMLArgs{Title: url, URL: url}) } resp, err := http.Get(url) if err != nil { return err } defer resp.Body.Close() meta, err := GetMetaData(resp.Body) if err != nil { return err } return tmpl.Execute(w, redirectHTMLArgs{ URL: url, Title: meta.Title, MetaTags: meta.Tags, }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HTML(c *slurp.C, data interface{}) slurp.Stage {\n\treturn func(in <-chan slurp.File, out chan<- slurp.File) {\n\n\t\ttemplates := html.New(\"\")\n\n\t\tvar wg sync.WaitGroup\n\t\tdefer wg.Wait() //Wait before all templates are executed.\n\n\t\tfor f := range in {\n\n\t\t\tbuf := new(bytes.Buffer)\n\t\t\t_, err := buf.ReadFrom(f.Reader)\n\t\t\tf.Close()\n\t\t\tif err != nil {\n\t\t\t\tc.Println(err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttemplate, err := templates.New(f.Stat.Name()).Parse(buf.String())\n\t\t\tif err != nil {\n\t\t\t\tc.Println(err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tf.Reader = NewTemplateReadCloser(c, wg, template, data)\n\n\t\t\tout <- f\n\t\t}\n\t}\n}", "func HtmlFile(name string) http.Handler {\n\treturn &htmlFile{name: name}\n}", "func StaticHtmlFile(name string) http.Handler {\n\tfile, err := os.Open(name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\treturn &staticHtmlFile{\n\t\tcontent: ProcessHtml(file).Bytes(),\n\t}\n}", "func outHTML(config *MainConfig, fileFunc FileResultFunc) {\n\n\tindexPath := filepath.Join(config.Outpath, FILE_NAME_HTML_INDEX)\n\terr := SFFileManager.WirteFilepath(indexPath, []byte(assets.HTML_INDEX))\n\n\tif nil != err {\n\t\tfileFunc(indexPath, ResultFileOutFail, err)\n\t} else {\n\t\tfileFunc(indexPath, ResultFileSuccess, nil)\n\t}\n\n\tsrcPath := filepath.Join(config.Outpath, FILE_NAME_HTML_SRC)\n\terr = SFFileManager.WirteFilepath(srcPath, []byte(assets.HTML_SRC))\n\n\tif nil != err {\n\t\tfileFunc(srcPath, ResultFileOutFail, err)\n\t} else {\n\t\tfileFunc(srcPath, ResultFileSuccess, nil)\n\t}\n\n}", "func (te *TemplateEngine) CreateHTML(templateFilePathList []string, data interface{}) (string, error) {\n\tt, err := template.ParseFiles(templateFilePathList...)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbuf := new(bytes.Buffer)\n\tif err = t.Execute(buf, data); err != nil {\n\t\treturn \"\", err\n\t}\n\thtmlString := buf.String()\n\treturn htmlString, nil\n}", "func main() {\n\t// go through each directory in go using os package\n\thtmlFiles := []string{}\n\toutputFolder := \"gh-pages\"\n\treg := []string{\"rm\", \"-rf\", outputFolder}\n\tcmd := strings.Join(reg[:], \" \")\n\n\ttmpl := `\n\t<html>\n\t\t<head>\n\t\t\t<title>List of Matlab Reports and Files</title>\n\t\t</head>\n\t\t<body>\n\t\t\t<h1>List of Files</h1>\n\t\t\t<ul>\n\t\t\t{{ range . }}\n\t\t\t\t<li><a href={{.}}>{{ . }}</a></li>\n\t\t\t{{ end }}\n\t\t\t</ul>\n\t\t</body>\n\t</html>\n\t`\n\tscript.IfExists(outputFolder).Exec(cmd).Stdout()\n\tscript.FindFiles(\".\").FilterScan(func(line string, w io.Writer) {\n\t\t// if line contains html print it\n\t\tif strings.Contains(line, \".html\") || strings.Contains(line, \".pdf\") {\n\t\t\tfmt.Fprintf(w, \"scanned line: %q\\n\", line)\n\t\t\thtmlFiles = append(htmlFiles, line)\n\t\t}\n\t}).Stdout()\n\n\tfmt.Println(htmlFiles)\n\t// create html directory\n\tscript.Exec(\"mkdir \" + outputFolder).Stdout()\n\n\t// for each html file\n\tfor _, file := range htmlFiles {\n\t\treg = []string{\"cp\", file, outputFolder}\n\t\tcmd = strings.Join(reg[:], \" \")\n\t\t// copy file to html directory\n\t\tscript.Exec(cmd).Stdout()\n\t}\n\n\t// move ads.txt to html directory\n\tscript.Exec(\"mv ads.txt \" + outputFolder).Stdout()\n\n\tt, err := template.New(\"files\").Parse(tmpl)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tfile, err := os.Create(outputFolder + \"/index.html\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer file.Close()\n\t// remove outputFolder from htmlFiles\n\tfor i, file := range htmlFiles {\n\t\t// get basename of file\n\t\tbaseName := filepath.Base(file)\n\t\thtmlFiles[i] = baseName\n\t}\n\terr = t.Execute(file, htmlFiles)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n}", "func RenderFileTemplate(w http.ResponseWriter, tmpl string) {\n\thead, err := template.ParseFiles(\"header.html\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tcontent, err := template.ParseFiles(tmpl + \".html\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tfoot, err := template.ParseFiles(\"footer.html\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = head.Execute(w, nil)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\terr = content.Execute(w, nil)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\terr = foot.Execute(w, nil)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func HTMLFile(w http.ResponseWriter, path string, status int) (int, error) {\n\tbytes, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn WriteHTML(w, bytes, status)\n}", "func HTMLPageHandler(pageTmplname string, jsFilename []string) http.HandlerFunc {\n\tpage := NewHTMLPage(pageTmplname, jsFilename)\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tstart := time.Now()\n\t\tio.Copy(rw, bytes.NewReader(page))\n\t\tlog.Printf(\"Done in %v\", time.Since(start))\n\t}\n}", "func outputHTML(w http.ResponseWriter, r *http.Request, filepath string) {\n\tfile, err := os.Open(filepath)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\thttp.ServeContent(w, r, file.Name(), time.Now(), file)\n}", "func generateHTML(writer http.ResponseWriter, data interface{}, filenames ...string) {\n\n\tvar t *template.Template\n\tvar files []string\n\tfor _, file := range filenames {\n\t\tfiles = append(files, fmt.Sprintf(\"web/ui/template/HTMLLayouts/%s.html\", file))\n\t}\n\tt = template.Must(template.ParseFiles(files...))\n\tt.ExecuteTemplate(writer, \"layout\", data)\n}", "func writeHTML(domain, pkg, source, filename string) error {\n\tdata, err := generateHTML(domain, pkg, source)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.MkdirAll(filepath.Dir(filename), 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(filename, data, 0666)\n}", "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\r\n t, err := template.ParseFiles(tmpl + \".html\")\r\n if err != nil {\r\n http.Error(w, err.Error(), http.StatusInternalServerError)\r\n return\r\n }\r\n err = t.Execute(w, p)\r\n if err != nil {\r\n http.Error(w, err.Error(), http.StatusInternalServerError)\r\n }\r\n}", "func (b *BaseHandler) RenderHTML(w http.ResponseWriter, templatePath string, data interface{}) {\n\tt := template.New(\"result template\")\n\tt, err := template.ParseFiles(templatePath)\n\tif err != nil {\n\t\tarklog.ERROR.Printf(\"[BaseHandler][RenderHTML] Cannot parse the template. Err: %s\\n\", err.Error())\n\t\tb.RenderError(w, errors.New(errors.InternalServerError))\n\t}\n\n\tt.Execute(w, data)\n}", "func RenderHTMLFromFile(filename string, settings ...configuration.Setting) (string, types.Metadata, error) {\n\tinfo, err := os.Stat(filename)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn \"\", types.Metadata{}, err\n\t}\n\n\tallSettings := append([]configuration.Setting{\n\t\tconfiguration.WithLastUpdated(info.ModTime()),\n\t\tconfiguration.WithFilename(filename),\n\t\tconfiguration.WithBackEnd(\"html5\")},\n\t\tsettings...)\n\tconfig := configuration.NewConfiguration(allSettings...)\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn \"\", types.Metadata{}, err\n\t}\n\tdefer func() { f.Close() }()\n\tresultWriter := bytes.NewBuffer(nil)\n\tmetadata, err := libasciidoc.Convert(f, resultWriter, config)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn \"\", types.Metadata{}, err\n\t}\n\tif log.IsLevelEnabled(log.DebugLevel) {\n\t\tlog.Debug(resultWriter.String())\n\t}\n\treturn resultWriter.String(), metadata, nil\n}", "func CreateHTML(w io.Writer, header, body string) error {\n\tbox := packr.New(\"MyBox\", \"templates\")\n\tindex, err := box.FindString(\"index.html\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpage := template.New(\"page\")\n\tpage, err = page.Parse(index)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvalues := struct {\n\t\tHead string\n\t\tBody string\n\t}{\n\t\tHead: header,\n\t\tBody: strings.TrimLeft(strings.TrimRight(body, \"\\n\"), \"\\n\"),\n\t}\n\n\terr = page.Execute(w, values)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (b *Builder) AddHTMLFunc(f func(io.Writer) error, file ...string) error {\n\tfor i := range file {\n\t\tfile, err := os.Open(file[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb.htmlRelatedFiles = append(b.htmlRelatedFiles, file)\n\t}\n\tb.htmlFunc = f\n\treturn nil\n}", "func newStaticTemplateHandler(filename string, data map[string]interface{}) *staticTemplateHandler {\n\tif data == nil {\n\t\tdata = map[string]interface{}{}\n\t}\n\n\tt := &staticTemplateHandler{\n\t\tfilename: filename,\n\t\tdata: data,\n\t}\n\n\tt.once.Do(func() {\n\t\tfuncs := template.FuncMap{\n\t\t\t\"include\": func(part string) (template.HTML, error) {\n\t\t\t\tbuf := bytes.NewBuffer(nil)\n\t\t\t\tpt := template.Must(template.ParseFiles(filepath.Join(partialDir, part)))\n\t\t\t\terr := pt.Execute(buf, t.data)\n\t\t\t\treturn template.HTML(buf.String()), err\n\t\t\t},\n\t\t}\n\t\tt.templ = template.Must(template.New(t.filename).Funcs(funcs).\n\t\t\tParseFiles(filepath.Join(templateDir, t.filename)))\n\t})\n\treturn t\n}", "func ServeHtmlFile(filePath string) error {\n\t_, fileErr := os.Stat(filePath)\n\tif os.IsNotExist(fileErr) {\n\t\treturn errors.New(\"File do not exist.\")\n\t}\n\n\thandler := ServeFileHandler{filePath}\n\terr := http.ListenAndServe(\":8080\", &handler)\n\treturn err\n}", "func tryStaticHTML(ctx *fasthttp.RequestCtx, p IPage) error {\n\tif !p.Attr().CacheOption.IsStaticHTML {\n\t\treturn nil\n\t}\n\n\tfilename := util.Bytes2Str(ctx.RequestURI())\n\tl := len(filename)\n\tif l < 1 {\n\t\treturn nil\n\t}\n\n\tif filename[l-1] == '/' {\n\t\tfilename += \"index.html\"\n\t} else {\n\t\tfilename += \".html\"\n\t}\n\n\tfile, err := os.OpenFile(filepath.Join(HomeDir, WEBROOT, filename), os.O_CREATE|os.O_TRUNC, os.ModePerm)\n\tdefer file.Close()\n\tfile.Write(ctx.Response.Body())\n\n\treturn err\n}", "func MakeHTMLFile(fileName, lang string, numOfPages *int) float64 {\n\tvar fileSizes float64\n\n\tfile, err := os.Lstat(fileName)\n\tcheck(err)\n\n\tfileContent, err := ioutil.ReadFile(fileName)\n\tcheck(err)\n\n\tfileSizes += float64(file.Size()) / float64(bytesize.KB)\n\n\ttranslatedFileContent, err := translate.Translate(lang, string(fileContent))\n\tcheck(err)\n\n\tif filepath.Ext(file.Name()) == \".md\" {\n\t\textensions := parser.CommonExtensions | parser.AutoHeadingIDs\n\t\tp := parser.NewWithExtensions(extensions)\n\n\t\thtmlFlags := html.CommonFlags | html.HrefTargetBlank\n\t\topts := html.RendererOptions{Flags: htmlFlags}\n\t\trenderer := html.NewRenderer(opts)\n\n\t\ttranslatedFileContent = string(markdown.ToHTML([]byte(translatedFileContent), p, renderer))\n\t}\n\n\twriteHTMLFile(file.Name(), translatedFileContent)\n\t*numOfPages++\n\treturn fileSizes\n}", "func Static(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n var mime_type string\n\n static_path := \"/src/github.com/mrgirlyman/watcher/frontman/build\" + params.ByName(\"filepath\")\n p, _ := loadPage(static_path)\n\n // Determining the MIME type of the file based on file extension\n switch slice := strings.Split(static_path, \".\"); slice[len(slice) - 1] {\n case \"css\":\n mime_type = \"text/css\"\n case \"js\":\n mime_type = \"application/javascript\"\n default:\n mime_type = \"text/plain\"\n }\n \n w.Header().Set(\"Content-Type\", mime_type)\n\n // Writing content to the http.ResponseWriter\n fmt.Fprintf(w, string(p.Body))\n}", "func (rw *RW) WriteHTML(fileName string) (err error) {\n\tfile ,err := os.Open(\"views/\"+fileName)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\tfileBytes ,err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trw.W.WriteHeader(200)\n\t_,err = rw.W.Write(fileBytes)\n\treturn\n}", "func renderTemplate(w http.ResponseWriter, p *models.Page) {\n\tlp := path.Join(\"views\", \"log.html\")\n\ttmpl, err := template.ParseFiles(lp)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\ttmpl.ExecuteTemplate(w, \"log.html\", p)\n}", "func RenderTemplate(w http.ResponseWriter, templateFile string, templateData interface{}) {\n\tt, err := template.ParseFiles(templateFile, \"./templates/header.html\", \"./templates/footer.html\")\n\tif err != nil {\n\t\tlog.Printf(\"Error encountered while parsing the template: \", err)\n\t}\n\tt.Execute(w, templateData)\n}", "func render(w http.ResponseWriter, context PageContext) {\n\tfuncMap := template.FuncMap{\n\t\t\"title\": strings.Title,\n\t\t\"HumanizeBytes\": HumanizeBytes,\n\t\t\"HumanizeBigBytes\": HumanizeBigBytes,\n\t\t\"CommifyFloat\": CommifyFloat,\n\t\t\"Float2Int\": IntFromFloat64,\n\t\t\"OkToBool\": OkToBool,\n\t\t\"tableflip\": func() string { return \"(╯°□°)╯︵ ┻━┻\" },\n\t}\n\tcontext.Static = STATIC_URL\n\ttmpl_list := getTemplateList(context.ViewTemplate)\n\t/*\n\t\tt, err := template.ParseFiles(tmpl_list...)\n\t\tif err != nil {\n\t\t\tlog.Print(\"template parsing error: \", err)\n\t\t}\n\t*/\n\tt := template.Must(template.New(\"base.html\").Funcs(funcMap).ParseFiles(tmpl_list...))\n\terr := t.Execute(w, context)\n\tif err != nil {\n\t\tlog.Print(\"template executing error: \", err)\n\t}\n}", "func WriteHTMLFiles(path string, r *Report) error {\n\tif err := os.Mkdir(path, os.ModePerm); err != nil && !os.IsExist(err) {\n\t\treturn err\n\t}\n\n\t// Reading templates\n\tt, err := tpl.Load()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// CSS\n\tif err := execTplIntoFile(\"css\", path, \"main.css\", t, nil); err != nil {\n\t\treturn err\n\t}\n\t// Summary\n\tif err := execTplIntoFile(\"summary\", path, \"summary.html\", t, r); err != nil {\n\t\treturn err\n\t}\n\t// Remotes\n\tif err := execTplIntoFile(\"remotes\", path, \"remotes-avg.html\", t, r.TopRemoteRequests(50, \"avg\")); err != nil {\n\t\treturn err\n\t}\n\tif err := execTplIntoFile(\"remotes\", path, \"remotes-max.html\", t, r.TopRemoteRequests(50, \"max\")); err != nil {\n\t\treturn err\n\t}\n\tif err := execTplIntoFile(\"remotes\", path, \"remotes-sum.html\", t, r.TopRemoteRequests(50, \"sum\")); err != nil {\n\t\treturn err\n\t}\n\t// Suites\n\tfor _, suite := range r.Suites() {\n\t\tif err := execTplIntoFile(\"suite\", path, \"suite-\"+strconv.Itoa(suite.ID)+\".html\", t, suite); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func StartHtmlHandler(configFile *goconf.ConfigFile) {\n\tif contentDir, _ := configFile.GetString(\"default\", \"contentDirectory\"); contentDir != \"\" {\n\t\tlogger.Printf(\"StartHtmlHandler(): serving HTML content from [%v]\", contentDir)\n\t\thttp.Handle(\"/html/\", http.StripPrefix(\"/html/\", http.FileServer(http.Dir(contentDir))))\n\t\thttp.Handle(\"/\", http.RedirectHandler(\"/html/index.html\", http.StatusTemporaryRedirect))\n\t\twd, err := os.Getwd()\n\t\tif err == nil {\n\t\t\thttp.Handle(\"/output/\", http.StripPrefix(\"/output/\", http.FileServer(http.Dir(wd))))\n\t\t}\n\t}\n}", "func MustHTMLFile(w http.ResponseWriter, path string, status int) int {\n\tresult, err := HTMLFile(w, path, status)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn result\n}", "func (h *Handler) IndexHTMLHandler(w http.ResponseWriter, r *http.Request) {\n\tsp, err := h.requestParameters(r)\n\tif err != nil {\n\t\th.Error(httperror.NewInvalidParams(\"request params\").WithError(err), w, \"IndexHTMLHandler\")\n\t\treturn\n\t}\n\n\tpr, pw := io.Pipe()\n\tgo func() {\n\t\terr := h.file.Get(sp.StorageName, sp.IsPermanent, \"index.html\", pw)\n\t\tpw.CloseWithError(err)\n\t}()\n\n\tw.Header().Set(\"Content-type\", \"text/html\")\n\t_, err = io.Copy(w, pr)\n\tif err != nil {\n\t\th.Error(httperror.NewInternalError(\"can't open index.html\").WithError(err), w, \"IndexHTMLHandler\")\n\t\treturn\n\t}\n}", "func HTML(opts ...ServerOption) {\n\tsrv, err := initServer(opts...)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\thttp.HandleFunc(\"/\", renderTemplate(srv))\n\n\tlog.Println(\"Listening on :3000...\")\n\terr = http.ListenAndServe(\":3000\", nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (r *HTMLRenderer) RenderTemplate(w http.ResponseWriter, name string, data interface{}) error {\n\tf, err := r.fs.Open(name)\n\tif err != nil {\n\t\tif v, ok := err.(*os.PathError); ok {\n\t\t\tif os.IsNotExist(v.Err) {\n\t\t\t\treturn fmt.Errorf(\"the template %q does not exist\", name)\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"failed to open template %q: %s\", name, err)\n\t}\n\tb, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read template %q: %s\", name, err)\n\t}\n\tt, err := r.mainTmpl.Clone()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to clone the main template for template %q: %s\", name, err)\n\t}\n\tt, err = t.Parse(string(b))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to parse template %q: %s\", name, err)\n\t}\n\n\tvar (\n\t\tbuf bytes.Buffer\n\t\tbw = bufio.NewWriter(&buf)\n\t)\n\tif err = t.Execute(bw, map[string]interface{}{\"WebBasePath\": r.BasePath, \"Data\": data}); err != nil {\n\t\treturn err\n\t}\n\tif err = bw.Flush(); err != nil {\n\t\treturn err\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t_, err = buf.WriteTo(w)\n\treturn err\n\n}", "func handler(w http.ResponseWriter, r *http.Request) {\n\ttmpl := template.Must(template.ParseFiles(\"index.html\"))\n\tdata := page\n\ttmpl.Execute(w, data)\n}", "func templatesMy_ordersHtml() (*asset, error) {\n\tpath := filepath.Join(rootDir, \"templates/my_orders.html\")\n\tname := \"templates/my_orders.html\"\n\tbytes, err := bindataRead(path, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error reading asset info %s at %s: %v\", name, path, err)\n\t}\n\n\ta := &asset{bytes: bytes, info: fi}\n\treturn a, err\n}", "func getHTMLFromTemplate(path string, data HelloMessage) string {\n\ttmpl := template.Must(template.ParseFiles(path))\n\tvar templateString bytes.Buffer\n\ttmpl.Execute(&templateString, data)\n\treturn templateString.String()\n}", "func (page string) HTMLRender(w http.ResponseWriter, r *http.Request) string {\n\ttemp, err := template.ParseFile(page + \".html\")\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t}\n\ttemp.ExecuteTemplate(w, page)\n}", "func (l *StaticLoader) WatchHtmlTemplate(name string) <-chan *template.Template {\n\treturn neverUpdatedTemplateChan\n}", "func main() {\n\n\tbase_dirs, _ := ioutil.ReadDir(\".\")\n\n\tfor _, f := range base_dirs {\n\t\tif !f.IsDir() {\n\t\t\tfn := strings.Split(f.Name(),\".\")\n\t\t\tif fn[len(fn)-1] == \"html\" {\n\t\t\t\tfmt.Printf(\"Processing %s.html\\n\", fn[0])\t\n\t\t\t\tprocessFile(fn[0])\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\n\n\t\n\n}", "func Static(w http.ResponseWriter, r *http.Request) {\n http.ServeFile(w, r, r.URL.Path[1:])\n}", "func ProcessTemplate(templateFile string, values interface{}) (string, []byte, error) {\n\tname := path.Base(templateFile)\n\tt := template.New(name).Funcs(map[string]interface{}{\n\t\t\"addURIAndSha\": func(url, tag string) string {\n\t\t\tt := struct {\n\t\t\t\tTagName string\n\t\t\t}{\n\t\t\t\tTagName: tag,\n\t\t\t}\n\t\t\tbuf := new(bytes.Buffer)\n\t\t\ttemp, err := template.New(\"url\").Parse(url)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\terr = temp.Execute(buf, t)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tlogrus.Infof(\"getting sha256 for %s\", buf.String())\n\t\t\tsha256, err := getSha256ForAsset(buf.String())\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\treturn fmt.Sprintf(`uri: %s\n sha256: %s`, buf.String(), sha256)\n\t\t},\n\t})\n\n\ttemplateObject, err := t.ParseFiles(templateFile)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\terr = templateObject.Execute(buf, values)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tkrewFile, err := ioutil.TempFile(\"\", \"krew-\")\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\terr = ioutil.WriteFile(krewFile.Name(), buf.Bytes(), 0644)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tprocessedTemplate := buf.Bytes()\n\tpluginName, err := krew.GetPluginName(krewFile.Name())\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\treturn pluginName, processedTemplate, nil\n}", "func generateDownloadHTML() (err error) {\n\tfds := []*fileDesc{}\n\n\t// It happens we want releases in reverse order in the HTML table:\n\tsort.Sort(sort.Reverse(sort.StringSlice(targetFiles)))\n\twebFolder := filepath.Join(srtgearsRoot, relativeWebFldr)\n\n\tparams := map[string]interface{}{\n\t\t\"ReleaseDate\": time.Now().Format(\"2006-01-02\"),\n\t}\n\n\t// Fill fds scice\n\tfor i, targetFile := range targetFiles {\n\t\tfd := fileDesc{Name: filepath.Base(targetFile)}\n\t\tfds = append(fds, &fd)\n\n\t\t// the regexp patter is for folder name (without extension)\n\t\tnameNoExt := fd.Name[:len(fd.Name)-len(filepath.Ext(fd.Name))]\n\t\tif parts := rlsFldrPttrn.FindStringSubmatch(nameNoExt); len(parts) > 0 {\n\t\t\t// [full string, version, os, arch]\n\t\t\tparams[\"Version\"] = parts[1]\n\t\t\tfd.OS = osNameMap[parts[2]]\n\t\t\tfd.Arch = archNameMap[parts[3]]\n\t\t} else {\n\t\t\t// Never to happen, file name was already matched earlier\n\t\t\treturn fmt.Errorf(\"Target name does not match pattern: %s\", targetFile)\n\t\t}\n\t\tif i%2 != 0 {\n\t\t\tfd.Class = \"alt\"\n\t\t}\n\t\tif fd.URL, err = filepath.Rel(webFolder, targetFile); err != nil {\n\t\t\treturn\n\t\t}\n\t\t// We need forward slashes \"/\" in urls:\n\t\tfd.URL = \"/\" + filepath.ToSlash(fd.URL)\n\t\tvar fi os.FileInfo\n\t\tif fi, err = os.Stat(targetFile); err != nil {\n\t\t\treturn\n\t\t}\n\t\tfd.Size = fmt.Sprintf(\"%.2f MB\", float64(fi.Size())/(1<<20))\n\n\t\t// Hash and include checksum\n\t\tvar content []byte\n\t\tif content, err = ioutil.ReadFile(targetFile); err != nil {\n\t\t\treturn\n\t\t}\n\t\tfd.SHA256 = fmt.Sprintf(\"%x\", sha256.Sum256(content))\n\t}\n\tparams[\"Fds\"] = fds\n\n\t// Now generate download table:\n\tt := template.Must(template.New(\"\").Parse(dltable))\n\tbuf := &bytes.Buffer{}\n\tif err = t.Execute(buf, params); err != nil {\n\t\treturn\n\t}\n\toutf := \"download-table.html\"\n\tif err = ioutil.WriteFile(outf, buf.Bytes(), 0); err != nil {\n\t\treturn\n\t}\n\tlog.Println(\"Download table written to:\", outf)\n\t// Also print to console:\n\tos.Stdout.Write(buf.Bytes())\n\treturn\n}", "func (o *OutputHandler) createBeautifulHTML() error {\n\terr := o.importFile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.markdownToHTML()\n\n\terr = o.createFile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func renderTemplate(srv *Server) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfp := filepath.Clean(r.URL.Path)\n\t\tif strings.HasPrefix(fp, `/`) || strings.HasPrefix(fp, `\\`) {\n\t\t\tfp = fp[1:] // remove starting \"/\" (or \"\\\" on Windows)\n\t\t}\n\t\tif fp == \"\" {\n\t\t\tfp = \"index.html\"\n\t\t}\n\n\t\tlog.Println(\"rendering\", fp)\n\n\t\t// TODO: load all templates outside this funcion\n\t\ttmpl, err := template.New(\"\").Funcs(template.FuncMap{\n\t\t\t\"ptFmtFloat\": ptFmtFloat,\n\t\t}).ParseFS(_contentFS, \"layout.html\", fp)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\t// Set the payload according to the URL path\n\t\tvar payload interface{}\n\t\tif strings.Contains(fp, \"fii.html\") && r.Method == http.MethodPost {\n\t\t\tcodes := parseCodes(r.FormValue(\"codes\"))\n\t\t\tmonths := parseNumeric(r.FormValue(\"months\"), 1)\n\t\t\tpayload = fiiDividendsPayload(srv, codes, months)\n\t\t}\n\n\t\terr = tmpl.ExecuteTemplate(w, \"layout\", payload)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}", "func (render *Renderer) RenderToFile(id int) {\n\tcategory := render.indexer.getCategory(id)\n\n\tif category == nil {\n\t\treturn\n\t}\n\tf, err := os.Create(fmt.Sprintf(`%d.html`, id))\n\tdefer f.Close()\n\tcheckErr(err)\n\n\terr = render.t.Execute(f, category)\n\tif err != nil {\n\t\tfmt.Println(\"executing template:\", err)\n\t}\n}", "func (h *Handler) TemplateHandler(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tlayout = path.Join(\"tmpl\", \"layout.html\")\n\t\tbodyTmpl = path.Join(\"tmpl\", r.URL.Path)\n\t)\n\n\tinfo, err := os.Stat(bodyTmpl)\n\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\thttp.Error(w, fmt.Sprintf(\"not found: %s\", r.URL.Path), http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif info.IsDir() {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\ttmpl, err := template.ParseFiles(layout, bodyTmpl)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\thttp.Error(w, \"template\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := tmpl.ExecuteTemplate(w, \"layout\", h.urls); err != nil {\n\t\tlog.Error(err.Error())\n\t\thttp.Error(w, \"template\", http.StatusInternalServerError)\n\t}\n}", "func indexHandler(res http.ResponseWriter, req *http.Request) {\n//Parsing the template\ntpl := template.Must(template.ParseFiles(\"index.html\"))\nerr := tpl.Execute(res, nil)\nlogError(err)\n}", "func File(staticPath string ,file string) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tswitch file {\n\t\tcase \"index\":\n\t\t\thttp.ServeFile(w, r, staticPath + \"/html/index.html\")\n\t\tdefault:\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tw.Write([]byte(\"file not found\"))\n\t\t}\n\t}\n}", "func MakeMultipleHTMLfile(dir, lang string, numOfPages *int) float64 {\n\tvar fileSizes float64\n\n\tallFiles, err := ioutil.ReadDir(dir)\n\tcheck(err)\n\n\tfor _, file := range allFiles {\n\t\tif file.IsDir() {\n\t\t\t// recursive check for subdirectories\n\t\t\tMakeMultipleHTMLfile(dir+\"/\"+file.Name(), lang, numOfPages)\n\t\t}\n\n\t\tif filepath.Ext(file.Name()) == \".txt\" {\n\t\t\tfileContent, err := ioutil.ReadFile(dir + \"/\" + file.Name())\n\t\t\tcheck(err)\n\n\t\t\ttranslatedFileContent, err := translate.Translate(lang, string(fileContent))\n\t\t\tcheck(err)\n\n\t\t\twriteHTMLFile(file.Name(), translatedFileContent)\n\n\t\t\tfileSizes += float64(file.Size()) / float64(bytesize.KB)\n\t\t\t*numOfPages++\n\t\t} else if filepath.Ext(file.Name()) == \".md\" {\n\t\t\textensions := parser.CommonExtensions | parser.AutoHeadingIDs\n\t\t\tp := parser.NewWithExtensions(extensions)\n\n\t\t\thtmlFlags := html.CommonFlags | html.HrefTargetBlank\n\t\t\topts := html.RendererOptions{Flags: htmlFlags}\n\t\t\trenderer := html.NewRenderer(opts)\n\n\t\t\tfileContent, err := ioutil.ReadFile(dir + \"/\" + file.Name())\n\t\t\tcheck(err)\n\n\t\t\ttranslatedFileContent, err := translate.Translate(lang, string(fileContent))\n\t\t\tcheck(err)\n\n\t\t\thtml := markdown.ToHTML([]byte(translatedFileContent), p, renderer)\n\n\t\t\twriteHTMLFile(file.Name(), string(html))\n\n\t\t\tfileSizes += float64(file.Size()) / float64(bytesize.KB)\n\t\t\t*numOfPages++\n\t\t}\n\t}\n\treturn fileSizes\n}", "func FileHandler(viewsRootBox *rice.Box) gintemplate.FileHandler {\n\treturn func(config gintemplate.TemplateConfig, tplFile string) (content string, err error) {\n\t\t// get file contents as string\n\t\treturn viewsRootBox.String(tplFile + config.Extension)\n\t}\n}", "func GetLevel1File(c *gin.Context) {\n p, _ := c.Get(\"serviceProvider\")\n var serviceProvider *services.ServiceProvider\n serviceProvider = p.(*services.ServiceProvider)\n\tfileName := c.Param(\"level1\")\n\thtmlFolder := serviceProvider.GetConfig().StaticFolder\n\tpath := fmt.Sprintf(\"%s/%s\", htmlFolder, fileName)\n\tc.File(path)\n}", "func generateHTML(domain, pkg, source string) ([]byte, error) {\n\tvar (\n\t\tdir, file, redirect string\n\t\tb bytes.Buffer\n\t)\n\n\tif pkg != \"\" {\n\t\tredirect = \"https://pkg.go.dev/\" + domain + \"/\" + pkg\n\n\t\t// Add the URL scheme if not already present\n\t\tif !strings.HasPrefix(source, \"http\") {\n\t\t\tsource = \"https://\" + source\n\t\t}\n\n\t\t// Deduce go-source paths for the hosting\n\t\tswitch path := urlMustParse(source); path.Host {\n\t\tcase \"github.com\":\n\t\t\tdir = source + \"/tree/master/{dir}\"\n\t\t\tfile = source + \"/blob/master/{dir}/{file}#L{line}\"\n\t\tcase \"gitlab.com\":\n\t\t\tdir = source + \"/-/tree/master/{dir}\"\n\t\t\tfile = source + \"/-/blob/master/{dir}/{file}#L{line}\"\n\t\t}\n\t} else {\n\t\tredirect = \"https://\" + domain\n\t}\n\n\tt := template.Must(template.New(\"package\").Parse(templString))\n\terr := t.Execute(&b, &templValue{redirect, domain, pkg, source, dir, file})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn b.Bytes(), nil\n}", "func WebappHandler(w http.ResponseWriter, r *http.Request) {\n renderTemplate(w, \"webapp\")\n}", "func (p *Page) render(f *os.File) error {\n\tt, err := template.ParseFiles(p.Template)\n\n\tif (err != nil) {\n\t\treturn err\n\t}\n\n\treturn t.Execute(f, p)\n}", "func NewHTML(t string) http.Handler {\n\treturn &HTMLhandler{t}\n}", "func NewHTMLRenderer(cnf Config) (*HTMLRenderer, error) {\n\tmainTmpl, err := template.New(\"main\").Parse(mainT)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create template's renderer\")\n\t}\n\tfs := intTmplsFS\n\tif cnf.Dir != \"\" {\n\t\tfs = http.Dir(cnf.Dir)\n\t}\n\treturn &HTMLRenderer{Config: cnf, mainTmpl: mainTmpl, fs: fs}, nil\n}", "func (h *TemplateFileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\ttemplateFileName := r.URL.Path\n\tif templateFileName == \"\" || strings.HasSuffix(templateFileName, \"/\") {\n\t\ttemplateFileName += \"index.html\"\n\t}\n\tlog.Println(\"fetch \" + templateFileName)\n\trealPath := path.Join(h.RootDir, templateFileName)\n\t// caching\n\ttempl, err := template.ParseFiles(realPath)\n\t// should have the option of specify an error page\n\tif err != nil {\n\t\tlog.Printf(\"error when parse template %#v \\n\", err)\n\t\thttp.Error(w, \"some thing wrong\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdata := h.DataFunc(r)\n\tcontentType := mime.TypeByExtension(filepath.Ext(templateFileName))\n\t// should use some constant or sniff the type\n\tw.Header().Set(\"Content-Type\", contentType)\n\ttempl.Execute(w, &data)\n}", "func applyTemplates(files []string, op string, args UserRepoArgs) error {\n\tfor _, f := range files {\n\n\t\treplaced := replaceDir(f, args)\n\n\t\t// fetch the template\n\t\ttb, err := Asset(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Remove the .tmpl from the suffix\n\t\tnp := filepath.Join(op, strings.TrimSuffix(replaced, \".tmpl\"))\n\n\t\t// Create the *template.Template with name f\n\t\tt, err := template.New(np).Parse(string(tb))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Create the file at path f\n\t\tf, err := os.Create(np)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Render template and write it to file\n\t\terr = t.Execute(f, args)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Printf(\"Created %s...\\n\", np)\n\t}\n\treturn nil\n}", "func serveTemplates(w http.ResponseWriter, r *http.Request) {\n\tlp := filepath.Join(\"static/templates\", \"layout.html\")\n\tfp := filepath.Join(\"static/templates\", \"sample.html\")\n\ttem, err := template.ParseFiles(lp, fp)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\terr = tem.ExecuteTemplate(w, \"layout\", nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (tmplh HTMLTemplateConfig) CheckHTMLTemplate() error {\n\tfor _, field := range tmplh {\n\t\tif _, err := os.Stat(field); os.IsNotExist(err) {\n\t\t\treturn errors.New(fmt.Sprintf(`Template path \"%s\", not exist.\"`, field))\n\t\t}\n\t}\n\treturn nil\n}", "func staticFilesHandler(u *UHTTP) http.HandlerFunc {\n\treturn chain(addLoggingMiddleware(u))(func(w http.ResponseWriter, r *http.Request) {\n\t\tif len(filesCache) == 0 {\n\t\t\tu.RenderError(w, r, errors.New(\"staticFilesHandler used but not initialized\"))\n\t\t\treturn\n\t\t}\n\n\t\tvar cachedFile cachedFile\n\t\tvar ok bool\n\n\t\t// Find file (fallback to index.html)\n\t\tif cachedFile, ok = filesCache[r.URL.Path]; !ok {\n\t\t\tcachedFile = filesCache[\"/index.html\"]\n\t\t}\n\t\tw.Header().Add(\"Content-Type\", cachedFile.ContentType)\n\n\t\t// If client accepts br or gzip -> return compressed\n\t\tif acceptEncoding := r.Header.Get(\"Accept-Encoding\"); strings.Contains(acceptEncoding, \"br\") && u.opts.enableBrotli {\n\t\t\tw.Header().Add(\"Content-Encoding\", \"br\")\n\t\t\tulog.LogIfErrorSecondArg(w.Write(cachedFile.BrContent))\n\t\t} else if acceptEncoding := r.Header.Get(\"Accept-Encoding\"); strings.Contains(acceptEncoding, \"gzip\") && u.opts.enableGzip {\n\t\t\tw.Header().Add(\"Content-Encoding\", \"gzip\")\n\t\t\tulog.LogIfErrorSecondArg(w.Write(cachedFile.GzippedContent))\n\t\t} else {\n\t\t\tulog.LogIfErrorSecondArg(w.Write(cachedFile.Content))\n\t\t}\n\t})\n}", "func main() {\n out, _ := os.Create(\"error-template.go\")\n out.Write([]byte(\"// generated by go run scripts/embed-template.go; DO NOT EDIT\\n\\n\"))\n out.Write([]byte(\"package main\\n\\nconst (\\n\"))\n out.Write([]byte(\"errorTemplate = `\"))\n f, _ := os.Open(\"error-template.html\")\n io.Copy(out, f)\n out.Write([]byte(\"`\\n\"))\n out.Write([]byte(\")\\n\"))\n}", "func init() {\n\ttpl = template.Must(template.New(\"\").Funcs(fn).ParseFiles(\"index.gohtml\"))\n}", "func (t *Template) Render(ctx *gear.Context, w io.Writer, name string, data interface{}) (err error) {\n\tdir, _ := os.Getwd()\n\tname = filepath.Join(dir, \"view\", name+\".html\")\n\ttmpl := template.Must(template.ParseFiles(name))\n\n\terr = tmpl.Execute(w, data)\n\tif err != nil {\n\t\tlogging.Println(err)\n\t}\n\n\treturn\n}", "func HTML() *template.Template {\n\ttemplates, err := fs.Sub(embedFS, \"templates\")\n\tif err != nil {\n\t\tlog.Errorf(\"HTML fs.Sub error: %+v\", err)\n\t}\n\n\tt, err := template.ParseFS(templates, \"*.html\", \"**/*.html\")\n\tif err != nil {\n\t\tlog.Errorf(\"HTML template.ParseFS error: %+v\", err)\n\t}\n\n\tif gin.IsDebugging() {\n\t\tfor _, tmpl := range t.Templates() {\n\t\t\tfmt.Println(tmpl.Name())\n\t\t}\n\t}\n\n\treturn t\n}", "func (t *templater) templateFile(workDir string, outDir string, file os.FileInfo, d map[string]interface{}) {\n\tif strings.Contains(file.Name(), \"yaml\") {\n\n\t\tfilePath := workDir + \"/\" + file.Name()\n\t\ttEx := templ.New(file.Name())\n\t\ttEx.Funcs(templateFuncs(workDir))\n\t\ttEx.ParseFiles(filePath)\n\t\tb := bytes.NewBuffer([]byte{})\n\t\terr := tEx.Execute(b, d)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to execute template\")\n\t\t}\n\t\tnewF, err := os.Create(outDir + \"/\" + file.Name())\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to create file\", \"file\", file.Name())\n\t\t\treturn\n\t\t}\n\t\tnewF.Write(b.Bytes())\n\t\tnewF.Close()\n\t}\n}", "func (u *UHTTP) RegisterStaticFilesHandler(root string) error {\n\tfileNames := []string{}\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\tif path != root && !info.IsDir() {\n\t\t\tfileNames = append(fileNames, path)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfoundMainFile := false\n\tfor _, fileName := range fileNames {\n\t\tif strings.Contains(fileName, \".DS_Store\") {\n\t\t\tulog.Infof(\"Skipping '%s'\", fileName)\n\t\t\tcontinue\n\t\t}\n\t\tfileContent, err := ioutil.ReadFile(fileName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Strip the root part\n\t\tvar pattern string\n\t\tif strings.HasPrefix(root, \"./\") {\n\t\t\tpattern = strings.ReplaceAll(fileName, filepath.Base(root), \"\")\n\t\t} else {\n\t\t\tpattern = strings.ReplaceAll(fileName, root, \"\")\n\t\t}\n\n\t\tif strings.ReplaceAll(pattern, \"/\", \"\") == \"index.html\" {\n\t\t\tfoundMainFile = true\n\t\t}\n\n\t\t// fmt.Println(\"registering\", fileName, pattern, strings.ReplaceAll(pattern, \"/\", \"\"))\n\n\t\t// Detect content-type automatically\n\t\tcontentType := http.DetectContentType(fileContent)\n\n\t\t// For some reason it cannot detect minified js and css files -> manual override\n\t\tif strings.HasSuffix(pattern, \".js\") {\n\t\t\tcontentType = \"text/javascript; charset=utf-8\"\n\t\t} else if strings.HasSuffix(pattern, \".css\") {\n\t\t\tcontentType = \"text/css; charset=utf-8\"\n\t\t} else if strings.HasSuffix(pattern, \".html\") {\n\t\t\tcontentType = \"text/html; charset=utf-8\"\n\t\t}\n\n\t\tcached := cachedFile{\n\t\t\tContent: fileContent,\n\t\t\tContentType: contentType,\n\t\t}\n\n\t\tif u.opts.enableGzip {\n\t\t\t// Compress gzip\n\t\t\tvar gzipBuffer bytes.Buffer\n\t\t\tgzipWriter, err := gzip.NewWriterLevel(&gzipBuffer, gzip.BestCompression)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = gzipWriter.Write(fileContent)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = gzipWriter.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcached.GzippedContent, err = ioutil.ReadAll(&gzipBuffer)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif u.opts.enableBrotli {\n\t\t\t// Compress brotli\n\t\t\tvar brotliBuffer bytes.Buffer\n\t\t\tbrotliWriter := enc.NewBrotliWriter(&brotliBuffer, &enc.BrotliWriterOptions{Quality: 11})\n\t\t\t_, err = brotliWriter.Write(fileContent)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = brotliWriter.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcached.BrContent, err = ioutil.ReadAll(&brotliBuffer)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tfilesCache[pattern] = cached\n\t\tif !u.opts.silentStaticFileRegistration {\n\t\t\tulog.Infof(\"Registered http static %s (%s, gzip:%s, br:%s)\",\n\t\t\t\tpattern,\n\t\t\t\tuhelpers.ByteCountIEC(int64(len(fileContent))),\n\t\t\t\tuhelpers.ByteCountIEC(int64(len(cached.GzippedContent))),\n\t\t\t\tuhelpers.ByteCountIEC(int64(len(cached.BrContent))),\n\t\t\t)\n\t\t}\n\t\tu.opts.serveMux.HandleFunc(pattern, staticFilesHandler(u))\n\t}\n\tulog.Infof(\"Registered http static / -> /index.html\")\n\tu.opts.serveMux.HandleFunc(\"/\", staticFilesHandler(u))\n\n\tif !foundMainFile {\n\t\treturn errors.New(\"could not find index.html\")\n\t}\n\n\treturn nil\n}", "func NewStaticFilesHandler() StaticFilesHandler {\n\tstaticPath := os.Getenv(\"DEKART_STATIC_FILES\")\n\tfs := http.Dir(staticPath)\n\tindexFile, err := fs.Open(\"./index.html\")\n\tif err != nil {\n\t\tlog.Fatal().Err(err).Send()\n\t}\n\tdefer indexFile.Close()\n\tstat, err := indexFile.Stat()\n\tif err != nil {\n\t\tlog.Fatal().Err(err).Send()\n\t}\n\ttemplate := make([]byte, stat.Size())\n\t_, err = indexFile.Read(template)\n\tif err != nil {\n\t\tlog.Fatal().Err(err).Send()\n\t}\n\tindexFileBuffer := customCodeRe.ReplaceAll(template, []byte(os.Getenv(\"DEKART_HTML_CUSTOM_CODE\")))\n\n\tstaticFilesHandler := StaticFilesHandler{\n\t\tstaticPath: staticPath,\n\t\tindexFileBuffer: indexFileBuffer,\n\t\tindexFileModTime: time.Now(),\n\t}\n\treturn staticFilesHandler\n}", "func loadTemplate() (*template.Template, error) {\n\tt := template.New(\"\")\n\tfor name, file := range Assets.Files {\n\t\tif file.IsDir() || !strings.HasSuffix(name, \".gohtml\") {\n\t\t\tcontinue\n\t\t}\n\t\th, err := ioutil.ReadAll(file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tt, err = t.New(name).Parse(string(h))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn t, nil\n}", "func (fs *fileServer) Serve(root http.FileSystem) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n upath := r.URL.Path\n if !strings.HasPrefix(upath, \"/\") {\n upath = \"/\" + upath\n r.URL.Path = upath\n }\n\n name := path.Clean(upath)\n\n\n // INFO: By having html this high up, it converts the document to HTML instread of go or some other rendering method\n //fmt.Fprintf(w, \"<a href=\\\"%s\\\">%s</a>\\n\", \"/search?q=\", htmlReplacer.Replace(\"pow\"))\n\n if file, ok := fs.cache[name]; ok {\n fs.serveContent(w, r, file.name, file.modTime, file.size, bytes.NewReader(file.data))\n // Serves all files as HTML\n //io.Copy(w, bytes.NewReader(file.data))\n return\n }\n\n // redirect .../index.html to .../\n // can't use Redirect() because that would make the path absolute,\n // which would be a problem running under StripPrefix\n if strings.HasSuffix(r.URL.Path, fs.indexPage) {\n localRedirect(w, r, \"./\")\n return\n }\n\n f, err := root.Open(name)\n if err != nil {\n http.NotFound(w, r)\n return\n }\n defer f.Close()\n\n d, err := f.Stat()\n if err != nil {\n http.NotFound(w, r)\n return\n }\n\n // redirect to canonical path: / at end of directory url\n // r.URL.Path always begins with /\n url := r.URL.Path\n if d.IsDir() {\n if url[len(url)-1] != '/' {\n localRedirect(w, r, path.Base(url)+\"/\")\n return\n }\n } else {\n if url[len(url)-1] == '/' {\n localRedirect(w, r, \"../\"+path.Base(url))\n return\n }\n }\n\n \n // use contents of index.html for directory, if present\n if d.IsDir() {\n index := name + fs.indexPage\n ff, err := root.Open(index)\n if err == nil {\n defer ff.Close()\n dd, err := ff.Stat()\n if err == nil {\n d = dd\n f = ff\n }\n }\n }\n\n // Still a directory? (we didn't find an index.html file)\n if d.IsDir() {\n if checkLastModified(w, r, d.ModTime()) {\n return\n }\n dirList(w, f)\n return\n }\n\n fs.serveContent(w, r, d.Name(), d.ModTime(), d.Size(), f)\n\n var buf bytes.Buffer\n io.Copy(&buf, f)\n\n fs.cache[name] = file{\n name: d.Name(),\n modTime: d.ModTime(),\n data: buf.Bytes(),\n }\n })\n}", "func RenderTemplate(tmpfile string, pairs map[string]interface{}) (string, error) {\n\n\tfile, err := os.Open(tmpfile)\n\tif err != nil {\n\t\tLogWarning.Println(err)\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\t//var srcContent string\n\tvar srcContent bytes.Buffer\n\tfor scanner.Scan() {\n\t\tt := fmt.Sprintln(scanner.Text())\n\t\tif strings.Index(t, \"<%file:\") > -1 {\n\t\t\tLogDebug.Println(\"Including file external file\")\n\t\t\tif strings.Index(t, \"%>\") > -1 {\n\t\t\t\tre := regexp.MustCompile(\"\\\\<\\\\%file:(.*?)\\\\%\\\\>\")\n\t\t\t\tmatch := re.FindStringSubmatch(t)\n\t\t\t\tif len(match) == 0 {\n\t\t\t\t\tLogError.Println(\"invalid file: syntax \", t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tincludeFileName := fmt.Sprintf(\"%s/%s\", path.Dir(tmpfile), match[1])\n\t\t\t\tincludeContent, err := ioutil.ReadFile(includeFileName)\n\t\t\t\tif err != nil {\n\t\t\t\t\tLogWarning.Println(err)\n\t\t\t\t}\n\t\t\t\tLogInfo.Println(\"including file :\", includeFileName)\n\t\t\t\tLogDebug.Println(\"includeContent\", string(includeContent))\n\t\t\t\tsrcContent.WriteString(string(includeContent))\n\t\t\t} else {\n\t\t\t\tLogWarning.Println(\"Found incomplete tag in include from file \", tmpfile)\n\t\t\t}\n\t\t} else if strings.Index(t, \"<%LookupFile:\") > -1 {\n\t\t\tLogDebug.Println(\"Rendering LookupFile\")\n\t\t\tvar lookup LookupList\n\t\t\tre := regexp.MustCompile(\"\\\\<\\\\%LookupFile:(.*?),(.*?),(.*?),(.*?)\\\\%\\\\>\")\n\n\t\t\t/*\n\t\t\t\t//\n\t\t\t\t// Fist we need to find if there is a template within the lookup definition\n\t\t\t\tt := fasttemplate.New(t, \"{{\", \"}}\")\n\t\t\t\ts := t.ExecuteString(pairs)\n\t\t\t*/\n\t\t\t//var tmpl = template.Must(template.ParseFiles(t))\n\t\t\t// Create a new template and parse the letter into it.\n\t\t\t// Get the Sprig function map.\n\t\t\tfmap := sprig.TxtFuncMap()\n\t\t\tvar tmpl = template.Must(template.New(\"LookupFile\").Funcs(fmap).Parse(t))\n\n\t\t\tvar bytes bytes.Buffer\n\t\t\twriter := bufio.NewWriter(&bytes)\n\n\t\t\terr = tmpl.Execute(writer, pairs)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\terr = writer.Flush()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\tLogDebug.Println(bytes.String())\n\n\t\t\tmatch := re.FindStringSubmatch(bytes.String())\n\n\t\t\tif len(match) == 0 {\n\t\t\t\tLogError.Println(\"invalid LookupFile: syntax \", t)\n\t\t\t\t//BUG/FIX: Should push up a error to rest calling function\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tLogDebug.Println(\"LookupFile: \", match[LookupFile])\n\t\t\tLogDebug.Println(\"LookupKey: \", match[LookupKey])\n\t\t\tLogDebug.Println(\"LookupSubkey: \", match[LookupSubkey])\n\t\t\tLogDebug.Println(\"LookupDefaultValue: \", match[LookupDefaultValue])\n\n\t\t\tyamlFile, err := ioutil.ReadFile(fmt.Sprintf(match[LookupFile]))\n\t\t\tif err != nil {\n\t\t\t\tLogError.Println(\"reading LookupFile \", match[LookupFile])\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\terr = yaml.Unmarshal(yamlFile, &lookup)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\tvar lookupvalue string\n\t\t\tvar ok bool\n\t\t\tLogDebug.Println(lookup.Lookup)\n\t\t\tif lookupvalue, ok = lookup.Lookup[match[LookupKey]][match[LookupSubkey]]; ok {\n\t\t\t\tLogDebug.Println(\"Found lookup value in file :\", lookupvalue)\n\t\t\t} else {\n\t\t\t\tlookupvalue = match[LookupDefaultValue]\n\t\t\t\tLogDebug.Println(\"Using default lookup Value :\", lookupvalue)\n\t\t\t}\n\n\t\t\tsrcContent.WriteString(re.ReplaceAllString(bytes.String(), lookupvalue))\n\n\t\t} else {\n\t\t\tsrcContent.WriteString(t)\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tLogWarning.Println(err)\n\t}\n\n\t//var tmpl = template.Must(template.ParseFiles(tmpl_file))\n\t// Get the Sprig function map.\n\tfmap := sprig.TxtFuncMap()\n\tvar tmpl = template.Must(template.New(\"rendered_template\").Funcs(fmap).Parse(srcContent.String()))\n\n\tvar bytes bytes.Buffer\n\twriter := bufio.NewWriter(&bytes)\n\n\terr = tmpl.Execute(writer, pairs)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = writer.Flush()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tLogDebug.Println(bytes.String())\n\n\treturn bytes.String(), nil\n\n}", "func staticHandler(w http.ResponseWriter, r *http.Request) {\n var path string\n if strings.HasSuffix(r.URL.Path, \"/\") {\n path = r.URL.Path + \"index.html\"\n } else {\n path = r.URL.Path\n }\n http.ServeFile(w, r, \"static/\"+path)\n}", "func genTemplate(w http.ResponseWriter, tmpt string, p *Page) {\n\tt, _ := template.ParseFiles(\"templates/\" + tmpt + \".html\")\n\tt.Execute(w, p)\n}", "func WriteHtml(in <-chan Chunk) <-chan HtmlFile {\n\n\thtmlfilec := make(chan HtmlFile)\n\n\tgo func() {\n\n\t\t// we need a waitgroup to assure that `htmlfilec` is closed\n\t\t// only after all inner go routines have been closed.\n\n\t\tvar wg sync.WaitGroup\n\n\t\tfor chunk := range in {\n\t\t\twg.Add(1)\n\t\t\t// use a closure here to prevent blocking\n\n\t\t\t// this inner closure needs to receive chunk as an argument\n\t\t\t// to prevent race conditions due to the typical closure issue...\n\t\t\tgo func(c Chunk) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tbytes, err := json.Marshal(c.Json)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tresultc := piperunner.Exec(\"pandoc -f json -t html\", bytes)\n\n\t\t\t\tresult := <-resultc\n\n\t\t\t\tif err = result.Err; err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\thtmlfilec <- HtmlFile{Path: c.Path, Title: c.Title, Contents: result.Text}\n\n\t\t\t}(chunk)\n\t\t}\n\n\t\twg.Wait()\n\t\tclose(htmlfilec)\n\t}()\n\n\treturn htmlfilec\n}", "func init() {\n\t// var err error\n\t// tmpl, err = template.ParseFiles(\"templates/hello.gohtml\")\n\t// if err != nil {\n\t// \tpanic(err)\n\t// }\n\ttmpl = template.Must(template.ParseGlob(\"templates/*.gohtml\"))\n\n}", "func (s *Service) prepareIndexHTML() (bool, error) {\n\tindexTMPL := filepath.Join(s.HTMLDir, \"index.tmpl\")\n\tindexTMPLFile, err := os.Open(indexTMPL)\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\tdefer indexTMPLFile.Close()\n\n\tindexHTML := filepath.Join(s.HTMLDir, \"index.html\")\n\tindexHTMLFile, err := os.Create(indexHTML)\n\tif err != nil {\n\t\treturn true, sdk.WrapError(err, \"error while creating %s file\", indexHTML)\n\t}\n\tdefer indexHTMLFile.Close()\n\t_, err = io.Copy(indexHTMLFile, indexTMPLFile)\n\treturn true, sdk.WrapError(err, \"error while copy index.tmpl to index.html file\")\n}", "func parseTemplate(filename string) *appTemplate {\n\ttmpl := template.Must(template.ParseFiles(\"templates/base.html\"))\n\n\t// Put the named file into a template called \"body\"\n\tpath := filepath.Join(\"templates\", filename)\n\tb, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tApp.Log.Errorf(\"could not read template: %v\", err)\n\t\tpanic(fmt.Errorf(\"could not read template: %v\", err))\n\t}\n\ttemplate.Must(tmpl.New(\"body\").Parse(string(b)))\n\n\treturn &appTemplate{tmpl.Lookup(\"base.html\")}\n}", "func renderFile(w http.ResponseWriter, file string, contentType string, c *RequestContext) (int, error) {\n\tfunctions := template.FuncMap{\n\t\t\"JS\": func(s string) template.JS {\n\t\t\treturn template.JS(s)\n\t\t},\n\t}\n\n\ttpl := template.Must(template.New(\"file\").Funcs(functions).Parse(file))\n\tw.Header().Set(\"Content-Type\", contentType+\"; charset=utf-8\")\n\n\terr := tpl.Execute(w, map[string]interface{}{\n\t\t\"BaseURL\": c.FM.RootURL(),\n\t\t\"Plugins\": c.FM.Plugins,\n\t})\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn 0, nil\n}", "func UploaderTemplate(template string) (func(context *gin.Context)) {\n\treturn func(context *gin.Context) {\n\t\theader := context.Writer.Header()\n\t\theader.Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tcontext.String(200, `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Upload</title>\n</head>\n<body>\n<form action=\"`+ Config.UrlPrefix+ `/upload/image\" method=\"post\" enctype=\"multipart/form-data\">\n <h2>Image Upload</h2>\n <input type=\"file\" name=\"file\">\n <input type=\"submit\" value=\"Upload\">\n</form>\n\n</hr>\n\n<form action=\"`+ Config.UrlPrefix+ `/upload/file\" method=\"post\" enctype=\"multipart/form-data\">\n <h2>File Upload</h2>\n <input type=\"file\" name=\"file\">\n <input type=\"submit\" value=\"Upload\">\n</form>\n\n</body>\n</html>\n\t`)\n\t}\n\n}", "func (s *Server) makeTplHandler(tplData interface{}) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar err error\n\t\tvar tpath = filepath.Join(s.Config.Web.StaticDir, r.URL.Path)\n\t\tvar tname = filepath.Base(r.URL.Path)\n\n\t\ttpl := template.New(tname).Funcs(s.tplFuncs)\n\t\ttpl2, err := tpl.ParseFiles(tpath)\n\t\tif err != nil {\n\t\t\t// try loading asset instead\n\t\t\tasset, err := Asset(path.Join(\"static\", r.URL.Path))\n\t\t\tif err != nil {\n\t\t\t\thttp.NotFound(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttpl2, err = tpl.Parse(string(asset))\n\t\t\tif err != nil {\n\t\t\t\tserr := fmt.Sprintf(\"error parsing %s template: %s\", r.URL.Path, err)\n\t\t\t\tlog.Println(serr)\n\t\t\t\thttp.Error(w, serr, http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\terr = tpl2.ExecuteTemplate(w, tname, tplData)\n\t\tif err != nil {\n\t\t\tserr := fmt.Sprintf(\"error executing %s template: %s\", r.URL.Path, err)\n\t\t\tlog.Println(serr)\n\t\t\thttp.Error(w, serr, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\treturn\n\t})\n}", "func templatesItemHtml() (*asset, error) {\n\tpath := filepath.Join(rootDir, \"templates/item.html\")\n\tname := \"templates/item.html\"\n\tbytes, err := bindataRead(path, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error reading asset info %s at %s: %v\", name, path, err)\n\t}\n\n\ta := &asset{bytes: bytes, info: fi}\n\treturn a, err\n}", "func ForHTMLTemplate(ts ...*template.Template) func(io.Writer) frameless.Presenter {\n\treturn (func(io.Writer) frameless.Presenter)(func(w io.Writer) frameless.Presenter {\n\t\treturn frameless.PresenterFunc(func(data interface{}) error {\n\n\t\t\tmostInnerTemplate := ts[len(ts)-1]\n\t\t\ttContent := bytes.NewBuffer([]byte{})\n\n\t\t\tif err := mostInnerTemplate.Execute(tContent, data); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\trest := ts[:len(ts)-1]\n\t\t\tcurrentContent := tContent.String()\n\n\t\t\tfor i := len(rest) - 1; i >= 0; i-- {\n\t\t\t\tt := rest[i]\n\t\t\t\tb := bytes.NewBuffer([]byte{})\n\n\t\t\t\tif err := t.Execute(b, template.HTML(currentContent)); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tcurrentContent = b.String()\n\t\t\t}\n\n\t\t\tw.Write([]byte(currentContent))\n\n\t\t\treturn nil\n\n\t\t})\n\t})\n}", "func New(TemplateDir, ContentType string) HTMLRender {\n\t// if TemplateDir[0] != '/' {\n\t// \tTemplateDir = \"/\" + TemplateDir\n\t// }\n\treturn &htmlRender{\n\t\ttemplateDir: TemplateDir,\n\t\tcontentType: ContentType,\n\t}\n}", "func RenderTemplate(writer http.ResponseWriter, templateName string, data interface{}) {\n\t// Parse the HTML template and return an error response when the parse fails\n\ttmpl, err := template.ParseFiles(templateName)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Execute the template and return an error status with the render fails\n\tif err = tmpl.Execute(writer, data); err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func serveTemplate(w http.ResponseWriter, r *http.Request, name string, info interface{}) {\n\tdata, err := Asset(\"templates/\" + name + \".mustache\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\tcontent := mustache.Render(string(data), info)\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.Write([]byte(content))\n}", "func templatesRegisterHtml() (*asset, error) {\n\tpath := filepath.Join(rootDir, \"templates/register.html\")\n\tname := \"templates/register.html\"\n\tbytes, err := bindataRead(path, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error reading asset info %s at %s: %v\", name, path, err)\n\t}\n\n\ta := &asset{bytes: bytes, info: fi}\n\treturn a, err\n}", "func Home(response http.ResponseWriter, request *http.Request) {\n\tpage := `\n<html>\n <head></head>\n <body>\n <h1>Index of examples</h1>\n <h2>Notes</h2>\n <div>\n %s\n </div>\n <h3>Example Pages</h3>\n <ul>\n <li><a href=\"/pages/simple-page\">Simple Page Load</a> -- this is a demonstration of simply loading html pages and sending them out. No templating involved.</li>\n <li><a href=\"/compositePages/page1\">Composite Page Load</a> -- This is just like the page load, but it uses a common template to wrap the pages. In other words, content only with a common wrapper.</li>\n <li><a href=\"/simpleImportedTemplate\">Simple Imported Template</a> -- a template imported from an HTML file.</li>\n <li><a href=\"/complexImportedTemplate\">Complex Imported Template</a> -- a template imported from an HTML file with lots of variables.</li>\n <li><a href=\"/fullyTemplatedTemplate\">Fully Templated Template</a> -- a template that incorporates loops, other template files, variables, and loops. Also includes css, images, and js files.</li>\n </ul>\n <h3>Utility Functions</h3>\n <ul>\n <li><a href=\"/images/modemConvo.jpg\">Image load example</a> -- Example of loading an images.</li>\n <li><a href=\"/js/alert.js\">Javascript load example</a> -- Example of loading javascipt.</li>\n <li><a href=\"/css/css1.css\">CSS load example</a> -- Example of loading css.</li>\n </ul>\n </body>\n</html>`\n\n\tf, err := os.Open(\".\")\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer f.Close()\n\n\tfileInfo, _ := f.Stat()\n\n\ttestString := fileInfo.IsDir()\n\n\tfmt.Fprintf(response, page, testString)\n}", "func PageFile(name, version, size string, path, links, lines []string) *Renderer {\n\treturn &Renderer{\n\t\tfilenames: []string{\n\t\t\t\"templates/layout.html\",\n\t\t\t\"templates/logo.html\",\n\t\t\t\"templates/pages/file.html\",\n\t\t},\n\t\tcontext: struct {\n\t\t\tPackage string\n\t\t\tVersion string\n\t\t\tSize string\n\t\t\tPath []string\n\t\t\tPathLinks []string\n\t\t\tLines []string\n\t\t}{\n\t\t\tPackage: name,\n\t\t\tVersion: version,\n\t\t\tSize: size,\n\t\t\tPath: path,\n\t\t\tPathLinks: links,\n\t\t\tLines: append([]string{\"\"}, lines...),\n\t\t},\n\t}\n}", "func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileSystem) HandlerFunc {\n\tabsolutePath := path.Join(group.prefix, relativePath) // client path\n\tfileServer := http.StripPrefix(absolutePath, http.FileServer(fs)) // server path\n\n\treturn func(ctx *Context) {\n\t\t// Check whether the file exists\n\t\tfile := ctx.Param(\"filepath\") // custom parameter name\n\t\tif _, err := fs.Open(file); err != nil {\n\t\t\tctx.Fail(http.StatusNotFound, \"Status Not Found: \"+ctx.Pattern)\n\t\t\treturn\n\t\t}\n\n\t\t// Serve file content\n\t\tfileServer.ServeHTTP(ctx.RespWriter, ctx.Req)\n\t}\n}", "func StaticFile(u *gin.Context) {\n\twidth, err := strconv.Atoi(u.Query(\"width\"))\n\tif err != nil {\n\t\twidth = 0\n\t}\n\theight, err := strconv.Atoi(u.Query(\"height\"))\n\tif err != nil {\n\t\twidth = 0\n\t}\n\n\tif width == 0 && height == 0 {\n\t\treturn\n\t}\n\n\tvar (\n\t\tfileByte []byte\n\t\tstaticDir = conf.GetString(\"app.filepath\")\n\t\turl = u.Request.URL.Path\n\t\turlSp = strings.Split(url, staticDir)\n\t\tdirFileName = urlSp[len(urlSp)-1]\n\t\tdirFileNameS = strings.Split(dirFileName, \"/\")\n\t\tname = dirFileNameS[len(dirFileNameS)-1]\n\t\tdayDir = \"\"\n\t\tnewFileName = strconv.Itoa(width) + \"-\" + strconv.Itoa(height) + \"-\" + name\n\t)\n\n\t// upload dir\n\tif len(dirFileNameS) > 1 {\n\t\tdayDir = dirFileNameS[0]\n\t}\n\tuploadDir := staticDir + dayDir + \"/\"\n\n\t// 文件查找 是否存在 不存在则压缩\n\tfileByte, err = ioutil.ReadFile(uploadDir + newFileName)\n\tif err != nil { // 文件不存在\n\t\t// 文件压缩\n\t\tfileUtil := &file.File{\n\t\t\tPath: uploadDir + name,\n\t\t\tNewPath: uploadDir + newFileName,\n\t\t\tWidth: width,\n\t\t\tHeight: height,\n\t\t}\n\t\terr = fileUtil.CompressImage(\"jpg\")\n\t\tfileByte, err = ioutil.ReadFile(fileUtil.NewPath)\n\t\tif err != nil {\n\t\t\tu.JSON(http.StatusOK, result.GetError(err))\n\t\t\treturn\n\t\t}\n\t\tu.Data(http.StatusOK, \"utf-8\", fileByte)\n\t}\n}", "func LaunchHTML() {\n\thttp.Handle(\"/\", http.FileServer(http.Dir(\"./\")))\n\thttp.ListenAndServe(\":80\", nil)\n}", "func viewHandler(w http.ResponseWriter, r *http.Request) {\n\t\n\ttitle := r.URL.Path[len(\"/\"):]\n\tp, err := loadPage(title, r)\n\n\tz := strings.Split(title, \"/\")\n\tif z[0] == \"commits\" {\n\t\thttp.ServeFile(w, r, title)\n\t\treturn\n\t}\n\n\tif err != nil && !cookies.IsLoggedIn(r) {\n\t\thttp.Redirect(w, r, \"static/templates/base.html\", http.StatusFound)\n\t\treturn\n\t} else if err != nil { \n\t\thttp.Redirect(w, r, \"static/templates/_commits.html\", http.StatusFound)\n\t\treturn\n\t}\n\n\tt, _ := template.ParseFiles(\"static/templates/_status.html\")\n\tt.Execute(w, p)\n}", "func (a *Api) serveLiveStatic(res http.ResponseWriter, req *http.Request) {\n\tdata, err := ioutil.ReadFile(\"livecrowdin.html\")\n\tif err != nil {\n\t\tlog.Printf(\"templates - failure to read index.html\")\n\t}\n\tres.Header().Set(\"content-type\", \"text/html\")\n\tres.WriteHeader(200)\n\tres.Write(data)\n\treturn\n}", "func prepareTemplates(templatedir string, fn ...string) (t *template.Template) {\n\tvar files []string\n\tfor _, file := range fn {\n\t\tfiles = append(files, fmt.Sprintf(\"%s/%s.html\", templatedir, file))\n\t}\n\tt = template.Must(template.ParseFiles(files...))\n\treturn\n}", "func StaticFileServer(r chi.Router, public string, static string) {\n\n\t// everything up to the r.Get call is executed the first time the function is called\n\tif strings.ContainsAny(public, \"{}*\") {\n\t\tpanic(\"FileServer does not permit URL parameters.\")\n\t}\n\n\troot, _ := filepath.Abs(static)\n\tif _, err := os.Stat(root); os.IsNotExist(err) {\n\t\tpanic(\"Static Documents Directory Not Found\")\n\t}\n\n\tfs := http.StripPrefix(public, http.FileServer(http.Dir(root)))\n\n\tif public != \"/\" && public[len(public)-1] != '/' {\n\t\tr.Get(public, http.RedirectHandler(public+\"/\", 301).ServeHTTP)\n\t\tpublic += \"/\"\n\t}\n\n\tlog.Printf(\"Serving spa index.html from: %s\", http.Dir(root))\n\n\t// Register the Get request for the specified path, most likely /*\n\tr.Get(public+\"*\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfile := strings.Replace(r.RequestURI, public, \"/\", 1)\n\t\t// if the requested resource was not found, pass the request to the client\n\t\tif _, err := os.Stat(root + file); os.IsNotExist(err) {\n\t\t\thttp.ServeFile(w, r, path.Join(root, \"index.html\"))\n\t\t\treturn\n\t\t}\n\t\t// if the requested resource was found, serve it\n\t\tfs.ServeHTTP(w, r)\n\t})\n}", "func staticHandler(w http.ResponseWriter, r *http.Request) {\n\tfs := http.FileServer(http.Dir(\"webapp/build\"))\n\tfs.ServeHTTP(w, r)\n}", "func parseTemplateFiles(filenames ...string) (t *template.Template) {\n\tvar files []string\n\tt = template.New(\"layout\")\n\tfor _, file := range filenames {\n\t\tfiles = append(files, fmt.Sprintf(\"templates/%s.html\", file))\n\t}\n\tt = template.Must(t.ParseFiles(files...))\n\treturn\n}", "func (ht *HTMLTemplate) RenderFile(ctx context.Context, filename string, data interface{}) (string, error) {\n\tread := ht.readFile\n\tif read == nil {\n\t\tread = os.ReadFile\n\t}\n\tbuf, err := read(filename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn ht.render(filename, string(buf), data)\n}", "func Handler(w http.ResponseWriter, req *http.Request, page interface{}, page2 *model.Page, templateName string, f func(), cfg config.Config) {\n\tctx := context.Background()\n\tb, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\trender.JSON(w, 400, model.ErrorResponse{\n\t\t\tError: err.Error(),\n\t\t})\n\t\tlog.Error(ctx, \"failed to read request body\", err)\n\t\treturn\n\t}\n\n\treq.Body.Close()\n\n\terr = json.Unmarshal(b, &page)\n\tif err != nil {\n\t\trender.JSON(w, 400, model.ErrorResponse{\n\t\t\tError: err.Error(),\n\t\t})\n\t\tlog.Error(ctx, \"failed to unmarshal request body to page\", err)\n\t\treturn\n\t}\n\n\tif f != nil {\n\t\tf()\n\t}\n\n\tpage2.PatternLibraryAssetsPath = cfg.PatternLibraryAssetsPath\n\tpage2.SiteDomain = cfg.SiteDomain\n\n\tlog.Info(ctx, \"rendered template\", log.Data{\"template\": templateName})\n\terr = render.HTML(w, 200, templateName, page)\n\tif err != nil {\n\t\trender.JSON(w, 500, model.ErrorResponse{\n\t\t\tError: err.Error(),\n\t\t})\n\t\tlog.Error(ctx, \"failed to render template\", err)\n\t\treturn\n\t}\n}", "func (view *View) getTemplate(filePath, folderPath, pattern string) (tpl interface{}, err error) {\n\tvar (\n\t\tmapKey = fmt.Sprintf(\"%s_%v\", filePath, view.config.Delimiters)\n\t\tmapFunc = func() interface{} {\n\t\t\ttplName := filePath\n\t\t\tif view.config.AutoEncode {\n\t\t\t\ttpl = htmltpl.New(tplName).Delims(\n\t\t\t\t\tview.config.Delimiters[0],\n\t\t\t\t\tview.config.Delimiters[1],\n\t\t\t\t).Funcs(view.funcMap)\n\t\t\t} else {\n\t\t\t\ttpl = texttpl.New(tplName).Delims(\n\t\t\t\t\tview.config.Delimiters[0],\n\t\t\t\t\tview.config.Delimiters[1],\n\t\t\t\t).Funcs(view.funcMap)\n\t\t\t}\n\t\t\t// Firstly checking the resource manager.\n\t\t\tif !gres.IsEmpty() {\n\t\t\t\tif files := gres.ScanDirFile(folderPath, pattern, true); len(files) > 0 {\n\t\t\t\t\tif view.config.AutoEncode {\n\t\t\t\t\t\tvar t = tpl.(*htmltpl.Template)\n\t\t\t\t\t\tfor _, v := range files {\n\t\t\t\t\t\t\t_, err = t.New(v.FileInfo().Name()).Parse(string(v.Content()))\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\terr = view.formatTemplateObjectCreatingError(v.Name(), tplName, err)\n\t\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar t = tpl.(*texttpl.Template)\n\t\t\t\t\t\tfor _, v := range files {\n\t\t\t\t\t\t\t_, err = t.New(v.FileInfo().Name()).Parse(string(v.Content()))\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\terr = view.formatTemplateObjectCreatingError(v.Name(), tplName, err)\n\t\t\t\t\t\t\t\treturn nil\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\treturn tpl\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Secondly checking the file system,\n\t\t\t// and then automatically parsing all its sub-files recursively.\n\t\t\tvar files []string\n\t\t\tfiles, err = gfile.ScanDir(folderPath, pattern, true)\n\t\t\tif err != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif view.config.AutoEncode {\n\t\t\t\tt := tpl.(*htmltpl.Template)\n\t\t\t\tfor _, file := range files {\n\t\t\t\t\tif _, err = t.Parse(gfile.GetContents(file)); err != nil {\n\t\t\t\t\t\terr = view.formatTemplateObjectCreatingError(file, tplName, err)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt := tpl.(*texttpl.Template)\n\t\t\t\tfor _, file := range files {\n\t\t\t\t\tif _, err = t.Parse(gfile.GetContents(file)); err != nil {\n\t\t\t\t\t\terr = view.formatTemplateObjectCreatingError(file, tplName, 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\t\t\treturn tpl\n\t\t}\n\t)\n\tresult := templates.GetOrSetFuncLock(mapKey, mapFunc)\n\tif result != nil {\n\t\treturn result, nil\n\t}\n\treturn\n}", "func main() {\n http.Handle(\"/\", http.FileServer(http.Dir(\"./static\")))//serving index.html in the root directory.\n http.HandleFunc(\"/guess\", templateHandler)\n http.ListenAndServe(\":8080\", nil)\n}" ]
[ "0.66211355", "0.65534633", "0.65329015", "0.622136", "0.6074046", "0.60708845", "0.60673046", "0.59700936", "0.5961719", "0.5909443", "0.5869705", "0.5825343", "0.57516897", "0.5736247", "0.5707978", "0.566163", "0.56614065", "0.56506515", "0.5551676", "0.55195755", "0.55116487", "0.55044955", "0.5461205", "0.54400766", "0.54345226", "0.5412719", "0.5386276", "0.536911", "0.5356295", "0.5340435", "0.5335113", "0.53137666", "0.5300507", "0.52982074", "0.5295124", "0.52832437", "0.5272744", "0.52700484", "0.5269127", "0.52582437", "0.5240549", "0.5219007", "0.52099234", "0.52092004", "0.5205012", "0.52009016", "0.51976645", "0.5184097", "0.51834464", "0.51820356", "0.51810217", "0.51672494", "0.51650184", "0.51490563", "0.5133616", "0.51308614", "0.5126579", "0.5123659", "0.51203346", "0.51174605", "0.5110559", "0.5109692", "0.510502", "0.51045394", "0.50962484", "0.5090278", "0.5080511", "0.5078304", "0.50747424", "0.50716233", "0.50713426", "0.50648814", "0.50595176", "0.5052666", "0.5047591", "0.5042467", "0.50393397", "0.5037615", "0.5034709", "0.50031537", "0.4995417", "0.4982348", "0.49796435", "0.49761856", "0.4973828", "0.49724773", "0.4963415", "0.4961187", "0.49546528", "0.49514937", "0.49423707", "0.4935207", "0.49339893", "0.49320185", "0.49310464", "0.4923581", "0.49234623", "0.49166065", "0.4914073", "0.49081188" ]
0.79579175
0
HTTPMuxCallback register redirect routes in a mux.
func HTTPMuxCallback(parent string, r Mux) Callback { parent = strings.TrimSuffix(parent, "/") return func(path, url string) error { route := parent + "/" + path r.HandleFunc(route, func(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, url, 301) }) return nil } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func registerRedirects(mux *http.ServeMux) {\n\tif mux == nil {\n\t\tmux = http.DefaultServeMux\n\t}\n\n\tfor prefix, baseURL := range prefixHelpers {\n\t\tp := \"/\" + prefix + \"/\"\n\t\tmux.Handle(p, hostRedirectHandler(wrappedHandler(prefixRedirectHandler(p, baseURL))))\n\t}\n\n\tfor path, redirect := range redirects {\n\t\tmux.Handle(path, hostRedirectHandler(wrappedHandler(redirectHandler(redirect))))\n\t}\n}", "func (this *CustomMux) AddMux(ruta string, fn customHandler) {\n\tthis.rutas[ruta] = fn\n}", "func (p *Proxy) registerFwdAuthHandlers() http.Handler {\n\tr := httputil.NewRouter()\n\t// NGNIX's forward-auth capabilities are split across two settings:\n\t// `auth-url` and `auth-signin` which correspond to `verify` and `auth-url`\n\t//\n\t// NOTE: Route order matters here which makes the request flow confusing\n\t// \t\t to reason about so each step has a postfix order step.\n\n\t// nginx 3: save the returned session post authenticate flow\n\tr.Handle(\"/verify\", httputil.HandlerFunc(p.nginxCallback)).\n\t\tQueries(urlutil.QueryForwardAuthURI, \"{uri}\",\n\t\t\turlutil.QuerySessionEncrypted, \"\",\n\t\t\turlutil.QueryRedirectURI, \"\")\n\n\t// nginx 1: verify, fronted by ext_authz\n\tr.Handle(\"/verify\", httputil.HandlerFunc(p.allowUpstream)).\n\t\tQueries(urlutil.QueryForwardAuthURI, \"{uri}\")\n\n\t// nginx 4: redirect the user back to their originally requested location.\n\tr.Handle(\"/\", httputil.HandlerFunc(p.nginxPostCallbackRedirect)).\n\t\tQueries(urlutil.QueryForwardAuthURI, \"{uri}\",\n\t\t\turlutil.QuerySessionEncrypted, \"\",\n\t\t\turlutil.QueryRedirectURI, \"\")\n\n\t// traefik 2: save the returned session post authenticate flow\n\tr.Handle(\"/\", httputil.HandlerFunc(p.forwardedURIHeaderCallback)).\n\t\tHeadersRegexp(httputil.HeaderForwardedURI, urlutil.QuerySessionEncrypted)\n\n\tr.Handle(\"/\", httputil.HandlerFunc(p.startAuthN)).\n\t\tQueries(urlutil.QueryForwardAuthURI, \"{uri}\")\n\n\t// otherwise, send a 200 OK for any other route.\n\t// these routes do _not_ enforce authZ, they are helper routes.\n\tr.NotFoundHandler = httputil.HandlerFunc(p.allowUpstream)\n\treturn r\n}", "func httpForward(store *ForwardStore) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tkey := mux.Vars(r)[\"uid\"]\n\t\tif key == \"\" {\n\t\t\tkey = \"0\"\n\t\t}\n\t\tforward, _ := store.get(key)\n\t\thttp.Redirect(w, r, forward.URL, 302)\n\t}\n}", "func Register(r *mux.Router, register func(http.HandlerFunc) http.HandlerFunc) (err error) {\n\n\turls, err := newURLHandler()\n\tr.Methods(\"GET\").Subrouter().HandleFunc(\"/urls\", register(urls.list()))\n\tr.Methods(\"GET\").Subrouter().HandleFunc(\"/urls/{id:[a-zA-Z0-9]+}\", register(urls.item()))\n\tr.Methods(\"POST\").Subrouter().HandleFunc(\"/urls\", register(urls.add()))\n\n\treturn err\n}", "func customChannelHandler(w http.ResponseWriter, r *http.Request) {\n muxedReq := mux.Vars(r)\n clientUrl = muxedReq[\"channel\"]\n customChannelSet = true\n http.Redirect(w, r, \"/\", 301)\n}", "func redirectHandler(w http.ResponseWriter, r *http.Request){\n newUrl:=\"http://localhost:5000/signup\"\n http.Redirect(w, r, newUrl, 301)\n fmt.Println(\"biccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\")\n}", "func redirectMiddleware(req *http.Request, via []*http.Request) error {\n\tif redirectWarnings {\n\t\treturn fmt.Errorf(\"%d redirect\", req.Response.StatusCode)\n\t}\n\treturn nil\n}", "func MountRegisterHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := h.(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"POST\", \"/v1/mtd/{state}\", f)\n}", "func setRedirectHandler (w http.ResponseWriter, r *http.Request) {\n r.ParseForm()\n cookieTemp := r.FormValue(\"cookie\")\n cookieName := r.FormValue(\"name\") // UUID (used as cookieMap's cookie name)\n\n if cookieTemp == \"\" || cookieName == \"\" {\n\tw.WriteHeader(400) // set response code to 400, request malformed\n\treturn\n } else {\n w.WriteHeader(200) // set response code to 200, request processed\n }\n\n // attempt to add cookie to internal cookie map\n var newCookie http.Cookie\n err1 := json.Unmarshal([]byte(cookieTemp), &newCookie)\n if err1 != nil {\n fmt.Println(\"Error unmarshalling new cookie\")\n\n if printToFile == 1 {\n\t defer Log.Flush()\n\t Log.Error(\"Error unmarshalling new cookie\")\n\t return\n\t}\n }\n \n mutex.Lock()\n cookieMap[cookieName] = newCookie\n mutex.Unlock()\n}", "func (j *AuthMux) Callback() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlog := j.Logger.\n\t\t\tWithField(\"component\", \"auth\").\n\t\t\tWithField(\"remote_addr\", r.RemoteAddr).\n\t\t\tWithField(\"method\", r.Method).\n\t\t\tWithField(\"url\", r.URL)\n\n\t\tstate := r.FormValue(\"state\")\n\t\t// Check if the OAuth state token is valid to prevent CSRF\n\t\t// The state variable we set is actually a token. We'll check\n\t\t// if the token is valid. We don't need to know anything\n\t\t// about the contents of the principal only that it hasn't expired.\n\t\tif _, err := j.Tokens.ValidPrincipal(r.Context(), Token(state), TenMinutes); err != nil {\n\t\t\tlog.Error(\"Invalid OAuth state received: \", err.Error())\n\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\treturn\n\t\t}\n\n\t\t// Exchange the code back with the provider to the the token\n\t\tconf := j.Provider.Config()\n\t\tcode := r.FormValue(\"code\")\n\t\ttoken, err := conf.Exchange(r.Context(), code)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Unable to exchange code for token \", err.Error())\n\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\treturn\n\t\t}\n\n\t\tif token.Extra(\"id_token\") != nil && !j.UseIDToken {\n\t\t\tlog.Info(\"found an extra id_token, but option --useidtoken is not set\")\n\t\t}\n\n\t\t// if we received an extra id_token, inspect it\n\t\tvar id string\n\t\tvar group string\n\t\tif j.UseIDToken && token.Extra(\"id_token\") != nil && token.Extra(\"id_token\") != \"\" {\n\t\t\tlog.Debug(\"found an extra id_token\")\n\t\t\tif provider, ok := j.Provider.(ExtendedProvider); ok {\n\t\t\t\tlog.Debug(\"provider implements PrincipalIDFromClaims()\")\n\t\t\t\ttokenString, ok := token.Extra(\"id_token\").(string)\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Error(\"cannot cast id_token as string\")\n\t\t\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tclaims, err := j.Tokens.GetClaims(tokenString)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"parsing extra id_token failed:\", err)\n\t\t\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlog.Debug(\"found claims: \", claims)\n\t\t\t\tid, err = provider.PrincipalIDFromClaims(claims)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"requested claim not found in id_token:\", err)\n\t\t\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tgroup, err = provider.GroupFromClaims(claims)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"requested claim not found in id_token:\", err)\n\t\t\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Debug(\"provider does not implement PrincipalIDFromClaims()\")\n\t\t\t}\n\t\t} else {\n\t\t\t// otherwise perform an additional lookup\n\t\t\toauthClient := conf.Client(r.Context(), token)\n\t\t\t// Using the token get the principal identifier from the provider\n\t\t\tid, err = j.Provider.PrincipalID(oauthClient)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Unable to get principal identifier \", err.Error())\n\t\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tgroup, err = j.Provider.Group(oauthClient)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Unable to get OAuth Group\", err.Error())\n\t\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tp := Principal{\n\t\t\tSubject: id,\n\t\t\tIssuer: j.Provider.Name(),\n\t\t\tGroup: group,\n\t\t}\n\t\tctx := r.Context()\n\t\terr = j.Auth.Authorize(ctx, w, p)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Unable to get add session to response \", err.Error())\n\t\t\thttp.Redirect(w, r, j.FailureURL, http.StatusTemporaryRedirect)\n\t\t\treturn\n\t\t}\n\t\tlog.Info(\"User \", id, \" is authenticated\")\n\t\thttp.Redirect(w, r, j.SuccessURL, http.StatusTemporaryRedirect)\n\t})\n}", "func MuxServe(w http.ResponseWriter, r *http.Request) {\n\tfor _, rule := range rules {\n\t\tif rule.patternReg.MatchString(r.URL.Path) {\n\t\t\trule.handler(w, r)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// if we get here, there is no matching handler, so its a 404\n\thttp.Error(w, \"No handler for this URL\", http.StatusNotFound)\n}", "func Mux(\n\tclient *http.Client,\n\ttargetURL, selfURL *url.URL,\n\tlogger *log.Logger,\n) *http.ServeMux {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", ProxyRootHandler(client, targetURL, selfURL, logger))\n\treturn mux\n}", "func RoutesMux() *http.ServeMux {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", upload)\n\n\treturn mux\n}", "func (s *Server) RedirectHTTP(addr string) *http.ServeMux {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", s.FromHTTP)\n\ts.redirServer = &http.Server{Handler: mux, Addr: addr}\n\n\treturn mux\n}", "func MountAddHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := handleStationOrigin(h).(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"POST\", \"/stations\", f)\n}", "func (s *Server) NewMux() (*http.ServeMux, error) {\n\ts.localService = http.NewServeMux()\n\ts.localService.HandleFunc(\"/acct/\", s.HandleAccount)\n log.Println(\"registering /acct/\")\n\ts.localService.HandleFunc(\"/check/\", s.HandleExists)\n log.Println(\"registering /check/\")\n\ts.localService.HandleFunc(\"/jump/\", s.HandleJump)\n log.Println(\"registering /jump/\")\n\ts.localService.HandleFunc(\"/push/\", s.HandlePush)\n log.Println(\"registering /push/\")\n\ts.localService.HandleFunc(\"/recv/\", s.HandleRecv)\n log.Println(\"registering /recv/\")\n\ts.localService.HandleFunc(\"/request/\", s.HandleLookup)\n log.Println(\"registering /request/\")\n\n\ts.localService.HandleFunc(\"/addr/\", s.HandleBase32)\n log.Println(\"registering /addr/\")\n\ts.localService.HandleFunc(\"/addr64/\", s.HandleBase64)\n log.Println(\"registering /addr64/\")\n\ts.localService.HandleFunc(\"/reflect32/\", s.HandleReflect32)\n log.Println(\"registering /reflect32/\")\n\ts.localService.HandleFunc(\"/reflect64/\", s.HandleReflect64)\n log.Println(\"registering /reflect64/\")\n\ts.localService.HandleFunc(\"/reflect/\", s.HandleReflectBoth)\n log.Println(\"registering /reflect/\")\n s.localService.HandleFunc(\"/headers/\", s.HandleReflectHeaders)\n log.Println(\"registering /headers/\")\n\ts.localService.HandleFunc(\"/pow/\", s.HandleProof)\n log.Println(\"registering /pow/\")\n\ts.localService.HandleFunc(\"/sub/\", s.HandleListing)\n log.Println(\"registering /sub/\")\n\n\ts.localService.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, \"Dave's not here man.\")\n\t})\n\n\tif s.err != nil {\n\t\treturn nil, fmt.Errorf(\"Local mux configuration error: %s\", s.err)\n\t}\n\treturn s.localService, nil\n}", "func registerStatic(mux *http.ServeMux, staticDir string) {\n\tif mux == nil {\n\t\tmux = http.DefaultServeMux\n\t}\n\tmux.Handle(\"/\", hostRedirectHandler(wrappedHandler(http.FileServer(http.Dir(staticDir)))))\n}", "func (r *Routers) Add(url string, handler func(http.ResponseWriter, *http.Request)) {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tif r.urls == nil {\n\t\tr.urls = make(map[string]*func(http.ResponseWriter, *http.Request))\n\t}\n\tr.urls[url] = &handler\n\thttp.HandleFunc(url, handler)\n}", "func init() {\r\n\thttp.HandleFunc(\"/\", redirectIndex)\r\n\thttp.HandleFunc(\"/VehicleLocations\", getLocations)\r\n}", "func (auth *Auth) RegisterHTTPProxy(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error {\n\treturn apiv1.RegisterAuthenticatorHandlerFromEndpoint(ctx, mux, endpoint, opts)\n}", "func RedirectHandler(w http.ResponseWriter, r *http.Request) {\n Logger.Info(\"Redirecting from %s to %s\", ListenHTTP, ListenHTTPS)\n http.Redirect(w, r, Httpsprotocol+Hostname+r.RequestURI, http.StatusMovedPermanently)\n}", "func (t Twitter) registerRoutes(r *mux.Router) {\n\n}", "func (r *GowebHTTPResponder) WithRedirect(ctx context.Context, pathOrURLSegments ...interface{}) error {\n\n\tctx.HttpResponseWriter().Header().Set(\"Location\", paths.PathFromSegments(pathOrURLSegments...))\n\treturn r.WithStatus(ctx, http.StatusFound)\n\n}", "func (n networkRoute) Register(m *mux.Router, handler http.Handler) {\n}", "func PrepareMux(config_obj *api_proto.Config, mux *http.ServeMux) error {\n\tctx := context.Background()\n\th, err := GetAPIHandler(ctx, config_obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmux.Handle(\"/api/\", checkUserCredentialsHandler(config_obj, h))\n\tmux.Handle(\"/api/v1/download/\", checkUserCredentialsHandler(\n\t\tconfig_obj, flowResultDownloadHandler(config_obj)))\n\tmux.Handle(\"/api/v1/DownloadHuntResults\", checkUserCredentialsHandler(\n\t\tconfig_obj, huntResultDownloadHandler(config_obj)))\n\tmux.Handle(\"/api/v1/DownloadVFSFile/\", checkUserCredentialsHandler(\n\t\tconfig_obj, vfsFileDownloadHandler(config_obj)))\n\tmux.Handle(\"/api/v1/DownloadVFSFolder\", checkUserCredentialsHandler(\n\t\tconfig_obj, vfsFolderDownloadHandler(config_obj)))\n\n\t// Assets etc do not need auth.\n\tinstall_static_assets(config_obj, mux)\n\n\th, err = GetTemplateHandler(config_obj, \"/static/templates/app.html\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tmux.Handle(\"/app.html\", checkUserCredentialsHandler(config_obj, h))\n\n\th, err = GetTemplateHandler(config_obj, \"/static/templates/index.html\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// No Auth on / which is a redirect to app.html anyway.\n\tmux.Handle(\"/\", h)\n\n\treturn MaybeAddOAuthHandlers(config_obj, mux)\n}", "func (rsh *redirectSchemeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tnewURL := r.URL\n\tif r.URL.IsAbs() == false {\n\t\tr.URL.Host = r.Host\n\t}\n\tnewURL.Scheme = rsh.scheme\n\thttp.Redirect(w, r, newURL.String(), rsh.code)\n}", "func makeRedirect(destination string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.Redirect(w, r, destination, http.StatusFound)\n\t}\n}", "func (r *AutoRoller) AddHandlers(*mux.Router) {}", "func RedirectHandler(c *fiber.Ctx) {\n\tprovider := c.Params(\"provider\")\n\tif provider != \"google\" && provider != \"facebook\" {\n\t\terrors.SendErrors(c, http.StatusUnprocessableEntity, &[]string{\"unsupported provider\"})\n\t}\n\tcfg := config.GetInstance()\n\tproviderSecrets := map[string]map[string]string{\n\t\t\"facebook\": {\n\t\t\t\"clientID\": cfg.Facebook.ClientID,\n\t\t\t\"clientSecret\": cfg.Facebook.ClientSecret,\n\t\t\t\"redirectURL\": cfg.Domain+\"/api/auth/facebook/callback\",\n\t\t},\n\t\t\"google\": {\n\t\t\t\"clientID\": cfg.Google.ClientID,\n\t\t\t\"clientSecret\": cfg.Google.ClientSecret,\n\t\t\t\"redirectURL\": cfg.Domain + \"/api/auth/google/callback\",\n\t\t},\n\t}\n\tproviderData := providerSecrets[provider]\n\tauthURL, err := getGocialInstance().New().\n\t\tDriver(provider).\n\t\tRedirect(\n\t\t\tproviderData[\"clientID\"],\n\t\t\tproviderData[\"clientSecret\"],\n\t\t\tproviderData[\"redirectURL\"],\n\t\t)\n\n\t// Check for errors (usually driver not valid)\n\tif err != nil {\n\t\terrors.SendErrors(c, http.StatusInternalServerError, &[]string{err.Error()})\n\t\treturn\n\t}\n\t// Redirect with authURL\n\tc.Status(http.StatusOK).JSON(map[string]string{\"url\" : authURL})\n}", "func (h *Handler) Add(pattern string, handler HandlerFunc, opts ...RouteOption) *Route {\n\tfn := func(w http.ResponseWriter, req *http.Request) {\n\t\terr := handler(w, req)\n\t\tif err != nil {\n\t\t\th.Abort(w, req, err)\n\t\t}\n\t}\n\treturn h.Handle(pattern, http.Handler(http.HandlerFunc(fn)), opts...)\n}", "func (s *Strava) SetCallbackHandler(\n\tsuccess func(auth *strava.AuthorizationResponse, w http.ResponseWriter, r *http.Request),\n\tfailure func(err error, w http.ResponseWriter, r *http.Request)) {\n\tpath, _ := s.authenticator.CallbackPath()\n\thttp.HandleFunc(path, s.authenticator.HandlerFunc(success, failure))\n}", "func MountHmrcCallbackHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := h.(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"POST\", \"/v1/mtd\", f)\n}", "func postRedirect(db *bolt.DB) func(w http.ResponseWriter, r bunrouter.Request) error {\n\treturn func(w http.ResponseWriter, r bunrouter.Request) error {\n\t\tlr := io.LimitReader(r.Body, 5000)\n\t\tbody, err := io.ReadAll(lr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tu, err := url.Parse(string(body))\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"provided URL not valid: %s\", err), http.StatusBadRequest)\n\t\t\treturn nil\n\t\t}\n\t\tif u.Scheme == \"\" {\n\t\t\thttp.Error(w, \"provided URL not valid: scheme must be provided\", http.StatusBadRequest)\n\t\t\treturn nil\n\t\t}\n\t\tif u.Host == \"\" {\n\t\t\thttp.Error(w, \"provided URL not valid: host must be provided\", http.StatusBadRequest)\n\t\t\treturn nil\n\t\t}\n\n\t\tid := GenerateUnusedRedirectID(8, db)\n\t\tif id == \"\" {\n\t\t\thttp.Error(w, \"unable to generate random ID, please try again\", http.StatusInternalServerError)\n\t\t\treturn nil\n\t\t}\n\n\t\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t\tb := tx.Bucket([]byte(\"urls\"))\n\t\t\treturn b.Put([]byte(id), []byte(u.String()))\n\t\t})\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error saving to database: %s\", err), http.StatusBadRequest)\n\t\t\treturn err\n\t\t}\n\n\t\t_, _ = fmt.Fprintln(w, id)\n\n\t\treturn nil\n\t}\n}", "func staticRedirectHandler(u string, code int) http.Handler {\n\ttarget, err := url.Parse(u)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif target.Scheme != \"\" {\n\t\t\tr.URL.Scheme = target.Scheme\n\t\t}\n\t\tif target.Host != \"\" {\n\t\t\tr.URL.Host = target.Host\n\t\t}\n\t\tif target.Path != \"\" {\n\t\t\tr.URL.Path = target.Path\n\t\t}\n\t\thttp.Redirect(w, r, r.URL.String(), code)\n\t})\n}", "func (mx *Mux) Use(middlewares ...func(http.Handler) http.Handler) {\n\tif mx.handler != nil {\n\t\tpanic(\"all middlewares must be defined before routes on a mux\")\n\t}\n\tmx.middlewares = append(mx.middlewares, middlewares...)\n}", "func RegisterHandlers(rg *routing.RouteGroup, service Service, authHandler routing.Handler, logger log.Logger) {\n rg.Post(\"/login\", login(service, logger))\n rg.Post(\"/oauth2/github\", authenticateGitHub(service))\n\n rg.Use(authHandler)\n rg.Get(\"/verify_token\", verifyToken(logger))\n}", "func MapHandler(pathsToUrls map[string]string, fallback http.Handler) http.HandlerFunc {\n\t//\tTODO: Implement this...\n\t// http.HandlerFunc is a type that is really just a function\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tasked_path := r.URL.Path\n\t\tnew_path, ok := pathsToUrls[asked_path]\n\t\tif ok {\n\t\t\tfmt.Printf(\"Redirecting %v to %v\\n\", asked_path, new_path)\n\t\t\t// 302 is the integer code for Found in redirect\n\t\t\t// Better to use http.StatusFound\n\t\t\t// http.Redirect(w, r, new_path, 302)\n\t\t\thttp.Redirect(w, r, new_path, http.StatusFound)\n\t\t\treturn\n\t\t}\n\t\tfmt.Printf(\"Serving %v\\n\", asked_path)\n\t\tfallback.ServeHTTP(w, r)\n\t}\n\t// for shortened, redirect := range pathsToUrls {\n\t// fmt.Printf(\"%v, %v\", shortened, redirect)\n\t// }\n}", "func (adm *admin) registerHTTPHandlers(http *http.ServeMux) {\n\thttp.HandleFunc(\"/backend/list\", adm.listBackendHandler)\n\thttp.HandleFunc(\"/backend/add\", adm.addBackendHandler)\n\thttp.HandleFunc(\"/backend/config/\", adm.backendConfigHandler)\n\thttp.HandleFunc(\"/backend/disable/\", adm.disableBackendHandler)\n\thttp.HandleFunc(\"/backend/enable/\", adm.enableBackendHandler)\n\thttp.HandleFunc(\"/backend/failover/\", adm.failoverBackendHandler)\n\thttp.HandleFunc(\"/backend/reset/\", adm.resetBackendHandler)\n\thttp.HandleFunc(\"/backend/delete/\", adm.deleteBackendHandler)\n\thttp.HandleFunc(\"/session/list\", adm.listSessionHandler)\n\thttp.HandleFunc(\"/session/abort/\", adm.abortSessionHandler)\n\thttp.HandleFunc(\"/session/failover/\", adm.failoverSessionHandler)\n\thttp.HandleFunc(\"/frontend/list\", adm.listFrontendHandler)\n\thttp.HandleFunc(\"/frontend/pause/\", adm.pauseFrontendHandler)\n\thttp.HandleFunc(\"/frontend/resume/\", adm.resumeFrontendHandler)\n}", "func MapHandler(m map[string]string, fallback http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfor k, v := range m {\n\t\t\tfmt.Printf(\"%s:%s\", k, v)\n\t\t}\n\t\tif val, ok := m[r.URL.Path]; ok {\n\t\t\thttp.Redirect(w, r, val, 301)\n\t\t} else {\n\t\t\tfallback.ServeHTTP(w, r)\n\t\t}\n\t}\n}", "func rootHandler(w http.ResponseWriter, r *http.Request) {\n\n\tif !verifyLogin(r) {\n\t\turl := LoginCfg.AuthCodeURL(\"\")\n\t\turl = url + OauthURLParams\n\t\t// this will preseve the casenumber in the URI path during Oauth2 redirect\n\t\tparams := r.URL.Query()\n\t\tparamkeys := make([]string, 0)\n\t\tfor k := range params {\n\t\t\tfor i := range params[k] {\n\t\t\t\tparamkeys = append(paramkeys, k+\"=\"+params[k][i])\n\t\t\t}\n\t\t}\n\t\tif len(paramkeys) > 0 {\n\t\t\turl = url + \"&state=\" + base64.StdEncoding.EncodeToString([]byte(strings.Join(paramkeys, \"?\")))\n\t\t}\n\n\t\thttp.Redirect(w, r, url, http.StatusFound)\n\t\treturn\n\t}\n\n\t// if user is not using https then redirect them\n\tif ( r.Header.Get(\"x-forwarded-proto\") != \"https\" && BASEURL != LOCALBASEURL) {\n\t\tfmt.Printf(\"TLS handshake is https=false x-forwarded-proto=%s\\n\", r.Header.Get(\"x-forwarded-proto\"))\n\t\thttp.Redirect(w, r, BASEURL, http.StatusFound)\n\t\treturn\n\t}\n\n startPageTemplate.Execute(w, \"\")\n}", "func (srv *WebServer) setupMux() {\n\thttp.HandleFunc(\"/\", srv.logResponse(srv.handleStatus)) // GET.\n\thttp.HandleFunc(\"/vehiclestore/status\", srv.logResponse(srv.handleStoreStatus)) // GET.\n\thttp.HandleFunc(\"/lookup\", srv.logResponse(srv.handleLookup)) // GET.\n\thttp.HandleFunc(\"/vehicle\", srv.logResponse(srv.handleVehicle)) // PATCH.\n}", "func dispatch(redirect string, res http.ResponseWriter, req *http.Request) {\n\ttarget := GetTargets()[redirect]\n\ttargetUri := target[1]\n\ttargetUrl, err := url.Parse(targetUri)\n\tif err != nil {\n\t\tfmt.Printf(\"URL parse error %v\\n\", err)\n\t} else {\n\t\treq.URL.Host = targetUrl.Host\n\t\treq.URL.Scheme = targetUrl.Scheme\n\t\treq.Header.Set(\"X-Forwarded-Host\", req.Header.Get(\"Host\"))\n\t\treq.Host = targetUrl.Host\n\t\tproxy := proxies[redirect]\n\t\tproxy.ServeHTTP(res, req)\n\t\t//fmt.Printf(\"redirect is %v, Request is M: %v H: '%v' P: %v URI: %v\\n\", redirect, req.Method, targetUrl.Host, req.Proto, req.RequestURI)\n\t}\n}", "func Mount(multiplexer multiplexer, pattern string, handler http.Handler) {\n\tpattern = pathkit.Clean(pattern)\n\thandler = http.StripPrefix(pattern, handler)\n\thandler = MountPoint(pattern, handler)\n\tmultiplexer.Handle(pattern, handler)\n\tmultiplexer.Handle(pattern+`/`, handler)\n}", "func redirectHandler(res http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tid := params[\"id\"]\n\n\tlog.Println(\"Redirecting from:\", id)\n\tvar result []myURL\n\terr := db.C(collection).Find(bson.M{\"id\": id}).All(&result)\n\tif err != nil {\n\t\tlog.Println(\"Error running query\")\n\t\tlog.Fatal(err)\n\t\t// Respond with an error\n\t\tres.Header().Set(\"Content-Type\", \"application/json\")\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\tres.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\tif len(result) == 0 {\n\t\tlog.Println(\"ShortURL not found for ID:\", id)\n\t\tres.Header().Set(\"Content-Type\", \"application/json\")\n\t\tres.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(res).Encode(\"Impossible to redirect. URL not found.\")\n\t} else {\n\t\tlog.Println(\"Redirecting to:\", result[0].LongURL)\n\t\thttp.Redirect(res, req, result[0].LongURL, 301)\n\t}\n\n}", "func registerRoutes(router *httprouter.Router, ctrl *webhook.Controller) {\n\trouter.POST(\"/auto-deploy/docker-hub\", ctrl.AutoDeployDockerHub)\n}", "func handleRedirect(w http.ResponseWriter, r *http.Request, server string, tube string, action string, count string) {\n\tvar link bytes.Buffer\n\tlink.WriteString(`/tube?server=`)\n\tlink.WriteString(server)\n\tlink.WriteString(`&tube=`)\n\tswitch action {\n\tcase \"kick\":\n\t\tkick(server, tube, count)\n\t\tlink.WriteString(url.QueryEscape(tube))\n\t\thttp.Redirect(w, r, link.String(), 302)\n\tcase \"kickJob\":\n\t\tkickJob(server, tube, r.URL.Query().Get(\"jobid\"))\n\t\tlink.WriteString(url.QueryEscape(tube))\n\t\thttp.Redirect(w, r, link.String(), 302)\n\tcase \"pause\":\n\t\tpause(server, tube, count)\n\t\tlink.WriteString(url.QueryEscape(tube))\n\t\thttp.Redirect(w, r, link.String(), 302)\n\tcase \"moveJobsTo\":\n\t\tdestTube := tube\n\t\tif r.URL.Query().Get(\"destTube\") != \"\" {\n\t\t\tdestTube = r.URL.Query().Get(\"destTube\")\n\t\t}\n\t\tmoveJobsTo(server, tube, destTube, r.URL.Query().Get(\"state\"), r.URL.Query().Get(\"destState\"))\n\t\tlink.WriteString(url.QueryEscape(destTube))\n\t\thttp.Redirect(w, r, link.String(), 302)\n\tcase \"deleteAll\":\n\t\tdeleteAll(server, tube)\n\t\tlink.WriteString(url.QueryEscape(tube))\n\t\thttp.Redirect(w, r, link.String(), 302)\n\tcase \"deleteJob\":\n\t\tdeleteJob(server, tube, r.URL.Query().Get(\"jobid\"))\n\t\tlink.WriteString(url.QueryEscape(tube))\n\t\thttp.Redirect(w, r, link.String(), 302)\n\tcase \"loadSample\":\n\t\tloadSample(server, tube, r.URL.Query().Get(\"key\"))\n\t\tlink.WriteString(url.QueryEscape(tube))\n\t\thttp.Redirect(w, r, link.String(), 302)\n\t}\n\t_, _ = io.WriteString(w, tplTube(currentTube(server, tube), server, tube))\n}", "func mapper(handler http.Handler, url url.URL, proxyConfig *Proxy) *httprouter.Router {\n\trouter := httprouter.New()\n\tif proxyConfig.Connect.To == url.Host {\n\t\tfor _, r := range proxyConfig.Routes {\n\t\t\t// link allow methods\n\t\t\tif r.Allow.Method != nil {\n\t\t\t\tfor _, m := range r.Allow.Method {\n\t\t\t\t\thttpMethodBuilder(m, r, handler, router, \"allow\", r.Route, proxyConfig)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn router\n}", "func init() {\n\tmux = http.NewServeMux()\n\tmux.Handle(\"/\", handlerFn(\"Hello World!\"))\n\tmux.Handle(\"/foo\", handlerFn(\"foo\"))\n\tmux.Handle(\"/bar\", handlerFn(\"bar\"))\n\tmux.Handle(\"/baz\", handlerFn(\"baz\"))\n}", "func (_m *Proxy) Redirect(w http.ResponseWriter, r *http.Request) {\n\t_m.Called(w, r)\n}", "func (p *Proxy) nginxPostCallbackRedirect(w http.ResponseWriter, r *http.Request) error {\n\tu, err := url.Parse(r.FormValue(urlutil.QueryRedirectURI))\n\tif err != nil {\n\t\treturn httputil.NewError(http.StatusBadRequest, err)\n\t}\n\thttputil.Redirect(w, r, u.String(), http.StatusFound)\n\treturn nil\n}", "func Register(mux *http.ServeMux) {\n\tif mux == nil {\n\t\tmux = http.DefaultServeMux\n\t}\n\tmux.HandleFunc(\"/pastehere/\", Home)\n\tmux.HandleFunc(\"/pastehere/paste\", Paste)\n\tmux.HandleFunc(\"/pastehere/view/\", View)\n}", "func getRedirectHandler (w http.ResponseWriter, r *http.Request) {\n responseCode := 200\n\n r.ParseForm()\n cookieName := \"\"\n cookieUUID := r.FormValue(\"cookie\")\n if cookieUUID == \"\" { \n\tresponseCode = 400 // set response code to 400, malformed request\n } else {\n\tresponseCode = 200 // set response code to 200, request processed\n }\n \n //Attempt to retrieve user name from cookie map based on UUID\n foundCookie := false\n\n mutex.Lock()\n cookieLookup := cookieMap[cookieUUID]\n mutex.Unlock()\n\n if cookieLookup.Name != \"\" {\n\tfoundCookie = true\n\tcookieName = cookieLookup.Value\n }\n\n if !foundCookie {\n\tresponseCode = 400 // set response code to 400, malformed request\n }\n \n w.WriteHeader(responseCode)\n w.Write([]byte(cookieName))\n // timeserver will need to use r.ParseForm() and http.get(URL (i.e. authhost:9090/get) to retrieve data\n}", "func redirectHandler(target string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tredirectWithQuery(w, r, target)\n\t})\n}", "func RegisterHTTPHandlers(http HTTP) http.Handler {\n\tr := chi.NewRouter()\n\tr.With(mid.Paginate).Get(\"/\", http.List)\n\treturn r\n}", "func NewMux(mc MuxCreator) *Router {\n\treturn &Router{\n\t\tmux: make(map[string]Mux),\n\t\tmc: mc,\n\t\thead: NewMiddleware(emptyHandler),\n\t\ttail: NewMiddleware(emptyHandler),\n\t\tinterceptors: []func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc){},\n\t}\n}", "func (mux *Mux) Add(m Router, h Handler) {\n\tmux.Route(&Route{\n\t\tHandler: h,\n\t\tRouter: m,\n\t})\n}", "func redirectFunc(req *http.Request, via []*http.Request) error {\n\tredirectNum := req.Context().Value(ContextRedirectNumKey).(int)\n\tif len(via) > redirectNum {\n\t\terr := &RedirectError{redirectNum}\n\t\treturn WrapErr(err, \"RedirectError\")\n\t}\n\treturn nil\n}", "func httpRedirect(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(\n\t\tfunc(rw http.ResponseWriter, r *http.Request) {\n\t\t\tif r.Header.Get(\"x-Forwarded-Proto\") == \"https\" ||\n\t\t\t\tstrings.HasPrefix(r.URL.Path, \"/ping\") ||\n\t\t\t\tstrings.HasPrefix(r.URL.Path, \"/health\") {\n\t\t\t\tnext.ServeHTTP(rw, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif r.Method != \"GET\" && r.Method != \"HEAD\" {\n\t\t\t\thttp.Error(rw, \"Use HTTPS\", http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttarget := \"https://\" + manglePort(r.Host) + r.URL.RequestURI()\n\t\t\thttp.Redirect(rw, r, target, http.StatusFound)\n\t\t})\n}", "func MapHandler(pathsToUrls map[string]string, fallback http.Handler) http.HandlerFunc {\n\t//\tTODO: Implement this...\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tredirecturl, ok := pathsToUrls[r.URL.Path]\n\t\tif !ok {\n\t\t\tfallback.ServeHTTP(w, r)\n\t\t} else {\n\t\t\thttp.Redirect(w, r, redirecturl, http.StatusFound)\n\t\t}\n\t}\n}", "func MapHandler(pathsToUrls map[string]string, fallback http.Handler) http.HandlerFunc {\n\t//\tTODO: Implement this...\n\t// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n // \tw.Write([]byte(\"hello\"))\n // \t})\n\n\t// See: https://www.alexedwards.net/blog/making-and-using-middleware\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t path := r.URL.Path\n\t\tif url, ok := pathsToUrls[path]; ok {\n \t\thttp.Redirect(w, r, url, http.StatusFound)\n\t\t\treturn\n\t\t}\n\t fallback.ServeHTTP(w, r)\n\t})\n}", "func Register(shutdown chan os.Signal, log *log.Logger) http.Handler {\n\tapp := web.NewApp(shutdown, middleware.Logger(log))\n\n\tapp.MountHandler(http.MethodGet, \"/\", home)\n\tapp.MountHandler(http.MethodPost, \"/v1/locate\", locate)\n\n\treturn app\n}", "func MapHandler(paths map[string]string, fallback http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t//if path match - redirect to the url\n\t\tpath := r.URL.Path\n\t\tif dest, ok := paths[path]; ok {\n\t\t\thttp.Redirect(w, r, dest, http.StatusFound)\n\t\t\treturn\n\t\t}\n\t}\n}", "func InternalRedirect(h http.Handler, url string) Handler {\n\tu, err := parseURL(url)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif u.Fragment != \"\" {\n\t\tpanic(\"handlers: fragment must be empty in InternalRedirect\")\n\t}\n\n\treturn &internalRedirect{h, u}\n}", "func MapHandler(pathsToUrls map[string]string, fallback http.Handler) http.HandlerFunc {\n\t//\tTODO: Implement this...\n\tfmt.Println(pathsToUrls)\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\turl := pathsToUrls[r.URL.Path]\n\t\tif url != \"\" {\n\t\t\thttp.Redirect(w, r, url, http.StatusPermanentRedirect)\n\t\t} else {\n\t\t\tfallback.ServeHTTP(w, r)\n\t\t}\n\t}\n}", "func (p *PatternServeMux) Add(meth, pat string, h http.Handler) {\n\tp.add(meth, pat, h, false)\n}", "func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request))", "func Next(next http.HandlerFunc) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Println(\"BeforeRequst\", r)\n\t\tnext.ServeHTTP(w, r)\n\t\tfmt.Println(\"AfterRequest\", r)\n\t})\n}", "func InternalRedirectWrap(url string) Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn InternalRedirect(h, url)\n\t}\n}", "func (a *Auth) RedirectHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tcode := r.URL.Query().Get(\"code\")\n\t\ttoken, err := a.cfg.Exchange(r.Context(), code)\n\t\tif err != nil {\n\t\t\ta.logf(\"Authentication failure for code %s: %s\", code, err)\n\t\t\thttp.Error(w, \"Authorization failure\", http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\t_, ok := token.Extra(\"id_token\").(string)\n\t\tif !ok {\n\t\t\ta.logf(\"Invalid ID token %v (%T)\", token.Extra(\"id_token\"), token.Extra(\"id_token\"))\n\t\t\thttp.Error(w, \"Internal error\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\terr = a.setCookie(w, fromOauth2(token))\n\t\tif err != nil {\n\t\t\ta.logf(\"Failed setting cookie: %v\", err)\n\t\t\thttp.Error(w, \"Internal error\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tredirectPath := r.URL.Query().Get(\"state\")\n\t\tif redirectPath == \"\" {\n\t\t\tredirectPath = \"/\"\n\t\t}\n\t\thttp.Redirect(w, r, redirectPath, http.StatusTemporaryRedirect)\n\t})\n}", "func (c *Config) RegisterOpenShiftRoutesChangeCallback(f func() error) {\n\tc.onOpenShiftRoutesChange.Register(f)\n}", "func RedirectHandler(url string, code int) Handler {\n\treturn &redirectHandler{url, code}\n}", "func NewServeMux() *ServeMux { return &ServeMux{m: make(map[string]muxEntry)} }", "func (s *HTTPService) RegisterRoutes(srv *server.Server) {\n\tbaseMW := router.NewMiddlewareChain()\n\tbaseAuthMW := baseMW.Extend(\n\t\tmiddleware.WithContextTimeout(time.Minute),\n\t\tauth.Authenticate(srv.CookieAuth),\n\t)\n\n\tsrv.Routes.GET(\"/raw-artifact/*artifactName\", baseAuthMW, handleError(s.buildRawArtifactHandler(\"/raw-artifact/\")))\n}", "func MapHandler(urlMap map[string]string, fallback http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tpath, ok := urlMap[r.URL.Path]\n\t\tif ok {\n\t\t\thttp.Redirect(w, r, path, http.StatusFound)\n\t\t} else {\n\t\t\tfallback.ServeHTTP(w, r)\n\t\t}\n\t}\n}", "func (l *HandlerList) PushBack(f func(*Request)) {\n\tl.list = append(l.list, NamedHandler{\"__anonymous\", f})\n}", "func MapUrls() {\n\thttp.HandleFunc(\"/\", handlers.RedirectHome)\n\thttp.HandleFunc(\"/home/\", handlers.MakeHandler(handlers.Home))\n\thttp.HandleFunc(\"/save/\", handlers.MakeHandler(handlers.Save))\n\thttp.HandleFunc(\"/edit/\", handlers.MakeHandler(handlers.Edit))\n\thttp.HandleFunc(\"/view/\", handlers.MakeHandler(handlers.View))\n}", "func NewServeMux(g *Gateway, appLoc string) *http.ServeMux {\n\t// Register objects.\n\tapi := NewAPI(g)\n\n\t// Prepare mux.\n\tmux := http.NewServeMux()\n\n\tmux.Handle(\"/\", http.FileServer(http.Dir(appLoc)))\n\n\tmux.HandleFunc(\"/api/get_subscription\", api.GetSubscription)\n\tmux.HandleFunc(\"/api/get_subscriptions\", api.GetSubscriptions)\n\tmux.HandleFunc(\"/api/subscribe\", api.Subscribe)\n\tmux.HandleFunc(\"/api/unsubscribe\", api.Unsubscribe)\n\n\tmux.HandleFunc(\"/api/users/get_current\", api.GetCurrentUser)\n\tmux.HandleFunc(\"/api/users/set_current\", api.SetCurrentUser)\n\tmux.HandleFunc(\"/api/users/get_masters\", api.GetMasterUsers)\n\tmux.HandleFunc(\"/api/users/new_master\", api.NewMasterUser)\n\tmux.HandleFunc(\"/api/users/get_all\", api.GetUsers)\n\tmux.HandleFunc(\"/api/users/new\", api.NewUser)\n\tmux.HandleFunc(\"/api/users/remove\", api.RemoveUser)\n\n\tmux.HandleFunc(\"/api/get_boards\", api.GetBoards)\n\tmux.HandleFunc(\"/api/new_board\", api.NewBoard)\n\tmux.HandleFunc(\"/api/get_threads\", api.GetThreads)\n\tmux.HandleFunc(\"/api/new_thread\", api.NewThread)\n\tmux.HandleFunc(\"/api/get_threadpage\", api.GetThreadPage)\n\tmux.HandleFunc(\"/api/get_posts\", api.GetPosts)\n\tmux.HandleFunc(\"/api/new_post\", api.NewPost)\n\tmux.HandleFunc(\"/api/import_thread\", api.ImportThread)\n\tmux.HandleFunc(\"/api/remove_board\", api.RemoveBoard)\n\tmux.HandleFunc(\"/api/remove_thread\", api.RemoveThread)\n\tmux.HandleFunc(\"/api/remove_post\", api.RemovePost)\n\n\tmux.HandleFunc(\"/api/hex/get_threadpage\", api.GetThreadPageAsHex)\n\tmux.HandleFunc(\"/api/hex/get_threadpage/tp_ref\", api.GetThreadPageWithTpRefAsHex)\n\tmux.HandleFunc(\"/api/hex/new_thread\", api.NewThreadWithHex)\n\tmux.HandleFunc(\"/api/hex/new_post\", api.NewPostWithHex)\n\n\tmux.HandleFunc(\"/api/tests/new_filled_board\", api.TestNewFilledBoard)\n\n\treturn mux\n}", "func (p *Proxy) forwardedURIHeaderCallback(w http.ResponseWriter, r *http.Request) error {\n\tforwardedURL, err := url.Parse(r.Header.Get(httputil.HeaderForwardedURI))\n\tif err != nil {\n\t\treturn httputil.NewError(http.StatusBadRequest, err)\n\t}\n\tq := forwardedURL.Query()\n\tredirectURLString := q.Get(urlutil.QueryRedirectURI)\n\tencryptedSession := q.Get(urlutil.QuerySessionEncrypted)\n\n\tif _, err := p.saveCallbackSession(w, r, encryptedSession); err != nil {\n\t\treturn httputil.NewError(http.StatusBadRequest, err)\n\t}\n\thttputil.Redirect(w, r, redirectURLString, http.StatusFound)\n\treturn nil\n}", "func (m *Mux) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\tvar handler HandlerFunc\n\tpath := req.URL.Path\n\tmethod := req.Method\n\tres := m.trie.Match(path)\n\n\tif res.Node == nil {\n\t\t// FixedPathRedirect or TrailingSlashRedirect\n\t\tif res.TSR != \"\" || res.FPR != \"\" {\n\t\t\treq.URL.Path = res.TSR\n\t\t\tif res.FPR != \"\" {\n\t\t\t\treq.URL.Path = res.FPR\n\t\t\t}\n\t\t\tcode := 301\n\t\t\tif method != \"GET\" {\n\t\t\t\tcode = 307\n\t\t\t}\n\t\t\thttp.Redirect(w, req, req.URL.String(), code)\n\t\t\treturn\n\t\t}\n\n\t\tif m.otherwise == nil {\n\t\t\thttp.Error(w, fmt.Sprintf(`\"%s\" not implemented`, path), 501)\n\t\t\treturn\n\t\t}\n\t\thandler = m.otherwise\n\t} else {\n\t\tok := false\n\t\tif handler, ok = res.Node.GetHandler(method).(HandlerFunc); !ok {\n\t\t\t// OPTIONS support\n\t\t\tif method == http.MethodOptions {\n\t\t\t\tw.Header().Set(\"Allow\", res.Node.GetAllow())\n\t\t\t\tw.WriteHeader(204)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif m.otherwise == nil {\n\t\t\t\t// If no route handler is returned, it's a 405 error\n\t\t\t\tw.Header().Set(\"Allow\", res.Node.GetAllow())\n\t\t\t\thttp.Error(w, fmt.Sprintf(`\"%s\" not allowed in \"%s\"`, method, path), 405)\n\t\t\t\treturn\n\t\t\t}\n\t\t\thandler = m.otherwise\n\t\t}\n\t}\n\n\thandler(w, req, res.Params)\n}", "func MapUrls(router *gin.Engine, authorizationController Authorization) *gin.RouterGroup {\n\n\tapiRoutes := router.Group(\"/api/authorization\")\n\t{\n\t\tapiRoutes.POST(\"/signin\", authorizationController.SignIn)\n\t\tapiRoutes.POST(\"/signup\", authorizationController.SignUp)\n\t}\n\n\treturn apiRoutes\n}", "func redirectHandler(w http.ResponseWriter, r *http.Request) {\n to := r.FormValue(\"to\")\n if len(to) == 0 {\n http.Error(w, \"No destination present in the URL's query.\", http.StatusInternalServerError)\n return\n }\n\n setNoCacheAndCORSHeaders(w, r)\n http.Redirect(w, r, to, http.StatusTemporaryRedirect);\n}", "func (cs *ConfigServer) addResource(rs Resourcer, paths ...string) {\n\tif cs.mux == nil {\n\t\tcs.mux = http.NewServeMux()\n\t}\n\tfor _, path := range paths {\n\t\tcs.mux.HandleFunc(path, cs.requestHandler(rs))\n\t}\n}", "func registerRoutes(jwtMiddleware *jwtmiddleware.JWTMiddleware) *mux.Router {\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/healthcheck\", http.HandlerFunc(healthCheck)).Methods(\"GET\")\n\n\tr.Handle(\"/message\", http.HandlerFunc(message)).Methods(\"POST\")\n\tr.Handle(\"/message/{id}\", http.HandlerFunc(messageDelete)).Methods(\"DELETE\")\n\tr.Handle(\"/publish\", http.HandlerFunc(publish)).Methods(\"POST\")\n\n\tmsgRouter := mux.NewRouter().PathPrefix(\"/message\").Subrouter()\n\tpubRouter := mux.NewRouter().PathPrefix(\"/publish\").Subrouter()\n\n\tr.PathPrefix(\"/message\").Handler(negroni.New(\n\t\tnegroni.HandlerFunc(jwtMiddleware.HandlerWithNext),\n\t\tnegroni.Wrap(msgRouter),\n\t))\n\n\tr.PathPrefix(\"/publish\").Handler(negroni.New(\n\t\tnegroni.HandlerFunc(jwtMiddleware.HandlerWithNext),\n\t\tnegroni.Wrap(pubRouter),\n\t))\n\n\t// GET - handles upgrading http/https connections to ws/wss.\n\t// the JWT middleware is expecting an access_token\n\t// query parameter within the request\n\tr.Handle(\"/ws\", negroni.New(\n\t\tnegroni.HandlerFunc(jwtMiddleware.HandlerWithNext),\n\t\tnegroni.HandlerFunc(AddUserID),\n\t\tnegroni.Wrap(broker),\n\t))\n\n\treturn r\n}", "func RegisterAPIHandlers(r pure.IRouteGroup) {\n\tr.Get(\"/token\", tokenGetAPI)\n}", "func (s *Server) RegisterHTTPHandlers() {\n\ts.router.HandleFunc(\"/api/v1/chaincode/query\", s.httpHandleCCQuery)\n\ts.router.HandleFunc(\"/api/v1/chaincode/invoke\", s.httpHandleCCInvoke)\n\ts.router.HandleFunc(\"/api/v1/config\", s.httpHandleGetConfig)\n}", "func MustAuth(handler http.Handler) http.Handler {\n return &authHandler{next: handler}\n}", "func MapHandler(pathToURL map[string]string, fallback http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif path, ok := pathToURL[r.URL.Path]; ok {\n\t\t\thttp.Redirect(w, r, path, http.StatusFound)\n\t\t}\n\t\tfallback.ServeHTTP(w, r)\n\t}\n}", "func NewServeMux(services ...[]*Handler) *http.ServeMux {\n\tmux := http.NewServeMux()\n\tfor _, svc := range services {\n\t\tfor _, method := range svc {\n\t\t\tmux.Handle(method.Path(), method)\n\t\t}\n\t}\n\treturn mux\n}", "func Redirect(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\thash := vars[\"hash\"]\n\turl, exists := engine.Resolve(hash)\n\t\n\tif exists {\n\t\tfmt.Println(\"Redirecting\", hash, \"-->\", url)\n\t\thttp.Redirect(w, r, url, 301)\n\t\treturn\n\t}\n\t\n\tfmt.Println(\"Cannot redirect\", hash, \": not found\")\n\thttp.Error(w, http.StatusText(404), 404)\n}", "func RegisterAdminHandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) {\n\tapiHandlerStore[pattern] = NewAPIHandler(handler)\n\tlog.StartLogger.Infof(\"[admin server] [register api] register a new api %s\", pattern)\n}", "func (mx *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// Ensure the mux has some routes defined on the mux\n\tif mx.handler == nil {\n\t\tpanic(\"attempting to route to a mux with no handlers.\")\n\t}\n\n\t// Fetch a RouteContext object from the sync pool, and call the computed\n\t// mx.handler that is comprised of mx.middlewares + mx.routeHTTP.\n\t// Once the request is finished, reset the routing context and put it back\n\t// into the pool for reuse from another request.\n\trctx := mx.pool.Get().(*Context)\n\trctx.Reset()\n\tr = r.WithContext(context.WithValue(r.Context(), RouteCtxKey, rctx))\n\tmx.handler.ServeHTTP(w, r)\n\tmx.pool.Put(rctx)\n}", "func redirectHTTP() {\n\te := echo.New()\n\te.Use(middleware.HTTPSRedirect())\n\tgo func() { e.Logger.Fatal(e.Start(HTTPPort)) }()\n}", "func registerHandlers() Option {\n\treturn optionFunc(func(c *config) {\n\t\tmux := http.NewServeMux()\n\t\tfor pattern, h := range c.handlers {\n\t\t\tmux.Handle(pattern, h)\n\t\t}\n\t\tc.httpServer.Handler = mux\n\t})\n}", "func Configure(app *fiber.App) {\n\n\t// Create new url and return hash.\n\tapp.Post(\"/new\", handler.CreateHandler)\n\n\t// Handle Redirects for short url\n\tapp.Get(\"/:urlHash\", handler.ResolveHandler)\n\n}", "func (n *CommandNode) AddRedirect(redir *RedirectNode) {\n\tn.redirs = append(n.redirs, redir)\n}", "func handler(w http.ResponseWriter, r *http.Request) {\n\turls := *(*UrlMap)(atomic.LoadPointer(&urlmap))\n\tdest, ok := urls[strings.ToLower(r.URL.Path)]\n\tstatus := 302\n\tif !ok {\n\t\tglog.Warningf(\"no match for %s\", r.URL.Path)\n\t\tif defaultUrl != \"\" {\n\t\t\tdest = defaultUrl\n\t\t} else {\n\t\t\tdest = \"\"\n\t\t\tstatus = 404\n\t\t}\n\t}\n\tglog.Infof(\"%s %s %s %d\", r.RemoteAddr, r.URL.Path, dest, status)\n\tif status == 302 {\n\t\thttp.Redirect(w, r, dest, status)\n\t} else {\n\t\thttp.Error(w, \"not found\", status)\n\t}\n}", "func init() {\n //make user\n UsersMux.HandleFunc(\"/users/make\", make)\n //get user info\n UsersMux.HandleFunc(\"/users/activate\", activate)\n //login user\n UsersMux.HandleFunc(\"/users/login\", login)\n}", "func MapHandler(pathsToUrls map[string]string, fallback http.Handler) http.HandlerFunc {\n\t//\tTODO: Implement this...\n\t// Read this: https://medium.com/@matryer/the-http-handler-wrapper-technique-in-golang-updated-bc7fbcffa702\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Now we need to get the request URL from r\n\t\t// See here for an example from the docs\n\t\t// https://golang.org/pkg/net/http/\n\t\tp := r.URL.Path\n\t\t// Check if p exists in the map, if key does not exist in map exists\n\t\t// will be nil\n\t\tif redirect, exists := pathsToUrls[p]; exists {\n\t\t\t// redirect with a 302.\n\t\t\thttp.Redirect(w, r, redirect, http.StatusFound)\n\t\t\treturn\n\t\t}\n\t\t// If it's not found, call fallback.\n\t\tfallback.ServeHTTP(w, r)\n\t})\n\n}", "func Auth(next http.HandlerFunc) http.HandlerFunc {\n\treturn http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {\n\t\tredir := req.URL.Scheme + req.URL.Host + \"/admin/login\"\n\n\t\tif IsValid(req) {\n\t\t\tnext.ServeHTTP(res, req)\n\t\t} else {\n\t\t\thttp.Redirect(res, req, redir, http.StatusFound)\n\t\t}\n\t})\n}" ]
[ "0.6541076", "0.5995289", "0.5566815", "0.5473153", "0.54565626", "0.5441074", "0.54062897", "0.5403264", "0.5355054", "0.5332366", "0.53287095", "0.5303781", "0.5296168", "0.5282657", "0.5276768", "0.5273478", "0.52536356", "0.5249785", "0.5245712", "0.522044", "0.52047104", "0.52007234", "0.51972437", "0.5182572", "0.5173198", "0.51716375", "0.5170684", "0.51603913", "0.51361465", "0.51186174", "0.5116773", "0.51072335", "0.51062596", "0.51036835", "0.5098608", "0.50927407", "0.50702125", "0.5069492", "0.5035701", "0.50233597", "0.5015498", "0.5003483", "0.49938786", "0.49921823", "0.49919486", "0.4980534", "0.49727613", "0.49694398", "0.4960969", "0.49572712", "0.49553117", "0.49512413", "0.4949593", "0.49424294", "0.49343738", "0.49325302", "0.49227318", "0.49225324", "0.49162441", "0.49151957", "0.4913923", "0.4894755", "0.48904827", "0.48879895", "0.48875836", "0.48773402", "0.48755127", "0.48740476", "0.4865005", "0.48614326", "0.48601148", "0.4855103", "0.4854136", "0.48539016", "0.48497978", "0.4846332", "0.4835396", "0.48233566", "0.48226184", "0.48225576", "0.48213688", "0.48157838", "0.4811583", "0.48102883", "0.48101255", "0.48055053", "0.48036623", "0.48008516", "0.4794835", "0.47890112", "0.4787526", "0.47873396", "0.47837922", "0.47824332", "0.47780976", "0.4763657", "0.47611994", "0.4749443", "0.4748325", "0.47477043" ]
0.7531319
0
Read parses all URLs and calls the callback once found a key (string) and value (url)
func Read(ctx context.Context, path string, urls URLs, cb Callback) error { eg, ctx := errgroup.WithContext(ctx) read(ctx, eg, path, urls, cb) return eg.Wait() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Parser) Parse(ctx context.Context, url string, body io.Reader) (urls []string, errs []error) {\n\tb, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn nil, []error{err}\n\t}\n\tresult, ok := p.Results[string(b)]\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\tfor _, e := range result.Errs {\n\t\terrs = append(errs, errors.New(e))\n\t}\n\treturn result.Urls, errs\n}", "func CrawlEachURLFound(url string, fetcher Fetcher, ch chan []string) {\n\tbody, urls, err := fetcher.Fetch(url)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t} else {\n\t\tfmt.Printf(\"Found: %s %q\\n\", url, body)\n\t}\n\tch <- urls\n}", "func loadMap() {\n\tfile, err := os.Open(\"urls.txt\")\n\tif err != nil {\n\t\tglog.Fatalln(err)\n\t}\n\tdefer file.Close()\n\turls := make(UrlMap)\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline := strings.TrimSpace(scanner.Text())\n\t\tif strings.HasPrefix(line, \"#\") || len(line) < 1 {\n\t\t\tcontinue\n\t\t}\n\t\tparts := strings.Split(line, \" \")\n\t\tif len(parts) == 2 {\n\t\t\tkey := strings.ToLower(strings.TrimSpace(parts[0]))\n\t\t\tif _, ok := urls[key]; ok {\n\t\t\t\tglog.Warningf(\"duplicate key %s!\", key)\n\t\t\t}\n\t\t\turls[key] = strings.TrimSpace(parts[1])\n\t\t} else {\n\t\t\tglog.Warningf(\"skipping malformed line:\\n%s\", line)\n\t\t}\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tglog.Errorln(err)\n\t}\n\tglog.Infof(\"loaded %d mappings\", len(urls))\n\tatomic.StorePointer(&urlmap, (unsafe.Pointer)(&urls))\n}", "func read(url string, c chan *gofeed.Feed) {\n\tresp, err := request(url)\n\n\tif err != nil {\n\t\tc <- nil\n\t\treturn\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tlogrus.Error(err)\n\t\t\tc <- nil\n\t\t\treturn\n\t\t}\n\n\t\tbodyString := string(bodyBytes)\n\t\tlogrus.WithField(\"body\", bodyString).Error(resp.Status)\n\t\tc <- nil\n\t\treturn\n\t}\n\n\tc <- parseRequest(resp)\n}", "func ReadUrls(fileName *string) (UrlConfig, error) {\n\tlog.Print(\"Reading config\")\n\tfile, err := ioutil.ReadFile(*fileName)\n\tif err != nil {\n\t\tlog.Printf(\"Could not read config: %s\", err)\n\t\treturn UrlConfig{}, errors.New(\"Could not read config\")\n\t}\n\tvar config UrlConfig\n\terr = json.Unmarshal(file, &config)\n\tif err != nil {\n\t\tlog.Printf(\"Could not parse config: %s\", err)\n\t\treturn UrlConfig{}, errors.New(\"Could not parse config\")\n\t}\n\tlog.Printf(\"Read %d records\", len(config))\n\tif configValid(config) {\n\t\treturn config, nil\n\t} else {\n\t\treturn UrlConfig{}, errors.New(\"Config is not valid\")\n\t}\n}", "func (r *retriever) Process() {\n\tvar wg sync.WaitGroup\n\n\tfor url := range r.In {\n\t\twg.Add(1)\n\t\t// For now the goroutines will be unbounded\n\t\tgo func(url string) {\n\t\t\tdefer wg.Done()\n\t\t\t// TODO: Add an error process\n\t\t\tif html, err := r.getter(url); err == nil {\n\t\t\t\tr.Out <- NewPage(url, html)\n\t\t\t} else {\n\t\t\t\tr.Err <- err\n\t\t\t}\n\t\t}(url)\n\t}\n\n\twg.Wait()\n}", "func ReadAll(numWorkers int) {\n\turlchan, err := parseSourceFile(\"rss.source\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(runtime.NumCPU())\n\n\t//assign 3 workers to read ursl\n\tfor n := 0; n < numWorkers; n++ {\n\t\tgo func(urlchan <-chan string) {\n\t\t\tfor url := range urlchan {\n\t\t\t\tReadUrl(url)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(urlchan)\n\t}\n\n\twg.Wait()\n}", "func OpenAndReadLinks(filename string,links Links)[]string{\n\tfile,err:=os.Open(filename)\n\tif err!=nil{\n\t\t_ = fmt.Errorf(\"sometring went wrong %s\", err)\n\t}\n\tdefer file.Close()\n\tbyteData,_:=ioutil.ReadAll(file)\n\tbyteData=byteData[:len(byteData)-2]\n\tbyteData = append(byteData, 93)\n\t_ = json.Unmarshal(byteData, &links)\n\turlSlice:=make([]string,0)\n\tfor _,i:=range links{\n\t\tfor _,j:=range i{\n\t\t\turlSlice = append(urlSlice, j)\n\t\t}\n\t}\n\treturn urlSlice\n}", "func OpenAndRead(fileName string, data models.MainPages)[]string{\n\tfile,err:=os.Open(fileName)\n\tif err!=nil{\n\t\t_ = fmt.Errorf(\"Something went wrong %s\\n\", err)\n\t}\n\tdefer file.Close()\n\tbyteData,_:=ioutil.ReadAll(file)\n\tbyteData=byteData[:len(byteData)-2]\n\tbyteData = append(byteData, 93)\n\t_ = json.Unmarshal(byteData, &data)\n\turlsSlice:=make([]string,0)\n\tfor _,i:=range data{\n\t\tfor _,j:=range i.Links{\n\t\t\turlsSlice = append(urlsSlice, j)\n\t\t}\n\t}\n\treturn urlsSlice\n}", "func (r *feed) Read(ctx context.Context, consumer data.Consumer) error {\n\tfp := gofeed.NewParser()\n\tfp.Client = r.HTTPClient.HTTPClient\n\n\tfeed, err := fp.ParseURL(r.URL)\n\tif err != nil {\n\t\tlog.Error().Err(err).Str(\"url\", r.URL).Msg(\"unable to parse rss url\")\n\t\treturn err\n\t}\n\n\tvar articles []data.Article\n\tfor _, item := range feed.Items {\n\t\tif isCanceled(ctx) {\n\t\t\treturn context.Canceled\n\t\t}\n\n\t\tarticle, err := parseArticleFromRSS(item)\n\t\tif err != nil {\n\t\t\tlog.Error().Err(err).Str(\"url\", r.URL).Msg(\"unable to item from rss feed\")\n\t\t\treturn err\n\t\t}\n\n\t\tarticles = append(articles, article)\n\t}\n\n\t// Sort articles by time in ascending order.\n\tsort.Slice(articles, func(i, j int) bool {\n\t\treturn articles[i].Time.Before(articles[j].Time)\n\t})\n\n\tfor _, article := range articles {\n\t\terr := consumer.On(ctx, article)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func getContents(url string, c chan map[string]int64 ){\n\t//HTTP Head on a URL\n\tresp,err :=http.Head(url)\n\t//Map < URL->ContentLength >\n\tresult := make(map[string]int64)\n\tif err == nil{\n\t\tresult[url] =resp.ContentLength\n\t\t//Channeling in ContentLength with the URL as the key\n\t\tc <- result\n\t}\n}", "func fastURLs(u string) ([]string, error) {\n\tresp, err := http.Get(u)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tdest := make([]map[string]string, 0, 5)\n\tdec := json.NewDecoder(resp.Body)\n\tif err := dec.Decode(&dest); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist := make([]string, len(dest))\n\tfor i, u := range dest {\n\t\tlist[i] = u[\"url\"]\n\t}\n\treturn list, nil\n}", "func getUrls(key string) []string {\n return []string{\"https://www.zoopla.co.uk/for-sale/houses/manchester/?q=Manchester&radius=0&results_sort=newest_listings&search_source=refine\"}\n}", "func Parse(urlStr string, key ...interface{}) (func(http.Handler) http.Handler,\n\terror) {\n\n\tu, err := mgourl.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts, err := mgo.Dial(u.ShortString())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tk := getkey(key...)\n\tif k == nil {\n\t\tk = u.Database()\n\t}\n\n\treturn Handler(s, u.Database(), k), nil\n}", "func (r *requestParams) getURLs(res *http.Response, imWebPage bool) ([]string, error) {\n\tvar ar []string\n\tdoc, err := goquery.NewDocumentFromReader(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treg1 := regexp.MustCompile(\"key: 'ds:1'\")\n\treg2 := regexp.MustCompile(`\"(https?:\\/\\/.+?)\",\\d+,\\d+`)\n\treg3 := regexp.MustCompile(`https:\\/\\/encrypted\\-tbn0`)\n\treg4 := regexp.MustCompile(`\"(https?:\\/\\/.+?)\"`)\n\treg5 := regexp.MustCompile(`https?:\\/\\/.+?\\.jpg|https?:\\/\\/.+?\\.png|https?:\\/\\/.+?\\.gif`)\n\tdoc.Find(\"script\").Each(func(_ int, s *goquery.Selection) {\n\t\tif reg1.MatchString(s.Text()) {\n\t\t\tvar urls [][]string\n\t\t\tif imWebPage {\n\t\t\t\turls = reg4.FindAllStringSubmatch(s.Text(), -1)\n\t\t\t\tfor _, u := range urls {\n\t\t\t\t\tif !reg3.MatchString(u[1]) && !reg5.MatchString(u[0]) {\n\t\t\t\t\t\tss, err := strconv.Unquote(`\"` + u[1] + `\"`)\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\tar = append(ar, ss)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\turls = reg2.FindAllStringSubmatch(s.Text(), -1)\n\t\t\t\tfor _, u := range urls {\n\t\t\t\t\tif !reg3.MatchString(u[1]) {\n\t\t\t\t\t\tss, err := strconv.Unquote(`\"` + u[1] + `\"`)\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\tar = append(ar, ss)\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\tif len(ar) == 0 {\n\t\treturn nil, errors.New(\"data couldn't be retrieved\")\n\t}\n\treturn ar, nil\n}", "func Main(cookie, etag string, gzip, ignoreBody bool, urls ...string) error {\n\tfor i, url := range urls {\n\t\t// Separate subsequent lookups with newline\n\t\tif i > 0 {\n\t\t\tfmt.Println()\n\t\t}\n\t\tif err := getHeaders(cookie, etag, gzip, ignoreBody, url); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func getLinks(inURLs []string) {\n\tlinksChan := make(chan string)\n\tsignalChan := make(chan bool)\n\n\tfor _, link := range inURLs {\n\n\t\tres, err := http.Get(link)\n\t\tif res.StatusCode != http.StatusOK {\n\t\t\tfmt.Println(\"error fetching url : %s\", err)\n\t\t\treturn\n\t\t}\n\t\tbuf, err := ioutil.ReadAll(res.Body)\n\t\tgo parseHTML(buf, linksChan, signalChan)\n\t}\n\n\tfor count := 0; count < len(inURLs); {\n\t\tselect {\n\t\tcase u := <-linksChan:\n\t\t\tfmt.Println(u)\n\t\tcase <-signalChan:\n\t\t\tcount++\n\t\t}\n\t}\n}", "func ReadURL(url string) ([]byte, error) {\n response, err := http.Get(url)\n if err != nil {\n return nil, err\n }\n context, err := ioutil.ReadAll(response.Body)\n response.Body.Close()\n return context, err\n}", "func (result *Result) Crawl(url string, fetcher Fetcher) {\n\t// This Lock is to avoid processing the same link/url twice\n\tresult.Lock()\n\tif _, ok := result.cmap[url]; ok {\n\t\tresult.Unlock()\n\t\treturn\n\t}\n\t// Add the url to the map while the lock is being held\n\tresult.cmap[url] = \"processing\"\n\tresult.Unlock()\n\n\tbody, urls, err := fetcher.Fetch(url)\n\tif err != nil {\n\t\tresult.cmap[url] = err.Error()\n\t\treturn\n\t}\n\t// Update the result after acquiring the Lock\n\tresult.Lock()\n\tresult.cmap[url] = body\n\t//result.cmap[url] = append(result.cmap[url], urls...)\n\tresult.Unlock()\n\n\t// A channel to block till all links are processed\n\tdone := make(chan bool)\n\tfor _, u := range urls {\n\t\tgo func(url string) {\n\t\t\tresult.Crawl(url, fetcher)\n\t\t\tdone <- true\n\t\t}(u)\n\t}\n\n\t// Now wait for those results from for loop to be ready\n\tfor range urls {\n\t\t<-done\n\t}\n}", "func URLCountMap(filename string, contents string) []KeyValue {\n\tlines := strings.Split(contents, \"\\n\")\n\tkvs := make([]KeyValue, 0, len(lines))\n\tfor i := 0; i < len(lines); i++ {\n\t\tl := strings.TrimSpace(lines[i])\n\t\tif len(l) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tkvs = append(kvs, KeyValue{Key: l})\n\t}\n\treturn kvs\n}", "func ReadUrl(url string) {\n\tval, err := ReadNewsFrom(url)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\trenderToSTDOUT(val)\n}", "func ReadUrl(url string) ([]byte, error) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, errors.New(url + \": \" + resp.Status)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\t// log.Println(url + \":\", string(body))\n\n\treturn body, err\n}", "func ParseURLs(content string) []string { return parseURLsMax(content, -1) }", "func (getter *Getter) RetrieveURIs(sourceURI string, customLimit int) []string {\n\tvar wg sync.WaitGroup\n\tvar links []soup.Root\n\tvar single bool\n\tvar i = 0\n\tvar useLimit bool\n\n\tif customLimit == 0 {\n\t\tuseLimit = false\n\t} else {\n\t\tuseLimit = true\n\t}\n\n\tt := strings.Split(sourceURI, \"/\")\n\tfilename := t[len(t)-1]\n\n\tif strings.Contains(filename, \".\") {\n\t\t// sourceURI is a single file\n\t\tsingle = true\n\t\tdoc := soup.HTMLParse(\"<a href='\" + sourceURI + \"'>\" + sourceURI + \"</a>\")\n\t\tlinks = doc.FindAll(\"a\")\n\t} else {\n\t\tresp, err := soup.Get(sourceURI)\n\t\tif err != nil {\n\t\t\tos.Exit(1)\n\t\t}\n\t\tdoc := soup.HTMLParse(resp)\n\t\tlinks = doc.Find(\"table\").FindAll(\"a\")\n\t}\n\n\tlog.Printf(\"Retrieved this many links %v\", len(links))\n\n\tif len(links) > MAXRETRIEVALSIZE {\n\t\tlog.Printf(\"Unable to continue. More files (%v) requested to download than allowed(%v)\", len(links), MAXRETRIEVALSIZE)\n\t\treturn nil\n\t}\n\n\t// NOTE remember that unbuffered channels hang\n\tallFileLocations := make(chan string, len(links))\n\tfor _, link := range links {\n\t\tswitch useLimit {\n\t\tcase true:\n\t\t\tif i != customLimit {\n\t\t\t\tvar fileURI string\n\t\t\t\twg.Add(1)\n\t\t\t\tlog.Printf(\"%v| Link: %v\", link.Text(), link.Attrs()[\"href\"])\n\n\t\t\t\tif single {\n\t\t\t\t\tfileURI = link.Attrs()[\"href\"]\n\t\t\t\t} else {\n\t\t\t\t\tfileURI = sourceURI + link.Attrs()[\"href\"]\n\t\t\t\t}\n\n\t\t\t\tgo func(file string, wg *sync.WaitGroup) {\n\t\t\t\t\tdefer wg.Done()\n\t\t\t\t\tgetter.RetrieveSingleFile(file, allFileLocations)\n\t\t\t\t}(fileURI, &wg)\n\n\t\t\t\ti++\n\t\t\t}\n\t\t\tbreak\n\t\tcase false:\n\t\t\tvar fileURI string\n\t\t\twg.Add(1)\n\t\t\tlog.Printf(\"%v| Link: %v\", link.Text(), link.Attrs()[\"href\"])\n\n\t\t\tif single {\n\t\t\t\tfileURI = link.Attrs()[\"href\"]\n\t\t\t} else {\n\t\t\t\tfileURI = sourceURI + link.Attrs()[\"href\"]\n\t\t\t}\n\n\t\t\tgo func(file string, wg *sync.WaitGroup) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tgetter.RetrieveSingleFile(file, allFileLocations)\n\t\t\t}(fileURI, &wg)\n\t\t} //switch\n\t} //for\n\n\twg.Wait()\n\tclose(allFileLocations)\n\tvar fileList []string\n\tfor file := range allFileLocations {\n\t\tfileList = append(fileList, file)\n\t}\n\treturn fileList\n}", "func (bot *Bot) handleURLsListener(message events.EventMessage) {\n\n\t// Find all URLs in the message.\n\tlinks := xurls.Strict().FindAllString(message.Message, -1)\n\t// Remove multiple same links from one message.\n\tlinks = utils.RemoveDuplicates(links)\n\tfor i := range links {\n\t\t// Validate the url.\n\t\tbot.Log.Infof(\"Got link %s\", links[i])\n\t\tlink := utils.StandardizeURL(links[i])\n\t\tbot.Log.Debugf(\"Standardized to: %s\", link)\n\n\t\t// Try to get the body of the page.\n\t\terr, finalLink, body := bot.GetPageBody(link, map[string]string{})\n\t\tif err != nil {\n\t\t\tbot.Log.Warningf(\"Could't fetch the body: %s\", err)\n\t\t}\n\n\t\t// Update link if needed.\n\t\tif finalLink != \"\" {\n\t\t\tlink = finalLink\n\t\t}\n\n\t\t// Iterate over meta tags to get the description\n\t\tdescription := \"\"\n\t\tmetas := metaRe.FindAllStringSubmatch(string(body), -1)\n\t\tfor i := range metas {\n\t\t\tif len(metas[i]) > 1 {\n\t\t\t\tisDesc := descRe.FindString(metas[i][0])\n\t\t\t\tif isDesc != \"\" && (len(metas[i][1]) > len(description)) {\n\t\t\t\t\tdescription = utils.CleanString(metas[i][1], true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Get the title\n\t\ttitle := \"\"\n\t\tmatch := titleRe.FindStringSubmatch(string(body))\n\t\tif len(match) > 1 {\n\t\t\ttitle = utils.CleanString(match[1], true)\n\t\t}\n\n\t\t// Insert URL into the db.\n\t\tbot.Log.Debugf(\"Storing URL info for: %s\", link)\n\t\tif _, err := bot.Db.Exec(`INSERT INTO urls(transport, channel, nick, link, quote, title) VALUES(?, ?, ?, ?, ?, ?)`,\n\t\t\tmessage.TransportName, message.Channel, message.Nick, link, message.Message, title); err != nil {\n\t\t\tbot.Log.Warningf(\"Can't add url to database: %s\", err)\n\t\t}\n\n\t\t// Trigger url found message.\n\t\tbot.EventDispatcher.Trigger(events.EventMessage{\n\t\t\tmessage.TransportName,\n\t\t\tmessage.TransportFormatting,\n\t\t\tevents.EventURLFound,\n\t\t\tmessage.Nick,\n\t\t\tmessage.UserId,\n\t\t\tmessage.Channel,\n\t\t\tlink,\n\t\t\tmessage.Context,\n\t\t\tmessage.AtBot,\n\t\t})\n\n\t\tlinkKey := link + message.Channel\n\t\t// If we can't announce yet, skip this link.\n\t\tif time.Since(bot.lastURLAnnouncedTime[linkKey]) < bot.Config.UrlAnnounceIntervalMinutes*time.Minute {\n\t\t\tcontinue\n\t\t}\n\t\tif lines, exists := bot.lastURLAnnouncedLinesPassed[linkKey]; exists && lines < bot.Config.UrlAnnounceIntervalLines {\n\t\t\tcontinue\n\t\t}\n\n\t\t// On mattermost we can skip all link info display.\n\t\tif message.TransportName == \"mattermost\" {\n\t\t\treturn\n\t\t}\n\n\t\t// Announce the title, save the description.\n\t\tif title != \"\" {\n\t\t\tif description != \"\" {\n\t\t\t\tbot.SendNotice(&message, title+\" …\")\n\t\t\t} else {\n\t\t\t\tbot.SendNotice(&message, title)\n\t\t\t}\n\t\t\tbot.lastURLAnnouncedTime[linkKey] = time.Now()\n\t\t\tbot.lastURLAnnouncedLinesPassed[linkKey] = 0\n\t\t\t// Keep the long info for later.\n\t\t\tbot.AddMoreInfo(message.TransportName, message.Channel, description)\n\t\t}\n\t}\n}", "func readURLs(filename string) ([]string, error) {\n\turlsBytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttrimmed := strings.TrimSuffix(string(urlsBytes), \"\\n\")\n\turls := strings.Split(trimmed, \"\\n\")\n\treturn urls, nil\n}", "func LoadURLs(filename string) (*URLs, error) {\n\tif filename == \"\" {\n\t\tfilename = defaultFilename\n\t}\n\tbuf, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar urls URLs\n\tif err := json.Unmarshal(buf, &urls); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &urls, nil\n}", "func crawl(url, start_domain string) (map[string]bool, map[string]bool) {\n\turls := make(map[string]bool)\n\tassets := make(map[string]bool)\n\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer resp.Body.Close()\n\t// Check response HTTP status\n\tif resp.StatusCode != 200 {\n\t\treturn nil, nil\n\t}\n\n\ttokenizer := html.NewTokenizer(resp.Body)\n\tnot_done := true\n\tfor not_done {\n\t\tnext_token := tokenizer.Next()\n\t\tswitch next_token {\n\t\tcase html.ErrorToken:\n\t\t\t// End of tokens, exit loop\n\t\t\tnot_done = false\n\t\tcase html.StartTagToken:\n\t\t\ttoken := tokenizer.Token()\n\t\t\tis_url := false\n\t\t\tvar attr_val string\n\t\t\tswitch strings.ToLower(token.Data) {\n\t\t\tcase \"a\":\n\t\t\t\tattr_val = getAttrVal(token, \"href\")\n\t\t\t\tis_url = true\n\t\t\tcase \"script\":\n\t\t\t\tattr_val = getAttrVal(token, \"src\")\n\t\t\tcase \"img\":\n\t\t\t\tattr_val = getAttrVal(token, \"src\")\n\t\t\tcase \"link\":\n\t\t\t\tattr_val = getAttrVal(token, \"href\")\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif attr_val != \"\" {\n\t\t\t\tnew_url := processUrl(attr_val, start_domain)\n\t\t\t\tif is_url == true {\n\t\t\t\t\turls[new_url] = false\n\t\t\t\t\tif strings.HasPrefix(new_url, start_domain) {\n\t\t\t\t\t\turls[new_url] = true\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tassets[new_url] = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// log.Printf(\"Token %s didn't have a detectable url/asset value: ignored\", token.Data)\n\t\t\t}\n\t\t}\n\t}\n\treturn urls, assets\n}", "func GetAllURLs() error {\n\tr, err := http.Get(\"http://localhost:8080/api/fetcher\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tdefer r.Body.Close()\n\t//new decoder that reads from r\n\tdec := json.NewDecoder(r.Body)\n\t//checks if request body contains only fields that are in the structure\n\tdec.DisallowUnknownFields()\n\t//decode request in json format and store it in the url struct\n\terr = dec.Decode(&collection.Items)\n\t//check various errors\n\tif err != nil {\n\t\thandleError(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ctrl *RedirCtrl) ReadByUrl(c *gin.Context) {\n\tif c.Param(\"redirect\") != \"api\" || c.Param(\"url\") == \"\" {\n\t\tc.JSON(ctrl.Config.STATUS_CODES[\"BAD_REQUEST\"], gin.H{\n\t\t\t\"error\": \"Bad Request\",\n\t\t})\n\t\treturn\n\t}\n\tredir := c.Param(\"url\")\n\tredirect, err := ctrl.RedirService.FindByRedirect(context.TODO(), redir, models.REDIRECTSCOLLECTION)\n\tif err != nil {\n\t\tc.JSON(ctrl.Config.STATUS_CODES[\"INTERNAL_SERVER_ERROR\"], gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(ctrl.Config.STATUS_CODES[\"OK\"], redirect)\n}", "func FetchUrls(userid string) (urls map[string]string, err error) {\n\tvar result *sql.Rows\n\turls = make(map[string]string)\n\tresult, err = DB.Query(\"Select urlname, url from urls where userid = ? group by urlname, url\", userid)\n\tif err != nil {\n\t\turls = nil\n\t\treturn\n\t}\n\n\tfor result.Next() {\n\t\tvar url string\n\t\tvar urlname string\n\t\tif err = result.Scan(&urlname, &url); err != nil {\n\t\t\turls = nil\n\t\t\tbreak\n\t\t}\n\t\tif url != \"\" {\n\t\t\tif urlname == \"\" {\n\t\t\t\turlname = url[:20]\n\t\t\t}\n\t\t\turls[urlname] = url\n\t\t}\n\t}\n\treturn\n}", "func processUrls(dasquery dasql.DASQuery, system, api string, urls []string) []mongo.DASRecord {\n\tvar outRecords []mongo.DASRecord\n\tout := make(chan utils.ResponseType)\n\tdefer close(out)\n\tumap := map[string]int{}\n\tclient := utils.HttpClient()\n\tfor _, furl := range urls {\n\t\tumap[furl] = 1 // keep track of processed urls below\n\t\tgo utils.Fetch(client, furl, \"\", out) // \"\" specify optional args\n\t}\n\t// collect all results from out channel\n\texit := false\n\tfor {\n\t\tselect {\n\t\tcase r := <-out:\n\t\t\t// process data\n\t\t\tvar records []mongo.DASRecord\n\t\t\tif system == \"dbs3\" || system == \"dbs\" {\n\t\t\t\trecords = DBSUnmarshal(api, r.Data)\n\t\t\t} else if system == \"phedex\" {\n\t\t\t\trecords = PhedexUnmarshal(api, r.Data)\n\t\t\t}\n\t\t\tfor _, rec := range records {\n\t\t\t\trec[\"url\"] = r.Url\n\t\t\t\toutRecords = append(outRecords, rec)\n\t\t\t}\n\t\t\t// remove from umap, indicate that we processed it\n\t\t\tdelete(umap, r.Url) // remove Url from map\n\t\tdefault:\n\t\t\tif len(umap) == 0 { // no more requests, merge data records\n\t\t\t\texit = true\n\t\t\t}\n\t\t\ttime.Sleep(time.Duration(10) * time.Millisecond) // wait for response\n\t\t}\n\t\tif exit {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn outRecords\n}", "func SelectFeedFetcher(url string) (FeedFunc, error) {\n // sometimes it's pretty promising based on the host\n urlmap := map[string]FeedFunc {\n \".libsyn.com\" : FeedFromLibsyn,\n \".libsynpro.com\" : FeedFromLibsyn,\n \"npr.org\" : FeedFromNPR,\n \"feeds.soundcloud.com\" : FeedSelfLinking,\n }\n // the `channel/generator` can be a pretty good hint too\n genmap := map[string]FeedFunc {\n \"Site-Server v6.\" : FeedFromSquarespace,\n \"Libsyn WebEngine\" : FeedFromLibsyn,\n \"NPR API RSS Generator\" : FeedFromNPR,\n }\n\n // try actually fetching, this will get us through redirects to the actual\n // url, also an early bail on eg. 404's\n resp, err := util.LimitedBody(url, maxBytes)\n if err != nil {\n return nil, err\n }\n if resp.StatusCode >= 400 {\n return nil, errors.New(resp.Status)\n }\n for stub, fn := range urlmap {\n if strings.HasSuffix(resp.Request.URL.Hostname(), stub) {\n return fn, nil\n }\n }\n\n // parse the xml document and see if we get `channel/generator` hints\n dat, err := ioutil.ReadAll(resp.Body)\n if err != nil {\n return nil, err\n }\n doc, err := gokogiri.ParseXml(dat)\n if err != nil {\n return nil, err\n }\n gen, err := doc.Root().Search(\"channel/generator\")\n if err != nil {\n return nil, err\n }\n if len(gen) > 0 {\n generator := gen[0].Content()\n for stub, fn := range genmap {\n if strings.HasPrefix(generator, stub) {\n return fn, nil\n }\n }\n }\n\n // check for a `channel/atom:link` with `rel=next` that would tell us how\n // to paginate through the feed.\n feed, err := NewFeed(dat, nil)\n if err == nil {\n _, err = nextSelfLink(feed, \"\")\n if err == nil {\n // don't actually care what the url was, only that it was found\n return FeedSelfLinking, nil\n }\n }\n\n // Some podcasts are backed by Libsyn in a way that we could fetch the feed\n // from their service, from which we've already worked out how to rebuild an\n // entire history.\n _, err = getLibsynHostname(doc)\n if err == nil {\n // we found one, but don't actually care what it is right now\n return FeedFromLibsyn, FetcherDetectUntrusted\n }\n\n // As a last ditch, there's a chance the entire history exists in the\n // currently published feed. We could also try FeedFromWayback to rebuild it\n // using the Internet Archive, but coverage is pretty spotty.\n return nil, FetcherDetectFailed\n}", "func init() {\n\tfmt.Println(\"Reading stocks\")\n\tcapAlphabets := []string{\"A\", \"B\", \"C\", \"D\", \"E\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"}\n\tfor _, char := range capAlphabets {\n\t\tdoc, err := getStockQuote(sourceURL + char)\n\t\tif err != nil {\n\t\t\tlog.Panic(\"Error in fetching stock URLs \", err.Error())\n\t\t}\n\t\tdoc.Find(\".bl_12\").Each(func(i int, s *goquery.Selection) {\n\t\t\tlink, _ := s.Attr(\"href\")\n\t\t\tstockName := s.Text()\n\t\t\tif match, _ := regexp.MatchString(`^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$`, link); match {\n\t\t\t\tstockURLSplit := strings.Split(link, \"/\")\n\t\t\t\tstocksURL[strings.ToLower(stockName)] = stockURLValue{stockURLSplit[5], stockURLSplit[6], stockURLSplit[7]}\n\t\t\t}\n\t\t})\n\t}\n\tfmt.Println(\"Stocks Read Succesfull\")\n}", "func ReadURL(url string, client *http.Client, header *http.Header) (body []byte, err error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif header != nil {\n\t\treq.Header = *header\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tklog.V(2).InfoS(\"Failed to read URL\", \"statusCode\", resp.StatusCode, \"URL\", url)\n\t\treturn nil, &HTTPError{\n\t\t\tStatusCode: resp.StatusCode,\n\t\t\tURL: url,\n\t\t}\n\t}\n\n\tlimitedReader := &io.LimitedReader{R: resp.Body, N: maxReadLength}\n\tcontents, err := io.ReadAll(limitedReader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif limitedReader.N <= 0 {\n\t\treturn nil, errors.New(\"the read limit is reached\")\n\t}\n\n\treturn contents, nil\n}", "func get_maps(filename string) (map[string]string, map[string]string) {\n // read urls.json\n url_file, e := ioutil.ReadFile(filename)\n var shorten_map map[string]string\n original_map := make(map[string]string)\n if e == nil {\n // save it as map\n //err2 := json.Unmarshal(url_file, &shorten_map)\n //fmt.Println(err2)\n json.Unmarshal(url_file, &shorten_map)\n } else {\n //fmt.Println(\"no urls.json\")\n shorten_map = make(map[string]string)\n }\n for k, v := range shorten_map {\n original_map[v] = k\n }\n\n return shorten_map, original_map\n}", "func getRead(url string) ([]byte, error) {\n\tresp, err := http.Get(url)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, resp.Body.Close()\n}", "func get(URLStr string) []string {\n\tresp, err := http.Get(URLStr)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"getting %s: %v\\n\", URLStr, err)\n\t\treturn []string{}\n\t}\n\tfoundLinks := filter(hrefs(resp.Body, hostURL), withPrefix(hostURL.String()))\n\tresp.Body.Close()\n\treturn foundLinks\n}", "func extractor(url string) {\n\tresp, err := http.Get(url) // send request and get response\n\tif err != nil {\n\t\tlog.Printf(\"error occured while getting response http.get(%s) and error is %s\", url, err.Error())\n\t}\n\tdefer resp.Body.Close()\n\n\tlinks, err := collectLinksFromHtml(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(\"failed collecting links\")\n\t}\n\n\tfor _, link := range links {\n\t\tnonDuplicateLinks := make(map[string]int, 1)\n\t\tif _, ok := nonDuplicateLinks[link.url]; !ok {\n\t\t\tnonDuplicateLinks[link.url] = 1\n\t\t\tlog.Printf(\"URL: %s TEXT: %s \\n\", link.url, link.text)\n\t\t}\n\t}\n}", "func allLinks(prefix, prop string, titles []string) chan Links {\n c := make(chan Links)\n\n go func(prefix, prop string, titles []string) {\n // Holds Wikipedia's \"continue\" string if we have more results to fetch. Set after the first request\n var cont string\n\n // Wikipedia can batch process up to 50 page titles at a time\n for _, titlesBatch := range batch(titles, 50) {\n // Continue paginating through results as long as Wikipedia is telling us to continue\n for i := 0; i == 0 || len(cont) > 0; i++ {\n queryURL := buildQuery(prefix, prop, titlesBatch, cont)\n body, err := get(queryURL)\n if err != nil {\n // If Wikipedia returns an error, just panic instead of doing an exponential back-off\n panic(err)\n }\n\n // Parse the response\n resp := linksResponse{prefix: prefix, prop: prop}\n err = json.Unmarshal(body, &resp)\n if err != nil {\n panic(err)\n }\n\n c <- resp.Links\n cont = resp.Continue\n }\n }\n close(c)\n }(prefix, prop, titles)\n\n return c\n}", "func readurl(url string) (data string, err error) {\n\tvar resp *http.Response\n\tresp, err = http.Get(url)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer resp.Body.Close()\n\n\t// read data from url\n\tvar bytes []byte\n\tbytes, err = ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdata = string(bytes)\n\treturn\n}", "func crawl(src string, srcID int64, parentID int64, ch chan UrlData, chFinished chan bool) {\n\t//Retrieve the webpage\n\tresp, err := http.Get(src)\n\n\tdefer func() {\n\t\t// Notify that we're done after this function\n\t\tchFinished <- true\n\t}()\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\t// fmt.Println(\"ERROR: Failed to crawl \\\"\" + src + \"\\\"\")\n\t\treturn\n\t}\n\n\turlResult := UrlData{sourceUrl: src, sourceID: srcID}\n\n\tb := resp.Body\n\tdefer b.Close() // close Body when the function returns\n\n\t//Open a secondary stream\n\n\tres, err := http.Get(src)\n\n\tc := res.Body\n\tdefer c.Close()\n\n\thtmlData, err := ioutil.ReadAll(c)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error cannot open\")\n\t\treturn\n\t}\n\n\t// Get page size in bytes\n\turlResult.pageSize = len(htmlData)\n\t// Get raw HTML\n\turlResult.rawHTML = string(htmlData)\n\n\ttimeString, err := getLastModifiedTime(src)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\turlResult.lastModified = timeString\n\n\tz := html.NewTokenizer(b)\n\n\tfor {\n\t\ttt := z.Next()\n\n\t\tswitch {\n\t\tcase tt == html.ErrorToken:\n\t\t\t// End of the document, we're done, increment explored pages and return result\n\t\t\tch <- urlResult\n\t\t\tfeedToIndexer(src, srcID, &urlResult, parentID)\n\t\t\texploredPages++\n\t\t\treturn\n\t\tcase tt == html.StartTagToken:\n\t\t\tt := z.Token()\n\n\t\t\t// Check the token tags\n\t\t\tif t.Data == \"a\" {\n\t\t\t\t// Extract the href value, if there is one\n\t\t\t\tok, url := getHref(t)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t//Fix the URL into a absolute and valid form\n\t\t\t\turl = fixURL(url, src)\n\t\t\t\t// Make sure the url begins in http**\n\t\t\t\thasProto := strings.Index(url, \"http\") == 0\n\t\t\t\tif hasProto && len(url) > 0 {\n\t\t\t\t\turlResult.foundUrl = append(urlResult.foundUrl, url)\n\t\t\t\t}\n\t\t\t} else if t.Data == \"title\" {\n\t\t\t\tfor {\n\t\t\t\t\t//Extract the title tag content\n\t\t\t\t\tt := z.Next()\n\t\t\t\t\tif t == html.TextToken {\n\t\t\t\t\t\tu := z.Token()\n\t\t\t\t\t\turlResult.pageTitle += u.Data\n\t\t\t\t\t} else if t == html.EndTagToken {\n\t\t\t\t\t\tu := z.Token()\n\t\t\t\t\t\tif u.Data == \"title\" {\n\t\t\t\t\t\t\t//Finished, end extraction\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n}", "func main() {\n s := new(simpleReader)\n if _, err := s.Fill( os.Stdin ); err != nil {\n fmt.Fprintf( os.Stderr, \"simpleReader: Fill: %v\\n\", err )\n os.Exit( 1 )\n }\n\n doc, err := html.Parse( s )\n if err != nil {\n fmt.Fprintf(os.Stderr, \"findlinks1: %v\\n\", err)\n os.Exit(1)\n }\n for _, link := range visit(nil, doc) {\n fmt.Println(link)\n }\n}", "func (t *Torrent) Read(dict *map[string]interface{}) error {\n\tvar err error\n\n\t// reading the announce-url from bencode metainfo dictionary\n\t// fmt.Println((*dict)[\"announce\"].(string))\n\tt.Announce, err = url.Parse((*dict)[\"announce\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// calculating infohash, a 20-byte long SHA1 hash of bencode encoded\n\t// info value. Every torrent is uniquely identified by its infohash\n\tenc := bencode.Encode((*dict)[\"info\"])\n\thash, err := GetSHA1(enc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.InfoHash = hash\n\n\t// converting info into a dictionary (map[string]interface{})\n\tinfo := (*dict)[\"info\"].(map[string]interface{})\n\n\t// extracting each piece length from\n\t// the decoded info dictionary\n\tt.PieceLen = uint32(info[\"piece length\"].(int64))\n\n\t// concatinated SHA1 hash of all the pieces,\n\t// can be used to extract the number of pieces\n\tpieces := []byte(info[\"pieces\"].(string))\n\n\t// reading pieces from the concatinated hash\n\t// and appending `*Piece` to the `Torrent`\n\tfor i := 0; i+20 <= len(pieces); i += 20 {\n\t\tt.Pieces = append(t.Pieces, &Piece{\n\t\t\tHash: pieces[i : i+20],\n\t\t\tIndex: uint32(i / 20),\n\t\t\tLength: t.PieceLen,\n\t\t})\n\t}\n\n\t// total size of the content, to be downloaded\n\tt.Size = int(t.PieceLen) * len(t.Pieces)\n\n\t// checking if `info[\"files\"]` property exists. If \"yes\" then\n\t// it's a multi file downloader, else single-file downloader\n\tif _, ok := info[\"files\"]; ok {\n\t\tt.Mode = TorrMultiFile // setting file-mode to multi-file enum\n\t\tt.DirName = info[\"name\"].(string) // root directory name\n\n\t\t// converting the value at `info[\"files\"]` into a list\n\t\tfiles := info[\"files\"].([]interface{})\n\t\tdirnm := info[\"name\"].(string)\n\n\t\toff := 0\n\n\t\tfor _, file := range files {\n\t\t\t// converting each element into dictionaries,\n\t\t\t// that describes a single file\n\t\t\tf := file.(map[string]interface{})\n\n\t\t\t// extracting the file path from the\n\t\t\t// list of file and directory names\n\t\t\tvar fp string\n\t\t\tfor _, p := range f[\"path\"].([]interface{}) {\n\t\t\t\tfp = path.Join(fp, p.(string))\n\t\t\t}\n\n\t\t\tlng := int(uint32(f[\"length\"].(int64)))\n\n\t\t\t// appending all the files in `Piles` peroperty of `Torrent`\n\t\t\tt.Files = append(t.Files, &File{\n\t\t\t\tPath: path.Join(dirnm, fp),\n\t\t\t\tStart: off,\n\t\t\t\tLength: lng,\n\t\t\t})\n\n\t\t\toff += lng\n\t\t}\n\t} else {\n\t\tt.Mode = TorrSingleFile // single-file mode\n\n\t\t// appending the single file in `Files` property.\n\t\t// for single-file mode length will always be 1\n\t\tt.Files = append(t.Files, &File{\n\t\t\tPath: info[\"name\"].(string),\n\t\t\tStart: 0,\n\t\t\tLength: int(uint32(info[\"length\"].(int64))),\n\t\t})\n\t}\n\n\treturn nil\n}", "func (p *URLFetcher) run() {\n\tdefer p.onCompletion()\n\treq, err := http.NewRequest(\"GET\", p.urlEntry.url.String(), nil)\n\tif err != nil {\n\t\t//wrong format, don't have to reinsert the URL for retry\n\t\t//p.err = err\n\t\treturn\n\t}\n\t//req.Header.Set(\"Connection\", \"close\")\n\tctx, cancel := context.WithTimeout(p.ctx, p.timeout)\n\tdefer cancel()\n\treq.WithContext(ctx)\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn\n\tdefault:\n\t\tresp, err := p.client.Do(req)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Http Connection Error (Retry Scheduled) : \", err)\n\t\t\tp.genNewURLEntry(p.urlEntry)\n\t\t\t//p.err = err\n\t\t\treturn\n\t\t}\n\t\tp.processPage(resp)\n\t}\n}", "func (f *Fast) GetUrls() (urls []string, err error) {\n\tr := rq.Get(f.url)\n\tr.Qs(\"https\", \"true\")\n\tr.Qs(\"token\", f.token)\n\tr.Qs(\"urlCount\", strconv.Itoa(f.urlCount))\n\n\t_, res, err := f.client.Send(r, false)\n\tif err != nil {\n\t\terr = errInternet\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\n\turls = pickjson.PickString(res.Body, \"url\", 0)\n\tdebug.Info(\"urls:\", len(urls))\n\treturn\n}", "func extractAllLinks(body io.ReadCloser) ([]string, error) {\n\tlinks := make([]string, 0, 20)\n\n\tb, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn links, err\n\t}\n\n\texp := regexp.MustCompile(`(?:document.location(?:.href)?|href)\\s?=\\s?(?:\"|')([^\"]*)(?:\"|')`)\n\n\t// Strip 'key' values returned by FindAllStringSubmatch\n\tfor _, arr := range exp.FindAllStringSubmatch(string(b), -1) {\n\t\tlinks = append(links, arr[1])\n\t}\n\n\treturn links, nil\n}", "func (w *Watcher) readEvents() {\n\tdefer close(w.doneResp)\n\tdefer close(w.Errors)\n\tdefer close(w.Events)\n\n\tfor {\n\t\tfor path, eTag := range w.paths {\n\t\t\tcleanPath := strings.Split(path, \"s3://\")[1]\n\t\t\tpSplit := strings.Split(cleanPath, \"/\")\n\t\t\tbucket, key := pSplit[0], strings.Join(pSplit[1:], \"/\")\n\n\t\t\tinput := &s3.HeadObjectInput{\n\t\t\t\tBucket: aws.String(bucket),\n\t\t\t\tKey: aws.String(key),\n\t\t\t}\n\t\t\tresult, err := w.svc.HeadObject(input)\n\t\t\tif err != nil {\n\t\t\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase w.Errors <- aerr:\n\t\t\t\t\tcase <-w.done:\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase w.Errors <- err:\n\t\t\t\t\tcase <-w.done:\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\tcurrentETag := *result.ETag\n\t\t\tif currentETag != eTag {\n\t\t\t\tevent := newEvent(path)\n\t\t\t\tw.paths[path] = currentETag\n\t\t\t\tselect {\n\t\t\t\tcase w.Events <- event:\n\t\t\t\tcase <-w.done:\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(5 * time.Second)\n\t}\n}", "func (u *URLMapper) loadRules(reader io.Reader) error {\n\tdata, err := io.ReadAll(reader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trulesText := strings.TrimSpace(string(data))\n\n\tu.rules = make(map[string]string)\n\n\tfor _, row := range strings.Split(rulesText, \"\\n\") {\n\t\trow = strings.TrimSpace(row)\n\t\turls := strings.Split(row, \" \")\n\t\tif len(urls) != 2 {\n\t\t\treturn fmt.Errorf(\"bad row %s\", row)\n\t\t}\n\n\t\tfrom, to := strings.TrimSpace(urls[0]), strings.TrimSpace(urls[1])\n\t\tu.rules[from] = to\n\t}\n\treturn nil\n}", "func (c *crawlerDS) parseLinks(data *string, pageURL string, index int, shutdown *chan int) {\n\n\tdefer wg.Done()\n\tu, err := url.Parse(pageURL)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tre := regexp.MustCompile(\"href=\\\"(.*?)\\\"\")\n\tsubre := regexp.MustCompile(\"\\\"/[\\\\w]+\")\n\n\tmatchLink := re.FindAllStringSubmatch(string(*data), -1)\n\tfor _, lk := range matchLink {\n\n\t\tif subre.MatchString(lk[0]) && lk[1] != pageURL {\n\t\t\turl := pageURL + lk[1]\n\t\t\tscheme, _ := c.parseURL(url)\n\n\t\t\tif scheme {\n\t\t\t\tc.pushURLToWaitingList(url, index, shutdown)\n\t\t\t}\n\n\t\t} else if strings.Contains(lk[1], u.Hostname()) {\n\t\t\tscheme, host := c.parseURL(lk[1])\n\t\t\tinit, _ := url.Parse(pageURL)\n\n\t\t\tif scheme && host != init.Host {\n\t\t\t\tc.pushURLToWaitingList(lk[1], index, shutdown)\n\t\t\t}\n\t\t}\n\t}\n}", "func EachReadEntry(gs GraphStore, req *spb.ReadRequest, f func(*spb.Entry) error) error {\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tentries := make(chan *spb.Entry)\n\tvar iterErr error\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor entry := range entries {\n\t\t\tif iterErr != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\titerErr = f(entry)\n\t\t}\n\t}()\n\n\tif req == nil {\n\t\treq = &spb.ReadRequest{}\n\t}\n\terr := gs.Read(req, entries)\n\tclose(entries)\n\twg.Wait()\n\tif iterErr != nil {\n\t\treturn iterErr\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read error: %v\", err)\n\t}\n\treturn nil\n}", "func (c *Client) processStream(baseURL *url.URL, path string, authHandler AuthHandler, callb func(interface{}) error, data interface{}) error {\n\tvar requestUrl string\n\n\tif q := strings.Index(path, \"?\"); q > 0 {\n\t\trequestUrl = baseURL.Scheme + \"://\" + baseURL.Host + path[:q] + \"?\" + path[q+1:]\n\t} else {\n\t\trequestUrl = baseURL.Scheme + \"://\" + baseURL.Host + path\n\t}\n\n\treq, err := http.NewRequest(\"GET\", requestUrl, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = maybeAddAuth(req, authHandler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := doHTTPRequest(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer res.Body.Close()\n\tif res.StatusCode != 200 {\n\t\tbod, _ := ioutil.ReadAll(io.LimitReader(res.Body, 512))\n\t\treturn fmt.Errorf(\"HTTP error %v getting %q: %s\",\n\t\t\tres.Status, requestUrl, bod)\n\t}\n\n\treader := bufio.NewReader(res.Body)\n\tfor {\n\t\tbs, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(bs) == 1 && bs[0] == '\\n' {\n\t\t\tcontinue\n\t\t}\n\n\t\terr = json.Unmarshal(bs, data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = callb(data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n\n}", "func (f realFetcher) Fetch(urlToFetch string) (string, []string, error) {\n\tf.guard <- struct{}{}\n\tdefer func() {\n\t\t<-f.guard\n\t}()\n\n\tdomain, _ := getDomainFromURL(urlToFetch)\n\tresults := make([]string, 0, maxLinksScraped)\n\tlinksScraped := 0\n\tresp, err := f.client.Get(urlToFetch)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn \"\", nil, err\n\t}\n\n\tdefer func() {\n\t\tresp.Body.Close()\n\t}()\n\n\tz := html.NewTokenizer(resp.Body)\n\n\tfor {\n\t\ttt := z.Next()\n\n\t\tswitch tt {\n\t\tcase html.ErrorToken:\n\t\t\treturn \"\", results, nil\n\t\tcase html.StartTagToken:\n\n\t\t\ttn, _ := z.TagName()\n\t\t\tif len(tn) == 1 && tn[0] == 'a' {\n\t\t\t\t// Scan anchor tag for href attribute\n\t\t\t\tkey, val, moreAttrs := z.TagAttr()\n\t\t\t\tfor {\n\n\t\t\t\t\tif string(key) == \"href\" {\n\t\t\t\t\t\tif isHTTP, _ := regexp.Match(`https?://.*`, val); isHTTP {\n\t\t\t\t\t\t\tchildDomain, err := getDomainFromURL(string(val))\n\n\t\t\t\t\t\t\t// Check if the url was valid (html document could always be bad)\n\t\t\t\t\t\t\t// Then check that the domain is different from our parent\n\t\t\t\t\t\t\tif err == nil && domain != childDomain {\n\t\t\t\t\t\t\t\tresults = append(results, string(val))\n\t\t\t\t\t\t\t\tlinksScraped++\n\t\t\t\t\t\t\t\tif linksScraped >= maxLinksScraped {\n\t\t\t\t\t\t\t\t\treturn \"\", results, nil\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Stop reading attributes once we get to the href attribute\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif !moreAttrs {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tkey, val, moreAttrs = z.TagAttr()\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "func MapHandler(pathsToUrls map[string]string) func(string) (string, bool) {\n\treturn func(path string) (string, bool) {\n\t\turl, exists := pathsToUrls[path]\n\t\tfmt.Println(pathsToUrls[path])\n\t\treturn url, exists\n\t}\n}", "func crawl(urlSet *concurrentStorage, ch chan url.URL){\n\tfor {\n\t\tselect {\n\t\tcase u := <- ch:\n\t\t\tif ok := urlSet.add(u); ok {\n\t\t\t\tlog.Printf(\"Received url=%s\", u.String())\n\t\t\t\turls, err := scrape(u)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Could not scrape url=%s.\\nError: %s\", u.String(), err)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tfor _, url := range urls {\n\t\t\t\t\tgo \tfunc() {ch <- url}()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (fp *FileParser) ReadAll(callback func(interface{}) error) error {\n\tfor {\n\t\tgot, err := fp.Read()\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := callback(got); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "func read(path string) ([]io.Reader, error) {\n\tif path == \"-\" {\n\t\treturn []io.Reader{os.Stdin}, nil\n\t}\n\n\tif url, ok := toURL(path); ok {\n\t\tif strings.ToLower(url.Scheme) != \"https\" {\n\t\t\treturn nil, fmt.Errorf(\"only HTTPS URLs are allowed\")\n\t\t}\n\t\tresp, err := http.Get(url.String())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn nil, fmt.Errorf(\"unable to read URL %q, server reported %s, status code=%d\", path, resp.Status, resp.StatusCode)\n\t\t}\n\n\t\t// Save to a buffer, so that response can be closed here\n\t\tbuf := new(bytes.Buffer)\n\t\t_, err = buf.ReadFrom(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn []io.Reader{buf}, nil\n\t}\n\n\treturn walk(path)\n}", "func (r *Paths) Lookup(url string) (interface{}, Params) {\n\tparts := splitter(url) // нормализуем путь и разбиваем его на части\n\t// сначала ищем среди статических путей; если статические пути не\n\t// определены, то пропускаем проверку\n\tif r.static != nil {\n\t\tif handler, ok := r.static[strings.Join(parts, PathDelimeter)]; ok {\n\t\t\treturn handler, nil\n\t\t}\n\t}\n\t// если пути с параметрами не определены, то на этом заканчиваем проверку\n\tif r.fields == nil {\n\t\treturn nil, nil\n\t}\n\tlength := uint16(len(parts)) // вычисляем количество элементов пути\n\t// наши определения могут быть короче, если используются catchAll параметры,\n\t// поэтому вычисляем с какой длины начинать\n\tvar total uint16\n\t// если длина запроса больше максимальной длины определений, то нужно\n\t// замахиваться на меньшее...\n\tif length > r.maxParts {\n\t\t// если нет динамических параметров, то ничего и не подойдет,\n\t\t// потому что наш запрос явно длиннее\n\t\tif r.catchAll == 0 {\n\t\t\treturn nil, nil\n\t\t}\n\t\ttotal = r.maxParts // начнем с максимального определения пути\n\t} else {\n\t\ttotal = length // наш запрос короче самого длинного определения\n\t}\n\t// запрашиваем список обработчиков для такого же количества элементов пути\n\tfor l := total; l > 0; l-- {\n\t\trecords := r.fields[l] // получаем определения путей для данной длины\n\t\t// если обработчики для такой длины пути не зарегистрированы, то...\n\t\tif len(records) == 0 {\n\t\t\t// проверяем, что на этом уровне динамические пути еще встречаются\n\t\t\tif l < r.catchAll {\n\t\t\t\tbreak // больше нет динамических параметров дальше\n\t\t\t}\n\t\t\t// переходим к более короткому пути\n\t\t\tcontinue\n\t\t}\n\tnextRecord:\n\t\t// обработчики есть — перебираем все записи с ними\n\t\tfor _, record := range records {\n\t\t\t// если наш путь длиннее обработчика, а он не содержит catchAll\n\t\t\t// параметра, то он точно нам не подойдет\n\t\t\tif l < length && record.params>>15 != 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// здесь мы будем собирать значения параметров к данному запросу\n\t\t\t// если ранее они были не пустые от другого обработчика, то\n\t\t\t// сбрасываем их\n\t\t\tvar params Params\n\t\t\t// перебираем все части пути, заданные в обработчике\n\t\t\tfor i, part := range record.parts {\n\t\t\t\tif strings.HasPrefix(part, NamedParamFlag) {\n\t\t\t\t\t// это одиночный параметр\n\t\t\t\t\tparams = append(params, Param{\n\t\t\t\t\t\tKey: strings.TrimPrefix(part, NamedParamFlag),\n\t\t\t\t\t\tValue: parts[i],\n\t\t\t\t\t})\n\t\t\t\t} else if strings.HasPrefix(part, CatchAllParamFlag) {\n\t\t\t\t\t// это параметр, который заберет все\n\t\t\t\t\tparams = append(params, Param{\n\t\t\t\t\t\tKey: strings.TrimPrefix(part, CatchAllParamFlag),\n\t\t\t\t\t\t// добавляем весь оставшийся путь\n\t\t\t\t\t\tValue: strings.Join(parts[i:], PathDelimeter),\n\t\t\t\t\t})\n\t\t\t\t\tbreak // больше ловить нечего — нашли\n\t\t\t\t} else if part != parts[i] {\n\t\t\t\t\t// статическая часть пути не совпадает с запрашиваемой\n\t\t\t\t\tcontinue nextRecord // переходим к следующему обработчику\n\t\t\t\t}\n\t\t\t}\n\t\t\t// возвращаем найденный обработчик и заполненные параметры\n\t\t\treturn record.handler, params\n\t\t}\n\t}\n\t// сюда мы попадаем, если так ничего подходящего и не нашли\n\treturn nil, nil\n}", "func (l *InfosT) URLByKey(argKey string) string {\n\tret := l.ByKey(argKey)\n\treturn ret.Urls[0]\n}", "func ReadURLContents(targetURL string) ([]byte, error) {\n\tresp, err := http.Get(targetURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"request failed: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"response status code is %v\", resp.StatusCode)\n\t}\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading response body failed: %v\", err)\n\t}\n\n\treturn b, nil\n}", "func fetchUrlInfo(urlStr string) (urlInfoType, bool) {\n\tvar urlInfo urlInfoType\n\tvar err error\n\n\turlInfo.urlData, err = url.Parse(urlStr)\n\tif err != nil {\n\t\treturn urlInfo, false\n\t}\n\tif urlInfo.urlData.Scheme == \"\" {\n\t\tlogMsg(\"No protocol specified.. assuming http...\")\n\t\turlInfo.urlData.Scheme = \"http\"\n\t}\n\tif urlInfo.urlData.Scheme != \"http\" {\n\t\tlogMsg(\"URL:\", urlStr)\n\t\tlogMsg(\"Only HTTP URLs supported...\")\n\t\treturn urlInfo, false\n\t}\n\tif !strings.ContainsAny(urlInfo.urlData.Host, \":\") {\n\t\tif urlInfo.urlData.Scheme == \"http\" {\n\t\t\turlInfo.urlData.Host += \":80\"\n\t\t} else if urlInfo.urlData.Scheme == \"https\" {\n\t\t\turlInfo.urlData.Host += \":443\"\n\t\t} else {\n\t\t\tlogMsg(\"Dunno default port for Protocol:\", urlInfo.urlData.Scheme)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\tif urlInfo.urlData.Fragment != \"\" {\n\t\tlogMsg(\"Ignoring url Fragment:\", urlInfo.urlData.Fragment)\n\t}\n\tlogMsg(\"URL:\", urlStr)\n\tres, err := http.Head(urlStr)\n\tif err != nil {\n\t\tlogMsg(\"Could not get Header...\")\n\t\treturn urlInfo, false\n\t}\n\t//logMsg(\"Status:\", res.Status)\n\t// May be there are other successful codes ??\n\tif res.Status != \"200 OK\" {\n\t\tlogMsg(res)\n\t\treturn urlInfo, false\n\t}\n\tsize := res.Header[\"Content-Length\"]\n\tfileSize, _ := strconv.Atoi(size[0])\n\turlInfo.FileSize = uint(fileSize)\n\turlPieces := strings.Split(urlInfo.urlData.Path, \"/\")\n\turlInfo.FileName = urlPieces[len(urlPieces)-1]\n\t//logMsg(urlInfo)\n\treturn urlInfo, true\n}", "func lookupLinks() {\n\tlog.Printf(\"looking up links...\")\n\n\tclient := http.Client{\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn NoRedirects\n\t\t},\n\t}\n\n\tfor link := range links {\n\t\tresp, err := client.Head(link)\n\t\tif !errors.Is(err, NoRedirects) {\n\t\t\tlog.Printf(\"error fetching %s: %v\", link, err)\n\t\t\tcontinue\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tlocation, err := resp.Location()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error getting location %s: %v\", link, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(location.String(), \"https://github.com/\") {\n\t\t\tpath := strings.Split(strings.TrimPrefix(location.String(), \"https://github.com/\"), \"/\")\n\n\t\t\tif len(path) >= 2 {\n\t\t\t\thits <- path[0] + \"/\" + path[1]\n\t\t\t}\n\t\t}\n\t}\n}", "func recupURLsFromConfig(config Config) (URLs []string) {\n\n\t//recup the different urls from the config file\n\turlString := strings.TrimLeft(config.URL, \"[\")\n\turlString = strings.TrimRight(urlString, \"]\")\n\tURLs = strings.Split(urlString, \",\")\n\n\t// save to slice\n\tfor i := 0; i < len(URLs); i++ {\n\t\tURLs[i] = strings.TrimSpace(URLs[i])\n\t}\n\n\t// if no MPD urls passed in, stop the app\n\tif URLs == nil {\n\t\tfmt.Println(\"No urls has been found in the config file\")\n\t\t// stop the app\n\t\tutils.StopApp()\n\t}\n\n\treturn\n}", "func (f fakeFetcher) Fetch(url string) (string, []string, error) {\n\tif res, ok := f[url]; ok {\n\t\treturn res.body, res.urls, nil\n\t}\n\treturn \"\", nil, fmt.Errorf(\"not found: %s\", url)\n}", "func visit(url string) ([]string, error) {\n\tvar links []string\n\n\tif !urlRegex.MatchString(url) {\n\t\treturn links, fmt.Errorf(\"Not a valid url to visit : %s\", url)\n\t}\n\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn links, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tresp.Body.Close()\n\t\treturn links, fmt.Errorf(\"Received status code %s when fetching url %s\", resp.Status, url)\n\t}\n\n\tdoc, err := html.Parse(resp.Body)\n\tresp.Body.Close()\n\tif err != nil {\n\t\treturn links, err\n\t}\n\n\tlinks = traverse(doc, nil)\n\treturn links, nil\n}", "func crawl(uri string, ch chan string, chFinished chan bool) {\n\tgivenUrl, err := url.Parse(uri)\n\tif err != nil {\n\t\tfmt.Println(\"Given URL does not look valid \" + uri)\n\t\treturn\n\t}\n\tresp, err := http.Get(uri)\n\n\tdefer func() {\n\t\tchFinished <- true\n\t}()\n\n\tif err != nil {\n\t\tfmt.Println(\"Failed to crawl \" + uri)\n\t\treturn\n\t}\n\n\tb := resp.Body\n\tdefer b.Close()\n\n\tz := html.NewTokenizer(b)\n\n\tfor {\n\t\ttt := z.Next()\n\n\t\tswitch {\n\t\tcase tt == html.ErrorToken:\n\t\t\t// we're done\n\t\t\treturn\n\t\tcase tt == html.StartTagToken:\n\t\t\tt := z.Token()\n\n\t\t\t// Check if the token is an <a> tag\n\t\t\tisAnchor := t.Data == \"a\"\n\t\t\tif !isAnchor {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\teurl := fetcher.ExtractLink(t)\n\t\t\tif eurl == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\textractedUrl, _ := url.Parse(eurl)\n\n\t\t\t// Ignore external or relative links\n\t\t\tif extractedUrl.IsAbs() && extractedUrl.Host == givenUrl.Host {\n\t\t\t\tch <- eurl\n\t\t\t}\n\t\t}\n\t}\n}", "func getURLsfromPage( url string ) ([]string, error) {\n\n\turlList := []string{}\n\tcontents, err := downloadContentsfromURL(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// regular.\n\tchecker := regexp.MustCompile(urlRegex)\n\tdoesMatch := checker.MatchString( contents)\n\tif doesMatch {\n\t\turlList = checker.FindAllString(contents,100)\n\t}\n\tuniqueList := uniqueStringList(urlList)\n\n\n return uniqueList, nil\n}", "func FetchAll(urls []string, c *Client) {\r\n\tfor _, url := range urls {\r\n\t\tgo c.AsyncGet(url)\r\n\t}\r\n}", "func (client *Client) Read() {\n\tvar message Message\n\tfor {\n\t\tif err := client.socket.ReadJSON(&message); err != nil {\n\t\t\tbreak\n\t\t}\n\t\t// Call findHandler to know which handler to call. If handler in router map value matches key then call it.\n\t\tif handler, found := client.findHandler(message.Name); found {\n\t\t\thandler(client, message.Data)\n\t\t}\n\t}\n\t// close connection once finished.\n\tclient.socket.Close()\n}", "func ReadAllLinks(filter ...string) []*LinkObj {\n\tLog.Warnln(filter)\n\tdb := GetDbConnection(\"sqlite3\", \"bot.db\")\n\tdefer db.Close()\n\t// rows, er := db.Queryx(\"select * from link_store\")\n\tlinks := []*LinkObj{}\n\tvar er error\n\tif len(filter) == 0 {\n\t\ter = db.Select(&links, \"select * from link_store\")\n\t} else {\n\t\ter = db.Select(&links, \"select * from link_store where descrip like $1\", \"%\"+filter[0]+\"%\")\n\t}\n\n\tif er != nil {\n\t\tLog.Errorln(errors.Wrap(er, \"Unable to fetch link_store\"))\n\t}\n\tLog.Warnln(links)\n\tfor _, link := range links {\n\t\tLog.Infoln(link.Username)\n\t\tLog.Infoln(link.Descrip)\n\t\tLog.Infoln(link.Link)\n\t\tLog.Infoln(link.ID)\n\t}\n\treturn links\n}", "func URLs(dir string, skip bool) error {\n\turls := []string{federalRevenueURL, nationalTreasureBaseURL}\n\thandlers := []getURLsHandler{federalRevenueGetURLsNoUpdatedAt, nationalTreasureGetURLs}\n\tvar out []string\n\tfor idx := range urls {\n\t\tu, err := getURLs(urls[idx], handlers[idx], dir, skip)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error gathering resources for download: %w\", err)\n\t\t}\n\t\tout = append(out, u...)\n\t}\n\tsort.Strings(out)\n\tfmt.Println(strings.Join(out, \"\\n\"))\n\treturn nil\n}", "func getTitles(urls ...string) <-chan string {\n\tch := make(chan string)\n\n\tfor _, url := range urls {\n\n\t\tgo func(urlParam string) { // Calling an anonymous function in a go routine\n\t\t\tresp, _ := http.Get(urlParam)\n\t\t\thtml, _ := ioutil.ReadAll(resp.Body)\n\t\t\tregX, _ := regexp.Compile(\"<title.*?>(.*?)<\\\\/title>\")\n\t\t\tmatches := regX.FindStringSubmatch(string(html))\n\n\t\t\tch <- matches[1]\n\t\t}(url) // Passing each URL in URLs array\n\t}\n\n\treturn ch\n}", "func parseSite(ctx context.Context, uri string, word string, result chan<- SiteData) {\n\tres, err := request(ctx, uri)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tif findOccurance(res, word) {\n\t\tresult <- SiteData{data: res, uri: uri}\n\t\tfmt.Println(fmt.Sprintf(\"'%v' string is found in: %v\", word, uri))\n\t\treturn\n\t}\n\n\tfmt.Println(\"Nothing found in: \", uri)\n}", "func main() {\n\t// read a bunch of urls from the file \"urls.txt\" from the current directory\n\t// create a data slice of []strings\n\turls := []string{}\n file, err := os.Open(\"urls.txt\")\n if err != nil {\n log.Fatal(err)\n }\n defer file.Close()\n\n scanner := bufio.NewScanner(file)\n for scanner.Scan() {\n line := scanner.Text()\n urls = append(urls, line)\n }\n\t// Create our input and output channels, with *Resoruces. Pending is for Poll to check status, while complete, as the name suggest is you're done with the Resource\n\t// The channels provide the means of communication between the main, Poller, and StateMonitor goroutines.\n\tpending, complete := make(chan *Resource), make(chan *Resource)\n\t// Launch the StateMonitor, with its goroutine, and its return value of status channel is saved and used in the Poller\n\t// the argument to StateMonitor is the constant time interval defined above.\n\tstatus := StateMonitor(statusInterval)\n\t// Launch some Poller goroutines. Ths is the where the Pollers do their job. It passes the necessary channels it\n\t// needs for sharing *Resouce. Note again, share memory by communicaitng. \n\tfor i := 0; i < numPollers; i++ {\n\t\tgo Poller(pending, complete, status)\n\t}\n\n\t// Send some Resources to the pending queue.\n\tgo func() {\n\t\tfor _, url := range urls {\n\t\t\tpending <- &Resource{url: url}\n\t\t}\n\t}()\n\n\tfor r := range complete {\n\t\tgo r.Sleep(pending)\n\t}\n}", "func FetchAll(urls []string, c *Client) {\n\tfor _, url := range urls {\n\t\tgo c.AsyncGet(url)\n\t}\n}", "func (s *Spider) crawl(fetcher Fetcher) error {\n\tfor !s.Queue.IsEmpty() {\n\t\t// get next item from queue\n\t\tp, ok := s.Queue.Dequeue()\n\t\tif !ok {\n\t\t\treturn errors.New(\"crawl dequeue error: expected a page, got none\")\n\t\t}\n\t\t// if a depth value was passed and the distance is > depth, we are done\n\t\t// depth of 0 means no limit\n\t\tif s.maxDepth != -1 && p.(Page).distance > s.maxDepth {\n\t\t\treturn nil\n\t\t}\n\t\tpage := p.(Page)\n\t\t// see if this is an external url\n\t\tif s.externalURL(page.URL) {\n\t\t\tif s.Config.CheckExternalLinks {\n\t\t\t\ts.fetchExternalLink(page.URL)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// check to see if this url should be skipped for other reasons\n\t\tif s.skip(page.URL) {\n\t\t\t// see if the skipped is external and process accordingly\n\t\t\tcontinue\n\t\t}\n\t\ts.foundURLs[page.URL.String()] = struct{}{}\n\t\t// get the url\n\t\tr := ResponseInfo{}\n\t\tpage.body, r, page.links = fetcher.Fetch(page.URL.String())\n\t\t// add the page and status to the map. map isn't checked for membership becuase we don't\n\t\t// fetch found urls.\n\t\ts.Lock()\n\t\ts.Pages[page.URL.String()] = page\n\t\ts.fetchedURLs[page.URL.String()] = r\n\t\ts.Unlock()\n\t\t// add the urls that the node contains to the queue\n\t\tfor _, l := range page.links {\n\t\t\tu, _ := url.Parse(l)\n\t\t\ts.Queue.Enqueue(Page{URL: u, distance: page.distance + 1})\n\t\t}\n\t\t// if there is a wait between fetches, sleep for that + random jitter\n\t\tif s.Config.FetchInterval > 0 {\n\t\t\twait := s.Config.FetchInterval\n\t\t\t// if there is a value for jitter, add a random jitter\n\t\t\tif s.Config.Jitter > 0 {\n\t\t\t\tn := s.Config.Jitter.Nanoseconds()\n\t\t\t\tn = rand.Int63n(n)\n\t\t\t\twait += time.Duration(n) * time.Nanosecond\n\t\t\t}\n\t\t\ttime.Sleep(wait)\n\t\t}\n\t}\n\treturn nil\n}", "func scrape(u url.URL) ([]url.URL, error) {\n\n\tif strings.Trim(u.String(), \" \") == \"\"{\n\t\treturn []url.URL{}, errors.New(\"empty url\")\n\t}\n\n\tpageReadCloser, err := getHttp(u)\n\tdefer pageReadCloser.Close()\n\tif err != nil {\n\t\tlog.Printf(\"failed to get pageReadCloser at u=%s. err=%s\\n\", u, err)\n\t\treturn []url.URL{}, nil\n\t}\n\n\tpage, err := ioutil.ReadAll(pageReadCloser)\n\tif err != nil {\n\t\tlog.Printf(\"Could not read page buffer for url=%s\\n\", u.String())\n\t\treturn []url.URL{}, err\n\t}\n\n\tsavePage(u, page)\n\n\turls, err := getUrls(page, u.Host)\n\tif err != nil {\n\t\tlog.Printf(\"failed to extract valid urls for pageReadCloser at u=%s. err=%s\\n\", u, err)\n\t\treturn []url.URL{}, err\n\t}\n\n\treturn urls, nil\n}", "func hrefs(r io.Reader, baseURL string) (res []string) {\n\tlinks, _ := link.Parse(r)\n\tfor _, l := range links {\n\t\tswitch {\n\t\tcase strings.HasPrefix(l.Href, \"/\"):\n\t\t\tres = append(res, baseURL+l.Href)\n\t\tcase strings.HasPrefix(l.Href, \"http\"):\n\t\t\tres = append(res, l.Href)\n\t\t}\n\t}\n\treturn\n}", "func (parse *BinaryPorotolParse) Retrieval(keys []string) (items map[string]common.Item) {\n\t// result set of items\n\titems = make(map[string]common.Item)\n\n\tif len(keys) == 0 {\n\t\treturn\n\t}\n\n\tkeyMap := make(map[int][]string)\n\n\t// if a key has the same index, they will put together.\n\tfor _, key := range keys {\n\t\tif index, err := parse.pool.GetNode(key); err != nil {\n\t\t\treturn\n\t\t} else {\n\t\t\t// same index, same slice\n\t\t\tif ks, ok := keyMap[index]; ok {\n\t\t\t\tkeyMap[index] = append(ks, key)\n\t\t\t} else {\n\t\t\t\tks = make([]string, 0, 5)\n\t\t\t\tkeyMap[index] = append(ks, key)\n\t\t\t}\n\t\t}\n\t}\n\n\t// send the get command line, and parse response\n\tLoopOut:\n\tfor i, ks := range keyMap {\n\t\t// get connect by key\n\t\tconn, err := parse.pool.Get(ks[0])\n\n\t\tif err != nil || conn.Index != i {\n\t\t\tcontinue LoopOut\n\t\t}\n\n\t\tloopCount := len(ks) - 1\n\t\t\n\t\tfor j := 0; j <= loopCount; j++ {\n\t\t\treqPacket := &packet{\n\t\t\t\tmagic : reqMagic,\n\t\t\t\tkeyLength : uint16(len(ks[j])),\n\t\t\t\tkey : []byte(ks[j]),\n\t\t\t\ttotalBodyLength: uint32(len(ks[j])),\n\t\t\t}\n\n\t\t\t//the first n-1 being getkq, the last being a regular getk\n\t\t\tif j < loopCount {\n\t\t\t\treqPacket.opcode = GetKQ\n\t\t\t} else {\n\t\t\t\treqPacket.opcode = GetK\n\t\t\t}\n\n\t\t\tif err := parse.fillPacket(reqPacket, conn); err != nil {\n\t\t\t\tparse.release(conn, true)\n\t\t\t\tcontinue LoopOut\n\t\t\t}\n\t\t}\n\n\t\t// send content to memcached server\n\t\tif err := conn.Flush(); err != nil {\n\t\t\tparse.release(conn, true)\n\t\t\tcontinue LoopOut\n\t\t}\n\n\t\t// receive response from memcached server\n\t\tfor j := 0; j <= loopCount; j++ {\n\t\t\tresPacket, err := parse.parsePacket(conn)\n\t\t\tif err != nil {\n\t\t\t\tparse.release(conn, true)\n\t\t\t\tcontinue LoopOut\n\t\t\t}\n\n\t\t\tif err := parse.checkError(resPacket.statusOrVbucket); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// fill item\n\t\t\titem := &common.BinaryItem{BCas:resPacket.cas}\n\n\t\t\tif resPacket.keyLength > 0 {\n\t\t\t\titem.BKey = string(resPacket.key)\n\t\t\t}\n\n\t\t\tif len(resPacket.value) > 0 {\n\t\t\t\titem.BValue = make([]byte, len(resPacket.value))\n\t\t\t\tcopy(item.BValue, resPacket.value)\n\t\t\t}\n\n\t\t\tif resPacket.extrasLength > 0 {\n\t\t\t\titem.BFlags = binary.BigEndian.Uint32(resPacket.extras)\n\t\t\t}\n\n\t\t\titems[item.BKey] = item\n\n\t\t\t// if the item is the last one, done!\n\t\t\tif item.BKey == ks[loopCount] {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tparse.release(conn, false)\n\t}\n\n\treturn\n}", "func process(job *Job) (Result, error) {\n\tvar result Result\n\tresult.Host = job.URL\n\tresult.Matches = make([]Match, 0)\n\tvar err error\n\n\tvar cookies []*http.Cookie\n\tvar cookiesMap = make(map[string]string)\n\tvar body []byte\n\tvar headers http.Header\n\n\t// get response from host if allowed\n\tif job.forceNotDownload {\n\t\tbody = job.Body\n\t\theaders = job.Headers\n\t\tcookies = job.Cookies\n\t} else {\n\t\tresp, err := fetchHost(job.URL)\n\t\tif err != nil {\n\t\t\tresult.Error = fmt.Sprintf(\"%s\", err)\n\t\t\treturn result, fmt.Errorf(\"Failed to retrieve\")\n\t\t}\n\n\t\tdefer resp.Body.Close()\n\n\t\tbody, err = ioutil.ReadAll(resp.Body)\n\t\tif err == nil {\n\t\t\theaders = resp.Header\n\t\t\tcookies = resp.Cookies()\n\t\t}\n\t}\n\n\tfor _, c := range cookies {\n\t\tcookiesMap[c.Name] = c.Value\n\t}\n\n\tdoc, err := goquery.NewDocumentFromReader(bytes.NewReader(body))\n\tif err != nil {\n\t\tresult.Error = fmt.Sprintf(\"%s\", err)\n\t\treturn result, err\n\t}\n\n\t// handle crawling\n\tif job.Crawl > 0 {\n\t\tbase, _ := url.Parse(job.URL)\n\n\t\tfor c, link := range parseLinks(doc, base) {\n\t\t\tif c >= job.Crawl {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\twa.schedule(NewOnlineJob(link, \"\", nil, 0))\n\t\t}\n\t\twa.wgJobs.Done()\n\t}\n\n\tvar title, keywords, descripiton string\n\t//查找网页标题、关键词、描述\n\ttitle = doc.Find(\"title\").First().Text()\n\n\tdoc.Find(\"meta\").Each(func(i int, s *goquery.Selection) {\n\t\tname := s.AttrOr(\"name\", \"\")\n\t\tif name == \"keywords\" {\n\t\t\tkeywords = s.AttrOr(\"content\", \"\")\n\t\t} else if name == \"description\" {\n\t\t\tdescripiton = s.AttrOr(\"content\", \"\")\n\t\t}\n\t})\n\n\tresult.WebTitle = title\n\tresult.WebKeywords = keywords\n\tresult.WebDesc = descripiton\n\n\tfor appname, app := range AppDefs.Apps {\n\t\t// TODO: Reduce complexity in this for-loop by functionalising out\n\t\t// the sub-loops and checks.\n\n\t\tfindings := Match{\n\t\t\tApp: app,\n\t\t\tAppName: appname,\n\t\t\tMatches: make([][]string, 0),\n\t\t}\n\n\t\t// check raw html\n\t\tif m, v := findMatches(string(body), app.HTMLRegex); len(m) > 0 {\n\t\t\tfindings.Matches = append(findings.Matches, m...)\n\t\t\tfindings.updateVersion(v)\n\t\t}\n\n\t\t// check response header\n\t\theaderFindings, version := app.FindInHeaders(headers)\n\t\tfindings.Matches = append(findings.Matches, headerFindings...)\n\t\tfindings.updateVersion(version)\n\n\t\t// check url\n\t\tif m, v := findMatches(job.URL, app.URLRegex); len(m) > 0 {\n\t\t\tfindings.Matches = append(findings.Matches, m...)\n\t\t\tfindings.updateVersion(v)\n\t\t}\n\n\t\t// check script tags\n\t\tdoc.Find(\"script\").Each(func(i int, s *goquery.Selection) {\n\t\t\tif script, exists := s.Attr(\"src\"); exists {\n\t\t\t\tif m, v := findMatches(script, app.ScriptRegex); len(m) > 0 {\n\t\t\t\t\tfindings.Matches = append(findings.Matches, m...)\n\t\t\t\t\tfindings.updateVersion(v)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\t// check meta tags\n\t\tfor _, h := range app.MetaRegex {\n\t\t\tselector := fmt.Sprintf(\"meta[name='%s']\", h.Name)\n\t\t\tdoc.Find(selector).Each(func(i int, s *goquery.Selection) {\n\t\t\t\tcontent, _ := s.Attr(\"content\")\n\t\t\t\tif m, v := findMatches(content, []AppRegexp{h}); len(m) > 0 {\n\t\t\t\t\tfindings.Matches = append(findings.Matches, m...)\n\t\t\t\t\tfindings.updateVersion(v)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\t// check cookies\n\t\tfor _, c := range app.CookieRegex {\n\t\t\tif _, ok := cookiesMap[c.Name]; ok {\n\n\t\t\t\t// if there is a regexp set, ensure it matches.\n\t\t\t\t// otherwise just add this as a match\n\t\t\t\tif c.Regexp != nil {\n\n\t\t\t\t\t// only match single AppRegexp on this specific cookie\n\t\t\t\t\tif m, v := findMatches(cookiesMap[c.Name], []AppRegexp{c}); len(m) > 0 {\n\t\t\t\t\t\tfindings.Matches = append(findings.Matches, m...)\n\t\t\t\t\t\tfindings.updateVersion(v)\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tfindings.Matches = append(findings.Matches, []string{c.Name})\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif len(findings.Matches) > 0 {\n\t\t\tresult.Matches = append(result.Matches, findings)\n\n\t\t\t// handle implies\n\t\t\tfor _, implies := range app.Implies {\n\t\t\t\tfor implyAppname, implyApp := range AppDefs.Apps {\n\t\t\t\t\tif implies != implyAppname {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tf2 := Match{\n\t\t\t\t\t\tApp: implyApp,\n\t\t\t\t\t\tAppName: implyAppname,\n\t\t\t\t\t\tMatches: make([][]string, 0),\n\t\t\t\t\t}\n\t\t\t\t\tresult.Matches = append(result.Matches, f2)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func jsonURLsHandler(w http.ResponseWriter, r *http.Request) {\n\trunID := r.FormValue(\"runID\")\n\turls, err := resultStore.GetURLs(runID)\n\tif err != nil {\n\t\thttputils.ReportError(w, r, err, fmt.Sprintf(\"Failed to retrieve URLs for run %s\", runID))\n\t}\n\tsendJsonResponse(w, map[string][]map[string]string{\"urls\": urls})\n}", "func (f *FetcherCache) Fetch(url string) (body string, urls []string, err error) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\tfetchResult, isCached := f.Cache[url]\n\tif isCached {\n\t\treturn fetchResult.body, fetchResult.urls, fetchResult.err\n\t}\n\tb, urls, err := f.Delegator.Fetch(url)\n\tf.Cache[url] = &FetchResult{\n\t\tbody: b,\n\t\turls: urls,\n\t\terr: err,\n\t}\n\treturn b, urls, err\n}", "func parse(base *url.URL, in io.Reader) (names []string, err error) {\n\tdoc, err := html.Parse(in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar (\n\t\twalk func(*html.Node)\n\t\tseen = make(map[string]struct{})\n\t)\n\twalk = func(n *html.Node) {\n\t\tif n.Type == html.ElementNode && n.Data == \"a\" {\n\t\t\tfor _, a := range n.Attr {\n\t\t\t\tif a.Key == \"href\" {\n\t\t\t\t\tname, err := parseName(base, a.Val)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tif _, found := seen[name]; !found {\n\t\t\t\t\t\t\tnames = append(names, name)\n\t\t\t\t\t\t\tseen[name] = struct{}{}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor c := n.FirstChild; c != nil; c = c.NextSibling {\n\t\t\twalk(c)\n\t\t}\n\t}\n\twalk(doc)\n\treturn names, nil\n}", "func main(){\n\t// make a request and then the request will return response in bytes\n\t// and error. An error might be empty, for now we define it as underscore\n\t// we can define a variable that you don't intend to use as _ (underscore)\n\n\tresp, _ := http.Get(\"https://www.washingtonpost.com/news-sitemaps/index.xml\")\n\t//unpack it\n\tbytes, _ := ioutil.ReadAll(resp.Body)\n\t// parse to string\n\t// string_body := string(bytes)\n\t// fmt.Println(string_body)\n\tresp.Body.Close()\n\n\tvar s SitemapIndex\n\txml.Unmarshal(bytes, &s) // memory address s\n\n\t// fmt.Println(s.Locations)\n\t// After we know how to loop, we can print all the URLs as multilines of strings\n\tfmt.Printf(\"Here %s some %s\", \"are\",\"variables\")\n\t// we use _, Location because in map in will contain both key and value.\n\t// then _ is the index of the url (key) which we don't want to print and know. \n\t// So, we use _ that we already declared (just to iterate like i or something)\n\t// what we really want is the next one which is the \"value\" or the real url data which uses Location as iterator\n\t// *Note that _, Location = 1, http://...\n\t// *and Location is just a variable which is not associated w/ Location struct.\n\tfor _, Location := range s.Locations {\n\t\tfmt.Printf(\"\\n%s\", Location)\n\t}\n}", "func getURLs(r *build.Rule) []string {\n\turls := r.AttrStrings(\"urls\")\n\tif urls != nil {\n\t\treturn urls\n\t}\n\treturn []string{r.AttrString(\"url\")}\n}", "func GetAnalysisFromFile(search, url string, result map[string]string, key string, flag chan string) {\n\tfilePath := \"pkg/feeds/db/\" + key\n\tfileBytes, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tres := string(fileBytes)\n\t\n\tif strings.Contains(res, search) {\n\t\tresult[key] = \"Malicious\"\n\t} else {\n\t\tresult[key] = \"\"\n\t}\n\tflag <- \"done\"\n}", "func GetAllURL(w http.ResponseWriter, r *http.Request) {\n\t// set headers\n\t// w.Header().Set(\"Content-Type\", \"application/json\")\n\t// w.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET\")\n\n\tif !auth.IsValidToken(r.Header.Get(\"x-auth-token\")) {\n\t\tresp := response{Status: \"error\", Message: \"Invalid Token\"}\n\t\tjson.NewEncoder(w).Encode(resp)\n\t\treturn\n\t}\n\n\tcursor, err := collection.Find(context.TODO(), bson.D{})\n\tif err != nil {\n\t\tlg.WriteError(err.Error())\n\t}\n\tdefer cursor.Close(context.TODO())\n\n\tvar urls []bson.M\n\n\tfor cursor.Next(context.TODO()) {\n\t\tvar url bson.M\n\t\tif err = cursor.Decode(&url); err != nil {\n\t\t\tlg.WriteError(err.Error())\n\t\t}\n\t\turls = append(urls, url)\n\t}\n\n\tjson.NewEncoder(w).Encode(urls)\n}", "func (self *AbtabURL) OpenRead() error {\n\tswitch {\n\tcase \"\" == self.Url.Scheme:\n\t\tself.TabOpenRead()\n\t\treturn nil\n\t\tbreak\n\tcase \"tab\" == self.Url.Scheme:\n\t\tself.TabOpenRead()\n\t\treturn nil\n\t\tbreak\n\tcase \"fixed\" == self.Url.Scheme:\n\t\tself.FixedWidthOpenRead()\n\t\treturn nil\n\t\tbreak\n\tdefault:\n\t\treturn AbtabError{Message: fmt.Sprintf(\"Error: unrecognized scheme: '%s'\", self.Url.Scheme)}\n\t\tbreak\n\tcase \"csv\" == self.Url.Scheme:\n\t\tself.CsvOpenRead()\n\t\tbreak\n\t\t// case \"fixed\" == self.Url.Scheme:\n\t\t// self.FixedOpenRead()\n\t\t// break;\n\tcase \"pg\" == self.Url.Scheme:\n\t\tself.PgOpenRead()\n\t\tbreak\n\t\t// case \"mysql\" == self.Url.Scheme:\n\t\t// self.MysqlOpenRead()\n\t\t// break;\n\t\t// return nil\n\t}\n\treturn nil\n}", "func fetchall(urls []string) {\n\tch := make(chan string)\n\tfor _, url := range urls {\n\t\tgo fetch(url, ch)\n\t}\n\n\tfor range urls {\n\t\tfmt.Println(<-ch)\n\t}\n}", "func (c *Config) URL(key string) (*url.URL, error) {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\tvalue, ok := c.m[key]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unknow key : %s \", key)\n\t}\n\tu, err := url.Parse(value)\n\tif err != nil {\n\t\treturn u, err\n\t}\n\treturn u, nil\n}", "func StartParser() error {\n\tfor {\n\t\tpost := <-postReceiver\n\n\t\tlinks := extractLink(post.Message)\n\t\tfor _, l := range links {\n\t\t\tx := &Link{User: post.User, Url: l, Post: post.Message, Timestamp: post.Timestamp}\n\n\t\t\tif x.User == \"g0bot\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu, err := url.Parse(x.Url)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"unable to parse URL\", x.Url)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t//assuming a sane default\n\t\t\tif u.Scheme == \"\" {\n\t\t\t\tx.Url = \"http://\" + x.Url\n\t\t\t}\n\n\t\t\tx.Domain = u.Host\n\n\t\t\t// check for duplicate\n\t\t\tresult, dup := checkDuplicate(x)\n\t\t\tif dup {\n\t\t\t\tif !strings.Contains(post.Message, result.User) {\n\t\t\t\t\tircMessage(*cfgChannel, fmt.Sprintf(getSpruch(), result.Timestamp.Format(\"02.01.2006 15:04\"), result.User))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttr := &http.Transport{\n\t\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t\t}\n\t\t\tclient := &http.Client{Transport: tr}\n\n\t\t\t_size, err := client.Head(x.Url)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"unable to get HEAD from \" + x.Url + \": \" + err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tx.Size = _size.ContentLength\n\t\t\tio.Copy(ioutil.Discard, _size.Body) // throw any response away, should 0 cause of HEAD\n\t\t\t_size.Body.Close()\n\n\t\t\tif addLink(x) {\n\t\t\t\tlog.Printf(\"%s: %s\\n\", post.User, x.Url)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Could not insert link (%s) into the database.\\n\", x.Url)\n\t\t\t}\n\n\t\t}\n\t}\n}", "func fetchOneURL(url string, refresh bool, redirect bool, errWriter io.Writer, timeout time.Duration, useCookie bool) (str_ptr *string, err error, c <-chan struct{}) {\n\tif !refresh {\n\t\tstr_ptr, err = fetchReadCache(url)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t}\n\tstr_ptr, err = fetchWithTry(url, redirect, errWriter, timeout, useCookie)\n\tif err != nil {\n\t\treturn nil, err, nil\n\t}\n\t// Sync I/O to ensure file has been written after the ending of program.\n\tc = fetchWriteCache(url, str_ptr)\n\treturn\n}", "func FetchURL(entry DownloadEntry, zipQ chan FetchedStream, fetcher Fetcher) {\n\tzipQ <- fetcher(entry)\n}", "func LoadURLs(urlsFile string) []string {\n\t// Fetch URLs from the given file, which should be formatted as one URL per line\n\t// NOTE: This reads the entire file and stores it in memory.\n\t// This can be memory-intensive if the file is large, but\n\t// majestic_1million.csv is 78MB, so that should be fine\n\tcontent, err := ioutil.ReadFile(urlsFile)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not read URLs file: %v\", err)\n\t}\n\tlines := strings.Split(string(content), \"\\n\")\n\treturn lines\n}", "func (urls *url) urlUpdater(config *rest.Config, i *int, namespace string) {\n\tfor {\n\t\td := time.Duration(*i)\n\t\ttime.Sleep(d * time.Second)\n\t\t*urls = getIngressUrls(config, namespace)\n\t\tlog.Info(\"Updated host list.\")\n\t}\n}", "func Crawl(url string, g LinkGetter, done <-chan struct{}) <-chan Result {\n\tvisited := make(map[string]bool)\n\tin := make(chan string)\n\tout := make(chan Result)\n\tgo func() {\n\t\t<-done\n\t\tclose(out)\n\t}()\n\tdoWork := func(url string) {\n\t\tlinks, err := g.Links(url)\n\t\tfor _, link := range links {\n\t\t\tin <- link\n\t\t}\n\t\tout <- Result{Resource{url, links}, err}\n\t}\n\t// run a single (for thread saftey) goroutine to listen on the\n\t// \"in\" channel and check if URLs have already been visited.\n\tgo func(in <-chan string) {\n\t\tfor link := range in {\n\t\t\tif _, ok := visited[link]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo doWork(link)\n\t\t\tvisited[link] = true\n\t\t}\n\t}(in)\n\t// push the initial URL into the \"in\" channel so\n\t// that we can begin processing\n\tin <- url\n\treturn out\n}", "func GetAll(c http.Client, urls []string, after time.Duration) (results map[string]Result) {\n\tResponses.Add(1)\n\n\tresults = make(map[string]Result, len(urls))\n\trequests := make(chan Result, len(urls))\n\ttimeout := &ErrResult{fmt.Errorf(\"timeout %v\", after)}\n\n\t// Initialize pending requests all with timeout\n\tfor _, u := range urls {\n\t\tresults[u] = Result{u, \"\", nil, timeout}\n\t}\n\n\t// Fork off instrumeted requests\n\tfor _, u := range urls {\n\t\tgo func(url string) {\n\t\t\tinstrumentGet(func() {\n\t\t\t\trequests <- Get(c, url)\n\t\t\t})\n\t\t}(u)\n\t}\n\n\t// Join results up until the deadline, anything still pending\n\t// will have been initialized with timeout\n\tdeadline := time.After(after)\n\tfor pending := len(urls); pending > 0; pending-- {\n\t\tselect {\n\t\tcase res := <-requests:\n\t\t\tresults[res.RequestURI] = res\n\t\t\tSuccessRequests.Add(1)\n\t\tcase <-deadline:\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func downloadLinksList(url string, links chan string, fail chan error, done chan struct{}) {\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\tfail <- fmt.Errorf(\"cannot process url: %v\", err)\n\t}\n\tdefer response.Body.Close()\n\tlog.Println(\"Succesful connection\")\n\ttokenizer := html.NewTokenizer(response.Body)\n\tlog.Println(\"Start parsing\")\n\tfor {\n\t\ttokenType := tokenizer.Next()\n\t\tswitch tokenType {\n\t\tcase html.ErrorToken:\n\t\t\tdone <- struct{}{}\n\t\tcase html.StartTagToken:\n\t\t\t// gets the current token\n\t\t\ttoken := tokenizer.Token()\n\t\t\tif token.Data != \"a\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlink := extractLink(token.Attr)\n\t\t\tif len(link) < minProtocolLen {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif strings.HasSuffix(link, zipSuffix) {\n\t\t\t\tlinks <- link\n\t\t\t}\n\t\t}\n\t}\n}", "func (f *RealFetcher) Fetch(url string) (body string, urls []string, err error) {\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\turls = make([]string, 0)\n\treq.Header.Add(\"cache-control\", \"no-cache\")\n\tres, erro := http.DefaultClient.Do(req)\n\tif erro != nil {\n\t\treturn \"\", []string{}, erro\n\t}\n\tdefer res.Body.Close()\n\tb, _ := ioutil.ReadAll(res.Body)\n\tre := regexp.MustCompile(`href *= *\"http[^-\"]+`)\n\th := re.FindAll(b, -1)\n\tfor _, i := range h {\n\t\tre = regexp.MustCompile(`http[^\"]+`)\n\t\takt := re.Find(i)\n\t\turls = append(urls, string(akt))\n\t}\n\treturn string(b), urls, nil\n}", "func checkThenProcessURL(u url.URL) {\n\tmux.Lock()\n\t_, success := checkedURLs[u]\n\t// if the url isn't in the map then the program hasn't seen it before\n\tif !success {\n\t\tcheckedURLs[u] = false\n\t\tgo processURL(u)\n\t}\n\tmux.Unlock()\n}" ]
[ "0.57270956", "0.5717775", "0.5679312", "0.5667154", "0.56026137", "0.5594659", "0.55910826", "0.54826564", "0.5375638", "0.53603315", "0.5325304", "0.5272231", "0.52669436", "0.52281606", "0.52233833", "0.5220855", "0.52169085", "0.51331687", "0.5131579", "0.5104256", "0.50850874", "0.5079719", "0.50741726", "0.50686485", "0.50580853", "0.50500715", "0.50325733", "0.5026479", "0.50244296", "0.50155586", "0.5015281", "0.5010071", "0.5007654", "0.5005933", "0.49892882", "0.49885723", "0.49780813", "0.49780482", "0.4971365", "0.4945047", "0.49300355", "0.49210307", "0.4890647", "0.4859197", "0.48511493", "0.48476043", "0.48379588", "0.48296636", "0.48284602", "0.48246747", "0.48098883", "0.48074782", "0.47983113", "0.47976282", "0.47919056", "0.47717804", "0.4763264", "0.47619525", "0.47576916", "0.47529632", "0.4746093", "0.4740716", "0.47353444", "0.47273466", "0.47236505", "0.47171158", "0.47135216", "0.47123894", "0.47029418", "0.47017902", "0.4701633", "0.46639505", "0.46621388", "0.46614096", "0.46569037", "0.46447593", "0.46372014", "0.46367076", "0.46322244", "0.4630743", "0.46272138", "0.4624345", "0.4623855", "0.46219322", "0.46117675", "0.46067232", "0.4603711", "0.45963982", "0.45842004", "0.4583679", "0.4580222", "0.45795107", "0.45790553", "0.45716882", "0.457072", "0.456934", "0.4567289", "0.45625988", "0.45619777", "0.4560066" ]
0.6016037
0
Add creates a new KogitoInfra Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.
func Add(mgr manager.Manager) error { return add(mgr, newReconciler(mgr)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Add(mgr manager.Manager, opts options.AddOptions) error {\n\tif !opts.EnterpriseCRDExists {\n\t\t// No need to start this controller.\n\t\treturn nil\n\t}\n\n\treconciler := newReconciler(mgr, opts)\n\n\tc, err := controller.New(\"tiers-controller\", mgr, controller.Options{Reconciler: reconciler})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tk8sClient, err := kubernetes.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to establish a connection to k8s\")\n\t\treturn err\n\t}\n\n\tgo utils.WaitToAddTierWatch(networkpolicy.TigeraComponentTierName, c, k8sClient, log, nil)\n\n\tgo utils.WaitToAddNetworkPolicyWatches(c, k8sClient, log, []types.NamespacedName{\n\t\t{Name: tiers.ClusterDNSPolicyName, Namespace: \"openshift-dns\"},\n\t\t{Name: tiers.ClusterDNSPolicyName, Namespace: \"kube-system\"},\n\t})\n\n\treturn add(mgr, c)\n}", "func Add(mgr manager.Manager) error {\n\tr := &Reconciler{\n\t\tconnecter: &providerConnecter{kube: mgr.GetClient(), newClient: resourcegroup.NewClient},\n\t\tkube: mgr.GetClient(),\n\t}\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot create Kubernetes controller\")\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &v1alpha1.ResourceGroup{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tlog.Debug(\"Adding watched objects for KogitoInfra controller\")\n\t// Create a new controller\n\tc, err := controller.New(\"kogitoinfra-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &v1beta1.KogitoInfra{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar watchedObjects []framework.WatchedObjects\n\twatchedObjects = append(watchedObjects, getInfinispanWatchedObjects()...)\n\twatchedObjects = append(watchedObjects, getKafkaWatchedObjects()...)\n\twatchedObjects = append(watchedObjects, getKeycloakWatchedObjects()...)\n\n\tcontrollerWatcher := framework.NewControllerWatcher(r.(*ReconcileKogitoInfra).client, mgr, c, &v1beta1.KogitoInfra{})\n\tif err = controllerWatcher.Watch(watchedObjects...); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\tif !utildiscovery.DiscoverGVK(controllerKind) {\n\t\treturn nil\n\t}\n\treturn add(mgr, newReconciler(mgr))\n}", "func Add(mgr manager.Manager) error {\n\tr := &Reconciler{\n\t\tconnecter: &providerConnecter{kube: mgr.GetClient(), newClient: elasticache.NewClient},\n\t\tkube: mgr.GetClient(),\n\t}\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot create Kubernetes controller\")\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &v1alpha1.ReplicationGroup{}}, &handler.EnqueueRequestForObject{})\n}", "func Add(ctx context.Context, c *config.Config, mgr manager.Manager) error {\n\tctx = ctxlog.NewContext(ctx, \"buildrun-controller\")\n\treturn add(ctx, mgr, NewReconciler(ctx, c, mgr, controllerutil.SetControllerReference))\n}", "func Add(mgr manager.Manager) error {\n\tr := newReconciler(mgr)\n\tc, err := addController(mgr, r)\n\tr.controller = c\n\treturn err\n}", "func Add(mgr manager.Manager, opts options.AddOptions) error {\n\tif !opts.EnterpriseCRDExists {\n\t\t// No need to start this controller.\n\t\treturn nil\n\t}\n\tlicenseAPIReady := &utils.ReadyFlag{}\n\n\treconciler := newReconciler(mgr, opts, licenseAPIReady)\n\n\tc, err := controller.New(\"egressgateway-controller\", mgr, controller.Options{Reconciler: reconcile.Reconciler(reconciler)})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tk8sClient, err := kubernetes.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to establish a connection to k8s\")\n\t\treturn err\n\t}\n\n\tgo utils.WaitToAddLicenseKeyWatch(c, k8sClient, log, licenseAPIReady)\n\n\treturn add(mgr, c)\n}", "func Add(mgr manager.Manager, ctx *controllerconfig.Context) error {\n\treconcileMachineDisruption := &MachineDisruptionReconciler{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tcontext: ctx,\n\t}\n\n\t// TODO CHANGE ME (the context)\n\treconciler := reconcile.Reconciler(reconcileMachineDisruption)\n\t// create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: reconciler})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &cephv1.CephCluster{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &healthchecking.MachineDisruptionBudget{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &cephv1.CephCluster{},\n\t})\n}", "func Add(mgr manager.Manager) error {\n\tkialiReconciler := defaultKialiReconciler{Client: mgr.GetClient()}\n\tcniConfig, err := cni.InitConfig(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn add(mgr, newReconciler(mgr.GetClient(), mgr.GetScheme(), mgr.GetEventRecorderFor(controllerName), newNamespaceReconciler, &kialiReconciler, cniConfig))\n}", "func Add(mgr manager.Manager, recorder record.EventRecorder, logger logr.Logger,\n\tchannelDescriptor *utils.ChannelDescriptor, sync *helmsync.ChannelSynchronizer) error {\n\treturn add(mgr, newReconciler(mgr, channelDescriptor, logger.WithName(controllerName)), logger.WithName(controllerSetup))\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"kogitoapp-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KogitoApp\n\terr = c.Watch(&source.Kind{Type: &v1alpha1.KogitoApp{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twatchOwnedObjects := []runtime.Object{\n\t\t&oappsv1.DeploymentConfig{},\n\t\t&corev1.Service{},\n\t\t&routev1.Route{},\n\t\t&obuildv1.BuildConfig{},\n\t\t&oimagev1.ImageStream{},\n\t}\n\townerHandler := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &v1alpha1.KogitoApp{},\n\t}\n\tfor _, watchObject := range watchOwnedObjects {\n\t\terr = c.Watch(&source.Kind{Type: watchObject}, ownerHandler)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tlog.Info(\"Adding controller for IstioControlPlane\")\n\t// Create a new controller\n\tc, err := controller.New(\"istiocontrolplane-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource IstioControlPlane\n\terr = c.Watch(&source.Kind{Type: &v1alpha2.IstioControlPlane{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Controller added\")\n\treturn nil\n}", "func AddController(context *cli.Context) error {\n\n\tcontroller := context.String(\"name\")\n\tprojectName := util.FindProjectName()\n\thttpEngine := util.FindHttpEngine()\n\n\n\tapp := builder.NewApp()\n\tapp.GoMod(projectName).\n\t\tWorkingDir()\n\n\tif controller != \"\" {\n\t\tname := util.FixControllerName(controller)\n\t\tapp = app.\n\t\t\tBuildController(name, httpEngine).\n\t\t\tAddControllerModule(name).\n\t\t\tAddHandlerModule(name)\n\t}\n\n\tapp.Build()\n\n\treturn nil\n}", "func Add(mgr manager.Manager, logger *zap.SugaredLogger) error {\n\treceiveAdapterImage, defined := os.LookupEnv(raImageEnvVar)\n\tif !defined {\n\t\treturn fmt.Errorf(\"required environment variable %q not defined\", raImageEnvVar)\n\t}\n\n\tlog.Println(\"Adding the Drive Source Controller\")\n\tp := &sdk.Provider{\n\t\tAgentName: controllerAgentName,\n\t\tParent: &sourcesv1alpha1.DriveSource{},\n\t\tOwns: []runtime.Object{&servingv1alpha1.Service{}},\n\t\tReconciler: &reconciler{\n\t\t\trecorder: mgr.GetRecorder(controllerAgentName),\n\t\t\tscheme: mgr.GetScheme(),\n\t\t\treceiveAdapterImage: receiveAdapterImage,\n\t\t},\n\t}\n\n\treturn p.Add(mgr, logger)\n}", "func addController(mgr manager.Manager, r reconcile.Reconciler) (controller.Controller, error) {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Watch for changes to Cluster\n\terr = c.Watch(&source.Kind{Type: &clusterv1.Cluster{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller. All injections (e.g. InjectClient) are performed after this call to controller.New()\n\tc, err := controller.New(\"kedacontroller-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KedaController\n\terr = c.Watch(&source.Kind{Type: &kedav1alpha1.KedaController{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Deployment and requeue the owner KedaController\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &kedav1alpha1.KedaController{},\n\t}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\n\t// Create a controller that runs reconcile on noobaa backing store\n\n\tc, err := controller.New(\"noobaa-controller\", mgr, controller.Options{\n\t\tMaxConcurrentReconciles: 1,\n\t\tReconciler: reconcile.Func(\n\t\t\tfunc(req reconcile.Request) (reconcile.Result, error) {\n\t\t\t\treturn backingstore.NewReconciler(\n\t\t\t\t\treq.NamespacedName,\n\t\t\t\t\tmgr.GetClient(),\n\t\t\t\t\tmgr.GetScheme(),\n\t\t\t\t\tmgr.GetEventRecorderFor(\"noobaa-operator\"),\n\t\t\t\t).Reconcile()\n\t\t\t}),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes on resources to trigger reconcile\n\n\townerHandler := &handler.EnqueueRequestForOwner{IsController: true, OwnerType: &nbv1.BackingStore{}}\n\n\terr = c.Watch(&source.Kind{Type: &nbv1.BackingStore{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, ownerHandler)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.Watch(&source.Kind{Type: &corev1.PersistentVolumeClaim{}}, ownerHandler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.Funcs{\n\t// \tCreateFunc: func(e event.CreateEvent, q workqueue.RateLimitingInterface) {\n\t// \t\tfmt.Println(\"JAJA: Create\", e)\n\t// \t\townerHandler.Create(e, q)\n\t// \t},\n\t// \tUpdateFunc: func(e event.UpdateEvent, q workqueue.RateLimitingInterface) {\n\t// \t\tfmt.Println(\"JAJA: Update\", e)\n\t// \t\townerHandler.Update(e, q)\n\t// \t},\n\t// \tDeleteFunc: func(e event.DeleteEvent, q workqueue.RateLimitingInterface) {\n\t// \t\tfmt.Println(\"JAJA: Delete\", e)\n\t// \t\townerHandler.Delete(e, q)\n\t// \t},\n\t// \tGenericFunc: func(e event.GenericEvent, q workqueue.RateLimitingInterface) {\n\t// \t\tfmt.Println(\"JAJA: Generic\", e)\n\t// \t\townerHandler.Generic(e, q)\n\t// \t},\n\t// })\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager, managedCfg *rest.Config) error {\n\tmanagedClient, err := client.New(managedCfg, client.Options{})\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to generate client to managed cluster\")\n\t\treturn err\n\t}\n\tvar kubeClient kubernetes.Interface = kubernetes.NewForConfigOrDie(managedCfg)\n\teventsScheme := runtime.NewScheme()\n\tif err = v1.AddToScheme(eventsScheme); err != nil {\n\t\treturn err\n\t}\n\n\teventBroadcaster := record.NewBroadcaster()\n\tnamespace, err := k8sutil.GetWatchNamespace()\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to get watch namespace\")\n\t\treturn err\n\t}\n\teventBroadcaster.StartRecordingToSink(&corev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events(namespace)})\n\tmanagedRecorder := eventBroadcaster.NewRecorder(eventsScheme, v1.EventSource{Component: controllerName})\n\n\treturn add(mgr, newReconciler(mgr, managedClient, managedRecorder))\n}", "func (self *GE) AddController(group string, controllers ...Controller) *GE {\n\tself.group = self.Group(group)\n\tfor _, controller := range controllers {\n\t\tcontroller.Build(self)\n\t\tself.BindDep(controller)\n\t}\n\treturn self\n}", "func (c *ServiceController) AddController(router *mux.Router, s *Server) {\n\tc.Srv = s\n\trouter.Methods(\"POST\", \"GET\").Path(\"/service/get\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleGet)))\n\trouter.Methods(\"POST\").Path(\"/service/add\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleAdd)))\n\trouter.Methods(\"DELETE\").Path(\"/service/remove/{id}\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleRemove)))\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"toolchaincluster-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ToolchainCluster\n\treturn c.Watch(&source.Kind{Type: &toolchainv1alpha1.ToolchainCluster{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KeycloakClient\n\terr = c.Watch(&source.Kind{Type: &kc.KeycloakClient{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Make sure to watch the credential secrets\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &kc.KeycloakClient{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"ibmblockcsi-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource IBMBlockCSI\n\terr = c.Watch(&source.Kind{Type: &csiv1.IBMBlockCSI{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubresources := []runtime.Object{\n\t\t&appsv1.StatefulSet{},\n\t\t&appsv1.DaemonSet{},\n\t}\n\n\tfor _, subresource := range subresources {\n\t\terr = c.Watch(&source.Kind{Type: subresource}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &csiv1.IBMBlockCSI{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hive-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHive).kubeClient, err = kubernetes.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHive).deploymentClient, err = appsclientv1.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Hive\n\terr = c.Watch(&source.Kind{Type: &hivev1alpha1.Hive{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: need to watch resources that we have created through code\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to UnitedDeployment\n\terr = c.Watch(&source.Kind{Type: &appsv1alpha1.UnitedDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &appsv1.StatefulSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appsv1alpha1.UnitedDeployment{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"cluster-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Cluster\n\terr = c.Watch(&source.Kind{Type: &clusterv1alpha1.Cluster{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Instance\n\terr = c.Watch(&source.Kind{Type: &bucketv1alpha1.Bucket{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"concoursecipipeline-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ConcourseCIPipeline\n\terr = c.Watch(&source.Kind{Type: &showksv1beta1.ConcourseCIPipeline{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create\n\t// Uncomment watch a Deployment created by ConcourseCIPipeline - change this for objects you create\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &showksv1beta1.ConcourseCIPipeline{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hive-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).kubeClient, err = kubernetes.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).apiregClient, err = apiregclientv1.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).apiextClient, err = apiextclientv1beta1.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).dynamicClient, err = dynamic.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Regular manager client is not fully initialized here, create our own for some\n\t// initialization API communication:\n\ttempClient, err := client.New(mgr.GetConfig(), client.Options{Scheme: mgr.GetScheme()})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Determine if the openshift-config-managed namespace exists (> v4.0). If so, setup a watch\n\t// for configmaps in that namespace.\n\tns := &corev1.Namespace{}\n\tlog.Debugf(\"checking for existence of the %s namespace\", managedConfigNamespace)\n\terr = tempClient.Get(context.TODO(), types.NamespacedName{Name: managedConfigNamespace}, ns)\n\tif err != nil && !errors.IsNotFound(err) {\n\t\tlog.WithError(err).Errorf(\"error checking existence of the %s namespace\", managedConfigNamespace)\n\t\treturn err\n\t}\n\tif err == nil {\n\t\tlog.Debugf(\"the %s namespace exists, setting up a watch for configmaps on it\", managedConfigNamespace)\n\t\t// Create an informer that only listens to events in the OpenShift managed namespace\n\t\tkubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(r.(*ReconcileHiveConfig).kubeClient, 10*time.Minute, kubeinformers.WithNamespace(managedConfigNamespace))\n\t\tconfigMapInformer := kubeInformerFactory.Core().V1().ConfigMaps().Informer()\n\t\tmgr.Add(&informerRunnable{informer: configMapInformer})\n\n\t\t// Watch for changes to cm/kube-apiserver-aggregator-client-ca in the OpenShift managed namespace\n\t\terr = c.Watch(&source.Informer{Informer: configMapInformer}, &handler.EnqueueRequestsFromMapFunc{ToRequests: handler.ToRequestsFunc(aggregatorCAConfigMapHandler)})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.(*ReconcileHiveConfig).syncAggregatorCA = true\n\t\tr.(*ReconcileHiveConfig).managedConfigCMLister = kubeInformerFactory.Core().V1().ConfigMaps().Lister()\n\t} else {\n\t\tlog.Debugf(\"the %s namespace was not found, skipping watch for the aggregator CA configmap\", managedConfigNamespace)\n\t}\n\n\t// Watch for changes to HiveConfig:\n\terr = c.Watch(&source.Kind{Type: &hivev1.HiveConfig{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Monitor changes to DaemonSets:\n\terr = c.Watch(&source.Kind{Type: &appsv1.DaemonSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hivev1.HiveConfig{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Monitor changes to Deployments:\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hivev1.HiveConfig{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Monitor changes to Services:\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hivev1.HiveConfig{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If no HiveConfig exists, the operator should create a default one, giving the controller\n\t// something to sync on.\n\tlog.Debug(\"checking if HiveConfig 'hive' exists\")\n\tinstance := &hivev1.HiveConfig{}\n\terr = tempClient.Get(context.TODO(), types.NamespacedName{Name: hiveConfigName}, instance)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlog.Info(\"no HiveConfig exists, creating default\")\n\t\tinstance = &hivev1.HiveConfig{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: hiveConfigName,\n\t\t\t},\n\t\t}\n\t\terr = tempClient.Create(context.TODO(), instance)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Lookup the hive-operator Deployment image, we will assume hive components should all be\n\t// using the same image as the operator.\n\toperatorDeployment := &appsv1.Deployment{}\n\terr = tempClient.Get(context.Background(),\n\t\ttypes.NamespacedName{Name: hiveOperatorDeploymentName, Namespace: constants.HiveNamespace},\n\t\toperatorDeployment)\n\tif err == nil {\n\t\timg := operatorDeployment.Spec.Template.Spec.Containers[0].Image\n\t\tpullPolicy := operatorDeployment.Spec.Template.Spec.Containers[0].ImagePullPolicy\n\t\tlog.Debugf(\"loaded hive image from hive-operator deployment: %s (%s)\", img, pullPolicy)\n\t\tr.(*ReconcileHiveConfig).hiveImage = img\n\t\tr.(*ReconcileHiveConfig).hiveImagePullPolicy = pullPolicy\n\t} else {\n\t\tlog.WithError(err).Warn(\"unable to lookup hive image from hive-operator Deployment, image overriding disabled\")\n\t}\n\n\t// TODO: Monitor CRDs but do not try to use an owner ref. (as they are global,\n\t// and our config is namespaced)\n\n\t// TODO: it would be nice to monitor the global resources ValidatingWebhookConfiguration\n\t// and APIService, CRDs, but these cannot have OwnerReferences (which are not namespaced) as they\n\t// are global. Need to use a different predicate to the Watch function.\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"canary-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Canary\n\terr = c.Watch(&source.Kind{Type: &canaryv1beta1.Canary{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create\n\t// Uncomment watch a Deployment created by Canary - change this for objects you create\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &canaryv1beta1.Canary{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"cloudmetrics-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set up a GenericEvent channel that will be used\n\t// as the event source to trigger the controller's\n\t// reconcile loop\n\tevents := make(chan event.GenericEvent)\n\n\t// Send a generic event to the channel to kick\n\t// off the first reconcile loop\n\tgo func() {\n\t\tevents <- event.GenericEvent{\n\t\t\tMeta: &integreatlyv1alpha1.Redis{},\n\t\t\tObject: &integreatlyv1alpha1.Redis{},\n\t\t}\n\t}()\n\n\t// Setup the controller to use the channel as its watch source\n\terr = c.Watch(&source.Channel{Source: events}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Provider\n\terr = c.Watch(&source.Kind{Type: &gcpv1alpha1.Provider{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"virtualcluster-controller\",\n\t\tmgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Virtualcluster\n\terr = c.Watch(&source.Kind{\n\t\tType: &tenancyv1alpha1.Virtualcluster{}},\n\t\t&handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler, logger logr.Logger) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Deployable\n\terr = c.Watch(&source.Kind{Type: &dplv1.Deployable{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// watch for changes to channel too\n\treturn c.Watch(&source.Kind{\n\t\tType: &chv1.Channel{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: &channelMapper{Client: mgr.GetClient(), logger: logger}})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"iscsiconnection-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ISCSIConnection\n\terr = c.Watch(&source.Kind{Type: &ic.ISCSIConnection{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerAgentName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to KubernetesEventSource\n\terr = c.Watch(&source.Kind{Type: &sourcesv1alpha1.KubernetesEventSource{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to owned ContainerSource\n\terr = c.Watch(&source.Kind{Type: &sourcesv1alpha1.ContainerSource{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sourcesv1alpha1.KubernetesEventSource{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"minecraft-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Minecraft\n\terr = c.Watch(&source.Kind{Type: &interviewv1alpha1.Minecraft{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Minecraft\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &interviewv1alpha1.Minecraft{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"minecraft-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Minecraft\n\terr = c.Watch(&source.Kind{Type: &operatorv1alpha1.Minecraft{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Minecraft\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &operatorv1alpha1.Minecraft{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"deployment-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Deployment\n\terr = c.Watch(&source.Kind{Type: &ketiv1.Deployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Deployment\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &ketiv1.Deployment{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"floatingipset-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to FloatingIPSet\n\terr = c.Watch(&source.Kind{Type: &openstackv1beta1.FloatingIPSet{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create\n\t// Uncomment watch a Deployment created by FloatingIPSet - change this for objects you create\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &openstackv1beta1.FloatingIPSet{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\treconciler := &Reconciler{\n\t\tReconciler: base.Reconciler{\n\t\t\tEventRecorder: mgr.GetEventRecorderFor(Name),\n\t\t\tClient: mgr.GetClient(),\n\t\t\tLog: log,\n\t\t},\n\t}\n\tcnt, err := controller.New(\n\t\tName,\n\t\tmgr,\n\t\tcontroller.Options{\n\t\t\tReconciler: reconciler,\n\t\t})\n\tif err != nil {\n\t\tlog.Trace(err)\n\t\treturn err\n\t}\n\t// Primary CR.\n\terr = cnt.Watch(\n\t\t&source.Kind{Type: &api.Hook{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t\t&HookPredicate{})\n\tif err != nil {\n\t\tlog.Trace(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\treturn cosi.RunProvisioner(\n\t\tmgr.GetClient(),\n\t\tmgr.GetScheme(),\n\t\tmgr.GetEventRecorderFor(\"noobaa-operator\"),\n\t)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\topts := controller.Options{Reconciler: r}\n\tc, err := controller.New(\"apicuriodeployment-controller\", mgr, opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ApicurioDeployment\n\terr = c.Watch(&source.Kind{Type: &integreatlyv1alpha1.ApicurioDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &integreatlyv1alpha1.ApicurioDeployment{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func AddControllerToManager(logger logr.Logger, hostMgr, lsMgr manager.Manager, config containerv1alpha1.Configuration) error {\n\tctrlLogger := logger.WithName(\"ContainerDeployer\")\n\n\tdirectHostClient, err := client.New(hostMgr.GetConfig(), client.Options{\n\t\tScheme: hostMgr.GetScheme(),\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create direct client for the host cluster: %w\", err)\n\t}\n\tdeployer, err := NewDeployer(\n\t\tctrlLogger,\n\t\tlsMgr.GetClient(),\n\t\thostMgr.GetClient(),\n\t\tdirectHostClient,\n\t\tconfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrc := source.NewKindWithCache(&corev1.Pod{}, hostMgr.GetCache())\n\tpodRec := NewPodReconciler(\n\t\tctrlLogger.WithName(\"PodReconciler\"),\n\t\tlsMgr.GetClient(),\n\t\thostMgr.GetClient(),\n\t\tlsMgr.GetEventRecorderFor(\"Lanscaper\"),\n\t\tconfig,\n\t\tdeployer)\n\n\terr = deployerlib.Add(ctrl.Log, lsMgr, hostMgr, deployerlib.DeployerArgs{\n\t\tName: Name,\n\t\tVersion: version.Get().String(),\n\t\tIdentity: config.Identity,\n\t\tType: Type,\n\t\tDeployer: deployer,\n\t\tTargetSelectors: config.TargetSelector,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ctrl.NewControllerManagedBy(lsMgr).\n\t\tFor(&lsv1alpha1.DeployItem{}, builder.WithPredicates(noopPredicate{})).\n\t\tWatches(src, &PodEventHandler{}).\n\t\tComplete(podRec)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"apischeme-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource APIScheme\n\terr = c.Watch(&source.Kind{Type: &cloudingressv1alpha1.APIScheme{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewController(\n\tkube *runtime.KubeRuntime,\n\tseratosRuntime *runtime.SeratosRuntime,\n) *Controller {\n\tmicroservicesAPI := seratosRuntime.Informers.Seratos().V1beta1().Microservices()\n\tsidecarsAPI := seratosRuntime.Informers.Seratos().V1beta1().Sidecars()\n\n\teventBroadcaster := record.NewBroadcaster()\n\n\teventBroadcaster.StartStructuredLogging(0)\n\teventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kube.Clientset.CoreV1().Events(\"\")})\n\n\trecorder := eventBroadcaster.NewRecorder(apiserver.GetRuntimeScheme(), corev1.EventSource{Component: \"microservices-controller\"})\n\n\tcontroller := &Controller{\n\t\tkubeRuntime: kube,\n\t\tseratosRuntime: seratosRuntime,\n\t\tmicroserviceLister: microservicesAPI.Lister(),\n\t\tsidecarsLister: sidecarsAPI.Lister(),\n\t\tsynced: microservicesAPI.Informer().HasSynced,\n\t\tqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"Microservices\"),\n\t\trecorder: recorder,\n\t}\n\n\tmicroservicesAPI.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tevent := MicroserviceEvent{\n\t\t\t\tEventType: CREATED,\n\t\t\t\tCreated: &MicroserviceCreatedEvent{\n\t\t\t\t\tMicroservice: obj.(*v1beta1.Microservice),\n\t\t\t\t},\n\t\t\t\tUpdated: nil,\n\t\t\t\tDeleted: nil,\n\t\t\t}\n\n\t\t\tcontroller.queue.Add(event)\n\t\t},\n\n\t\tUpdateFunc: func(old interface{}, new interface{}) {\n\t\t\tevent := MicroserviceEvent{\n\t\t\t\tEventType: UPDATED,\n\t\t\t\tCreated: nil,\n\t\t\t\tUpdated: &MicroserviceUpdatedEvent{\n\t\t\t\t\tOldMicroservice: old.(*v1beta1.Microservice),\n\t\t\t\t\tNewMicroservice: new.(*v1beta1.Microservice),\n\t\t\t\t},\n\t\t\t\tDeleted: nil,\n\t\t\t}\n\n\t\t\tcontroller.queue.Add(event)\n\t\t},\n\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tevent := MicroserviceEvent{\n\t\t\t\tEventType: DELETED,\n\t\t\t\tCreated: nil,\n\t\t\t\tUpdated: nil,\n\t\t\t\tDeleted: &MicroserviceDeletedEvent{\n\t\t\t\t\tMicroservice: obj.(*v1beta1.Microservice),\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tcontroller.queue.Add(event)\n\t\t},\n\t})\n\n\treturn controller\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"ingress-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Ingress\n\terr = c.Watch(&source.Kind{Type: &networkingv1alpha1.Ingress{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Routes and requeue the\n\t// owner Ingress\n\terr = c.Watch(&source.Kind{Type: &routev1.Route{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &networkingv1alpha1.Ingress{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"stack-controller\", mgr, controller.Options{\n\t\tReconciler: r,\n\t\tMaxConcurrentReconciles: maxConcurrentReconciles,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Filter out update events if an object's metadata.generation is\n\t// unchanged, or if the object never had a generation update.\n\t// - https://github.com/operator-framework/operator-lib/blob/main/predicate/nogeneration.go#L29-L34\n\t// - https://github.com/operator-framework/operator-sdk/issues/2795\n\t// - https://github.com/kubernetes-sigs/kubebuilder/issues/1103\n\t// - https://github.com/kubernetes-sigs/controller-runtime/pull/553\n\t// - https://book-v1.book.kubebuilder.io/basics/status_subresource.html\n\t// Set up predicates.\n\tpredicates := []predicate.Predicate{\n\t\tpredicate.Or(predicate.GenerationChangedPredicate{}, libpredicate.NoGenerationPredicate{}),\n\t}\n\n\t// Watch for changes to primary resource Stack\n\terr = c.Watch(&source.Kind{Type: &pulumiv1alpha1.Stack{}}, &handler.EnqueueRequestForObject{}, predicates...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"imagesigningrequest-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ImageSigningRequest\n\terr = c.Watch(&source.Kind{Type: &imagesigningrequestsv1alpha1.ImageSigningRequest{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &imagesigningrequestsv1alpha1.ImageSigningRequest{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"controlplane-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ControlPlane\n\terr = c.Watch(&source.Kind{Type: &caksv1alpha1.ControlPlane{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployment and requeue the owner ControlPlane\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{Funcs: predicate.Funcs{DeleteFunc: func(e event.DeleteEvent) bool {\n\t\tif _, ok := e.Meta.GetLabels()[\"tier\"]; ok {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}}})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Service and requeue the owner ControlPlane\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &caksv1alpha1.ControlPlane{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"appservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource AppService\n\terr = c.Watch(&source.Kind{Type: &csye7374v1alpha1.AppService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner AppService\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &csye7374v1alpha1.AppService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"integration-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Integration\n\terr = c.Watch(&source.Kind{Type: &integrationv1alpha1.Integration{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Integration\n\t// Watch for deployment\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &integrationv1alpha1.Integration{},\n\t})\n\n\t// Watch for service\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &integrationv1alpha1.Integration{},\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"droidvirt-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource DroidVirt\n\terr = c.Watch(&source.Kind{Type: &dvv1alpha1.DroidVirt{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmapping := &unstructured.Unstructured{}\n\tmapping.SetGroupVersionKind(GatewayMappingGVK())\n\twatchResources := []runtime.Object{\n\t\t&kubevirtv1.VirtualMachineInstance{},\n\t\t&corev1.Service{},\n\t\tmapping,\n\t}\n\n\tfor _, subResource := range watchResources {\n\t\terr = c.Watch(&source.Kind{Type: subResource}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &dvv1alpha1.DroidVirt{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Template\n\terr = c.Watch(&source.Kind{Type: &elasticsearchdbv1beta1.Template{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"node-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Node\n\terr = c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Service) Register(c Controller) {\n\ts.Controllers = append(s.Controllers, c)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hostoperatorconfig-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource HostOperatorConfig\n\treturn c.Watch(&source.Kind{Type: &toolchainv1alpha1.HostOperatorConfig{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, c controller.Controller) error {\n\tif err := utils.AddNetworkWatch(c); err != nil {\n\t\treturn fmt.Errorf(\"tiers-controller failed to watch Tigera network resource: %v\", err)\n\t}\n\n\tif err := utils.AddAPIServerWatch(c); err != nil {\n\t\treturn fmt.Errorf(\"tiers-controller failed to watch APIServer resource: %v\", err)\n\t}\n\n\tif err := utils.AddNodeLocalDNSWatch(c); err != nil {\n\t\treturn fmt.Errorf(\"tiers-controller failed to watch node-local-dns daemonset: %v\", err)\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"node-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlabelPreds := []predicate.Predicate{\n\t\tpredicate.Funcs{\n\t\t\tUpdateFunc: func(evt event.UpdateEvent) bool {\n\t\t\t\twatchResourceTag, ok := evt.MetaNew.GetLabels()[watchResourceTag]\n\t\t\t\treturn !(ok && watchResourceTag == watchResourceValue)\n\t\t\t},\n\t\t\tCreateFunc: func(evt event.CreateEvent) bool {\n\t\t\t\twatchResourceTag, ok := evt.Meta.GetLabels()[watchResourceTag]\n\t\t\t\treturn !(ok && watchResourceTag == watchResourceValue)\n\t\t\t},\n\t\t\tGenericFunc: func(evt event.GenericEvent) bool {\n\t\t\t\twatchResourceTag, ok := evt.Meta.GetLabels()[watchResourceTag]\n\t\t\t\treturn !(ok && watchResourceTag == watchResourceValue)\n\t\t\t},\n\t\t},\n\t}\n\n\t// Watch for changes to primary resource Node\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{}, labelPreds...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"deploymentconfig-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to DeploymentConfig\n\terr = c.Watch(&source.Kind{Type: &appsapi_v1.DeploymentConfig{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\tscope.Error(err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager, hubconfig *rest.Config, cluster types.NamespacedName) error {\n\treconciler, err := newReconciler(mgr, hubconfig, cluster)\n\tif err != nil {\n\t\tklog.Error(\"Failed to create the application reconciler \", err)\n\t\treturn err\n\t}\n\treconciler.start()\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"clustersync-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ClusterSync\n\terr = c.Watch(&source.Kind{Type: &hiveinternal.ClusterSync{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewController(client kubernetes.Interface) *Controller {\n\tshared := informers.NewSharedInformerFactory(client, time.Second*30)\n\tinform := shared.Apps().V1().Deployments()\n\tcontrl := &Controller{\n\t\tclient: client,\n\t\tinformer: inform.Informer(),\n\t\tlister: inform.Lister(),\n\t\tlogger: logrus.New(),\n\t\tqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"regitseel\"),\n\t}\n\n\tinform.Informer().AddEventHandler(\n\t\tcache.ResourceEventHandlerFuncs{\n\t\t\tAddFunc: contrl.enqueue,\n\t\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\t\tcontrl.enqueue(new)\n\t\t\t},\n\t\t\tDeleteFunc: func(obj interface{}) {\n\t\t\t\td := obj.(*appsv1.Deployment)\n\t\t\t\tif err := contrl.delete(d); err != nil {\n\t\t\t\t\tcontrl.logger.Errorf(\"failed to delete from api: %v\", d.Name)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t)\n\n\treturn contrl\n}", "func Add(mgr manager.Manager) error {\n\turl := os.Getenv(\"CONCOURSECI_URL\")\n\ttarget := os.Getenv(\"CONCOURSECI_TARGET\")\n\tteam := os.Getenv(\"CONCOURSECI_TEAM\")\n\tusername := os.Getenv(\"CONCOURSECI_USERNAME\")\n\tpassword := os.Getenv(\"CONCOURSECI_PASSWORD\")\n\treturn add(mgr, newReconciler(mgr, concourseci.NewClient(url, target, team, username, password)))\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"application-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Application\n\terr = c.Watch(&source.Kind{Type: &appV1Alpha1.Application{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployment and requeue the owner Application\n\terr = c.Watch(&source.Kind{Type: &appsV1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appV1Alpha1.Application{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"configmap-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ConfigMap\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner ConfigMap\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &corev1.ConfigMap{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func AddMachineControllerToManager(ctx *context.ControllerManagerContext, mgr manager.Manager) error {\n\n\tvar (\n\t\tcontrolledType = &infrav1.VSphereMachine{}\n\t\tcontrolledTypeName = reflect.TypeOf(controlledType).Elem().Name()\n\t\tcontrolledTypeGVK = infrav1.GroupVersion.WithKind(controlledTypeName)\n\n\t\tcontrollerNameShort = fmt.Sprintf(\"%s-controller\", strings.ToLower(controlledTypeName))\n\t\tcontrollerNameLong = fmt.Sprintf(\"%s/%s/%s\", ctx.Namespace, ctx.Name, controllerNameShort)\n\t)\n\n\t// Build the controller context.\n\tcontrollerContext := &context.ControllerContext{\n\t\tControllerManagerContext: ctx,\n\t\tName: controllerNameShort,\n\t\tRecorder: record.New(mgr.GetEventRecorderFor(controllerNameLong)),\n\t\tLogger: ctx.Logger.WithName(controllerNameShort),\n\t}\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\t// Watch the controlled, infrastructure resource.\n\t\tFor(controlledType).\n\t\t// Watch the CAPI resource that owns this infrastructure resource.\n\t\tWatches(\n\t\t\t&source.Kind{Type: &clusterv1.Machine{}},\n\t\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\t\tToRequests: clusterutilv1.MachineToInfrastructureMapFunc(controlledTypeGVK),\n\t\t\t},\n\t\t).\n\t\t// Watch a GenericEvent channel for the controlled resource.\n\t\t//\n\t\t// This is useful when there are events outside of Kubernetes that\n\t\t// should cause a resource to be synchronized, such as a goroutine\n\t\t// waiting on some asynchronous, external task to complete.\n\t\tWatches(\n\t\t\t&source.Channel{Source: ctx.GetGenericEventChannelFor(controlledTypeGVK)},\n\t\t\t&handler.EnqueueRequestForObject{},\n\t\t).\n\t\tComplete(machineReconciler{ControllerContext: controllerContext})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"applicationmonitoring-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ApplicationMonitoring\n\terr = c.Watch(&source.Kind{Type: &applicationmonitoringv1alpha1.ApplicationMonitoring{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"projectclaim-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ProjectClaim\n\terr = c.Watch(&source.Kind{Type: &gcpv1alpha1.ProjectClaim{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(\n\tmgr manager.Manager,\n\tlog *zap.SugaredLogger,\n\tnumWorkers int,\n\tworkerName string,\n\texternalURL string,\n\tseedGetter provider.SeedGetter,\n\tuserClusterConnProvider userClusterConnectionProvider,\n\toverwriteRegistry string,\n\tnodePortRange string,\n\tnodeAccessNetwork string,\n\tetcdDiskSize resource.Quantity,\n\tmonitoringScrapeAnnotationPrefix string,\n\tinClusterPrometheusRulesFile string,\n\tinClusterPrometheusDisableDefaultRules bool,\n\tinClusterPrometheusDisableDefaultScrapingConfigs bool,\n\tinClusterPrometheusScrapingConfigsFile string,\n\tdockerPullConfigJSON []byte,\n\tnodeLocalDNSCacheEnabled bool,\n\tconcurrentClusterUpdates int,\n\n\toidcCAFile string,\n\toidcIssuerURL string,\n\toidcIssuerClientID string,\n\tkubermaticImage string,\n\tdnatControllerImage string,\n\tfeatures Features) error {\n\n\treconciler := &Reconciler{\n\t\tlog: log.Named(ControllerName),\n\t\tClient: mgr.GetClient(),\n\t\tuserClusterConnProvider: userClusterConnProvider,\n\t\tworkerName: workerName,\n\n\t\trecorder: mgr.GetEventRecorderFor(ControllerName),\n\n\t\toverwriteRegistry: overwriteRegistry,\n\t\tnodePortRange: nodePortRange,\n\t\tnodeAccessNetwork: nodeAccessNetwork,\n\t\tetcdDiskSize: etcdDiskSize,\n\t\tinClusterPrometheusRulesFile: inClusterPrometheusRulesFile,\n\t\tinClusterPrometheusDisableDefaultRules: inClusterPrometheusDisableDefaultRules,\n\t\tinClusterPrometheusDisableDefaultScrapingConfigs: inClusterPrometheusDisableDefaultScrapingConfigs,\n\t\tinClusterPrometheusScrapingConfigsFile: inClusterPrometheusScrapingConfigsFile,\n\t\tmonitoringScrapeAnnotationPrefix: monitoringScrapeAnnotationPrefix,\n\t\tdockerPullConfigJSON: dockerPullConfigJSON,\n\t\tnodeLocalDNSCacheEnabled: nodeLocalDNSCacheEnabled,\n\t\tkubermaticImage: kubermaticImage,\n\t\tdnatControllerImage: dnatControllerImage,\n\t\tconcurrentClusterUpdates: concurrentClusterUpdates,\n\n\t\texternalURL: externalURL,\n\t\tseedGetter: seedGetter,\n\n\t\toidcCAFile: oidcCAFile,\n\t\toidcIssuerURL: oidcIssuerURL,\n\t\toidcIssuerClientID: oidcIssuerClientID,\n\n\t\tfeatures: features,\n\t}\n\n\tc, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler, MaxConcurrentReconciles: numWorkers})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttypesToWatch := []runtime.Object{\n\t\t&corev1.Service{},\n\t\t&corev1.ServiceAccount{},\n\t\t&corev1.ConfigMap{},\n\t\t&corev1.Secret{},\n\t\t&corev1.Namespace{},\n\t\t&appsv1.StatefulSet{},\n\t\t&appsv1.Deployment{},\n\t\t&batchv1beta1.CronJob{},\n\t\t&policyv1beta1.PodDisruptionBudget{},\n\t\t&autoscalingv1beta2.VerticalPodAutoscaler{},\n\t\t&rbacv1.Role{},\n\t\t&rbacv1.RoleBinding{},\n\t}\n\n\tfor _, t := range typesToWatch {\n\t\tif err := c.Watch(&source.Kind{Type: t}, controllerutil.EnqueueClusterForNamespacedObject(mgr.GetClient())); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create watcher for %T: %v\", t, err)\n\t\t}\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &kubermaticv1.Cluster{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"grafana-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Grafana\n\treturn c.Watch(&source.Kind{Type: &i8ly.Grafana{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"threescale-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ThreeScale\n\terr = c.Watch(&source.Kind{Type: &threescalev1alpha1.ThreeScale{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"jenkinsinstance-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twatchPredicate := util.NewPredicate(viper.GetString(\"namespace\"))\n\n\t// Watch for changes to JenkinsInstance\n\terr = c.Watch(&source.Kind{Type: &jenkinsv1alpha1.JenkinsInstance{}}, &handler.EnqueueRequestForObject{}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch a Deployment created by JenkinsInstance\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &jenkinsv1alpha1.JenkinsInstance{},\n\t}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch a PVC created by JenkinsInstance\n\terr = c.Watch(&source.Kind{Type: &corev1.PersistentVolumeClaim{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &jenkinsv1alpha1.JenkinsInstance{},\n\t}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch a Secret created by JenkinsInstance\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &jenkinsv1alpha1.JenkinsInstance{},\n\t}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch a Service created by JenkinsInstance\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &jenkinsv1alpha1.JenkinsInstance{},\n\t}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch an Ingress created by JenkinsInstance\n\terr = c.Watch(&source.Kind{Type: &v1beta1.Ingress{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &jenkinsv1alpha1.JenkinsInstance{},\n\t}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch a Networkpolicy created by JenkinsInstance\n\terr = c.Watch(&source.Kind{Type: &netv1.NetworkPolicy{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &jenkinsv1alpha1.JenkinsInstance{},\n\t}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch Secret resources not owned by the JenkinsInstance change\n\t// This is needed for re-loading login information from the pre-provided secret\n\t// When admin login secret changes, Watch will list all JenkinsInstances\n\t// and re-enqueue the keys for the ones that refer to that admin login secret via their spec.\n\terr = c.Watch(\n\t\t&source.Kind{Type: &corev1.Secret{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\tToRequests: handler.ToRequestsFunc(func(a handler.MapObject) []reconcile.Request {\n\n\t\t\t\tjenkinsInstances := &jenkinsv1alpha1.JenkinsInstanceList{}\n\t\t\t\terr = mgr.GetClient().List(\n\t\t\t\t\tcontext.TODO(),\n\t\t\t\t\t&client.ListOptions{LabelSelector: labels.Everything()},\n\t\t\t\t\tjenkinsInstances)\n\t\t\t\tif err != nil {\n\t\t\t\t\tglog.Errorf(\"Could not list JenkinsInstances\")\n\t\t\t\t\treturn []reconcile.Request{}\n\t\t\t\t}\n\n\t\t\t\tvar keys []reconcile.Request\n\t\t\t\tfor _, inst := range jenkinsInstances.Items {\n\t\t\t\t\tif inst.Spec.AdminSecret == a.Meta.GetName() {\n\t\t\t\t\t\tkeys = append(keys, reconcile.Request{\n\t\t\t\t\t\t\tNamespacedName: types.NewNamespacedNameFromString(\n\t\t\t\t\t\t\t\tfmt.Sprintf(\"%s%c%s\", inst.GetNamespace(), types.Separator, inst.GetName())),\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if inst.Spec.PluginConfig != nil {\n\t\t\t\t\t\tif inst.Spec.PluginConfig.ConfigSecret == a.Meta.GetName() {\n\t\t\t\t\t\t\tkeys = append(keys, reconcile.Request{\n\t\t\t\t\t\t\t\tNamespacedName: types.NewNamespacedNameFromString(\n\t\t\t\t\t\t\t\t\tfmt.Sprintf(\"%s%c%s\", inst.GetNamespace(), types.Separator, inst.GetName())),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// return found keys\n\t\t\t\treturn keys\n\t\t\t}),\n\t\t}, watchPredicate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"securitygroup-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to SecurityGroup\n\terr = c.Watch(&source.Kind{Type: &openstackv1beta1.SecurityGroup{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"tektoninstallation-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource TektonInstallation\n\tif err := c.Watch(&source.Kind{Type: &v1alpha1.TektonInstallation{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{}); err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource\n\tenqueueRequestForOwner := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &toolchainv1alpha1.TektonInstallation{},\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &olmv1alpha1.Subscription{}}, enqueueRequestForOwner)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"containerjfr-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ContainerJFR\n\terr = c.Watch(&source.Kind{Type: &rhjmcv1alpha1.ContainerJFR{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner ContainerJFR\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &rhjmcv1alpha1.ContainerJFR{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// TODO watch certificates and redeploy when renewed\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"server-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Server\n\terr = c.Watch(&source.Kind{Type: &devopsv1.Server{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Server\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &devopsv1.Server{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nameservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NameService\n\terr = c.Watch(&source.Kind{Type: &rocketmqv1beta1.NameService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner NameService\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &rocketmqv1beta1.NameService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\tr := &ReconcileLocalVolumeSet{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\teventReporter: newEventReporter(mgr.GetEventRecorderFor(ComponentName)),\n\t\tdeviceAgeMap: newAgeMap(),\n\t}\n\t// Create a new controller\n\tc, err := controller.New(ComponentName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &localv1alpha1.LocalVolumeSet{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Pods and requeue the owner LocalVolumeSet\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &localv1alpha1.LocalVolumeSet{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Service) Add(services ...Controller) {\n\tif s.ws == nil {\n\t\ts.ws = new(restful.WebService)\n\t\ts.ws.Path(fmt.Sprintf(\"/%s/%s/\", s.name, s.version)).Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)\n\t}\n\tfor i := range services {\n\t\tif !services[i].DisablePrefix() {\n\t\t\tservices[i].WebService(s.ws)\n\t\t} else {\n\t\t\tif s.noPrifixWs == nil {\n\t\t\t\ts.noPrifixWs = new(restful.WebService)\n\t\t\t\ts.noPrifixWs.Consumes(restful.MIME_JSON, \"application/x-www-form-urlencoded\").Produces(restful.MIME_JSON)\n\t\t\t}\n\t\t\tservices[i].WebService(s.noPrifixWs)\n\t\t}\n\t\tlogrus.Infof(\"controller %T regist router\", services[i])\n\t}\n}", "func Add(\n\tmgr manager.Manager,\n\tnumWorkers int,\n\tlog *zap.SugaredLogger,\n\tnamespace string,\n\tseedKubeconfigGetter provider.SeedKubeconfigGetter,\n\tseedsGetter provider.SeedsGetter,\n) error {\n\treconciler := &Reconciler{\n\t\tClient: mgr.GetClient(),\n\t\trecorder: mgr.GetEventRecorderFor(ControllerName),\n\t\tlog: log.Named(ControllerName),\n\t\tseedClientGetter: kubernetesprovider.SeedClientGetterFactory(seedKubeconfigGetter),\n\t}\n\n\tctrlOptions := controller.Options{Reconciler: reconciler, MaxConcurrentReconciles: numWorkers}\n\tc, err := controller.New(ControllerName, mgr, ctrlOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnsPredicate := predicate.ByNamespace(namespace)\n\n\t// watch all seeds in the given namespace\n\tif err := c.Watch(source.Kind(mgr.GetCache(), &kubermaticv1.Seed{}), &handler.EnqueueRequestForObject{}, nsPredicate); err != nil {\n\t\treturn fmt.Errorf(\"failed to create watcher: %w\", err)\n\t}\n\n\t// watch all KubermaticConfigurations in the given namespace\n\tconfigHandler := func(_ context.Context, o ctrlruntimeclient.Object) []reconcile.Request {\n\t\tseeds, err := seedsGetter()\n\t\tif err != nil {\n\t\t\tlog.Errorw(\"Failed to retrieve seeds\", zap.Error(err))\n\t\t\treturn nil\n\t\t}\n\n\t\trequests := []reconcile.Request{}\n\t\tfor _, seed := range seeds {\n\t\t\trequests = append(requests, reconcile.Request{\n\t\t\t\tNamespacedName: types.NamespacedName{\n\t\t\t\t\tNamespace: seed.GetNamespace(),\n\t\t\t\t\tName: seed.GetName(),\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\treturn requests\n\t}\n\n\tif err := c.Watch(source.Kind(mgr.GetCache(), &kubermaticv1.KubermaticConfiguration{}), handler.EnqueueRequestsFromMapFunc(configHandler), nsPredicate); err != nil {\n\t\treturn fmt.Errorf(\"failed to create watcher: %w\", err)\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"webapp-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource WebApp\n\terr = c.Watch(&source.Kind{Type: &appv1alpha1.WebApp{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner WebApp\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appv1alpha1.WebApp{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"elasticsearchtemplate-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ElasticSearchTemplate\n\terr = c.Watch(&source.Kind{Type: &xov1alpha1.ElasticSearchTemplate{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nameservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NameService\n\terr = c.Watch(&source.Kind{Type: &rocketmqv1alpha1.NameService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner NameService\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &rocketmqv1alpha1.NameService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tc, err := controller.New(\"application-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &appv1alpha1.Application{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: find out how to test this.\n\twatchedTypes := []runtime.Object{&corev1.ConfigMap{}, &appsv1.Deployment{}, &corev1.Service{}}\n\tfor _, t := range watchedTypes {\n\t\terr = c.Watch(&source.Kind{Type: t}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &appv1alpha1.Application{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func Add(mgr manager.Manager, hubconfig *rest.Config, cluster types.NamespacedName) error {\n\treconciler, err := newReconciler(mgr, hubconfig, cluster)\n\tif err != nil {\n\t\tklog.Error(\"Failed to create the deployer reconciler \", err)\n\t\treturn err\n\t}\n\treconciler.start()\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"rokku-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Rokku\n\terr = c.Watch(&source.Kind{Type: &rokkuv1alpha1.Rokku{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// HACK(nettoclaudio): Since the Rokku needs store all its pods' info into\n\t// the status field, we need watching every pod changes and enqueue a new\n\t// reconcile request to its Rokku owner, if any.\n\treturn c.Watch(&source.Kind{Type: &corev1.Pod{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\tToRequests: handler.ToRequestsFunc(func(o handler.MapObject) []reconcile.Request {\n\t\t\t\trokkuResourceName := k8s.GetRokkuNameFromObject(o.Meta)\n\t\t\t\tif rokkuResourceName == \"\" {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\treturn []reconcile.Request{\n\t\t\t\t\t{NamespacedName: types.NamespacedName{\n\t\t\t\t\t\tName: rokkuResourceName,\n\t\t\t\t\t\tNamespace: o.Meta.GetNamespace(),\n\t\t\t\t\t}},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"mongodbatlasproject-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource MongoDBAtlasProject\n\terr = c.Watch(&source.Kind{Type: &knappekv1alpha1.MongoDBAtlasProject{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"outgoingportal-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &tesseractv1alpha1.OutgoingPortal{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployments and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Services and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"outgoingportal-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &tesseractv1alpha1.OutgoingPortal{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployments and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Services and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func AddMachineControllerToManager(ctx *context.ControllerManagerContext, mgr manager.Manager) error {\n\n\tvar (\n\t\tcontrolledType = &infrav1.VSphereMachine{}\n\t\tcontrolledTypeName = reflect.TypeOf(controlledType).Elem().Name()\n\t\tcontrolledTypeGVK = infrav1.GroupVersion.WithKind(controlledTypeName)\n\n\t\tcontrollerNameShort = fmt.Sprintf(\"%s-controller\", strings.ToLower(controlledTypeName))\n\t\tcontrollerNameLong = fmt.Sprintf(\"%s/%s/%s\", ctx.Namespace, ctx.Name, controllerNameShort)\n\t)\n\n\t// Build the controller context.\n\tcontrollerContext := &context.ControllerContext{\n\t\tControllerManagerContext: ctx,\n\t\tName: controllerNameShort,\n\t\tRecorder: record.New(mgr.GetEventRecorderFor(controllerNameLong)),\n\t\tLogger: ctx.Logger.WithName(controllerNameShort),\n\t}\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\t// Watch the controlled, infrastructure resource.\n\t\tFor(controlledType).\n\t\t// Watch any VSphereVM resources owned by the controlled type.\n\t\tWatches(\n\t\t\t&source.Kind{Type: &infrav1.VSphereVM{}},\n\t\t\t&handler.EnqueueRequestForOwner{OwnerType: controlledType, IsController: false},\n\t\t).\n\t\t// Watch the CAPI resource that owns this infrastructure resource.\n\t\tWatches(\n\t\t\t&source.Kind{Type: &clusterv1.Machine{}},\n\t\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\t\tToRequests: clusterutilv1.MachineToInfrastructureMapFunc(controlledTypeGVK),\n\t\t\t},\n\t\t).\n\t\t// Watch a GenericEvent channel for the controlled resource.\n\t\t//\n\t\t// This is useful when there are events outside of Kubernetes that\n\t\t// should cause a resource to be synchronized, such as a goroutine\n\t\t// waiting on some asynchronous, external task to complete.\n\t\tWatches(\n\t\t\t&source.Channel{Source: ctx.GetGenericEventChannelFor(controlledTypeGVK)},\n\t\t\t&handler.EnqueueRequestForObject{},\n\t\t).\n\t\tComplete(machineReconciler{ControllerContext: controllerContext})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"example-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Example\n\terr = c.Watch(&source.Kind{Type: &examplev1alpha1.Example{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Pods and requeue the owner Example\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &examplev1alpha1.Example{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\tosClient, err := openstack.NewClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn add(mgr, newReconciler(mgr, osClient))\n}", "func NewController() *Controller {\n\treturn &Controller{\n\t\tClouds: make(map[string]CloudProvider),\n\t\t// WorkerOptions: NewWorkerOptions(),\n\t\tprovisionErr: NewErrCloudProvision(),\n\t}\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := crctrl.New(CtrlName, mgr, crctrl.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to PullRequestQueue\n\terr = c.Watch(&source.Kind{Type: &s2hv1.PullRequestQueue{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tisOpenShift, _, err := util.DetectOpenShift()\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"An error occurred when detecting current infra: %s\", err)\n\t}\n\t// Create a new controller\n\tc, err := controller.New(\"che-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// register OpenShift routes in the scheme\n\tif isOpenShift {\n\t\tif err := routev1.AddToScheme(mgr.GetScheme()); err != nil {\n\t\t\tlogrus.Errorf(\"Failed to add OpenShift route to scheme: %s\", err)\n\t\t}\n\t\tif err := oauth.AddToScheme(mgr.GetScheme()); err != nil {\n\t\t\tlogrus.Errorf(\"Failed to add oAuth to scheme: %s\", err)\n\t\t}\n\t}\n\n\t// register RBAC in the scheme\n\tif err := rbac.AddToScheme(mgr.GetScheme()); err != nil {\n\t\tlogrus.Errorf(\"Failed to add RBAC to scheme: %s\", err)\n\t}\n\n\t// Watch for changes to primary resource CheCluster\n\terr = c.Watch(&source.Kind{Type: &orgv1.CheCluster{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resources and requeue the owner CheCluster\n\n\tif err = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tif err = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &rbac.Role{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &rbac.RoleBinding{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.ServiceAccount{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isOpenShift {\n\t\terr = c.Watch(&source.Kind{Type: &routev1.Route{}}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &orgv1.CheCluster{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\terr = c.Watch(&source.Kind{Type: &v1beta1.Ingress{}}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &orgv1.CheCluster{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.PersistentVolumeClaim{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewController(\n\tkubeclientset kubernetes.Interface,\n\tsampleclientset clientset.Interface,\n\tdeploymentInformer appsinformers.DeploymentInformer,\n\tingressinformer externsionsv1beta1informers.IngressInformer,\n\tserviceInformer coreinformers.ServiceInformer,\n configmapInformer coreinformers.ConfigMapInformer,\n persistentVolumeClaimInformer coreinformers.PersistentVolumeClaimInformer,\n\tapimanagerInformer informers.APIManagerInformer) *Controller {\n\n\t// Create event broadcaster.\n\t// Add apim-controller types to the default Kubernetes Scheme so Events can be logged for apim-controller types.\n\tutilruntime.Must(samplescheme.AddToScheme(scheme.Scheme))\n\tklog.V(4).Info(\"Creating event broadcaster\")\n\teventBroadcaster := record.NewBroadcaster()\n\teventBroadcaster.StartLogging(klog.Infof)\n\teventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeclientset.CoreV1().Events(\"\")})\n\trecorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName})\n\n\tcontroller := &Controller{\n\t\tkubeclientset: kubeclientset,\n\t\tsampleclientset: sampleclientset,\n\t\tdeploymentsLister: deploymentInformer.Lister(),\n\t\tdeploymentsSynced: deploymentInformer.Informer().HasSynced,\n\t\tservicesLister: serviceInformer.Lister(),\n\t\tingressLister: ingressinformer.Lister(),\n\t\tservicesSynced: serviceInformer.Informer().HasSynced,\n configMapLister: configmapInformer.Lister(),\n persistentVolumeClaimsLister: persistentVolumeClaimInformer.Lister(),\n\t\tapimanagerslister: apimanagerInformer.Lister(),\n\t\tapimanagersSynced: apimanagerInformer.Informer().HasSynced,\n\t\tworkqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"Apimanagers\"),\n\t\trecorder: recorder,\n\t}\n\n\tklog.Info(\"Setting up event handlers\")\n\t// Set up an event handler for when Apimanager resources change\n\tapimanagerInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.enqueueApimanager,\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tcontroller.enqueueApimanager(new)\n\t\t},\n\t})\n\t// Set up an event handler for when Deployment resources change. This handler will lookup the owner of the given\n\t// Deployment, and if it is owned by a Apimanager resource will enqueue that Apimanager resource for processing.\n\t// This way, we don't need to implement custom logic for handling Deployment resources. More info on this pattern:\n\t// https://github.com/kubernetes/community/blob/8cafef897a22026d42f5e5bb3f104febe7e29830/contributors/devel/controllers.md\n\tdeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.handleObject,\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tnewDepl := new.(*appsv1.Deployment)\n\t\t\toldDepl := old.(*appsv1.Deployment)\n\t\t\tif newDepl.ResourceVersion == oldDepl.ResourceVersion {\n\t\t\t\t// Periodic resync will send update events for all known Deployments.\n\t\t\t\t// Two different versions of the same Deployment will always have different RVs.\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcontroller.handleObject(new)\n\t\t},\n\t\tDeleteFunc: controller.handleObject,\n\t})\n\tserviceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.handleObject,\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tnewServ := new.(*corev1.Service)\n\t\t\toldServ := old.(*corev1.Service)\n\t\t\tif newServ.ResourceVersion == oldServ.ResourceVersion {\n\t\t\t\t// Periodic resync will send update events for all known Services.\n\t\t\t\t// Two different versions of the same Service will always have different RVs.\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcontroller.handleObject(new)\n\t\t},\n\t\tDeleteFunc: controller.handleObject,\n\t})\n\n persistentVolumeClaimInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.handleObject,\n\t\tDeleteFunc: controller.handleObject,\n\t})\n\n\tconfigmapInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.handleObject,\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tnewConf := new.(*corev1.ConfigMap)\n\t\t\toldConf := old.(*corev1.ConfigMap)\n\t\t\tnewConf.ResourceVersion =\"\"\n\t\t\toldConf.ResourceVersion =\"\"\n\n\t\t\tcontroller.handleObject(new)\n\t\t},\n\t\tDeleteFunc: controller.handleObject,\n\t})\n\n\tingressinformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.handleObject,\n\t\tDeleteFunc: controller.handleObject,\n\t})\n\n\treturn controller\n}", "func Register(controller controller.Controller) {\n\tregistry.Register(controller)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"blackboxtarget-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource BlackboxTarget\n\terr = c.Watch(&source.Kind{Type: &applicationmonitoringv1alpha1.BlackboxTarget{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\t// Use the ServiceAccount CA cert and token to setup $HOME/.kube/config.\n\t// This is used to deploy Pulumi Stacks of k8s resources\n\t// in-cluster that use the default, ambient kubeconfig.\n\tif err := setupInClusterKubeconfig(); err != nil {\n\t\tlog.Info(\"skipping in-cluster kubeconfig setup due to non-existent ServiceAccount\", \"error\", err)\n\t}\n\treturn add(mgr, newReconciler(mgr))\n}" ]
[ "0.6881614", "0.6815906", "0.6669118", "0.6557132", "0.6517072", "0.64745504", "0.6472665", "0.64476967", "0.6436813", "0.6425181", "0.6382936", "0.6295244", "0.6247484", "0.61246836", "0.59649366", "0.590234", "0.5882951", "0.58423173", "0.58188677", "0.5807343", "0.5766581", "0.57627404", "0.57601196", "0.57410634", "0.57291025", "0.57185465", "0.5692877", "0.5690299", "0.56874543", "0.568066", "0.56762224", "0.5674992", "0.5663825", "0.5663527", "0.564427", "0.56284684", "0.56206673", "0.561281", "0.5609303", "0.56087923", "0.5604197", "0.5596629", "0.5575043", "0.5572097", "0.5565268", "0.5556233", "0.55560756", "0.5540572", "0.553621", "0.5497832", "0.5494482", "0.5494089", "0.54891586", "0.5484241", "0.54794806", "0.5459745", "0.5449707", "0.5442602", "0.5439829", "0.5438582", "0.5434879", "0.5425128", "0.54225993", "0.5419438", "0.5403733", "0.5401649", "0.5399198", "0.5395739", "0.5378573", "0.537413", "0.53541595", "0.5341807", "0.5333041", "0.5329084", "0.5327115", "0.5320697", "0.53192353", "0.5317638", "0.531721", "0.53150326", "0.53133005", "0.5305305", "0.5302791", "0.5302777", "0.5296184", "0.5293358", "0.52901876", "0.5269493", "0.52511865", "0.525062", "0.525062", "0.52424395", "0.5242391", "0.5237176", "0.52352786", "0.52288437", "0.52239484", "0.5222906", "0.52109706", "0.5209653", "0.5205312" ]
0.0
-1
newReconciler returns a new reconcile.Reconciler
func newReconciler(mgr manager.Manager) reconcile.Reconciler { return &ReconcileKogitoInfra{client: client.NewForController(mgr.GetConfig()), scheme: mgr.GetScheme()} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileStack{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileChe{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager, resourceManager resources.ResourceManager, clusterFactory clusterFactory.ClusterFactory) reconcile.Reconciler {\n\treturn &ReconcileServiceInstance{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tclusterFactory: clusterFactory,\n\t\tresourceManager: resourceManager,\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileExample{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileRestaurant{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileControlPlane{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tr := &Reconciler{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tkubeclient: kubernetes.NewForConfigOrDie(mgr.GetConfig()),\n\t\trecorder: mgr.GetRecorder(controllerName),\n\t}\n\tr.provision = r._provision\n\tr.bind = r._bind\n\tr.delete = r._delete\n\treturn r\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileCanary{Client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcilerPolkadot{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tr := &Reconciler{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tkubeclient: kubernetes.NewForConfigOrDie(mgr.GetConfig()),\n\t\trecorder: mgr.GetRecorder(controllerName),\n\t}\n\tr.validate = r._validate\n\treturn r\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileSdewan{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileIntegration{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileFunction{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileNode{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileDolevOp{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileAPIScheme{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileSporos{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileGitSource{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileServer{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileTemplate{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tindicesWatchingCancellers: make(map[string]context.CancelFunc),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileKubemanager{Client: mgr.GetClient(), Scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager, channelDescriptor *utils.ChannelDescriptor, logger logr.Logger) reconcile.Reconciler {\n\treturn &ReconcileDeployable{\n\t\tKubeClient: mgr.GetClient(),\n\t\tChannelDescriptor: channelDescriptor,\n\t\tLog: logger,\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &JenkinsReconciler{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func NewReconciler(cli client.Client, sch *runtime.Scheme, dm discoverymapper.DiscoveryMapper) *Reconciler {\n\treturn &Reconciler{\n\t\tdm: dm,\n\t\tClient: cli,\n\t\tScheme: sch,\n\t\twr: NewWorkloadRenderer(cli),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileDeploymentConfig{Client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileAppService{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileRokku{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager, actuator Actuator) reconcile.Reconciler {\n\treturn &ReconcileCluster{Client: mgr.GetClient(), scheme: mgr.GetScheme(), actuator: actuator}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileJedyKind{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileCopybird{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileCronner{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileDatabase{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileZdyfapi{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileDfJob{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager, client dynamic.Interface) (reconcile.Reconciler, error) {\n\treturn &Reconciler{\n\t\tdynClient: client,\n\t\tscheme: mgr.GetScheme(),\n\t\tRestMapper: mgr.GetRESTMapper(),\n\t}, nil\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileForwarding{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tlogger := log.WithName(\"newReconciler\")\n\tpodResourcesClient, err := podresourcesclient.NewPodResourcesClient()\n\tif err != nil {\n\t\tlogger.Error(err, \"unable to create podresources client\")\n\t\treturn nil\n\t}\n\treturn &ReconcilePod{client: mgr.GetClient(), scheme: mgr.GetScheme(), podResourcesClient: podResourcesClient}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileApplication{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileApplication{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileMinecraft{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileMinecraft{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileCollectd{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) (reconcile.Reconciler, error) {\n\n\tclientSet, err := kubernetes.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ReconcileDataset{\n\t\tclientSet: clientSet,\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t}, nil\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tscheme := mgr.GetScheme()\n\toappsv1.AddToScheme(scheme)\n\troutev1.AddToScheme(scheme)\n\t// Best practices\n\treturn &ReconcileCanary{client: mgr.GetClient(), scheme: scheme, recorder: mgr.GetRecorder(controllerName)}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileDescheduler{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\teventBroadcaster := record.NewBroadcaster()\n\teventBroadcaster.StartLogging(klog.Infof)\n\tclient, err :=clientset.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\tklog.Errorln(err)\n\t}\n\tkclient, err := kubeclient.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\tklog.Errorln(err)\n\t}\n\tdc := &ReconcileDeployment{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tKetiClient: client,\n\t\tKubeClient: kclient,\n\t\tqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"deployment\"),\n\t}\n\tdc.rsControl = util.RealRSControl{\n\t\tKubeClient: kclient,\n\t}\n\tdc.syncHandler = dc.Reconcile\n\tdc.enqueueDeployment = dc.enqueue\n\n\treturn dc\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileCollection{client: mgr.GetClient(), scheme: mgr.GetScheme(), indexResolver: ResolveIndex}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileMattermostRestoreDB{client: mgr.GetClient(), scheme: mgr.GetScheme(), state: mattermostv1alpha1.Restoring}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileProjectReference{client: mgr.GetClient(), scheme: mgr.GetScheme(), gcpClientBuilder: gcpclient.NewClient}\n}", "func newReconciler(mgr manager.Manager, c utils.Config) reconcile.Reconciler {\n\tscheme := mgr.GetScheme()\n\treturn &ReconcileReleaseManager{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: scheme,\n\t\tconfig: c,\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileInfluxdb{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileConfigMap{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tfactory := &helmreconciler.Factory{CustomizerFactory: &IstioRenderingCustomizerFactory{}}\n\treturn &ReconcileIstioControlPlane{client: mgr.GetClient(), scheme: mgr.GetScheme(), factory: factory}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\n\treturn &ReconcileKeycloakClient{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tcancel: cancel,\n\t\tcontext: ctx,\n\t\trecorder: mgr.GetEventRecorderFor(ControllerName),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileClusterSync{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) (reconcile.Reconciler, error) {\n\tsv, err := version.Server()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get version: %v\", err)\n\t}\n\n\treturn &ReconcilePerconaXtraDBClusterBackup{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tserverVersion: sv,\n\t}, nil\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileApiCurioDeployment{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tconfig: mgr.GetConfig(),\n\t\tbox: packr.NewBox(\"../../../res\"),\n\t}\n}", "func newReconciler(mgr manager.Manager, managedClient client.Client,\n\tmanagedRecorder record.EventRecorder) reconcile.Reconciler {\n\treturn &ReconcilePolicy{hubClient: mgr.GetClient(), managedClient: managedClient,\n\t\tmanagedRecorder: managedRecorder, scheme: mgr.GetScheme()}\n}", "func NewReconciler(mgr manager.Manager) *Reconciler {\n\tr := &Reconciler{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tjcUID: int64(os.Getuid()),\n\t\tjcGID: int64(os.Getgid()),\n\t}\n\treturn r\n}", "func newReconciler(mgr manager.Manager) (reconcile.Reconciler, error) {\n\tawsSession, err := aws.GetAwsSessionFromEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ReconcileNode{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tnodeTagger: aws.NewNodeInstanceTagger(ec2.New(awsSession)),\n\t}, nil\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileRethinkDBCluster{client: mgr.GetClient(), config: mgr.GetConfig(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileKedaController{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcilePodReplica{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileTaskRun{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tscmFactory: tracker.CreateSCMClient,\n\t\ttaskRuns: make(taskRunTracker),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileCockroachDB{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileContainerJFR{scheme: mgr.GetScheme(), client: mgr.GetClient(),\n\t\tReconcilerTLS: common.NewReconcilerTLS(&common.ReconcilerTLSConfig{\n\t\t\tClient: mgr.GetClient(),\n\t\t}),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileTektonInstallation{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) *ReconcileCluster {\n\treturn &ReconcileCluster{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\trecorder: mgr.GetEventRecorderFor(controllerName),\n\t}\n}", "func newReconciler(name string, controllerConfig config.DNSServiceConfig) *reconciler {\n\treturn &reconciler{\n\t\tEnv: common.NewEnv(name, controllerConfig),\n\t}\n}", "func newReconciler(mgr manager.Manager) *ReconcileChaosBlade {\n\tcbClient := mgr.GetClient().(*channel.Client)\n\treturn &ReconcileChaosBlade{\n\t\tclient: cbClient,\n\t\tscheme: mgr.GetScheme(),\n\t\tExecutor: exec.NewDispatcherExecutor(cbClient),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileGrafana{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\thelper: common.NewKubeHelper(),\n\t\tplugins: newPluginsHelper(),\n\t\tconfig: common.GetControllerConfig(),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileWavefrontProxy{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func NewReconciler(log *logrus.Entry, client client.Client) *Reconciler {\n\treturn &Reconciler{\n\t\tlog: log,\n\t\tclient: client,\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileNameService{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileNameService{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileJenkinsInstance{\n\t\tClient: mgr.GetClient(),\n\t\tEventRecorder: mgr.GetRecorder(\"JenkinsInstanceController\"),\n\t\tscheme: mgr.GetScheme(),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileDroidVirt{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileFloatingIPSet{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\trecorder: mgr.GetRecorder(\"floatingipassociate-controller\"),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileBlackboxTarget{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileHive{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n }\n}", "func newReconciler(mgr manager.Manager) (reconcile.Reconciler) {\n\treturn &ReconcileSriovNetwork{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tcli := util.NewClientFromManager(mgr, \"resourcedistribution-controller\")\n\treturn &ReconcileResourceDistribution{\n\t\tClient: cli,\n\t\tscheme: mgr.GetScheme(),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileProjectClaim{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileMysql{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileWordpress{Client: mgr.GetClient(), scheme: mgr.GetScheme(), recorder: mgr.GetRecorder(controllerName)}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileHiveConfig{Client: mgr.GetClient(), scheme: mgr.GetScheme(), restConfig: mgr.GetConfig()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileApplicationMonitoring{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\thelper: NewKubeHelper(),\n\t\textraParams: make(map[string]string),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileWebApp{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tvar err error\n\tvar c clientv3.Interface\n\tvar rc *rest.Config\n\n\tif c, err = clientv3.NewFromEnv(); err != nil {\n\t\treturn nil\n\t}\n\n\t// for pods/exec\n\tif rc, err = rest.InClusterConfig(); err != nil {\n\t\tlog.Error(err, \"Failed to get *rest.Config\")\n\t\treturn nil\n\t}\n\treturn &ReconcileRouteReflector{client: mgr.GetClient(), calico: c, rconfig: rc, scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileMongoDB{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(\n\tmgr manager.Manager,\n\tmutationSystem *mutation.System,\n\ttracker *readiness.Tracker,\n\tgetPod func(context.Context) (*corev1.Pod, error),\n\tkind string,\n\tnewMutationObj func() client.Object,\n\tmutatorFor func(client.Object) (types.Mutator, error),\n\tevents chan event.GenericEvent,\n) *Reconciler {\n\tr := &Reconciler{\n\t\tsystem: mutationSystem,\n\t\tClient: mgr.GetClient(),\n\t\ttracker: tracker,\n\t\tgetPod: getPod,\n\t\tscheme: mgr.GetScheme(),\n\t\treporter: ctrlmutators.NewStatsReporter(),\n\t\tcache: ctrlmutators.NewMutationCache(),\n\t\tgvk: mutationsv1.GroupVersion.WithKind(kind),\n\t\tnewMutationObj: newMutationObj,\n\t\tmutatorFor: mutatorFor,\n\t\tlog: logf.Log.WithName(\"controller\").WithValues(logging.Process, fmt.Sprintf(\"%s_controller\", strings.ToLower(kind))),\n\t\tevents: events,\n\t}\n\tif getPod == nil {\n\t\tr.getPod = r.defaultGetPod\n\t}\n\treturn r\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileVirtualcluster{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t}\n}", "func NewReconciler(client client.Client, scheme *runtime.Scheme, eventSourceImage string, logger *zap.SugaredLogger) reconcile.Reconciler {\n\treturn &reconciler{client: client, scheme: scheme, eventSourceImage: eventSourceImage, logger: logger}\n}", "func NewReconciler(scope *actuators.MachineScope) *Reconciler {\n\treturn &Reconciler{\n\t\tscope: scope,\n\t\tavailabilityZonesSvc: availabilityzones.NewService(scope),\n\t\tnetworkInterfacesSvc: networkinterfaces.NewService(scope),\n\t\tvirtualMachinesSvc: virtualmachines.NewService(scope),\n\t\tvirtualMachinesExtSvc: virtualmachineextensions.NewService(scope),\n\t\tpublicIPSvc: publicips.NewService(scope),\n\t\tdisksSvc: disks.NewService(scope),\n\t\tavailabilitySetsSvc: availabilitysets.NewService(scope),\n\t}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileSqlDB{Client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileGatlingTask{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileNamespacedValidatingType{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tsnapClientset, err := snapclientset.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &ReconcileVolumeBackup{\n\t\tclient: mgr.GetClient(),\n\t\tsnapClientset: snapClientset,\n\t\tconfig: mgr.GetConfig(),\n\t\tscheme: mgr.GetScheme(),\n\t\texecutor: executor.CreateNewRemotePodExecutor(mgr.GetConfig()),\n\t}\n}", "func NewReconciler(m manager.Manager, of resource.ManagedKind, o ...ReconcilerOption) *Reconciler {\n\tnm := func() resource.Managed {\n\t\treturn resource.MustCreateObject(schema.GroupVersionKind(of), m.GetScheme()).(resource.Managed)\n\t}\n\n\t// Panic early if we've been asked to reconcile a resource kind that has not\n\t// been registered with our controller manager's scheme.\n\t_ = nm()\n\n\tr := &Reconciler{\n\t\tclient: m.GetClient(),\n\t\tnewManaged: nm,\n\t\tpollInterval: defaultpollInterval,\n\t\ttimeout: reconcileTimeout,\n\t\tmanaged: defaultMRManaged(m),\n\t\texternal: defaultMRExternal(),\n\t\tvalidator: defaultMRValidator(),\n\t\t//resolver: defaultMRResolver(),\n\t\tlog: logging.NewNopLogger(),\n\t\trecord: event.NewNopRecorder(),\n\t}\n\n\tfor _, ro := range o {\n\t\tro(r)\n\t}\n\n\treturn r\n}", "func newReconciler(mgr manager.Manager, opts options.AddOptions) reconcile.Reconciler {\n\tr := &ReconcileTiers{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tprovider: opts.DetectedProvider,\n\t\tstatus: status.New(mgr.GetClient(), \"tiers\", opts.KubernetesVersion),\n\t}\n\tr.status.Run(opts.ShutdownContext)\n\treturn r\n}", "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\tclient := mgr.GetClient()\n\treturn &ReconcileIngress{\n\t\tbase: &common.BaseIngressReconciler{\n\t\t\tClient: client,\n\t\t},\n\t\tclient: client,\n\t\tscheme: mgr.GetScheme(),\n\t\trecorder: mgr.GetRecorder(\"knative-openshift-ingress\"),\n\t}\n}" ]
[ "0.869155", "0.86840576", "0.86815375", "0.86403406", "0.8638161", "0.86258256", "0.85951626", "0.85874075", "0.8582973", "0.85744613", "0.8572244", "0.8566092", "0.8559892", "0.8557846", "0.85474354", "0.85370016", "0.85009485", "0.84952927", "0.8490774", "0.8463059", "0.8413889", "0.84062254", "0.83983064", "0.83951896", "0.8393324", "0.83818364", "0.83717686", "0.8368335", "0.8365876", "0.8364473", "0.8359195", "0.8353234", "0.8331304", "0.83308053", "0.83208966", "0.831699", "0.8305883", "0.8298915", "0.8298915", "0.8293432", "0.8293432", "0.82835126", "0.82719594", "0.8267228", "0.82638603", "0.82552385", "0.8250959", "0.8248339", "0.82459176", "0.8242895", "0.8229484", "0.8227937", "0.8209992", "0.8205979", "0.8204427", "0.8197886", "0.8191791", "0.8183849", "0.817271", "0.81668085", "0.8164947", "0.8161387", "0.8160643", "0.8140433", "0.81388557", "0.8137971", "0.81332487", "0.8125937", "0.81235904", "0.8112768", "0.8112301", "0.8102732", "0.8099201", "0.8094858", "0.8094858", "0.8090955", "0.8090343", "0.8065435", "0.8055671", "0.80547166", "0.8047602", "0.804642", "0.8042676", "0.8042421", "0.80294883", "0.8027904", "0.8025611", "0.8025564", "0.8024464", "0.8020152", "0.8016513", "0.801593", "0.8015495", "0.79909194", "0.79838", "0.7971493", "0.7970681", "0.79651064", "0.79629284", "0.79595876", "0.7959353" ]
0.0
-1
add adds a new Controller to mgr with r as the reconcile.Reconciler
func add(mgr manager.Manager, r reconcile.Reconciler) error { log.Debug("Adding watched objects for KogitoInfra controller") // Create a new controller c, err := controller.New("kogitoinfra-controller", mgr, controller.Options{Reconciler: r}) if err != nil { return err } err = c.Watch(&source.Kind{Type: &v1beta1.KogitoInfra{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } var watchedObjects []framework.WatchedObjects watchedObjects = append(watchedObjects, getInfinispanWatchedObjects()...) watchedObjects = append(watchedObjects, getKafkaWatchedObjects()...) watchedObjects = append(watchedObjects, getKeycloakWatchedObjects()...) controllerWatcher := framework.NewControllerWatcher(r.(*ReconcileKogitoInfra).client, mgr, c, &v1beta1.KogitoInfra{}) if err = controllerWatcher.Watch(watchedObjects...); err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KeycloakClient\n\terr = c.Watch(&source.Kind{Type: &kc.KeycloakClient{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Make sure to watch the credential secrets\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &kc.KeycloakClient{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler, client dynamic.Interface) error {\n\topts := controller.Options{Reconciler: r}\n\tc, err := NewSBRController(mgr, opts, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.Watch()\n}", "func Add(mgr manager.Manager) error {\n\tr := newReconciler(mgr)\n\tc, err := addController(mgr, r)\n\tr.controller = c\n\treturn err\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Provider\n\terr = c.Watch(&source.Kind{Type: &gcpv1alpha1.Provider{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\tr := &Reconciler{\n\t\tconnecter: &providerConnecter{kube: mgr.GetClient(), newClient: elasticache.NewClient},\n\t\tkube: mgr.GetClient(),\n\t}\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot create Kubernetes controller\")\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &v1alpha1.ReplicationGroup{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"clustersync-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ClusterSync\n\terr = c.Watch(&source.Kind{Type: &hiveinternal.ClusterSync{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func addController(mgr manager.Manager, r reconcile.Reconciler) (controller.Controller, error) {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Watch for changes to Cluster\n\terr = c.Watch(&source.Kind{Type: &clusterv1.Cluster{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller. All injections (e.g. InjectClient) are performed after this call to controller.New()\n\tc, err := controller.New(\"kedacontroller-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KedaController\n\terr = c.Watch(&source.Kind{Type: &kedav1alpha1.KedaController{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Deployment and requeue the owner KedaController\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &kedav1alpha1.KedaController{},\n\t}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to UnitedDeployment\n\terr = c.Watch(&source.Kind{Type: &appsv1alpha1.UnitedDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &appsv1.StatefulSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appsv1alpha1.UnitedDeployment{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\tr := &Reconciler{\n\t\tconnecter: &providerConnecter{kube: mgr.GetClient(), newClient: resourcegroup.NewClient},\n\t\tkube: mgr.GetClient(),\n\t}\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot create Kubernetes controller\")\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &v1alpha1.ResourceGroup{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"cluster-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Cluster\n\terr = c.Watch(&source.Kind{Type: &clusterv1alpha1.Cluster{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"cloudmetrics-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set up a GenericEvent channel that will be used\n\t// as the event source to trigger the controller's\n\t// reconcile loop\n\tevents := make(chan event.GenericEvent)\n\n\t// Send a generic event to the channel to kick\n\t// off the first reconcile loop\n\tgo func() {\n\t\tevents <- event.GenericEvent{\n\t\t\tMeta: &integreatlyv1alpha1.Redis{},\n\t\t\tObject: &integreatlyv1alpha1.Redis{},\n\t\t}\n\t}()\n\n\t// Setup the controller to use the channel as its watch source\n\terr = c.Watch(&source.Channel{Source: events}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tlog.Info(\"Adding controller for IstioControlPlane\")\n\t// Create a new controller\n\tc, err := controller.New(\"istiocontrolplane-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource IstioControlPlane\n\terr = c.Watch(&source.Kind{Type: &v1alpha2.IstioControlPlane{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Controller added\")\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Instance\n\terr = c.Watch(&source.Kind{Type: &bucketv1alpha1.Bucket{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerAgentName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to KubernetesEventSource\n\terr = c.Watch(&source.Kind{Type: &sourcesv1alpha1.KubernetesEventSource{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to owned ContainerSource\n\terr = c.Watch(&source.Kind{Type: &sourcesv1alpha1.ContainerSource{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sourcesv1alpha1.KubernetesEventSource{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler, logger logr.Logger) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Deployable\n\terr = c.Watch(&source.Kind{Type: &dplv1.Deployable{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// watch for changes to channel too\n\treturn c.Watch(&source.Kind{\n\t\tType: &chv1.Channel{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: &channelMapper{Client: mgr.GetClient(), logger: logger}})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"node-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Node\n\terr = c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"grafana-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Grafana\n\treturn c.Watch(&source.Kind{Type: &i8ly.Grafana{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Policy\n\terr = c.Watch(&source.Kind{Type: &policiesv1.Policy{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"minecraft-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Minecraft\n\terr = c.Watch(&source.Kind{Type: &interviewv1alpha1.Minecraft{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Minecraft\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &interviewv1alpha1.Minecraft{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"minecraft-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Minecraft\n\terr = c.Watch(&source.Kind{Type: &operatorv1alpha1.Minecraft{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Minecraft\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &operatorv1alpha1.Minecraft{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"applicationmonitoring-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ApplicationMonitoring\n\terr = c.Watch(&source.Kind{Type: &applicationmonitoringv1alpha1.ApplicationMonitoring{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Template\n\terr = c.Watch(&source.Kind{Type: &elasticsearchdbv1beta1.Template{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"canary-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Canary\n\terr = c.Watch(&source.Kind{Type: &canaryv1beta1.Canary{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create\n\t// Uncomment watch a Deployment created by Canary - change this for objects you create\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &canaryv1beta1.Canary{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"virtualcluster-controller\",\n\t\tmgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Virtualcluster\n\terr = c.Watch(&source.Kind{\n\t\tType: &tenancyv1alpha1.Virtualcluster{}},\n\t\t&handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := crctrl.New(CtrlName, mgr, crctrl.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to PullRequestQueue\n\terr = c.Watch(&source.Kind{Type: &s2hv1.PullRequestQueue{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"ingress-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Ingress\n\terr = c.Watch(&source.Kind{Type: &networkingv1alpha1.Ingress{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Routes and requeue the\n\t// owner Ingress\n\terr = c.Watch(&source.Kind{Type: &routev1.Route{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &networkingv1alpha1.Ingress{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hive-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHive).kubeClient, err = kubernetes.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHive).deploymentClient, err = appsclientv1.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Hive\n\terr = c.Watch(&source.Kind{Type: &hivev1alpha1.Hive{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: need to watch resources that we have created through code\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"appservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource AppService\n\terr = c.Watch(&source.Kind{Type: &csye7374v1alpha1.AppService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner AppService\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &csye7374v1alpha1.AppService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(config.ControllerNameEnvVar.Value, mgr, controller.Options{Reconciler: r, MaxConcurrentReconciles: 1})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource CustomResource\n\terr = c.Watch(&source.Kind{Type: &polkadotv1alpha1.Polkadot{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource StatefulSet and requeue the owner CustomResource\n\terr = c.Watch(&source.Kind{Type: &appsv1.StatefulSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &polkadotv1alpha1.Polkadot{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Service and requeue the owner CustomResource\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &polkadotv1alpha1.Polkadot{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//TODO add watch for NetworkPolicy\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"server-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Server\n\terr = c.Watch(&source.Kind{Type: &devopsv1.Server{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Server\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &devopsv1.Server{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"controlplane-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ControlPlane\n\terr = c.Watch(&source.Kind{Type: &caksv1alpha1.ControlPlane{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployment and requeue the owner ControlPlane\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{Funcs: predicate.Funcs{DeleteFunc: func(e event.DeleteEvent) bool {\n\t\tif _, ok := e.Meta.GetLabels()[\"tier\"]; ok {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}}})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Service and requeue the owner ControlPlane\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &caksv1alpha1.ControlPlane{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"node-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlabelPreds := []predicate.Predicate{\n\t\tpredicate.Funcs{\n\t\t\tUpdateFunc: func(evt event.UpdateEvent) bool {\n\t\t\t\twatchResourceTag, ok := evt.MetaNew.GetLabels()[watchResourceTag]\n\t\t\t\treturn !(ok && watchResourceTag == watchResourceValue)\n\t\t\t},\n\t\t\tCreateFunc: func(evt event.CreateEvent) bool {\n\t\t\t\twatchResourceTag, ok := evt.Meta.GetLabels()[watchResourceTag]\n\t\t\t\treturn !(ok && watchResourceTag == watchResourceValue)\n\t\t\t},\n\t\t\tGenericFunc: func(evt event.GenericEvent) bool {\n\t\t\t\twatchResourceTag, ok := evt.Meta.GetLabels()[watchResourceTag]\n\t\t\t\treturn !(ok && watchResourceTag == watchResourceValue)\n\t\t\t},\n\t\t},\n\t}\n\n\t// Watch for changes to primary resource Node\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{}, labelPreds...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"apischeme-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource APIScheme\n\terr = c.Watch(&source.Kind{Type: &cloudingressv1alpha1.APIScheme{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"integration-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Integration\n\terr = c.Watch(&source.Kind{Type: &integrationv1alpha1.Integration{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Integration\n\t// Watch for deployment\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &integrationv1alpha1.Integration{},\n\t})\n\n\t// Watch for service\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &integrationv1alpha1.Integration{},\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"cockroachdb-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource CockroachDB\n\terr = c.Watch(&source.Kind{Type: &dbv1alpha1.CockroachDB{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Pods and requeue the owner CockroachDB\n\terr = c.Watch(&source.Kind{Type: &appsv1.StatefulSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &dbv1alpha1.CockroachDB{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hive-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).kubeClient, err = kubernetes.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).apiregClient, err = apiregclientv1.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).apiextClient, err = apiextclientv1beta1.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.(*ReconcileHiveConfig).dynamicClient, err = dynamic.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Regular manager client is not fully initialized here, create our own for some\n\t// initialization API communication:\n\ttempClient, err := client.New(mgr.GetConfig(), client.Options{Scheme: mgr.GetScheme()})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Determine if the openshift-config-managed namespace exists (> v4.0). If so, setup a watch\n\t// for configmaps in that namespace.\n\tns := &corev1.Namespace{}\n\tlog.Debugf(\"checking for existence of the %s namespace\", managedConfigNamespace)\n\terr = tempClient.Get(context.TODO(), types.NamespacedName{Name: managedConfigNamespace}, ns)\n\tif err != nil && !errors.IsNotFound(err) {\n\t\tlog.WithError(err).Errorf(\"error checking existence of the %s namespace\", managedConfigNamespace)\n\t\treturn err\n\t}\n\tif err == nil {\n\t\tlog.Debugf(\"the %s namespace exists, setting up a watch for configmaps on it\", managedConfigNamespace)\n\t\t// Create an informer that only listens to events in the OpenShift managed namespace\n\t\tkubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(r.(*ReconcileHiveConfig).kubeClient, 10*time.Minute, kubeinformers.WithNamespace(managedConfigNamespace))\n\t\tconfigMapInformer := kubeInformerFactory.Core().V1().ConfigMaps().Informer()\n\t\tmgr.Add(&informerRunnable{informer: configMapInformer})\n\n\t\t// Watch for changes to cm/kube-apiserver-aggregator-client-ca in the OpenShift managed namespace\n\t\terr = c.Watch(&source.Informer{Informer: configMapInformer}, &handler.EnqueueRequestsFromMapFunc{ToRequests: handler.ToRequestsFunc(aggregatorCAConfigMapHandler)})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.(*ReconcileHiveConfig).syncAggregatorCA = true\n\t\tr.(*ReconcileHiveConfig).managedConfigCMLister = kubeInformerFactory.Core().V1().ConfigMaps().Lister()\n\t} else {\n\t\tlog.Debugf(\"the %s namespace was not found, skipping watch for the aggregator CA configmap\", managedConfigNamespace)\n\t}\n\n\t// Watch for changes to HiveConfig:\n\terr = c.Watch(&source.Kind{Type: &hivev1.HiveConfig{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Monitor changes to DaemonSets:\n\terr = c.Watch(&source.Kind{Type: &appsv1.DaemonSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hivev1.HiveConfig{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Monitor changes to Deployments:\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hivev1.HiveConfig{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Monitor changes to Services:\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hivev1.HiveConfig{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If no HiveConfig exists, the operator should create a default one, giving the controller\n\t// something to sync on.\n\tlog.Debug(\"checking if HiveConfig 'hive' exists\")\n\tinstance := &hivev1.HiveConfig{}\n\terr = tempClient.Get(context.TODO(), types.NamespacedName{Name: hiveConfigName}, instance)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlog.Info(\"no HiveConfig exists, creating default\")\n\t\tinstance = &hivev1.HiveConfig{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: hiveConfigName,\n\t\t\t},\n\t\t}\n\t\terr = tempClient.Create(context.TODO(), instance)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Lookup the hive-operator Deployment image, we will assume hive components should all be\n\t// using the same image as the operator.\n\toperatorDeployment := &appsv1.Deployment{}\n\terr = tempClient.Get(context.Background(),\n\t\ttypes.NamespacedName{Name: hiveOperatorDeploymentName, Namespace: constants.HiveNamespace},\n\t\toperatorDeployment)\n\tif err == nil {\n\t\timg := operatorDeployment.Spec.Template.Spec.Containers[0].Image\n\t\tpullPolicy := operatorDeployment.Spec.Template.Spec.Containers[0].ImagePullPolicy\n\t\tlog.Debugf(\"loaded hive image from hive-operator deployment: %s (%s)\", img, pullPolicy)\n\t\tr.(*ReconcileHiveConfig).hiveImage = img\n\t\tr.(*ReconcileHiveConfig).hiveImagePullPolicy = pullPolicy\n\t} else {\n\t\tlog.WithError(err).Warn(\"unable to lookup hive image from hive-operator Deployment, image overriding disabled\")\n\t}\n\n\t// TODO: Monitor CRDs but do not try to use an owner ref. (as they are global,\n\t// and our config is namespaced)\n\n\t// TODO: it would be nice to monitor the global resources ValidatingWebhookConfiguration\n\t// and APIService, CRDs, but these cannot have OwnerReferences (which are not namespaced) as they\n\t// are global. Need to use a different predicate to the Watch function.\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"configmap-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ConfigMap\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner ConfigMap\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &corev1.ConfigMap{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nameservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NameService\n\terr = c.Watch(&source.Kind{Type: &rocketmqv1beta1.NameService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner NameService\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &rocketmqv1beta1.NameService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"cronner-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Cronner\n\terr = c.Watch(&source.Kind{Type: &notifyv1alpha1.Cronner{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nameservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NameService\n\terr = c.Watch(&source.Kind{Type: &rocketmqv1alpha1.NameService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner NameService\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &rocketmqv1alpha1.NameService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"mysql-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Mysql\n\terr = c.Watch(&source.Kind{Type: &mysqlv1alpha1.Mysql{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"kogitoapp-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KogitoApp\n\terr = c.Watch(&source.Kind{Type: &v1alpha1.KogitoApp{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twatchOwnedObjects := []runtime.Object{\n\t\t&oappsv1.DeploymentConfig{},\n\t\t&corev1.Service{},\n\t\t&routev1.Route{},\n\t\t&obuildv1.BuildConfig{},\n\t\t&oimagev1.ImageStream{},\n\t}\n\townerHandler := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &v1alpha1.KogitoApp{},\n\t}\n\tfor _, watchObject := range watchOwnedObjects {\n\t\terr = c.Watch(&source.Kind{Type: watchObject}, ownerHandler)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"ibmblockcsi-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource IBMBlockCSI\n\terr = c.Watch(&source.Kind{Type: &csiv1.IBMBlockCSI{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubresources := []runtime.Object{\n\t\t&appsv1.StatefulSet{},\n\t\t&appsv1.DaemonSet{},\n\t}\n\n\tfor _, subresource := range subresources {\n\t\terr = c.Watch(&source.Kind{Type: subresource}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &csiv1.IBMBlockCSI{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"logforwarding-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ClusterLogging\n\terr = c.Watch(&source.Kind{Type: &logforwarding.LogForwarding{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"kubemanager-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Kubemanager\n\terr = c.Watch(&source.Kind{Type: &v1alpha1.Kubemanager{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to PODs\n\tsrcPod := &source.Kind{Type: &corev1.Pod{}}\n\tpodHandler := resourceHandler(mgr.GetClient())\n\tpredInitStatus := utils.PodInitStatusChange(map[string]string{\"contrail_manager\": \"kubemanager\"})\n\tpredPodIPChange := utils.PodIPChange(map[string]string{\"contrail_manager\": \"kubemanager\"})\n\terr = c.Watch(srcPod, podHandler, predPodIPChange)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.Watch(srcPod, podHandler, predInitStatus)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcManager := &source.Kind{Type: &v1alpha1.Manager{}}\n\tmanagerHandler := resourceHandler(mgr.GetClient())\n\tpredManagerSizeChange := utils.ManagerSizeChange(utils.KubemanagerGroupKind())\n\terr = c.Watch(srcManager, managerHandler, predManagerSizeChange)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcCassandra := &source.Kind{Type: &v1alpha1.Cassandra{}}\n\tcassandraHandler := resourceHandler(mgr.GetClient())\n\tpredCassandraSizeChange := utils.CassandraActiveChange()\n\terr = c.Watch(srcCassandra, cassandraHandler, predCassandraSizeChange)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcConfig := &source.Kind{Type: &v1alpha1.Config{}}\n\tconfigHandler := resourceHandler(mgr.GetClient())\n\tpredConfigSizeChange := utils.ConfigActiveChange()\n\terr = c.Watch(srcConfig, configHandler, predConfigSizeChange)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcRabbitmq := &source.Kind{Type: &v1alpha1.Rabbitmq{}}\n\trabbitmqHandler := resourceHandler(mgr.GetClient())\n\tpredRabbitmqSizeChange := utils.RabbitmqActiveChange()\n\terr = c.Watch(srcRabbitmq, rabbitmqHandler, predRabbitmqSizeChange)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcZookeeper := &source.Kind{Type: &v1alpha1.Zookeeper{}}\n\tzookeeperHandler := resourceHandler(mgr.GetClient())\n\tpredZookeeperSizeChange := utils.ZookeeperActiveChange()\n\terr = c.Watch(srcZookeeper, zookeeperHandler, predZookeeperSizeChange)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcDeployment := &source.Kind{Type: &appsv1.Deployment{}}\n\tdeploymentHandler := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &v1alpha1.Kubemanager{},\n\t}\n\tdeploymentPred := utils.DeploymentStatusChange(utils.KubemanagerGroupKind())\n\terr = c.Watch(srcDeployment, deploymentHandler, deploymentPred)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"deployment-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Deployment\n\terr = c.Watch(&source.Kind{Type: &ketiv1.Deployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Deployment\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &ketiv1.Deployment{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"wavefrontproxy-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource WavefrontProxy\n\terr = c.Watch(&source.Kind{Type: &wfv1.WavefrontProxy{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Deployments and requeue the owner WavefrontProxy\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &wfv1.WavefrontProxy{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Services and requeue the owner WavefrontProxy\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &wfv1.WavefrontProxy{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"rokku-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Rokku\n\terr = c.Watch(&source.Kind{Type: &rokkuv1alpha1.Rokku{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// HACK(nettoclaudio): Since the Rokku needs store all its pods' info into\n\t// the status field, we need watching every pod changes and enqueue a new\n\t// reconcile request to its Rokku owner, if any.\n\treturn c.Watch(&source.Kind{Type: &corev1.Pod{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\tToRequests: handler.ToRequestsFunc(func(o handler.MapObject) []reconcile.Request {\n\t\t\t\trokkuResourceName := k8s.GetRokkuNameFromObject(o.Meta)\n\t\t\t\tif rokkuResourceName == \"\" {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\treturn []reconcile.Request{\n\t\t\t\t\t{NamespacedName: types.NamespacedName{\n\t\t\t\t\t\tName: rokkuResourceName,\n\t\t\t\t\t\tNamespace: o.Meta.GetNamespace(),\n\t\t\t\t\t}},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"droidvirt-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource DroidVirt\n\terr = c.Watch(&source.Kind{Type: &dvv1alpha1.DroidVirt{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmapping := &unstructured.Unstructured{}\n\tmapping.SetGroupVersionKind(GatewayMappingGVK())\n\twatchResources := []runtime.Object{\n\t\t&kubevirtv1.VirtualMachineInstance{},\n\t\t&corev1.Service{},\n\t\tmapping,\n\t}\n\n\tfor _, subResource := range watchResources {\n\t\terr = c.Watch(&source.Kind{Type: subResource}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &dvv1alpha1.DroidVirt{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"deploymentconfig-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to DeploymentConfig\n\terr = c.Watch(&source.Kind{Type: &appsapi_v1.DeploymentConfig{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\tscope.Error(err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"application-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Application\n\terr = c.Watch(&source.Kind{Type: &appV1Alpha1.Application{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployment and requeue the owner Application\n\terr = c.Watch(&source.Kind{Type: &appsV1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appV1Alpha1.Application{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"perconaxtradbclusterbackup-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource PerconaXtraDBClusterBackup\n\terr = c.Watch(&source.Kind{Type: &api.PerconaXtraDBClusterBackup{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"sdewan-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Sdewan\n\terr = c.Watch(&source.Kind{Type: &sdewanv1alpha1.Sdewan{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Sdewan\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sdewanv1alpha1.Sdewan{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"parameterstore-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ParameterStore\n\terr = c.Watch(&source.Kind{Type: &ssmv1alpha1.ParameterStore{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &ssmv1alpha1.ParameterStore{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"mattermostrestoredb-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource MattermostRestoreDB\n\terr = c.Watch(&source.Kind{Type: &mattermostv1alpha1.MattermostRestoreDB{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(ctx context.Context, c *config.Config, mgr manager.Manager) error {\n\tctx = ctxlog.NewContext(ctx, \"buildrun-controller\")\n\treturn add(ctx, mgr, NewReconciler(ctx, c, mgr, controllerutil.SetControllerReference))\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"iscsiconnection-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ISCSIConnection\n\terr = c.Watch(&source.Kind{Type: &ic.ISCSIConnection{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"stack-controller\", mgr, controller.Options{\n\t\tReconciler: r,\n\t\tMaxConcurrentReconciles: maxConcurrentReconciles,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Filter out update events if an object's metadata.generation is\n\t// unchanged, or if the object never had a generation update.\n\t// - https://github.com/operator-framework/operator-lib/blob/main/predicate/nogeneration.go#L29-L34\n\t// - https://github.com/operator-framework/operator-sdk/issues/2795\n\t// - https://github.com/kubernetes-sigs/kubebuilder/issues/1103\n\t// - https://github.com/kubernetes-sigs/controller-runtime/pull/553\n\t// - https://book-v1.book.kubebuilder.io/basics/status_subresource.html\n\t// Set up predicates.\n\tpredicates := []predicate.Predicate{\n\t\tpredicate.Or(predicate.GenerationChangedPredicate{}, libpredicate.NoGenerationPredicate{}),\n\t}\n\n\t// Watch for changes to primary resource Stack\n\terr = c.Watch(&source.Kind{Type: &pulumiv1alpha1.Stack{}}, &handler.EnqueueRequestForObject{}, predicates...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"sriovnetwork-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource SriovNetwork\n\terr = c.Watch(&source.Kind{Type: &sriovnetworkv1.SriovNetwork{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Watch for changes to secondary resource NetworkAttachmentDefinition\n\terr = c.Watch(&source.Kind{Type: &netattdefv1.NetworkAttachmentDefinition{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sriovnetworkv1.SriovNetwork{},\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"example-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Example\n\terr = c.Watch(&source.Kind{Type: &examplev1alpha1.Example{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Pods and requeue the owner Example\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &examplev1alpha1.Example{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\topts := controller.Options{Reconciler: r}\n\tc, err := controller.New(\"apicuriodeployment-controller\", mgr, opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ApicurioDeployment\n\terr = c.Watch(&source.Kind{Type: &integreatlyv1alpha1.ApicurioDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &integreatlyv1alpha1.ApicurioDeployment{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"toolchaincluster-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ToolchainCluster\n\treturn c.Watch(&source.Kind{Type: &toolchainv1alpha1.ToolchainCluster{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"routereflector-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource RouteReflector\n\terr = c.Watch(&source.Kind{Type: &routereflectorv1.RouteReflector{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner RouteReflector\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &routereflectorv1.RouteReflector{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"pod-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Pod\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Pod\n\terr = c.Watch(&source.Kind{Type: &intelv1alpha1.RmdWorkload{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &corev1.Pod{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"restaurant-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Restaurant\n\terr = c.Watch(&source.Kind{Type: &v1.Restaurant{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Restaurant\n\townedObjects := []runtime.Object{\n\t\t&appsv1.Deployment{},\n\t\t&corev1.ConfigMap{},\n\t\t&corev1.Service{},\n\t\t&v1beta1.Ingress{},\n\t}\n\n\tfor _, ownedObject := range ownedObjects {\n\t\terr = c.Watch(&source.Kind{Type: ownedObject}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &v1.Restaurant{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"outgoingportal-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &tesseractv1alpha1.OutgoingPortal{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployments and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Services and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"outgoingportal-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &tesseractv1alpha1.OutgoingPortal{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployments and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Services and requeue the owner OutgoingPortal\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &tesseractv1alpha1.OutgoingPortal{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"mongodbatlasproject-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource MongoDBAtlasProject\n\terr = c.Watch(&source.Kind{Type: &knappekv1alpha1.MongoDBAtlasProject{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tc, err := controller.New(\"application-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &appv1alpha1.Application{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: find out how to test this.\n\twatchedTypes := []runtime.Object{&corev1.ConfigMap{}, &appsv1.Deployment{}, &corev1.Service{}}\n\tfor _, t := range watchedTypes {\n\t\terr = c.Watch(&source.Kind{Type: t}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &appv1alpha1.Application{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"containerjfr-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ContainerJFR\n\terr = c.Watch(&source.Kind{Type: &rhjmcv1alpha1.ContainerJFR{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner ContainerJFR\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &rhjmcv1alpha1.ContainerJFR{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// TODO watch certificates and redeploy when renewed\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"podreplica-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource PodReplica\n\terr = c.Watch(&source.Kind{Type: &appv1alpha1.PodReplica{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Pods and requeue the owner PodReplica\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appv1alpha1.PodReplica{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager, recorder record.EventRecorder, logger logr.Logger,\n\tchannelDescriptor *utils.ChannelDescriptor, sync *helmsync.ChannelSynchronizer) error {\n\treturn add(mgr, newReconciler(mgr, channelDescriptor, logger.WithName(controllerName)), logger.WithName(controllerSetup))\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"mongodbatlasdatabase-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource MongoDBAtlasDatabase\n\terr = c.Watch(&source.Kind{Type: &knappekv1alpha1.MongoDBAtlasDatabase{}}, &handler.EnqueueRequestForObject{})\n// err = c.Watch(&source.Kind{Type: &MongoDBAtlasDatabase{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"zdyfapi-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Zdyfapi\n\terr = c.Watch(&source.Kind{Type: &zdyfv1alpha1.Zdyfapi{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource deployment and requeue the owner Zdyfapi\n\t//the deployment's owner is zdyfapi\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &zdyfv1alpha1.Zdyfapi{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\tif !utildiscovery.DiscoverGVK(controllerKind) {\n\t\treturn nil\n\t}\n\treturn add(mgr, newReconciler(mgr))\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"aerospikecluster-controller\", mgr, controller.Options{Reconciler: r, MaxConcurrentReconciles: maxConcurrentReconciles})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource AerospikeCluster\n\terr = c.Watch(\n\t\t&source.Kind{Type: &aerospikev1alpha1.AerospikeCluster{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t\t// Skip where cluster object generation is not changed\n\t\tpredicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: Do we need to monitor this? Statefulset is updated many times in reconcile and this add new entry in\n\t// update queue. If user will change only cr then we may not need to monitor statefulset.\n\t// Think all possible situation\n\n\t// Watch for changes to secondary resource StatefulSet and requeue the owner AerospikeCluster\n\terr = c.Watch(\n\t\t&source.Kind{Type: &appsv1.StatefulSet{}},\n\t\t&handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &aerospikev1alpha1.AerospikeCluster{},\n\t\t}, predicate.Funcs{\n\t\t\tCreateFunc: func(e event.CreateEvent) bool {\n\t\t\t\treturn false\n\t\t\t},\n\t\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\t\treturn false\n\t\t\t},\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"projectclaim-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ProjectClaim\n\terr = c.Watch(&source.Kind{Type: &gcpv1alpha1.ProjectClaim{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"influxdb-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Influxdb\n\terr = c.Watch(&source.Kind{Type: &influxdatav1alpha1.Influxdb{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Influxdb\n\terr = c.Watch(&source.Kind{Type: &appsv1.StatefulSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &influxdatav1alpha1.Influxdb{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"descheduler-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Descheduler\n\terr = c.Watch(&source.Kind{Type: &deschedulerv1alpha1.Descheduler{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hostoperatorconfig-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource HostOperatorConfig\n\treturn c.Watch(&source.Kind{Type: &toolchainv1alpha1.HostOperatorConfig{}}, &handler.EnqueueRequestForObject{})\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Wordpress\n\terr = c.Watch(&source.Kind{Type: &wordpressv1alpha1.Wordpress{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to WordpressRuntime\n\terr = c.Watch(&source.Kind{Type: &wordpressv1alpha1.WordpressRuntime{}}, &handler.EnqueueRequestsFromMapFunc{\n\t\tToRequests: handler.ToRequestsFunc(func(rt handler.MapObject) []reconcile.Request {\n\t\t\trtMap.lock.RLock()\n\t\t\tdefer rtMap.lock.RUnlock()\n\t\t\tvar reconciles = []reconcile.Request{}\n\t\t\tfor key, runtime := range rtMap.m {\n\t\t\t\tif runtime == rt.Meta.GetName() {\n\t\t\t\t\treconciles = append(reconciles, reconcile.Request{NamespacedName: key})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn reconciles\n\t\t}),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for Deployment changes\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &wordpressv1alpha1.Wordpress{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for Service changes\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &wordpressv1alpha1.Wordpress{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(calind): watch for PVC, CronJobs, Jobs and Ingresses\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"blackboxtarget-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource BlackboxTarget\n\terr = c.Watch(&source.Kind{Type: &applicationmonitoringv1alpha1.BlackboxTarget{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"threescale-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ThreeScale\n\terr = c.Watch(&source.Kind{Type: &threescalev1alpha1.ThreeScale{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\tkialiReconciler := defaultKialiReconciler{Client: mgr.GetClient()}\n\tcniConfig, err := cni.InitConfig(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn add(mgr, newReconciler(mgr.GetClient(), mgr.GetScheme(), mgr.GetEventRecorderFor(controllerName), newNamespaceReconciler, &kialiReconciler, cniConfig))\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"jedykind-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource JedyKind\n\terr = c.Watch(&source.Kind{Type: &cachev1alpha1.JedyKind{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner JedyKind\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &cachev1alpha1.JedyKind{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"resourcedistribution-controller\", mgr, controller.Options{\n\t\tReconciler: r, MaxConcurrentReconciles: concurrentReconciles,\n\t\tRateLimiter: ratelimiter.DefaultControllerRateLimiter()})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ResourceDistribution\n\terr = c.Watch(&source.Kind{Type: &appsv1alpha1.ResourceDistribution{}}, &handler.EnqueueRequestForObject{}, predicate.Funcs{\n\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\toldObj := e.ObjectOld.(*appsv1alpha1.ResourceDistribution)\n\t\t\tnewObj := e.ObjectNew.(*appsv1alpha1.ResourceDistribution)\n\t\t\tif !reflect.DeepEqual(oldObj.Spec, newObj.Spec) {\n\t\t\t\tklog.V(3).Infof(\"Observed updated Spec for ResourceDistribution: %s/%s\", oldObj.Namespace, newObj.Name)\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to all namespaces\n\terr = c.Watch(&source.Kind{Type: &corev1.Namespace{}}, &enqueueRequestForNamespace{reader: mgr.GetCache()})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"concoursecipipeline-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ConcourseCIPipeline\n\terr = c.Watch(&source.Kind{Type: &showksv1beta1.ConcourseCIPipeline{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create\n\t// Uncomment watch a Deployment created by ConcourseCIPipeline - change this for objects you create\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &showksv1beta1.ConcourseCIPipeline{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"mongodb-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource MongoDB\n\terr = c.Watch(&source.Kind{Type: &dbaasv1alpha1.MongoDB{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Deployment and requeue the owner MongoDB\n\t// err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &dbaasv1alpha1.MongoDB{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"floatingipset-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to FloatingIPSet\n\terr = c.Watch(&source.Kind{Type: &openstackv1beta1.FloatingIPSet{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create\n\t// Uncomment watch a Deployment created by FloatingIPSet - change this for objects you create\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &openstackv1beta1.FloatingIPSet{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Add(mgr manager.Manager) error {\n\treconciler := &Reconciler{\n\t\tReconciler: base.Reconciler{\n\t\t\tEventRecorder: mgr.GetEventRecorderFor(Name),\n\t\t\tClient: mgr.GetClient(),\n\t\t\tLog: log,\n\t\t},\n\t}\n\tcnt, err := controller.New(\n\t\tName,\n\t\tmgr,\n\t\tcontroller.Options{\n\t\t\tReconciler: reconciler,\n\t\t})\n\tif err != nil {\n\t\tlog.Trace(err)\n\t\treturn err\n\t}\n\t// Primary CR.\n\terr = cnt.Watch(\n\t\t&source.Kind{Type: &api.Hook{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t\t&HookPredicate{})\n\tif err != nil {\n\t\tlog.Trace(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"gitsource-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource GitSource\n\terr = c.Watch(&source.Kind{Type: &v1alpha1.GitSource{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"sqldb-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to SqlDB\n\terr = c.Watch(&source.Kind{Type: &infrav1alpha1.SqlDB{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch a StatefulSet created by SqlDB\n\terr = c.Watch(&source.Kind{Type: &appsv1.StatefulSet{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &infrav1alpha1.SqlDB{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch a Service created by SqlDB\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &infrav1alpha1.SqlDB{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"elasticsearchtemplate-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ElasticSearchTemplate\n\terr = c.Watch(&source.Kind{Type: &xov1alpha1.ElasticSearchTemplate{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, c controller.Controller) error {\n\tif err := utils.AddNetworkWatch(c); err != nil {\n\t\treturn fmt.Errorf(\"tiers-controller failed to watch Tigera network resource: %v\", err)\n\t}\n\n\tif err := utils.AddAPIServerWatch(c); err != nil {\n\t\treturn fmt.Errorf(\"tiers-controller failed to watch APIServer resource: %v\", err)\n\t}\n\n\tif err := utils.AddNodeLocalDNSWatch(c); err != nil {\n\t\treturn fmt.Errorf(\"tiers-controller failed to watch node-local-dns daemonset: %v\", err)\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"imagesigningrequest-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ImageSigningRequest\n\terr = c.Watch(&source.Kind{Type: &imagesigningrequestsv1alpha1.ImageSigningRequest{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &imagesigningrequestsv1alpha1.ImageSigningRequest{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"projectreference-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ProjectReference\n\terr = c.Watch(&source.Kind{Type: &gcpv1alpha1.ProjectReference{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"jbosswebserver-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource JBossWebServer\n\terr = c.Watch(&source.Kind{Type: &jwsserversv1alpha1.JBossWebServer{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Pods and requeue the owner JBossWebServer\n\tenqueueRequestForOwner := handler.EnqueueRequestForOwner{\n\tIsController: true,\n\tOwnerType: &jwsserversv1alpha1.JBossWebServer{},\n\t}\n\tfor _, obj := range [3]runtime.Object{&kbappsv1.StatefulSet{}, &corev1.Service{}, &routev1.Route{}} {\n\t\tif err = c.Watch(&source.Kind{Type: obj}, &enqueueRequestForOwner); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"tektoninstallation-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource TektonInstallation\n\tif err := c.Watch(&source.Kind{Type: &v1alpha1.TektonInstallation{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{}); err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource\n\tenqueueRequestForOwner := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &toolchainv1alpha1.TektonInstallation{},\n\t}\n\n\treturn c.Watch(&source.Kind{Type: &olmv1alpha1.Subscription{}}, enqueueRequestForOwner)\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tisOpenShift, _, err := util.DetectOpenShift()\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"An error occurred when detecting current infra: %s\", err)\n\t}\n\t// Create a new controller\n\tc, err := controller.New(\"che-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// register OpenShift routes in the scheme\n\tif isOpenShift {\n\t\tif err := routev1.AddToScheme(mgr.GetScheme()); err != nil {\n\t\t\tlogrus.Errorf(\"Failed to add OpenShift route to scheme: %s\", err)\n\t\t}\n\t\tif err := oauth.AddToScheme(mgr.GetScheme()); err != nil {\n\t\t\tlogrus.Errorf(\"Failed to add oAuth to scheme: %s\", err)\n\t\t}\n\t}\n\n\t// register RBAC in the scheme\n\tif err := rbac.AddToScheme(mgr.GetScheme()); err != nil {\n\t\tlogrus.Errorf(\"Failed to add RBAC to scheme: %s\", err)\n\t}\n\n\t// Watch for changes to primary resource CheCluster\n\terr = c.Watch(&source.Kind{Type: &orgv1.CheCluster{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resources and requeue the owner CheCluster\n\n\tif err = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tif err = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &rbac.Role{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &rbac.RoleBinding{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.ServiceAccount{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isOpenShift {\n\t\terr = c.Watch(&source.Kind{Type: &routev1.Route{}}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &orgv1.CheCluster{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\terr = c.Watch(&source.Kind{Type: &v1beta1.Ingress{}}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &orgv1.CheCluster{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.PersistentVolumeClaim{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &orgv1.CheCluster{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}" ]
[ "0.8065599", "0.8041863", "0.8039001", "0.79055005", "0.7891124", "0.78873914", "0.7865392", "0.78636605", "0.7836571", "0.77969944", "0.77768266", "0.77674615", "0.7749199", "0.7746262", "0.77203226", "0.767996", "0.7634948", "0.76342267", "0.76201874", "0.76085454", "0.76036733", "0.76022243", "0.75748", "0.75700486", "0.7565603", "0.7546541", "0.7520354", "0.7477108", "0.7460041", "0.74483025", "0.743946", "0.7437785", "0.742812", "0.7422282", "0.74132794", "0.73962986", "0.73811513", "0.73766714", "0.73478156", "0.73472184", "0.73444325", "0.73385376", "0.7319186", "0.7313555", "0.73012275", "0.7295048", "0.7257409", "0.72572285", "0.7248052", "0.7245787", "0.7242614", "0.72147524", "0.72137463", "0.7212727", "0.7207034", "0.7196819", "0.7189419", "0.7182751", "0.7177844", "0.7174655", "0.71697253", "0.71693856", "0.7149183", "0.7141969", "0.71374273", "0.7136544", "0.7134781", "0.7134781", "0.71299887", "0.7129373", "0.71259505", "0.7125561", "0.7111115", "0.71100986", "0.7093594", "0.70883834", "0.7083033", "0.70782787", "0.707259", "0.7055304", "0.70380574", "0.7030017", "0.7028437", "0.70243704", "0.7023928", "0.7014719", "0.700781", "0.70045197", "0.7003241", "0.7000605", "0.6993859", "0.6992397", "0.69923604", "0.6989762", "0.69648135", "0.6961428", "0.6956147", "0.6955589", "0.6945151", "0.6941806" ]
0.7276761
46
Reconcile reads that state of the cluster for a KogitoInfra object and makes changes based on the state read and what is in the KogitoInfra.Spec Note: The Controller will requeue the Request to be processed again if the returned error is nonnil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
func (r *ReconcileKogitoInfra) Reconcile(request reconcile.Request) (reconcile.Result, error) { log.Infof("Reconciling KogitoInfra for %s in %s", request.Name, request.Namespace) // Fetch the KogitoInfra instance instance, resultErr := infrastructure.FetchKogitoInfraInstance(r.client, request.Name, request.Namespace) if resultErr != nil { return reconcile.Result{}, resultErr } if instance == nil { log.Debugf("KogitoInfra instance with name %s not found in namespace %s. Going to return reconciliation request", request.Name, request.Namespace) return reconcile.Result{}, nil } defer updateBaseStatus(r.client, instance, &resultErr) reconciler, resultErr := getKogitoInfraReconciler(r.client, instance, r.scheme) if resultErr != nil { return r.getReconcileResultFor(resultErr, false) } requeue, resultErr := reconciler.Reconcile() return r.getReconcileResultFor(resultErr, requeue) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *ClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}()\n\n\tctx := context.WithValue(context.Background(), requestId, uuid.New())\n\tlog := log.Logger(ctx, \"controllers\", \"cluster_controller\", \"Reconcile\")\n\tlog.WithValues(\"cluster\", req.NamespacedName)\n\tlog.Info(\"Start of the request\")\n\t//Get the resource\n\tvar cluster managerv1alpha1.Cluster\n\tif err := r.Get(ctx, req.NamespacedName, &cluster); err != nil {\n\t\treturn ctrl.Result{}, ignoreNotFound(err)\n\t}\n\n\t// Retrieve k8s secret\n\t// Get the \"best\" Bearer token\n\t// Get the ManagedCluster k8s client\n\n\tstate := managerv1alpha1.Warning\n\n\tif cluster.Status.RetryCount > 3 {\n\t\tstate = managerv1alpha1.Error\n\t}\n\n\tsecret, err := r.K8sClient.GetK8sSecret(ctx, cluster.Spec.Config.BearerTokenSecret, cluster.ObjectMeta.Namespace)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to retrieve the bearer token for the given cluster\")\n\t\tdesc := fmt.Sprintf(\"unable to retrieve the bearer token for the given cluster due to error %s\", err.Error())\n\t\tr.Recorder.Event(&cluster, v1.EventTypeWarning, string(state), desc)\n\t\treturn r.UpdateStatus(ctx, &cluster, managerv1alpha1.ClusterStatus{RetryCount: cluster.Status.RetryCount + 1, ErrorDescription: desc}, state, errRequeueTime)\n\t}\n\tcfg, err := utils.PrepareK8sRestConfigFromClusterCR(ctx, &cluster, secret)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to prepare the rest config for the target cluster\", \"cluster\", cluster.Spec.Name)\n\t\tdesc := fmt.Sprintf(\"unable to prepare the rest config for the target cluster due to error %s\", err.Error())\n\t\tr.Recorder.Event(&cluster, v1.EventTypeWarning, string(state), desc)\n\t\treturn r.UpdateStatus(ctx, &cluster, managerv1alpha1.ClusterStatus{RetryCount: cluster.Status.RetryCount + 1, ErrorDescription: desc}, state, errRequeueTime)\n\t}\n\n\t// Isit being deleted?\n\tif cluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t//Good. This is not Delete use case\n\t\t//Lets check if this is very first time use case\n\t\tif !utils.ContainsString(cluster.ObjectMeta.Finalizers, finalizerName) {\n\t\t\tlog.Info(\"New cluster resource. Adding the finalizer\", \"finalizer\", finalizerName)\n\t\t\tcluster.ObjectMeta.Finalizers = append(cluster.ObjectMeta.Finalizers, finalizerName)\n\t\t\tr.UpdateMeta(ctx, &cluster)\n\t\t}\n\t\treturn r.HandleReconcile(ctx, req, &cluster, cfg)\n\n\t} else {\n\t\t//oh oh.. This is delete use case\n\t\t//Lets make sure to clean up the iam role\n\t\tif cluster.Status.RetryCount != 0 {\n\t\t\tcluster.Status.RetryCount = cluster.Status.RetryCount + 1\n\t\t}\n\t\tlog.Info(\"Cluster delete request\")\n\t\tif err := removeRBACInManagedCluster(ctx, cfg); err != nil {\n\t\t\tlog.Error(err, \"Unable to delete the cluster\")\n\t\t\tr.UpdateStatus(ctx, &cluster, managerv1alpha1.ClusterStatus{RetryCount: cluster.Status.RetryCount + 1, ErrorDescription: err.Error()}, managerv1alpha1.Error)\n\t\t\tr.Recorder.Event(&cluster, v1.EventTypeWarning, string(managerv1alpha1.Error), \"unable to delete the cluster due to \"+err.Error())\n\t\t\treturn ctrl.Result{RequeueAfter: 30 * time.Second}, nil\n\t\t}\n\n\t\t// Ok. Lets delete the finalizer so controller can delete the custom object\n\t\tlog.Info(\"Removing finalizer from Cluster\")\n\t\tcluster.ObjectMeta.Finalizers = utils.RemoveString(cluster.ObjectMeta.Finalizers, finalizerName)\n\t\tr.UpdateMeta(ctx, &cluster)\n\t\tlog.Info(\"Successfully deleted cluster\")\n\t\tr.Recorder.Event(&cluster, v1.EventTypeNormal, \"Deleted\", \"Successfully deleted cluster\")\n\t}\n\treturn ctrl.Result{}, nil\n}", "func (bmc *Controller) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tll := bmc.log.WithFields(logrus.Fields{\n\t\t\"method\": \"Reconcile\",\n\t\t\"name\": req.Name,\n\t})\n\n\tvar err error\n\t// if name in request doesn't start with namePrefix controller tries to read k8s node object at first\n\t// however if it get NotFound error it tries to read Node object as well\n\tif !strings.HasPrefix(req.Name, namePrefix) {\n\t\tk8sNode := new(coreV1.Node)\n\t\terr = bmc.k8sClient.ReadCR(context.Background(), req.Name, \"\", k8sNode)\n\t\tswitch {\n\t\tcase err == nil:\n\t\t\tll.Infof(\"Reconcile k8s node %s\", k8sNode.Name)\n\t\t\treturn bmc.reconcileForK8sNode(k8sNode)\n\t\tcase !k8sError.IsNotFound(err):\n\t\t\tll.Errorf(\"Unable to read node object: %v\", err)\n\t\t\treturn ctrl.Result{Requeue: true}, err\n\t\t}\n\t}\n\n\t// try to read Node\n\tbmNode := new(nodecrd.Node)\n\terr = bmc.k8sClient.ReadCR(context.Background(), req.Name, \"\", bmNode)\n\tswitch {\n\tcase err == nil:\n\t\tll.Infof(\"Reconcile Node %s\", bmNode.Name)\n\t\treturn bmc.reconcileForCSIBMNode(bmNode)\n\tcase !k8sError.IsNotFound(err):\n\t\tll.Errorf(\"Unable to read Node object: %v\", err)\n\t\treturn ctrl.Result{Requeue: true}, err\n\t}\n\n\tll.Warnf(\"unable to detect for which object (%s) that reconcile is. The object may have been deleted\", req.String())\n\treturn ctrl.Result{}, nil\n}", "func (r *RqliteClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\tlog := r.Log.WithValues(\"Reconcile RqliteCluster \", req.Name, \" in namespace \", req.NamespacedName)\n\n\tlog.V(1).Info(\"Get Object Info\")\n\t//objectInfo := new(rqlitev1.RqliteCluster{})\n\tobjectInfo := &rqlitev1.RqliteCluster{}\n\terr := r.Get(context.TODO(), req.NamespacedName, objectInfo)\n\n\tif err != nil {\n\t\tlog.Error(err, \"Error during r.Get\")\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\tlog.Info(\"Dump Object Info\", \"ClusterName\", objectInfo.Spec.Name, \"ClusterSize\", objectInfo.Spec.ClusterSize)\n\n\tlog.V(1).Info(\"Update Object Status\")\n\tlog.V(1).Info(\"Get Object Current Status\", \"NAme\", objectInfo.Spec.Name, \"Status\", objectInfo.Status.CurrentStatus)\n\tif objectInfo.Status.CurrentStatus == \"\" {\n\t\tlog.V(1).Info(\"Creating new RqliteCluster)\n\t\tpod := newRqliteCluster(objectInfo)\n\t\tobjectInfo.Status.CurrentStatus = \"OK\"\n\t}\n\n\tlog.V(1).Info(\"Set Object Target Status : \", \"Name\", objectInfo.Spec.Name, \"Status \", objectInfo.Status.CurrentStatus)\n\n\terr = r.Status().Update(context.TODO(), objectInfo)\n\tif err != nil {\n\t\tlog.Error(err, \"Error during r.Status\")\n\t\treturn reconcile.Result{}, err\n\t}\n\t//if anything else happens\n\treturn ctrl.Result{}, nil\n}", "func (r *RedisClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", req.Namespace, \"Request.Name\", req.Name)\n\treqLogger.Info(\"Reconciling RedisCluster\")\n\n\t// Fetch the RedisCluster instance\n\tinstance := &redisv1beta1.RedisCluster{}\n\terr := r.Client.Get(ctx, req.NamespacedName, instance)\n\tif err != nil {\n\t\treqLogger.Info(\"Error when retrieving namespaced name\", \"namespacedName\", req.NamespacedName)\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treqLogger.Info(\"RedisCluster delete\")\n\t\t\tinstance.Namespace = req.NamespacedName.Namespace\n\t\t\tinstance.Name = req.NamespacedName.Name\n\t\t\tr.handler.metaCache.Del(instance)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treqLogger.V(5).Info(fmt.Sprintf(\"RedisCluster Spec:\\n %+v\", instance))\n\n\tif err = r.handler.Do(instance); err != nil {\n\t\tif err.Error() == needRequeueMsg {\n\t\t\treturn ctrl.Result{RequeueAfter: 20 * time.Second}, nil\n\t\t}\n\t\treqLogger.Error(err, \"Reconcile handler\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err = r.handler.rcChecker.CheckSentinelReadyReplicas(instance); err != nil {\n\t\treqLogger.Info(err.Error())\n\t\treturn ctrl.Result{RequeueAfter: 20 * time.Second}, nil\n\t}\n\n\treturn ctrl.Result{RequeueAfter: time.Duration(reconcileTime) * time.Second}, nil\n}", "func (r *FoundationDBClusterReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {\n\tcluster := &fdbtypes.FoundationDBCluster{}\n\n\terr := r.Get(ctx, request.NamespacedName, cluster)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tclusterLog := log.WithValues(\"namespace\", cluster.Namespace, \"cluster\", cluster.Name)\n\n\tif cluster.Spec.Skip {\n\t\tclusterLog.Info(\"Skipping cluster with skip value true\", \"skip\", cluster.Spec.Skip)\n\t\t// Don't requeue\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\terr = internal.NormalizeClusterSpec(cluster, r.DeprecationOptions)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tadminClient, err := r.getDatabaseClientProvider().GetAdminClient(cluster, r)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tdefer adminClient.Close()\n\n\tsupportedVersion, err := adminClient.VersionSupported(cluster.Spec.Version)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif !supportedVersion {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"version %s is not supported\", cluster.Spec.Version)\n\t}\n\n\tsubReconcilers := []clusterSubReconciler{\n\t\tupdateStatus{},\n\t\tupdateLockConfiguration{},\n\t\tupdateConfigMap{},\n\t\tcheckClientCompatibility{},\n\t\treplaceMisconfiguredProcessGroups{},\n\t\treplaceFailedProcessGroups{},\n\t\tdeletePodsForBuggification{},\n\t\taddProcessGroups{},\n\t\taddServices{},\n\t\taddPVCs{},\n\t\taddPods{},\n\t\tgenerateInitialClusterFile{},\n\t\tupdateSidecarVersions{},\n\t\tupdatePodConfig{},\n\t\tupdateLabels{},\n\t\tupdateDatabaseConfiguration{},\n\t\tchooseRemovals{},\n\t\texcludeInstances{},\n\t\tchangeCoordinators{},\n\t\tbounceProcesses{},\n\t\tupdatePods{},\n\t\tremoveServices{},\n\t\tremoveProcessGroups{},\n\t\tupdateStatus{},\n\t}\n\n\toriginalGeneration := cluster.ObjectMeta.Generation\n\tnormalizedSpec := cluster.Spec.DeepCopy()\n\tdelayedRequeue := false\n\n\tfor _, subReconciler := range subReconcilers {\n\t\t// We have to set the normalized spec here again otherwise any call to Update() for the status of the cluster\n\t\t// will reset all normalized fields...\n\t\tcluster.Spec = *(normalizedSpec.DeepCopy())\n\t\tclusterLog.Info(\"Attempting to run sub-reconciler\", \"subReconciler\", fmt.Sprintf(\"%T\", subReconciler))\n\n\t\trequeue := subReconciler.reconcile(r, ctx, cluster)\n\t\tif requeue == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif requeue.delayedRequeue {\n\t\t\tclusterLog.Info(\"Delaying requeue for sub-reconciler\",\n\t\t\t\t\"subReconciler\", fmt.Sprintf(\"%T\", subReconciler),\n\t\t\t\t\"message\", requeue.message)\n\t\t\tdelayedRequeue = true\n\t\t\tcontinue\n\t\t}\n\n\t\treturn processRequeue(requeue, subReconciler, cluster, r.Recorder, clusterLog)\n\t}\n\n\tif cluster.Status.Generations.Reconciled < originalGeneration || delayedRequeue {\n\t\tclusterLog.Info(\"Cluster was not fully reconciled by reconciliation process\", \"status\", cluster.Status.Generations)\n\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\n\tclusterLog.Info(\"Reconciliation complete\", \"generation\", cluster.Status.Generations.Reconciled)\n\tr.Recorder.Event(cluster, corev1.EventTypeNormal, \"ReconciliationComplete\", fmt.Sprintf(\"Reconciled generation %d\", cluster.Status.Generations.Reconciled))\n\n\treturn ctrl.Result{}, nil\n}", "func (r *ProvisioningReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t// provisioning.metal3.io is a singleton\n\t// Note: this check is here to make sure that the early startup configuration\n\t// is correct. For day 2 operatations the webhook will validate this.\n\tif req.Name != metal3iov1alpha1.ProvisioningSingletonName {\n\t\tklog.Info(\"ignoring invalid CR\", \"name\", req.Name)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Make sure ClusterOperator exists\n\terr := r.ensureClusterOperator(nil)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult := ctrl.Result{}\n\tif !r.WebHookEnabled {\n\t\tif provisioning.WebhookDependenciesReady(r.OSClient) {\n\t\t\tklog.Info(\"restarting to enable the webhook\")\n\t\t\tos.Exit(1)\n\t\t}\n\t\t// Keep checking for our webhook dependencies to be ready, so we can\n\t\t// enable the webhook.\n\t\tresult.RequeueAfter = 5 * time.Minute\n\t}\n\n\tenabled, err := r.isEnabled()\n\tif err != nil {\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"could not determine whether to run\")\n\t}\n\tif !enabled {\n\t\t// set ClusterOperator status to disabled=true, available=true\n\t\t// We're disabled; don't requeue\n\t\treturn ctrl.Result{}, errors.Wrapf(\n\t\t\tr.updateCOStatus(ReasonUnsupported, \"Nothing to do on this Platform\", \"\"),\n\t\t\t\"unable to put %q ClusterOperator in Disabled state\", clusterOperatorName)\n\t}\n\n\tbaremetalConfig, err := r.readProvisioningCR(ctx)\n\tif err != nil {\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\tif baremetalConfig == nil {\n\t\t// Provisioning configuration not available at this time.\n\t\t// Cannot proceed wtih metal3 deployment.\n\t\tklog.Info(\"Provisioning CR not found\")\n\t\treturn result, nil\n\t}\n\n\t// Make sure ClusterOperator's ownership is updated\n\terr = r.ensureClusterOperator(baremetalConfig)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Read container images from Config Map\n\tvar containerImages provisioning.Images\n\tif err := provisioning.GetContainerImages(&containerImages, r.ImagesFilename); err != nil {\n\t\t// Images config map is not valid\n\t\t// Provisioning configuration is not valid.\n\t\t// Requeue request.\n\t\tklog.ErrorS(err, \"invalid contents in images Config Map\")\n\t\tco_err := r.updateCOStatus(ReasonInvalidConfiguration, err.Error(), \"invalid contents in images Config Map\")\n\t\tif co_err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, co_err)\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Get cluster-wide proxy information\n\tclusterWideProxy, err := r.OSClient.ConfigV1().Proxies().Get(context.Background(), \"cluster\", metav1.GetOptions{})\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tinfo := r.provisioningInfo(baremetalConfig, &containerImages, clusterWideProxy)\n\n\t// Check if Provisioning Configuartion is being deleted\n\tdeleted, err := r.checkForCRDeletion(ctx, info)\n\tif err != nil {\n\t\tvar coErr error\n\t\tif deleted {\n\t\t\tcoErr = r.updateCOStatus(ReasonDeployTimedOut, err.Error(), \"Unable to delete a metal3 resource on Provisioning CR deletion\")\n\t\t} else {\n\t\t\tcoErr = r.updateCOStatus(ReasonInvalidConfiguration, err.Error(), \"Unable to add Finalizer on Provisioning CR\")\n\t\t}\n\t\tif coErr != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, coErr)\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\tif deleted {\n\t\treturn result, errors.Wrapf(\n\t\t\tr.updateCOStatus(ReasonComplete, \"all Metal3 resources deleted\", \"\"),\n\t\t\t\"unable to put %q ClusterOperator in Available state\", clusterOperatorName)\n\t}\n\n\tspecChanged := baremetalConfig.Generation != baremetalConfig.Status.ObservedGeneration\n\tif specChanged {\n\t\terr = r.updateCOStatus(ReasonSyncing, \"\", \"Applying metal3 resources\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Syncing state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\n\tif !r.WebHookEnabled {\n\t\t// Check if provisioning configuration is valid\n\t\tif err := baremetalConfig.ValidateBaremetalProvisioningConfig(); err != nil {\n\t\t\t// Provisioning configuration is not valid.\n\t\t\t// Requeue request.\n\t\t\tklog.Error(err, \"invalid config in Provisioning CR\")\n\t\t\terr = r.updateCOStatus(ReasonInvalidConfiguration, err.Error(), \"Unable to apply Provisioning CR: invalid configuration\")\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %v\", clusterOperatorName, err)\n\t\t\t}\n\t\t\t// Temporarily not requeuing request\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t}\n\n\t//Create Secrets needed for Metal3 deployment\n\tif err := provisioning.CreateAllSecrets(r.KubeClient.CoreV1(), ComponentNamespace, baremetalConfig, r.Scheme); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check Metal3 Deployment already exists and managed by MAO.\n\tmetal3DeploymentSelector, maoOwned, err := provisioning.CheckExistingMetal3Deployment(r.KubeClient.AppsV1(), ComponentNamespace)\n\tinfo.PodLabelSelector = metal3DeploymentSelector\n\tif err != nil && !apierrors.IsNotFound(err) {\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"failed to check for existing Metal3 Deployment\")\n\t}\n\n\tif maoOwned {\n\t\tklog.Info(\"Adding annotation for CBO to take ownership of metal3 deployment created by MAO\")\n\t}\n\n\tfor _, ensureResource := range []ensureFunc{\n\t\tprovisioning.EnsureMetal3Deployment,\n\t\tprovisioning.EnsureMetal3StateService,\n\t\tprovisioning.EnsureImageCache,\n\t} {\n\t\tupdated, err := ensureResource(info)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tif updated {\n\t\t\treturn result, r.Client.Status().Update(ctx, baremetalConfig)\n\t\t}\n\t}\n\n\tif specChanged {\n\t\tbaremetalConfig.Status.ObservedGeneration = baremetalConfig.Generation\n\t\terr = r.Client.Status().Update(ctx, baremetalConfig)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to update observed generation: %w\", err)\n\t\t}\n\t}\n\n\t// Determine the status of the deployment\n\tdeploymentState, err := provisioning.GetDeploymentState(r.KubeClient.AppsV1(), ComponentNamespace, baremetalConfig)\n\tif err != nil {\n\t\terr = r.updateCOStatus(ReasonNotFound, \"metal3 deployment inaccessible\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"failed to determine state of metal3 deployment\")\n\t}\n\tif deploymentState == appsv1.DeploymentReplicaFailure {\n\t\terr = r.updateCOStatus(ReasonDeployTimedOut, \"metal3 deployment rollout taking too long\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\n\t// Determine the status of the DaemonSet\n\tdaemonSetState, err := provisioning.GetDaemonSetState(r.KubeClient.AppsV1(), ComponentNamespace, baremetalConfig)\n\tif err != nil {\n\t\terr = r.updateCOStatus(ReasonNotFound, \"metal3 image cache daemonset inaccessible\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"failed to determine state of metal3 image cache daemonset\")\n\t}\n\tif daemonSetState == provisioning.DaemonSetReplicaFailure {\n\t\terr = r.updateCOStatus(ReasonDeployTimedOut, \"metal3 image cache rollout taking too long\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\tif deploymentState == appsv1.DeploymentAvailable && daemonSetState == provisioning.DaemonSetAvailable {\n\t\terr = r.updateCOStatus(ReasonComplete, \"metal3 pod and image cache are running\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Progressing state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func (r *MultiClusterObservabilityReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", req.Namespace, \"Request.Name\", req.Name)\n\treqLogger.Info(\"Reconciling MultiClusterObservability\")\n\n\t// Fetch the MultiClusterObservability instance\n\tinstance := &mcov1beta1.MultiClusterObservability{}\n\terr := r.Client.Get(context.TODO(), types.NamespacedName{\n\t\tName: config.GetMonitoringCRName(),\n\t}, instance)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Init finalizers\n\tisTerminating, err := r.initFinalization(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t} else if isTerminating {\n\t\treqLogger.Info(\"MCO instance is in Terminating status, skip the reconcile\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t//read image manifest configmap to be used to replace the image for each component.\n\tif _, err = config.ReadImageManifestConfigMap(r.Client); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Do not reconcile objects if this instance of mch is labeled \"paused\"\n\tif config.IsPaused(instance.GetAnnotations()) {\n\t\treqLogger.Info(\"MCO reconciliation is paused. Nothing more to do.\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tstorageClassSelected, err := getStorageClass(instance, r.Client)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t//instance.Namespace = config.GetDefaultNamespace()\n\tinstance.Spec.StorageConfig.StatefulSetStorageClass = storageClassSelected\n\t//Render the templates with a specified CR\n\trenderer := rendering.NewRenderer(instance)\n\ttoDeploy, err := renderer.Render(r.Client)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Failed to render multiClusterMonitoring templates\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tdeployer := deploying.NewDeployer(r.Client)\n\t//Deploy the resources\n\tfor _, res := range toDeploy {\n\t\tif res.GetNamespace() == config.GetDefaultNamespace() {\n\t\t\tif err := controllerutil.SetControllerReference(instance, res, r.Scheme); err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to set controller reference\")\n\t\t\t}\n\t\t}\n\t\tif err := deployer.Deploy(res); err != nil {\n\t\t\treqLogger.Error(err, fmt.Sprintf(\"Failed to deploy %s %s/%s\",\n\t\t\t\tres.GetKind(), config.GetDefaultNamespace(), res.GetName()))\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// expose observatorium api gateway\n\tresult, err := GenerateAPIGatewayRoute(r.Client, r.Scheme, instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// create the certificates\n\terr = createObservabilityCertificate(r.Client, r.Scheme, instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// create an Observatorium CR\n\tresult, err = GenerateObservatoriumCR(r.Client, r.Scheme, instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// generate grafana datasource to point to observatorium api gateway\n\tresult, err = GenerateGrafanaDataSource(r.Client, r.Scheme, instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tenableManagedCluster, found := os.LookupEnv(\"ENABLE_MANAGED_CLUSTER\")\n\tif !found || enableManagedCluster != \"false\" {\n\t\t// create the placementrule\n\t\terr = createPlacementRule(r.Client, r.Scheme, instance)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tresult, err = r.UpdateStatus(instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *KubernetesMachineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, rerr error) {\n\t// TODO: what does ctx do\n\tctx := context.Background()\n\tlog := r.Log.WithName(machineControllerName).WithValues(\"kubernetes-machine\", req.NamespacedName)\n\n\t// Fetch the KubernetesMachine instance.\n\tkubernetesMachine := &capkv1.KubernetesMachine{}\n\tif err := r.Client.Get(ctx, req.NamespacedName, kubernetesMachine); err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Fetch the Machine.\n\tmachine, err := util.GetOwnerMachine(ctx, r.Client, kubernetesMachine.ObjectMeta)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif machine == nil {\n\t\tlog.Info(\"Waiting for Machine Controller to set OwnerRef on KubernetesMachine\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlog = log.WithValues(\"machine\", machine.Name)\n\n\t// Fetch the Cluster.\n\tcluster, err := util.GetClusterFromMetadata(ctx, r.Client, machine.ObjectMeta)\n\tif err != nil {\n\t\tlog.Info(\"KubernetesMachine owner Machine is missing cluster label or cluster does not exist\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tif cluster == nil {\n\t\tlog.Info(fmt.Sprintf(\"Please associate this machine with a cluster using the label %s: <name of cluster>\", clusterv1.MachineClusterLabelName))\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlog = log.WithValues(\"cluster\", cluster.Name)\n\n\t// Make sure infrastructure is ready\n\tif !cluster.Status.InfrastructureReady {\n\t\tlog.Info(\"Waiting for KubernetesCluster Controller to create cluster infrastructure\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Fetch the Kubernetes Cluster.\n\tkubernetesCluster := &capkv1.KubernetesCluster{}\n\tkubernetesClusterName := types.NamespacedName{\n\t\tNamespace: kubernetesMachine.Namespace,\n\t\tName: cluster.Spec.InfrastructureRef.Name,\n\t}\n\tif err := r.Client.Get(ctx, kubernetesClusterName, kubernetesCluster); err != nil {\n\t\tlog.Info(\"KubernetesCluster is not available yet\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlog = log.WithValues(\"kubernetes-cluster\", kubernetesCluster.Name)\n\n\t// Initialize the patch helper\n\tpatchHelper, err := patch.NewHelper(kubernetesMachine, r.Client)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\t// Always attempt to Patch the KubernetesMachine object and status after each reconciliation.\n\tdefer func() {\n\t\tif err := patchHelper.Patch(ctx, kubernetesMachine); err != nil {\n\t\t\tlog.Error(err, \"failed to patch KubernetesMachine\")\n\t\t\tif rerr == nil {\n\t\t\t\trerr = err\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Handle deleted machines\n\tif !kubernetesMachine.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(cluster, machine, kubernetesMachine)\n\t}\n\n\t// Handle non-deleted machines\n\treturn r.reconcileNormal(cluster, machine, kubernetesMachine)\n}", "func (r *WorkloadReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"workload\", req.NamespacedName)\n\n\tlog.Info(\"start to reconcile.\")\n\n\tvar workload cachev1alpha1.Workload\n\tif err := r.Get(ctx, req.NamespacedName, &workload); err != nil {\n\t\tlog.Error(err, \"unable to fetch Zookeeper Workload\")\n\t\treturn ReconcileWaitResult, client.IgnoreNotFound(err)\n\t}\n\n\tdefer func() {\n\t\tupdateObservedGeneration(&workload)\n\t\tif err := r.Client.Status().Update(ctx, &workload); err != nil {\n\t\t\tlog.Error(err, \"fail to update workload status\")\n\t\t\treturn\n\t\t}\n\t\tlog.Info(fmt.Sprintf(\"success to update workload status, ObservedGeneration: %d\", workload.Status.ObservedGeneration))\n\t}()\n\n\tdClient, err := k8s.NewDynamicClient()\n\tif err != nil {\n\t\tlog.Error(err, \"unable to create dynamic client\")\n\t\treturn ReconcileWaitResult, err\n\t}\n\n\toption := &GetOptions{\n\t\tClient: k8s.WrapClient(ctx, r.Client),\n\t\tRecorder: r.Recorder,\n\t\tLog: r.Log,\n\t\tDClient: k8s.WrapDClient(dClient),\n\t\tScheme: r.Scheme,\n\t\tLabels: GenerateLabels(workload.Labels, workload.Name),\n\t\tObservers: r.Observers,\n\t\tZKClient: r.ZKClient,\n\t\tObservedState: r.ObservedState,\n\t\tFinalizers: r.Finalizers,\n\t\tMonitor: r.Monitor,\n\t}\n\n\tif err := r.Workload(ctx, &workload, option).Reconcile(); err != nil {\n\t\tlog.Error(err, \"error when reconcile workload.\")\n\t\treturn ReconcileWaitResult, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *IPoIBNetworkReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.FromContext(ctx)\n\treqLogger.Info(\"Reconciling IPoIBNetwork\")\n\n\t// Fetch the IPoIBNetwork instance\n\tinstance := &mellanoxcomv1alpha1.IPoIBNetwork{}\n\terr := r.Get(ctx, req.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tmanagerStatus := r.stateManager.SyncState(ctx, instance, nil)\n\terr = r.updateCrStatus(ctx, instance, managerStatus)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif managerStatus.Status != state.SyncStateReady {\n\t\treturn reconcile.Result{\n\t\t\tRequeueAfter: time.Duration(config.FromEnv().Controller.RequeueTimeSeconds) * time.Second,\n\t\t}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *IstioControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlogger := r.Log.WithValues(\"istiocontrolplane\", req.NamespacedName)\n\n\ticp := &servicemeshv1alpha1.IstioControlPlane{}\n\terr := r.Get(ctx, req.NamespacedName, icp)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif icp.Spec.Version == \"\" {\n\t\terr = errors.New(\"please set spec.version in your istiocontrolplane CR to be reconciled by this operator\")\n\t\tlogger.Error(err, \"\", \"name\", icp.Name, \"namespace\", icp.Namespace)\n\n\t\treturn reconcile.Result{\n\t\t\tRequeue: false,\n\t\t}, nil\n\t}\n\n\tif !IsIstioVersionSupported(icp.Spec.Version) {\n\t\terr = errors.New(\"intended Istio version is unsupported by this version of the operator\")\n\t\tlogger.Error(err, \"\", \"version\", icp.Spec.Version)\n\n\t\treturn reconcile.Result{\n\t\t\tRequeue: false,\n\t\t}, nil\n\t}\n\n\tif requeueNeeded, err := k8sutil.IsReqeueNeededCosNamespaceTermination(ctx, r.GetClient(), icp); requeueNeeded && err == nil {\n\t\tlogger.Info(\"namespace is terminating, requeue needed\")\n\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: nsTerminationRequeueDuration,\n\t\t}, nil\n\t} else if err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err := r.reconcile(ctx, icp, logger)\n\tif err != nil {\n\t\tupdateErr := components.UpdateStatus(ctx, r.Client, icp, components.ConvertConfigStateToReconcileStatus(servicemeshv1alpha1.ConfigState_ReconcileFailed), err.Error())\n\t\tif updateErr != nil {\n\t\t\tlogger.Error(updateErr, \"failed to update state\")\n\n\t\t\treturn result, errors.WithStack(err)\n\t\t}\n\n\t\tif result.Requeue {\n\t\t\treturn result, nil\n\t\t}\n\n\t\treturn result, err\n\t}\n\n\tupdateErr := components.UpdateStatus(ctx, r.Client, icp, components.ConvertConfigStateToReconcileStatus(servicemeshv1alpha1.ConfigState_Available), \"\")\n\tif updateErr != nil && !k8serrors.IsNotFound(updateErr) {\n\t\tlogger.Error(updateErr, \"failed to update state\")\n\n\t\treturn result, errors.WithStack(err)\n\t}\n\n\terr = util.RemoveFinalizer(ctx, r.Client, icp, istioControlPlaneFinalizerID, true)\n\tif err != nil {\n\t\treturn result, errors.WithStack(err)\n\t}\n\n\treturn result, nil\n}", "func (c *Controller) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tdefer metricsC.ReconcileDuration.EvaluateDurationForType(\"node_drive_controller\")()\n\t// read name\n\tdriveName := req.Name\n\t// TODO why do we need 60 seconds here?\n\t// create context\n\tctx, cancelFn := context.WithTimeout(context.Background(), 60*time.Second)\n\tdefer cancelFn()\n\n\t// customize logging\n\tlog := c.log.WithFields(logrus.Fields{\"method\": \"drive/Reconcile\", \"name\": driveName})\n\n\t// obtain corresponding drive\n\tdrive := &drivecrd.Drive{}\n\tif err := c.client.ReadCR(ctx, driveName, \"\", drive); err != nil {\n\t\tlog.Errorf(\"Failed to read Drive %s CR\", driveName)\n\t\t// TODO is this correct error here?\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tlog.Infof(\"Drive changed: %v\", drive)\n\n\tusage := drive.Spec.GetUsage()\n\thealth := drive.Spec.GetHealth()\n\tid := drive.Spec.GetUUID()\n\ttoUpdate := false\n\n\tswitch usage {\n\tcase apiV1.DriveUsageInUse:\n\t\tif health == apiV1.HealthSuspect || health == apiV1.HealthBad {\n\t\t\t// TODO update health of volumes\n\t\t\tdrive.Spec.Usage = apiV1.DriveUsageReleasing\n\t\t\ttoUpdate = true\n\t\t}\n\tcase apiV1.DriveUsageReleasing:\n\t\tvolumes, err := c.crHelper.GetVolumesByLocation(ctx, id)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{RequeueAfter: base.DefaultRequeueForVolume}, err\n\t\t}\n\t\tallFound := true\n\t\tfor _, vol := range volumes {\n\t\t\tstatus, found := drive.Annotations[fmt.Sprintf(\n\t\t\t\t\"%s/%s\", apiV1.DriveAnnotationVolumeStatusPrefix, vol.Name)]\n\t\t\tif !found || status != apiV1.VolumeUsageReleased {\n\t\t\t\tallFound = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif allFound {\n\t\t\tdrive.Spec.Usage = apiV1.DriveUsageReleased\n\t\t\teventMsg := fmt.Sprintf(\"Drive is ready for replacement, %s\", drive.GetDriveDescription())\n\t\t\tc.eventRecorder.Eventf(drive, eventing.NormalType, eventing.DriveReadyForReplacement, eventMsg)\n\t\t\ttoUpdate = true\n\t\t}\n\n\tcase apiV1.DriveUsageReleased:\n\t\tstatus, found := drive.Annotations[apiV1.DriveAnnotationReplacement]\n\t\tif !found || status != apiV1.DriveAnnotationReplacementReady {\n\t\t\tbreak\n\t\t}\n\t\ttoUpdate = true\n\t\tdrive.Spec.Usage = apiV1.DriveUsageRemoving\n\t\tfallthrough\n\tcase apiV1.DriveUsageRemoving:\n\t\tvolumes, err := c.crHelper.GetVolumesByLocation(ctx, id)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{RequeueAfter: base.DefaultRequeueForVolume}, err\n\t\t}\n\t\tif c.checkAllVolsRemoved(volumes) {\n\t\t\tdrive.Spec.Usage = apiV1.DriveUsageRemoved\n\t\t\tstatus, err := c.driveMgrClient.Locate(ctx, &api.DriveLocateRequest{Action: apiV1.LocateStart, DriveSerialNumber: drive.Spec.SerialNumber})\n\t\t\tif err != nil || status.Status != apiV1.LocateStatusOn {\n\t\t\t\tlog.Errorf(\"Failed to locate LED of drive %s, err %v\", drive.Spec.SerialNumber, err)\n\t\t\t\tdrive.Spec.Usage = apiV1.DriveUsageFailed\n\t\t\t\t// send error level alert\n\t\t\t\teventMsg := fmt.Sprintf(\"Failed to locale LED, %s\", drive.GetDriveDescription())\n\t\t\t\tc.eventRecorder.Eventf(drive, eventing.ErrorType, eventing.DriveReplacementFailed, eventMsg)\n\t\t\t} else {\n\t\t\t\t// send info level alert\n\t\t\t\teventMsg := fmt.Sprintf(\"Drive successfully replaced, %s\", drive.GetDriveDescription())\n\t\t\t\tc.eventRecorder.Eventf(drive, eventing.NormalType, eventing.DriveSuccessfullyReplaced, eventMsg)\n\t\t\t}\n\t\t\ttoUpdate = true\n\t\t}\n\tcase apiV1.DriveUsageRemoved:\n\t\tif drive.Spec.Status == apiV1.DriveStatusOffline {\n\t\t\t// drive was removed from the system. need to clean corresponding custom resource\n\t\t\tif err := c.client.DeleteCR(ctx, drive); err != nil {\n\t\t\t\tlog.Errorf(\"Failed to delete Drive %s CR\", driveName)\n\t\t\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t\t\t}\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t}\n\n\t// update drive CR if needed\n\tif toUpdate {\n\t\tif err := c.client.UpdateCR(ctx, drive); err != nil {\n\t\t\tlog.Errorf(\"Failed to update Drive %s CR\", driveName)\n\t\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *MilvusClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tif !config.IsDebug() {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tr.logger.Error(err.(error), \"reconcile panic\")\n\t\t\t}\n\t\t}()\n\t}\n\n\tmilvuscluster := &milvusiov1alpha1.MilvusCluster{}\n\tif err := r.Get(ctx, req.NamespacedName, milvuscluster); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// The resource may have be deleted after reconcile request coming in\n\t\t\t// Reconcile is done\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\n\t\treturn ctrl.Result{}, fmt.Errorf(\"error get milvus cluster: %w\", err)\n\t}\n\n\t// Finalize\n\tif milvuscluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tif !controllerutil.ContainsFinalizer(milvuscluster, MCFinalizerName) {\n\t\t\tcontrollerutil.AddFinalizer(milvuscluster, MCFinalizerName)\n\t\t\tif err := r.Update(ctx, milvuscluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tif controllerutil.ContainsFinalizer(milvuscluster, MCFinalizerName) {\n\t\t\tif err := r.Finalize(ctx, *milvuscluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\tcontrollerutil.RemoveFinalizer(milvuscluster, MCFinalizerName)\n\t\t\tif err := r.Update(ctx, milvuscluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\t// Stop reconciliation as the item is being deleted\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Start reconcile\n\tr.logger.Info(\"start reconcile\")\n\told := milvuscluster.DeepCopy()\n\n\tif err := r.SetDefault(ctx, milvuscluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif !IsEqual(old.Spec, milvuscluster.Spec) {\n\t\treturn ctrl.Result{}, r.Update(ctx, milvuscluster)\n\t}\n\n\tif err := r.ReconcileAll(ctx, *milvuscluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err := r.UpdateStatus(ctx, milvuscluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif milvuscluster.Status.Status == v1alpha1.StatusUnHealthy {\n\t\treturn ctrl.Result{RequeueAfter: 30 * time.Second}, nil\n\t}\n\n\tif config.IsDebug() {\n\t\tdiff, err := client.MergeFrom(old).Data(milvuscluster)\n\t\tif err != nil {\n\t\t\tr.logger.Info(\"Update diff\", \"diff\", string(diff))\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *RunReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\t// Initialize Logger\n\trunLogger = r.Log.WithValues(\"runnerImage\", req.NamespacedName)\n\n\t// Fetch the RunnerImage instance\n\trunInstance := &v1alpha1.Run{}\n\terr := r.Client.Get(ctx, req.NamespacedName, runInstance)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\trunLogger.Info(\"Run with name \" + runInstance.Name + \" detected\")\n\t//runnerImageInstance.Status.Phase = PhaseInitialized\n\t//err = r.Status().Update(context.TODO(), runnerImageInstance)\n\t//if err != nil {\n\t//\treturn ctrl.Result{}, err\n\t//}\n\n\tjfConfigMapRef := runInstance.Spec.Jenkinsfile.ConfigMapRef\n\tcascConfigMapRef := runInstance.Spec.ConfigurationAsCode.ConfigMapRef\n\tvolumes := []corev1.Volume{\n\t\t{\n\t\t\tName: \"jenkinsfile\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{Name: jfConfigMapRef},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tvolumeMounts := []corev1.VolumeMount{\n\t\t{\n\t\t\tName: \"jenkinsfile\",\n\t\t\tMountPath: \"/workspace/jenkinsfile\",\n\t\t\tSubPath: \"Jenkinsfile\",\n\t\t},\n\t}\n\n\tif len(cascConfigMapRef) > 0 {\n\t\tcascVolume := corev1.Volume{\n\t\t\tName: \"casc\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{Name: cascConfigMapRef},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tcascVolumeMount := corev1.VolumeMount{\n\t\t\tName: \"casc\",\n\t\t\tMountPath: \"/usr/share/jenkins/ref/casc\",\n\t\t}\n\t\tvolumes = append(volumes, cascVolume)\n\t\tvolumeMounts = append(volumeMounts, cascVolumeMount)\n\t}\n\n\trunPod := &corev1.Pod{\n\t\tObjectMeta: ctrl.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"jfr-run-%s\", runInstance.Name),\n\t\t\tNamespace: req.Namespace,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"JAVA_OPTS\",\n\t\t\t\t\t\t\tValue: \"-Djenkins.model.Jenkins.slaveAgentPort=50000 -Djenkins.model.Jenkins.slaveAgentPortEnforce=true -Dhudson.slaves.NodeProvisioner.initialDelay=1 -Dhudson.slaves.ConnectionActivityMonitor.timeToPing=30000\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tName: \"jfr-run\",\n\t\t\t\t\tImage: runInstance.Spec.Image,\n\t\t\t\t\tVolumeMounts: volumeMounts,\n\t\t\t\t\tImagePullPolicy: \"Always\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tVolumes: volumes,\n\t\t\tRestartPolicy: \"Never\",\n\t\t},\n\t}\n\tcontrollerutil.SetControllerReference(runInstance, runPod, r.Scheme)\n\terr = r.Client.Create(context.TODO(), runPod)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *Iter8Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\t_ = r.Log.WithValues(\"iter8\", req.NamespacedName)\n\n\t// your logic here\n\t// Fetch the Iter8 instance\n\tinstance := &iter8v1alpha1.Iter8{}\n\terr := r.Client.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\tr.Log.Info(\"Iter8 resource not found. Ignoring since object must be deleted.\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tr.Log.Error(err, \"Failed to get Iter8\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t// r.Log.Info(\"Reconcile\", \"Iter8 instance\", instance)\n\n\t// Add finalizer if not already present\n\tif !contains(instance.GetFinalizers(), finalizer) {\n\t\tr.Log.Info(\"finalize adding finalizer\", \"finalizer\", finalizer)\n\t\tinstance.SetFinalizers(append(instance.GetFinalizers(), finalizer))\n\t\tif err = r.Client.Update(context.TODO(), instance); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// Check whether object has been deleted\n\tif instance.GetDeletionTimestamp() != nil {\n\t\treturn ctrl.Result{}, r.finalize(instance)\n\t}\n\n\terr = r.crdsForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\terr = r.rbacForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\terr = r.controllerForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\terr = r.analyticsEngineForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Do other things\n\tr.Log.Info(\"Reconcile ending with nil\")\n\n\treturn ctrl.Result{}, nil\n}", "func (ec *EtcdCustodian) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tec.logger.Info(\"Custodian controller reconciliation started\")\n\tetcd := &druidv1alpha1.Etcd{}\n\tif err := ec.Get(ctx, req.NamespacedName, etcd); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlogger := ec.logger.WithValues(\"etcd\", kutil.Key(etcd.Namespace, etcd.Name).String())\n\n\t// TODO: (timuthy) remove this as it could block important health checks\n\tif etcd.Status.LastError != nil && *etcd.Status.LastError != \"\" {\n\t\tlogger.Info(fmt.Sprintf(\"Requeue item because of last error: %v\", *etcd.Status.LastError))\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: 30 * time.Second,\n\t\t}, nil\n\t}\n\n\tselector, err := metav1.LabelSelectorAsSelector(etcd.Spec.Selector)\n\tif err != nil {\n\t\tlogger.Error(err, \"Error converting etcd selector to selector\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tstatusCheck := status.NewChecker(ec.Client, ec.config)\n\tif err := statusCheck.Check(ctx, logger, etcd); err != nil {\n\t\tlogger.Error(err, \"Error executing status checks\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trefMgr := NewEtcdDruidRefManager(ec.Client, ec.Scheme, etcd, selector, etcdGVK, nil)\n\n\tstsList, err := refMgr.FetchStatefulSet(ctx, etcd)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Requeue if we found more than one or no StatefulSet.\n\t// The Etcd controller needs to decide what to do in such situations.\n\tif len(stsList.Items) != 1 {\n\t\tif err := ec.updateEtcdStatus(ctx, logger, etcd, nil); err != nil {\n\t\t\tlogger.Error(err, \"Error while updating ETCD status when no statefulset found\")\n\t\t}\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: 5 * time.Second,\n\t\t}, nil\n\t}\n\n\tif err := ec.updateEtcdStatus(ctx, logger, etcd, &stsList.Items[0]); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{RequeueAfter: ec.config.SyncPeriod}, nil\n}", "func (tcr *TinkerbellClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\n\tcrc, err := tcr.newReconcileContext(ctx, req.NamespacedName)\n\tif err != nil {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"creating reconciliation context: %w\", err)\n\t}\n\n\tif crc == nil {\n\t\treturn defaultRequeueResult(), nil\n\t}\n\n\tif !crc.tinkerbellCluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tcrc.log.Info(\"Removing cluster\")\n\n\t\treturn ctrl.Result{}, crc.reconcileDelete()\n\t}\n\n\tif crc.cluster == nil {\n\t\treturn defaultRequeueResult(), nil\n\t}\n\n\tif util.IsPaused(crc.cluster, crc.tinkerbellCluster) {\n\t\tcrc.log.Info(\"TinkerbellCluster is marked as paused. Won't reconcile\")\n\n\t\treturn defaultRequeueResult(), nil\n\t}\n\n\treturn ctrl.Result{}, crc.reconcile()\n}", "func (r *KoupletBuildReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = log.FromContext(ctx)\n\t// \t_ = r.Log.WithValues(\"koupletbuild\", req.NamespacedName)\n\n\tshared.LogDebug(\"Reconciling KoupletBuild\")\n\n\tkbContext := koupletbuild.KBContext{\n\t\tClient: &r.Client,\n\t\tScheme: r.Scheme,\n\t\tNamespace: req.Namespace,\n\t}\n\n\tif controllerBuildDB == nil {\n\n\t\tdefaultOperatorPath := \"/kouplet-persistence/build\"\n\n\t\t// Run within /tmp if running outside container/image\n\t\tif _, err := os.Stat(defaultOperatorPath); os.IsNotExist(err) {\n\t\t\tdefaultOperatorPath = \"/tmp\" + defaultOperatorPath\n\t\t}\n\n\t\tcontrollerBuildDB = koupletbuild.NewKoupletBuildDB(koupletbuild.NewPersistenceContext(defaultOperatorPath), kbContext)\n\t}\n\n\t// Fetch the KoupletBuild instance\n\tinstance := &apiv1alpha1.KoupletBuild{}\n\terr := r.Client.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn appendBuildReconcileResult(reconcile.Result{}, nil)\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn appendBuildReconcileResult(reconcile.Result{}, err)\n\t}\n\n\tcontrollerBuildDB.Process(*instance, kbContext)\n\n\treturn appendBuildReconcileResult(reconcile.Result{}, nil)\n}", "func (r *reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx, cancel := context.WithCancel(r.ctx)\n\tdefer cancel()\n\n\tconfigMap := &corev1.ConfigMap{}\n\tif err := r.client.Get(ctx, types2.NamespacedName{Namespace: req.Namespace, Name: req.Name}, configMap); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil // do nothing if the ConfigMap does not exist\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\tif configMap.Name == constants.BOMMetadataConfigMapName {\n\t\tif err := r.updateConditions(ctx); err != nil {\n\t\t\tif apierrors.IsConflict(errors.Cause(err)) {\n\t\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t\t}\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\ttkr, err := tkrFromConfigMap(configMap)\n\tif err != nil {\n\t\tr.log.Error(err, \"Could not create TKR from ConfigMap\", \"ConfigMap\", configMap.Name)\n\t\treturn ctrl.Result{}, nil // no need to retry: if the ConfigMap changes, we'll get called\n\t}\n\tif tkr == nil {\n\t\treturn ctrl.Result{}, nil // no need to retry: no TKR in this ConfigMap\n\t}\n\n\tif err := r.client.Create(ctx, tkr); err != nil {\n\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\treturn ctrl.Result{}, nil // the TKR already exists, we're done.\n\t\t}\n\t\treturn ctrl.Result{}, errors.Wrapf(err, \"could not create TKR: ConfigMap.name='%s'\", configMap.Name)\n\t}\n\tif err := r.client.Status().Update(ctx, tkr); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err := r.updateConditions(ctx); err != nil {\n\t\tif apierrors.IsConflict(errors.Cause(err)) {\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\treturn ctrl.Result{}, nil\n}", "func (c *controller) Reconcile(req reconcile.Request) (reconcile.Result, error) {\n\tctx := context.TODO()\n\n\tprQueue := &s2hv1.PullRequestQueue{}\n\terr := c.client.Get(ctx, req.NamespacedName, prQueue)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// make request with samsahai controller\n\theaders := make(http.Header)\n\theaders.Set(internal.SamsahaiAuthHeader, c.authToken)\n\tctx, err = twirp.WithHTTPRequestHeaders(ctx, headers)\n\tif err != nil {\n\t\tlogger.Error(err, \"cannot set request header\")\n\t}\n\n\tif isUpdate := ensurePullRequestQueueStatus(prQueue); isUpdate {\n\t\tif err := c.updatePullRequestQueue(ctx, prQueue); err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tif skipReconcile, err := c.deleteFinalizerWhenFinished(ctx, prQueue); err != nil || skipReconcile {\n\t\tif err != nil && !k8serrors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tif skipReconcile, err := c.managePullRequestQueue(ctx, prQueue); err != nil || skipReconcile {\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\t// current pull request has been updated, it will re-trigger the reconcile\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tswitch prQueue.Status.State {\n\tcase \"\":\n\t\tc.setup(prQueue)\n\n\tcase s2hv1.PullRequestQueueWaiting:\n\t\treturn reconcile.Result{\n\t\t\tRequeue: true,\n\t\t\tRequeueAfter: 2 * time.Second,\n\t\t}, nil\n\n\tcase s2hv1.PullRequestQueueEnvCreating:\n\t\tif err := c.createPullRequestEnvironment(ctx, prQueue); err != nil && !k8serrors.IsAlreadyExists(err) {\n\t\t\tif s2herrors.IsNamespaceStillCreating(err) {\n\t\t\t\treturn reconcile.Result{\n\t\t\t\t\tRequeue: true,\n\t\t\t\t\tRequeueAfter: 2 * time.Second,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn reconcile.Result{}, errors.Wrapf(err, \"cannot create pull request environment\")\n\t\t}\n\n\tcase s2hv1.PullRequestQueueDeploying:\n\t\tif err := c.ensurePullRequestComponentsDeploying(ctx, prQueue); err != nil {\n\t\t\tif s2herrors.IsEnsuringComponentDeployed(err) {\n\t\t\t\treturn reconcile.Result{\n\t\t\t\t\tRequeue: true,\n\t\t\t\t\tRequeueAfter: 2 * time.Second,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\tcase s2hv1.PullRequestQueueTesting:\n\t\tif err := c.ensurePullRequestComponentsTesting(ctx, prQueue); err != nil {\n\t\t\tif s2herrors.IsEnsuringComponentTested(err) {\n\t\t\t\treturn reconcile.Result{\n\t\t\t\t\tRequeue: true,\n\t\t\t\t\tRequeueAfter: 2 * time.Second,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\tcase s2hv1.PullRequestQueueCollecting:\n\t\tif err := c.collectPullRequestQueueResult(ctx, prQueue); err != nil {\n\t\t\treturn reconcile.Result{}, errors.Wrapf(err, \"cannot collect pull request queue result\")\n\t\t}\n\n\tcase s2hv1.PullRequestQueueEnvDestroying:\n\t\tif skipReconcile, err := c.destroyPullRequestEnvironment(ctx, prQueue); err != nil || skipReconcile {\n\t\t\tif err != nil {\n\t\t\t\tif s2herrors.IsNamespaceStillExists(err) {\n\t\t\t\t\treturn reconcile.Result{\n\t\t\t\t\t\tRequeue: true,\n\t\t\t\t\t\tRequeueAfter: 2 * time.Second,\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\n\t\t\t\treturn reconcile.Result{}, errors.Wrapf(err, \"cannot destroy pull request environment\")\n\t\t\t}\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t}\n\n\tif err := c.updatePullRequestQueue(ctx, prQueue); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "func (r *ReconcileProvisioner) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"sfcluster\", req.NamespacedName)\n\n\t// Fetch the SFCluster\n\tclusterInstance := &resourcev1alpha1.SFCluster{}\n\terr := r.Get(ctx, req.NamespacedName, clusterInstance)\n\tif err != nil {\n\t\tif apiErrors.IsNotFound(err) {\n\t\t\t// Object not found, return.\n\t\t\terr = removeClusterFromWatch(req.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\tlog.Error(err, \"Failed to get SFCluster...\", \"clusterId\", req.NamespacedName.Name)\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\tclusterID := clusterInstance.GetName()\n\tlog.Info(\"reconciling cluster\", \"clusterID\", clusterID)\n\n\t//reconcile primaryClusterID in the configmap\n\terr = r.reconcilePrimaryClusterIDConfig()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Get targetClient for targetCluster\n\ttargetClient, err := r.clusterRegistry.GetClient(clusterID)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 2. Get deploment instance for provisioner\n\tdeplomentInstance := &appsv1.Deployment{}\n\terr = r.Get(ctx, types.NamespacedName{\n\t\tName: constants.ProvisionerTemplateName,\n\t\tNamespace: constants.InteroperatorNamespace,\n\t}, deplomentInstance)\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to get provisioner deployment from master cluster\", \"clusterId\", clusterID)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 3. Register sf CRDs\n\terr = r.registerSFCrds(clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 4. Add watches on resources in target sfcluster. Must be done after\n\t// registering sf crds, since we are trying to watch on sfserviceinstance\n\t// and sfservicebinding.\n\terr = addClusterToWatch(clusterID)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 5. Create/Update Namespace in target cluster for provisioner\n\tnamespace := deplomentInstance.GetNamespace()\n\terr = r.reconcileNamespace(namespace, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 6. Creating/Updating sfcluster in target cluster\n\terr = r.reconcileSfClusterCrd(clusterInstance, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 7. Creating/Updating kubeconfig secret for sfcluster in target cluster\n\t// Fetch current primary cluster id from configmap\n\tinteroperatorCfg := r.cfgManager.GetConfig()\n\tcurrPrimaryClusterID := interoperatorCfg.PrimaryClusterID\n\n\terr = r.reconcileSecret(namespace, clusterInstance.Spec.SecretRef, clusterID, targetClient)\n\tif err != nil {\n\t\t// Skip if secret not found for leader cluster\n\t\tif !(apiErrors.IsNotFound(err) && clusterID == currPrimaryClusterID) {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Ignoring secret not found error for leader cluster\", \"clusterId\", clusterID,\n\t\t\t\"secretRef\", clusterInstance.Spec.SecretRef)\n\t}\n\n\t// 8. Deploy cluster rolebinding\n\terr = r.reconcileClusterRoleBinding(namespace, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 9. Creating/Updating imagepull secrets for provisioner deployment in target cluster\n\tfor _, secretRef := range deplomentInstance.Spec.Template.Spec.ImagePullSecrets {\n\t\terr = r.reconcileSecret(namespace, secretRef.Name, clusterID, targetClient)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// 10. Create Deployment in target cluster for provisioner\n\terr = r.reconcileDeployment(deplomentInstance, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trequeueAfter, err := time.ParseDuration(interoperatorCfg.ClusterReconcileInterval)\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to parse ClusterReconcileInterval\",\n\t\t\t\"ClusterReconcileInterval\", interoperatorCfg.ClusterReconcileInterval)\n\t\trequeueAfter, _ = time.ParseDuration(constants.DefaultClusterReconcileInterval)\n\t}\n\treturn ctrl.Result{\n\t\tRequeueAfter: requeueAfter,\n\t}, nil\n}", "func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := reconcileRequestContext{\n\t\tContext: context.Background(),\n\t\tLog: r.Log.WithValues(\"processingjob\", req.NamespacedName),\n\t\tProcessingJob: new(processingjobv1.ProcessingJob),\n\t}\n\n\tctx.Log.Info(\"Getting resource\")\n\tif err := r.Get(ctx, req.NamespacedName, ctx.ProcessingJob); err != nil {\n\t\tctx.Log.Info(\"Unable to fetch ProcessingJob job\", \"reason\", err)\n\n\t\tif apierrs.IsNotFound(err) {\n\t\t\treturn controllers.NoRequeue()\n\t\t}\n\n\t\treturn controllers.RequeueImmediately()\n\t}\n\n\tif err := r.reconcileProcessingJob(ctx); err != nil {\n\t\tctx.Log.Info(\"Got error while reconciling, will retry\", \"err\", err)\n\t\treturn controllers.RequeueImmediately()\n\t}\n\n\tswitch ctx.ProcessingJob.Status.ProcessingJobStatus {\n\tcase string(sagemaker.ProcessingJobStatusCompleted):\n\t\tfallthrough\n\tcase string(sagemaker.ProcessingJobStatusFailed):\n\t\tfallthrough\n\tcase string(sagemaker.ProcessingJobStatusStopped):\n\t\treturn controllers.NoRequeue()\n\tdefault:\n\t\treturn controllers.RequeueAfterInterval(r.PollInterval, nil)\n\t}\n}", "func (r *ElasticJobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t// Fetch the ElasticJob instance\n\telasticJob := &v1alpha1.ElasticJob{}\n\terr := r.Get(context.TODO(), req.NamespacedName, elasticJob)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tlog := logger.LoggerForJob(elasticJob)\n\tneedSync := r.satisfiedExpections(elasticJob)\n\tif !needSync {\n\t\tlog.Info(\"reconcile skipped, job does not need to sync\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif elasticJob.DeletionTimestamp != nil {\n\t\tlog.Info(\"reconcile skipped, job has been deleted.\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Set default priorities for elastic job\n\tscheme.Scheme.Default(elasticJob)\n\n\t// Set default cleanPodPolicy for job\n\tif elasticJob.Spec.RunPolicy.CleanPodPolicy == nil {\n\t\telasticJob.Spec.RunPolicy.CleanPodPolicy = &defaultCleanPodPolicy\n\t}\n\n\t// Use common to reconcile the job related pod and service\n\terr = r.jobController.ReconcileJobs(elasticJob, elasticJob.Spec.ReplicaSpecs, elasticJob.Status.JobStatus, &elasticJob.Spec.RunPolicy)\n\tif err != nil {\n\t\tlog.Infof(\"Reconcile ElasticJob error %v\", err)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *RedPandaClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\t//// Reconcile successful - don't requeue\n\t//return ctrl.Result{}, nil\n\t//// Reconcile failed due to error - requeue\n\t//return ctrl.Result{}, err\n\t//// Requeue for any reason other than an error\n\t//return ctrl.Result{Requeue: true}, nil\n\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"redpandacluster\", req.NamespacedName)\n\n\tredPandaCluster := &eventstreamv1alpha1.RedPandaCluster{}\n\terr := r.Get(ctx, req.NamespacedName, redPandaCluster)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"RedPandaCluster resource not statefulSetFound. Ignoring...\")\n\t\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t\t}\n\t\tlog.Error(err, \"unable to fetch RedPandaCluster\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tserviceFound := &corev1.Service{}\n\terr = r.Get(ctx, types.NamespacedName{Name: redPandaCluster.Name, Namespace: redPandaCluster.Namespace}, serviceFound)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"Service not found. Trying to create one...\")\n\t\t\tvar rpService *corev1.Service\n\t\t\trpService = r.serviceFor(redPandaCluster)\n\t\t\tlog.Info(\"creating service \", \"Service.Namespace\", rpService.Namespace, \"Service.Name\", rpService.Name)\n\t\t\terr := r.Create(ctx, rpService)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new service\", \"Service.Namespace\", rpService.Namespace, \"Service.Name\", rpService.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\tlog.Info(\"unable to fetch Service resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// ConfigMap\n\tconfigMapFound := &corev1.ConfigMap{}\n\terr = r.Get(ctx, types.NamespacedName{Name: redPandaCluster.Name + \"base-config\", Namespace: redPandaCluster.Namespace}, configMapFound)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"ConfigMap not found. Trying to create one...\")\n\t\t\tvar rpConfigMap *corev1.ConfigMap\n\t\t\trpConfigMap = r.configMapFor(redPandaCluster)\n\t\t\terr := r.Create(ctx, rpConfigMap)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create ConfigMap resource\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\tlog.Info(\"unable to fetch Service resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// StatefulSet\n\tstatefulSetFound := &appsv1.StatefulSet{}\n\terr = r.Get(ctx, types.NamespacedName{Namespace: redPandaCluster.Namespace, Name: redPandaCluster.Name}, statefulSetFound)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"StatefulSet not found \")\n\t\t\tvar rpStatefulSet *appsv1.StatefulSet\n\t\t\trpStatefulSet = r.statefulSetFor(redPandaCluster, configMapFound, serviceFound)\n\t\t\terr := r.Create(ctx, rpStatefulSet)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create StatefulSet resource\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tobservedPods := &corev1.PodList{}\n\terr = r.List(ctx, observedPods, &client.ListOptions{\n\t\tLabelSelector: labels.SelectorFromSet(redPandaCluster.Labels),\n\t\tNamespace: redPandaCluster.Namespace,\n\t})\n\tif err != nil {\n\t\tlog.Error(err, \"unable to fetch PodList resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tvar observedNodes []string\n\tfor _, item := range observedPods.Items {\n\t\tobservedNodes = append(observedNodes, item.Name)\n\t}\n\tif !reflect.DeepEqual(observedNodes, redPandaCluster.Status.Nodes) {\n\t\tredPandaCluster.Status.Nodes = observedNodes\n\t\terr := r.Status().Update(ctx, redPandaCluster)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to update RedPandaClusterStatus\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\tlog.Info(\"reconcile loop ends\")\n\treturn ctrl.Result{}, nil\n}", "func (r *HetznerCloudMachineReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"hetznercloudmachine\", req.NamespacedName)\n\n\t// Fetch the DockerMachine instance.\n\thetznerMachine := &infrastructurev1alpha3.HetznerCloudMachine{}\n\tif err := r.Client.Get(ctx, req.NamespacedName, hetznerMachine); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Fetch the Machine.\n\tmachine, err := util.GetOwnerMachine(ctx, r.Client, hetznerMachine.ObjectMeta)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif machine == nil {\n\t\tlog.Info(\"Waiting for Machine Controller to set OwnerRef on HetznerCloudMachine\")\n\t\treturn ctrl.Result{Requeue: true, RequeueAfter: reconcileAfter}, nil\n\t}\n\n\t// Handle deleted machines\n\tif !hetznerMachine.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(ctx, machine, hetznerMachine)\n\t}\n\n\tlog = log.WithValues(\"machine\", machine.Name)\n\n\t// Fetch the Cluster.\n\tcluster, err := util.GetClusterFromMetadata(ctx, r.Client, machine.ObjectMeta)\n\tif err != nil {\n\t\tlog.Info(\"HetznerCloudMachine owner Machine is missing cluster label or cluster does not exist\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tif cluster == nil {\n\t\tlog.Info(fmt.Sprintf(\"Please associate this machine with a cluster using the label %s: <name of cluster>\", clusterv1.ClusterLabelName))\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlog = log.WithValues(\"cluster\", cluster.Name)\n\n\t// Make sure infrastructure is ready\n\tif !cluster.Status.InfrastructureReady {\n\t\tlog.Info(\"Waiting for HetznerCloudCluster Controller to create cluster infrastructure\")\n\t\treturn ctrl.Result{Requeue: true, RequeueAfter: reconcileAfter}, nil\n\t}\n\n\t// Fetch the HetznerCloudCluster Cluster.\n\thetznerCluster := &infrastructurev1alpha3.HetznerCloudCluster{}\n\thetznerClusterName := client.ObjectKey{\n\t\tNamespace: cluster.Namespace,\n\t\tName: cluster.Spec.InfrastructureRef.Name,\n\t}\n\tif err := r.Client.Get(ctx, hetznerClusterName, hetznerCluster); err != nil {\n\t\tlog.Info(fmt.Sprintf(\"HetznerCloudCluster '%s' is not available yet in namespace '%s'\", hetznerClusterName.Name, hetznerClusterName.Namespace))\n\t\treturn ctrl.Result{Requeue: true, RequeueAfter: reconcileAfter}, nil\n\t}\n\n\tlog = log.WithValues(\"hetzner-cloud-cluster\", hetznerCluster.Name)\n\n\treturn r.reconcileNormal(ctx, machine, hetznerMachine, hetznerCluster, cluster, log)\n\n}", "func (r *ReconcileRokku) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Rokku\", request)\n\treqLogger.Info(\"Starting Rokku reconciling\")\n\tdefer reqLogger.Info(\"Finishing Rokku reconciling\")\n\n\tctx := context.Background()\n\n\tinstance := &rokkuv1alpha1.Rokku{}\n\terr := r.client.Get(ctx, request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treqLogger.Info(\"Rokku resource not found, skipping reconcile\")\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\n\t\treqLogger.Error(err, \"Unable to get Rokku resource\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif err := r.reconcileRokku(ctx, instance); err != nil {\n\t\treqLogger.Error(err, \"Fail to reconcile\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif err := r.refreshStatus(ctx, instance); err != nil {\n\t\treqLogger.Error(err, \"Fail to refresh status subresource\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "func (r *Microk8sConfigReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, rerr error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"microk8sconfig\", req.NamespacedName)\n\n\t// your logic here\n\tmicrok8sconfig := &bootstrapv1alpha1.Microk8sConfig{}\n\n\tif err := r.Client.Get(ctx, req.NamespacedName, microk8sconfig); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\tlog.Error(err, \"failed to get config\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Look up the owner of this KubeConfig if there is one\n\tconfigOwner, err := bsutil.GetConfigOwner(ctx, r.Client, microk8sconfig)\n\tif apierrors.IsNotFound(err) {\n\t\t// Could not find the owner yet, this is not an error and will rereconcile when the owner gets set.\n\t\treturn ctrl.Result{}, nil\n\t}\n\tif err != nil {\n\t\tlog.Error(err, \"failed to get owner\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tif configOwner == nil {\n\t\tlog.Error(err, \"failed to get config-owner\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\tlog = log.WithValues(\"kind\", configOwner.GetKind(), \"version\", configOwner.GetResourceVersion(), \"name\", configOwner.GetName())\n\n\t// Initialize the patch helper\n\tpatchHelper, err := patch.NewHelper(microk8sconfig, r)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif configOwner.IsControlPlaneMachine() {\n\t\t_, err := r.setupControlPlaneBootstrapData(ctx, microk8sconfig)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treturn ctrl.Result{}, patchHelper.Patch(ctx, microk8sconfig)\n\t} else {\n\t\t// Worker node\n\t\t_, err := r.setupWorkerBootstrapData(ctx, microk8sconfig)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treturn ctrl.Result{}, patchHelper.Patch(ctx, microk8sconfig)\n\t}\n}", "func (r machineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, reterr error) {\n\n\t// Get the VSphereMachine resource for this request.\n\tvsphereMachine := &infrav1.VSphereMachine{}\n\tif err := r.Client.Get(r, req.NamespacedName, vsphereMachine); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tr.Logger.Info(\"VSphereMachine not found, won't reconcile\", \"key\", req.NamespacedName)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Fetch the CAPI Machine.\n\tmachine, err := clusterutilv1.GetOwnerMachine(r, r.Client, vsphereMachine.ObjectMeta)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif machine == nil {\n\t\tr.Logger.Info(\"Waiting for Machine Controller to set OwnerRef on VSphereMachine\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Fetch the CAPI Cluster.\n\tcluster, err := clusterutilv1.GetClusterFromMetadata(r, r.Client, machine.ObjectMeta)\n\tif err != nil {\n\t\tr.Logger.Info(\"Machine is missing cluster label or cluster does not exist\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Fetch the VSphereCluster\n\tvsphereCluster := &infrav1.VSphereCluster{}\n\tvsphereClusterName := client.ObjectKey{\n\t\tNamespace: vsphereMachine.Namespace,\n\t\tName: cluster.Spec.InfrastructureRef.Name,\n\t}\n\tif err := r.Client.Get(r, vsphereClusterName, vsphereCluster); err != nil {\n\t\tr.Logger.Info(\"Waiting for VSphereCluster\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Create the patch helper.\n\tpatchHelper, err := patch.NewHelper(vsphereMachine, r.Client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to init patch helper for %s %s/%s\",\n\t\t\tvsphereMachine.GroupVersionKind(),\n\t\t\tvsphereMachine.Namespace,\n\t\t\tvsphereMachine.Name)\n\t}\n\n\t// Create the machine context for this request.\n\tmachineContext := &context.MachineContext{\n\t\tControllerContext: r.ControllerContext,\n\t\tCluster: cluster,\n\t\tVSphereCluster: vsphereCluster,\n\t\tMachine: machine,\n\t\tVSphereMachine: vsphereMachine,\n\t\tLogger: r.Logger.WithName(req.Namespace).WithName(req.Name),\n\t\tPatchHelper: patchHelper,\n\t}\n\n\t// Always issue a patch when exiting this function so changes to the\n\t// resource are patched back to the API server.\n\tdefer func() {\n\t\t// Patch the VSphereMachine resource.\n\t\tif err := machineContext.Patch(); err != nil {\n\t\t\tif reterr == nil {\n\t\t\t\treterr = err\n\t\t\t}\n\t\t\tmachineContext.Logger.Error(err, \"patch failed\", \"machine\", machineContext.String())\n\t\t}\n\t}()\n\n\t// Handle deleted machines\n\tif !vsphereMachine.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(machineContext)\n\t}\n\n\t// Handle non-deleted machines\n\treturn r.reconcileNormal(machineContext)\n}", "func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {\n\t_ = r.Log.WithValues(\"cluster\", req.NamespacedName)\n\t// Fetch the Cluster instance.\n\tcluster, err := r.resourceFetcher.FetchCluster(ctx, req.NamespacedName)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\t// Initialize the patch helper\n\tpatchHelper, err := patch.NewHelper(cluster, r.Client)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tdefer func() {\n\t\t// Always attempt to patch the object and status after each reconciliation.\n\t\tif err := patchHelper.Patch(ctx, cluster); err != nil {\n\t\t\treterr = kerrors.NewAggregate([]error{reterr, err})\n\t\t}\n\t}()\n\n\t// Ignore deleted Clusters, this can happen when foregroundDeletion\n\t// is enabled\n\tif !cluster.DeletionTimestamp.IsZero() {\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// If the external object is paused, return without any further processing.\n\tif cluster.IsReconcilePaused() {\n\t\tr.Log.Info(\"eksa reconciliation is paused\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// dry run\n\tresult, err := r.reconcile(ctx, req.NamespacedName, true)\n\tif err != nil {\n\t\tr.Log.Error(err, \"Dry run failed to reconcile Cluster\")\n\t\treturn result, err\n\t}\n\t// non dry run\n\tresult, err = r.reconcile(ctx, req.NamespacedName, false)\n\tif err != nil {\n\t\tr.Log.Error(err, \"Failed to reconcile Cluster\")\n\t}\n\treturn result, err\n}", "func (r *reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {\n\tlog.Info(\"reconciling\", \"request\", request)\n\n\t// Fetch the Ingress Controller object.\n\tingressController := &operatorv1.IngressController{}\n\tif err := r.cache.Get(ctx, request.NamespacedName, ingressController); err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\t// This means the Ingress Controller object was already deleted/finalized.\n\t\t\tlog.Info(\"Ingress Controller not found; reconciliation will be skipped\", \"request\", request)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to get Ingress Controller %q: %w\", request, err)\n\t}\n\n\t// If the Ingress Controller is marked to be deleted, then return early. The corresponding RouteMetricsControllerRoutesPerShard metric label\n\t// will be deleted in \"ensureIngressDeleted\" function of ingresscontroller.\n\tif ingressController.DeletionTimestamp != nil {\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// NOTE: Even though the route admitted status should reflect validity of the namespace and route labelselectors, we still will validate\n\t// the namespace and route labels as there are still edge scenarios where the route status may be inaccurate.\n\n\t// List all the Namespaces filtered by our ingress's Namespace selector.\n\tnamespaceMatchingLabelsSelector := client.MatchingLabelsSelector{Selector: labels.Everything()}\n\tif ingressController.Spec.NamespaceSelector != nil {\n\t\tnamespaceSelector, err := metav1.LabelSelectorAsSelector(ingressController.Spec.NamespaceSelector)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"ingresscontroller has an invalid namespace selector\", \"ingresscontroller\",\n\t\t\t\tingressController.Name, \"namespaceSelector\", ingressController.Spec.NamespaceSelector)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\tnamespaceMatchingLabelsSelector = client.MatchingLabelsSelector{Selector: namespaceSelector}\n\t}\n\n\tnamespaceList := corev1.NamespaceList{}\n\tif err := r.cache.List(ctx, &namespaceList, namespaceMatchingLabelsSelector); err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to list Namespaces %q: %w\", request, err)\n\t}\n\t// Create a set of Namespaces to easily look up Namespaces that matches the Routes assigned to the Ingress Controller.\n\tnamespacesSet := sets.NewString()\n\tfor i := range namespaceList.Items {\n\t\tnamespacesSet.Insert(namespaceList.Items[i].Name)\n\t}\n\n\t// List routes filtered by our ingress's route selector.\n\trouteMatchingLabelsSelector := client.MatchingLabelsSelector{Selector: labels.Everything()}\n\tif ingressController.Spec.RouteSelector != nil {\n\t\trouteSelector, err := metav1.LabelSelectorAsSelector(ingressController.Spec.RouteSelector)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"ingresscontroller has an invalid route selector\", \"ingresscontroller\",\n\t\t\t\tingressController.Name, \"routeSelector\", ingressController.Spec.RouteSelector)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\trouteMatchingLabelsSelector = client.MatchingLabelsSelector{Selector: routeSelector}\n\t}\n\trouteList := routev1.RouteList{}\n\tif err := r.cache.List(ctx, &routeList, routeMatchingLabelsSelector); err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to list Routes for the Shard %q: %w\", request, err)\n\t}\n\n\t// Variable to store the number of routes admitted by the Shard (Ingress Controller).\n\troutesAdmitted := 0\n\n\t// Iterate through the list Routes.\n\tfor _, route := range routeList.Items {\n\t\t// Check if the Route's Namespace matches one of the Namespaces in the set namespacesSet and\n\t\t// the Route is admitted by the Ingress Controller.\n\t\tif namespacesSet.Has(route.Namespace) && routeStatusAdmitted(route, ingressController.Name) {\n\t\t\t// If the Route is admitted then, the routesAdmitted should be incremented by 1 for the Shard.\n\t\t\troutesAdmitted++\n\t\t}\n\t}\n\n\t// Set the value of the metric to the number of routesAdmitted for the corresponding Shard (Ingress Controller).\n\tSetRouteMetricsControllerRoutesPerShardMetric(request.Name, float64(routesAdmitted))\n\n\treturn reconcile.Result{}, nil\n}", "func (r *FalconContainerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := clog.FromContext(ctx)\n\tlog.Info(\"Reconciling FalconContainer\")\n\n\tfalconContainer := &falconv1alpha1.FalconContainer{}\n\terr := r.Client.Get(ctx, req.NamespacedName, falconContainer)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Cannot get the Falcon Container custom resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\td := falcon_container_deployer.FalconContainerDeployer{\n\t\tCtx: ctx,\n\t\tClient: r.Client,\n\t\tLog: log,\n\t\tInstance: falconContainer.DeepCopy(),\n\t\tRestConfig: r.RestConfig,\n\t\tScheme: r.Scheme,\n\t}\n\treturn d.Reconcile()\n}", "func (r *MachineTester) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\treturn ctrl.Result{}, nil\n}", "func (r *KubeFedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlogger := log.FromContext(ctx)\n\n\tobj := &corev1beta1.KubeFedCluster{}\n\tif err := r.Get(ctx, req.NamespacedName, obj); err != nil {\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tmgr, err := util.NewManager(obj, r.Namespace, r.Client, r.Scheme)\n\tif err != nil {\n\t\tlogger.Error(err, \"Unable to create manager\", \"cluster\", obj.Name)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tutil.AddclusterClient(obj.Name, mgr.GetClient())\n\n\tif err = (&typescontrollers.FederatedObjectReconciler{\n\t\tClient: mgr.GetClient(),\n\t\tScheme: mgr.GetScheme(),\n\t\tMaxConcurrentReconciles: r.MaxConcurrentReconciles,\n\t\tClusterName: util.FederationClusterName,\n\t\tTargetClusterName: obj.Name,\n\t}).SetupWithManager(mgr); err != nil {\n\t\tlogger.Error(err, \"Unable to create controller\", \"cluster\", obj.Name)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tgo mgr.Start(context.TODO())\n\n\treturn ctrl.Result{}, nil\n}", "func (a *Actuator) Reconcile(cluster *clusterv1.Cluster) error {\n\tlog := a.log.WithValues(\"cluster-name\", cluster.Name, \"cluster-namespace\", cluster.Namespace)\n\tlog.Info(\"Reconciling Cluster\")\n\n\tscope, err := scope.NewClusterScope(scope.ClusterScopeParams{\n\t\tCluster: cluster,\n\t\tLogger: a.log,\n\t})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to create scope: %+v\", err)\n\t}\n\n\tdefer scope.Close()\n\n\tec2svc := ec2.NewService(scope)\n\telbsvc := elb.NewService(scope)\n\tcertSvc := certificates.NewService(scope)\n\n\t// Store cert material in spec.\n\tif err := certSvc.ReconcileCertificates(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile certificates for cluster %q\", cluster.Name)\n\t}\n\n\tif err := ec2svc.ReconcileNetwork(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile network for cluster %q\", cluster.Name)\n\t}\n\n\tif err := ec2svc.ReconcileBastion(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile bastion host for cluster %q\", cluster.Name)\n\t}\n\n\tif err := elbsvc.ReconcileLoadbalancers(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile load balancers for cluster %q\", cluster.Name)\n\t}\n\n\tif cluster.Annotations == nil {\n\t\tcluster.Annotations = make(map[string]string)\n\t}\n\tcluster.Annotations[v1alpha2.AnnotationClusterInfrastructureReady] = v1alpha2.ValueReady\n\n\t// Store KubeConfig for Cluster API NodeRef controller to use.\n\tkubeConfigSecretName := remote.KubeConfigSecretName(cluster.Name)\n\tsecretClient := a.coreClient.Secrets(cluster.Namespace)\n\tif _, err := secretClient.Get(kubeConfigSecretName, metav1.GetOptions{}); err != nil && apierrors.IsNotFound(err) {\n\t\tkubeConfig, err := a.Deployer.GetKubeConfig(cluster, nil)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to get kubeconfig for cluster %q\", cluster.Name)\n\t\t}\n\n\t\tkubeConfigSecret := &apiv1.Secret{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: kubeConfigSecretName,\n\t\t\t},\n\t\t\tStringData: map[string]string{\n\t\t\t\t\"value\": kubeConfig,\n\t\t\t},\n\t\t}\n\n\t\tif _, err := secretClient.Create(kubeConfigSecret); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to create kubeconfig secret for cluster %q\", cluster.Name)\n\t\t}\n\t} else if err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get kubeconfig secret for cluster %q\", cluster.Name)\n\t}\n\n\t// If the control plane is ready, try to delete the control plane configmap lock, if it exists, and return.\n\tif cluster.Annotations[v1alpha2.AnnotationControlPlaneReady] == v1alpha2.ValueReady {\n\t\tconfigMapName := scope.ControlPlaneConfigMapName()\n\t\tlog.Info(\"Checking for existence of control plane configmap lock\", \"configmap-name\", configMapName)\n\n\t\t_, err := a.coreClient.ConfigMaps(cluster.Namespace).Get(configMapName, metav1.GetOptions{})\n\t\tswitch {\n\t\tcase apierrors.IsNotFound(err):\n\t\t\t// It doesn't exist - no-op\n\t\tcase err != nil:\n\t\t\treturn errors.Wrapf(err, \"Error retrieving control plane configmap lock %q\", configMapName)\n\t\tdefault:\n\t\t\tif err := a.coreClient.ConfigMaps(cluster.Namespace).Delete(configMapName, nil); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"Error deleting control plane configmap lock %q\", configMapName)\n\t\t\t}\n\t\t}\n\n\t\t// Nothing more to reconcile - return early.\n\t\treturn nil\n\t}\n\n\tlog.Info(\"Cluster does not have ready annotation - checking for ready control plane machines\")\n\n\tmachineList := &clusterv1.MachineList{}\n\tif err := a.List(context.Background(), machineList, scope.ListOptionsLabelSelector()); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to retrieve machines in cluster %q\", cluster.Name)\n\t}\n\n\tcontrolPlaneMachines := util.GetControlPlaneMachinesFromList(machineList)\n\n\tmachineReady := false\n\tfor _, machine := range controlPlaneMachines {\n\t\tif machine.Status.NodeRef != nil {\n\t\t\tmachineReady = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !machineReady {\n\t\tlog.Info(\"No control plane machines are ready - requeuing cluster\")\n\t\treturn &controllerError.RequeueAfterError{RequeueAfter: waitForControlPlaneMachineDuration}\n\t}\n\n\tlog.Info(\"Setting cluster ready annotation\")\n\tcluster.Annotations[v1alpha2.AnnotationControlPlaneReady] = v1alpha2.ValueReady\n\n\treturn nil\n}", "func (r *ReconcileRethinkDBCluster) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"namespace\", request.Namespace, \"name\", request.Name)\n\treqLogger.Info(\"reconciling RethinkDBCluster\")\n\n\t// Fetch the RethinkDBCluster instance\n\tcluster := &rethinkdbv1alpha1.RethinkDBCluster{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, cluster)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Verify resource defaults have been initialized\n\tif setDefaults(cluster) {\n\t\t// defaults updated, update and requeue\n\t\treqLogger.Info(\"default spec values initialized\")\n\t\treturn reconcile.Result{Requeue: true}, r.client.Update(context.TODO(), cluster)\n\t}\n\n\t// Reconcile the cluster CA secret\n\tcaSecret, err := r.reconcileCASecret(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile ca secret\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster CA configmap\n\terr = r.reconcileCAConfigMap(cluster, caSecret)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile ca configmap\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the admin service\n\terr = r.reconcileAdminService(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile admin service\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the driver service\n\terr = r.reconcileDriverService(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile driver service\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster TLS secrets\n\terr = r.reconcileTLSSecrets(cluster, caSecret)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile tls secrets\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster admin secret\n\terr = r.reconcileAdminSecret(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile admin secret\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster persistent volume claims\n\t// err = r.reconcilePersistentVolumeClaims(cluster)\n\t// if err != nil {\n\t// \treqLogger.Error(err, \"unable to reconcile persistent volume claims\")\n\t// \treturn reconcile.Result{}, err\n\t// }\n\n\t// Reconcile the cluster server pods\n\terr = r.reconcileServerPods(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile server pods\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// No errors, return and don't requeue\n\treturn reconcile.Result{}, nil\n}", "func (r *ContainerScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := r.Log\n\n\tlog.V(8).Info(\"Something happened to a pod\", \"pod\", req.Name, \"namespace\", req.Namespace)\n\n\tvar pod corev1.Pod\n\terr := r.Get(ctx, req.NamespacedName, &pod)\n\tif err != nil {\n\t\t//dont log an error, as a deleted pod cant be fetched and would spam the logs\n\t\tlog.V(7).Info(\"Unable to fetch Pod\", \"pod\", req.Name, \"namespace\", req.Namespace)\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tif podManagedBySecureCodeBox(pod) {\n\t\tlog.V(7).Info(\"Pod will be ignored, as it is managed by securecodebox\", \"pod\", pod)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif podNotReady(pod) {\n\t\tlog.V(6).Info(\"Pod not ready\", \"pod\", pod.Name)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif pod.DeletionTimestamp == nil {\n\n\t\tscanTypeInstalled := r.checkForScanType(ctx, pod)\n\t\tif scanTypeInstalled {\n\t\t\tr.checkIfNewScansNeedToBeCreated(ctx, pod)\n\t\t} else {\n\t\t\trequeueDuration := r.Config.ContainerAutoDiscoveryConfig.PassiveReconcileInterval.Duration\n\t\t\treturn ctrl.Result{Requeue: true, RequeueAfter: requeueDuration}, nil\n\t\t}\n\n\t} else {\n\t\tr.checkIfScansNeedToBeDeleted(ctx, pod)\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *ResourceRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {\n\tvar resourceRequest discoveryv1alpha1.ResourceRequest\n\terr = r.Get(ctx, req.NamespacedName, &resourceRequest)\n\tif err != nil {\n\t\tklog.Errorf(\"unable to get resourceRequest %s: %s\", req.NamespacedName, err)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tremoteClusterID := resourceRequest.Spec.ClusterIdentity.ClusterID\n\n\tvar requireSpecUpdate bool\n\t// ensure the ForeignCluster existence, if not exists we have to add a new one\n\t// with IncomingPeering discovery method.\n\trequireSpecUpdate, err = r.ensureForeignCluster(ctx, &resourceRequest)\n\tif err != nil {\n\t\tklog.Errorf(\"%s -> Error generating resourceOffer: %s\", remoteClusterID, err)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif requireTenantDeletion(&resourceRequest) {\n\t\tif err = r.ensureTenantDeletion(ctx, &resourceRequest); err != nil {\n\t\t\tklog.Errorf(\"%s -> Error deleting Tenant: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\trequireSpecUpdate = true\n\t} else {\n\t\tnewRequireSpecUpdate := false\n\t\tif newRequireSpecUpdate, err = r.ensureTenant(ctx, &resourceRequest); err != nil {\n\t\t\tklog.Errorf(\"%s -> Error creating Tenant: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\trequireSpecUpdate = requireSpecUpdate || newRequireSpecUpdate\n\t}\n\n\tif requireSpecUpdate {\n\t\tif err = r.Client.Update(ctx, &resourceRequest); err != nil {\n\t\t\tklog.Error(err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\t// always requeue after a spec update\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tdefer func() {\n\t\tnewErr := r.Client.Status().Update(ctx, &resourceRequest)\n\t\tif newErr != nil {\n\t\t\tklog.Error(newErr)\n\t\t\terr = newErr\n\t\t}\n\t}()\n\n\tif resourceRequest.Spec.WithdrawalTimestamp.IsZero() {\n\t\tr.Broadcaster.enqueueForCreationOrUpdate(remoteClusterID)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s -> Error generating resourceOffer: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t} else {\n\t\terr = r.invalidateResourceOffer(ctx, &resourceRequest)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s -> Error invalidating resourceOffer: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *FruitsCatalogGReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t//ctx := context.Background()\n\treqLogger := r.Log.WithValues(\"fruitscatalogg\", req.NamespacedName)\n\n\t// your logic here\n\treqLogger.Info(\"Starting reconcile loop for \" + req.NamespacedName.Name)\n\t// Fetch the FruitsCatalogG instance of this reconcile request.\n\tinstance := &redhatcomv1alpha1.FruitsCatalogG{}\n\terr := r.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue.\n\t\t\treqLogger.Info(\"FruitsCatalogG resource not found. Ignoring since object must be deleted.\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treqLogger.Error(err, \"Failed to get FruitsCatalogG.\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check if the FruitsCatalogG instance is marked to be deleted, which is\n\t// indicated by the deletion timestamp being set.\n\tisFruitsCatalogGMarkedToBeDeleted := instance.GetDeletionTimestamp() != nil\n\tif isFruitsCatalogGMarkedToBeDeleted {\n\t\tif contains(instance.GetFinalizers(), \"finalizer.fruitscatalogg.redhat.com\") {\n\t\t\t// Run finalization logic for finalizer. If the\n\t\t\t// finalization logic fails, don't remove the finalizer so\n\t\t\t// that we can retry during the next reconciliation.\n\t\t\tif err := r.finalizeFruitsCatalogG(reqLogger, instance); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// Remove finalizer. Once all finalizers have been\n\t\t\t// removed, the object will be deleted.\n\t\t\tcontrollerutil.RemoveFinalizer(instance, \"finalizer.fruitscatalogg.redhat.com\")\n\t\t\terr := r.Update(context.TODO(), instance)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Ensure all required resources are up-to-date.\n\tinstallMongodb := instance.Spec.MongoDB.Install\n\tif installMongodb {\n\t\t// Deal with MongoDB connection credentials.\n\t\tmongodbSecret := deployment.CreateSecretForMongoDB(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, mongodbSecret, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), mongodbSecret); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbSecret.Name+\" Secret\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Create \" + mongodbSecret.Name + \" Secret for MongoDB connection details\")\n\t\t\tinstance.Status.Secret = mongodbSecret.Name + \" is holding connection details to MongoDB\"\n\t\t}\n\n\t\t// Deal with MongoDB persistentn volume.\n\t\tif instance.Spec.MongoDB.Persistent {\n\t\t\tmongodbPVC := deployment.CreatePersistentVolumeClaimMongoDB(&instance.Spec, instance.Namespace)\n\t\t\tcontrollerutil.SetControllerReference(instance, mongodbPVC, r.Scheme)\n\t\t\tif err := r.Client.Create(context.TODO(), mongodbPVC); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbPVC.Name+\" PVC\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t} else if err == nil {\n\t\t\t\treqLogger.Info(\"Apply \" + mongodbPVC.Name + \" PVC for MongoDB\")\n\t\t\t}\n\t\t}\n\n\t\t// Deal with MongoDB deployment and service.\n\t\tmongodbDeployment := deployment.CreateDeploymentForMongoDB(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, mongodbDeployment, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), mongodbDeployment); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbDeployment.Name+\" Deployment\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Apply \" + mongodbDeployment.Name + \" Deployment for MongoDB\")\n\t\t\tinstance.Status.MongoDB = mongodbDeployment.Name + \" is the Deployment for MongoDB\"\n\t\t}\n\t\tmongodbService := deployment.CreateServiceForMongoDB(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, mongodbService, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), mongodbService); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbService.Name+\" Service\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Apply \" + mongodbService.Name + \" Service for MongoDB\")\n\t\t}\n\t}\n\n\t// Deal with WebApp deployment and service.\n\twebappDeployment := deployment.CreateDeploymentForWebapp(&instance.Spec, instance.Namespace)\n\tcontrollerutil.SetControllerReference(instance, webappDeployment, r.Scheme)\n\tif err := r.Client.Create(context.TODO(), webappDeployment); err != nil && !errors.IsAlreadyExists(err) {\n\t\treqLogger.Error(err, \"Error while creating \"+webappDeployment.Name+\" Deployment\")\n\t\treturn ctrl.Result{}, err\n\t} else if err != nil && errors.IsAlreadyExists(err) {\n\t\t// Check if we got the correct number of replicas.\n\t\tif *webappDeployment.Spec.Replicas != instance.Spec.WebApp.ReplicaCount {\n\t\t\twebappDeployment.Spec.Replicas = &instance.Spec.WebApp.ReplicaCount\n\t\t\tif err2 := r.Client.Update(context.TODO(), webappDeployment); err2 != nil {\n\t\t\t\treqLogger.Error(err2, \"Error while updating replicas in \"+webappDeployment.Name+\" Deployment\")\n\t\t\t\treturn ctrl.Result{}, err2\n\t\t\t} else if err2 == nil {\n\t\t\t\treqLogger.Info(\"Update replicas \" + webappDeployment.Name + \" Deployment for WebApp\")\n\t\t\t\tinstance.Status.WebApp = webappDeployment.Name + \" is the Deployment for WebApp\"\n\t\t\t}\n\t\t}\n\t} else if err == nil {\n\t\treqLogger.Info(\"Apply \" + webappDeployment.Name + \" Deployment for WebApp\")\n\t\tinstance.Status.WebApp = webappDeployment.Name + \" is the Deployment for WebApp\"\n\t}\n\twebappService := deployment.CreateServiceForWebapp(&instance.Spec, instance.Namespace)\n\tcontrollerutil.SetControllerReference(instance, webappService, r.Scheme)\n\tif err := r.Client.Create(context.TODO(), webappService); err != nil && !errors.IsAlreadyExists(err) {\n\t\treqLogger.Error(err, \"Error while creating \"+webappService.Name+\" Service\")\n\t\treturn ctrl.Result{}, err\n\t} else if err == nil {\n\t\treqLogger.Info(\"Apply \" + webappService.Name + \" Service for WebApp\")\n\t}\n\n\t// Finally check if we're on OpenShift of Vanilla Kubernetes.\n\tisOpenShift := false\n\n\t// The discovery package is used to discover APIs supported by a Kubernetes API server.\n\tconfig, err := ctrl.GetConfig()\n\tif err == nil && config != nil {\n\t\tdclient, err := getDiscoveryClient(config)\n\t\tif err == nil && dclient != nil {\n\t\t\tapiGroupList, err := dclient.ServerGroups()\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Info(\"Error while querying ServerGroups, assuming we're on Vanilla Kubernetes\")\n\t\t\t} else {\n\t\t\t\tfor i := 0; i < len(apiGroupList.Groups); i++ {\n\t\t\t\t\tif strings.HasSuffix(apiGroupList.Groups[i].Name, \".openshift.io\") {\n\t\t\t\t\t\tisOpenShift = true\n\t\t\t\t\t\treqLogger.Info(\"We detected being on OpenShift! Wouhou!\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treqLogger.Info(\"Cannot retrieve a DiscoveryClient, assuming we're on Vanilla Kubernetes\")\n\t\t}\n\t}\n\t// Create a Route if we're on OpenShift ;-)\n\tif isOpenShift {\n\t\tappRoute := deployment.CreateRouteForWebapp(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, appRoute, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), appRoute); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+appRoute.Name+\" Route\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Apply \" + appRoute.Name + \" Route for WebApp\")\n\t\t}\n\n\t\t// Maybe on next reconciliation loop ?\n\t\treqLogger.Info(\"Looking for route \" + appRoute.ObjectMeta.Name + \" on namespace \" + instance.Namespace)\n\t\terr = r.Client.Get(context.TODO(), types.NamespacedName{Name: appRoute.ObjectMeta.Name, Namespace: instance.Namespace}, appRoute)\n\t\tif err == nil {\n\t\t\tinstance.Status.Route = appRoute.Status.Ingress[0].Host\n\t\t} else {\n\t\t\treqLogger.Error(err, \"Error while reading Route for getting its Status.Ingress[0].Host field\")\n\t\t}\n\t}\n\n\t// Updating the Status that is modeled as a subresource. This way we can update\n\t// the status of our resources without increasing the ResourceGeneration metadata field.\n\tr.Status().Update(context.Background(), instance)\n\n\t// end of logic block\n\n\treturn ctrl.Result{}, nil\n}", "func (r machineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, reterr error) {\n\n\t// Get the VSphereMachine resource for this request.\n\tvsphereMachine := &infrav1.VSphereMachine{}\n\tif err := r.Client.Get(r, req.NamespacedName, vsphereMachine); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tr.Logger.Info(\"VSphereMachine not found, won't reconcile\", \"key\", req.NamespacedName)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Fetch the CAPI Machine.\n\tmachine, err := clusterutilv1.GetOwnerMachine(r, r.Client, vsphereMachine.ObjectMeta)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif machine == nil {\n\t\tr.Logger.Info(\"Waiting for Machine Controller to set OwnerRef on VSphereMachine\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Fetch the CAPI Cluster.\n\tcluster, err := clusterutilv1.GetClusterFromMetadata(r, r.Client, machine.ObjectMeta)\n\tif err != nil {\n\t\tr.Logger.Info(\"Machine is missing cluster label or cluster does not exist\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Fetch the VSphereCluster\n\tvsphereCluster := &infrav1.VSphereCluster{}\n\tvsphereClusterName := client.ObjectKey{\n\t\tNamespace: vsphereMachine.Namespace,\n\t\tName: cluster.Spec.InfrastructureRef.Name,\n\t}\n\tif err := r.Client.Get(r, vsphereClusterName, vsphereCluster); err != nil {\n\t\tr.Logger.Info(\"Waiting for VSphereCluster\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Get or create an authenticated session to the vSphere endpoint.\n\tauthSession, err := session.GetOrCreate(r.Context,\n\t\tvsphereCluster.Spec.Server, vsphereMachine.Spec.Datacenter,\n\t\tr.ControllerManagerContext.Username, r.ControllerManagerContext.Password)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrap(err, \"failed to create vSphere session\")\n\t}\n\n\t// Create the patch helper.\n\tpatchHelper, err := patch.NewHelper(vsphereMachine, r.Client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to init patch helper for %s %s/%s\",\n\t\t\tvsphereMachine.GroupVersionKind(),\n\t\t\tvsphereMachine.Namespace,\n\t\t\tvsphereMachine.Name)\n\t}\n\n\t// Create the machine context for this request.\n\tmachineContext := &context.MachineContext{\n\t\tClusterContext: &context.ClusterContext{\n\t\t\tControllerContext: r.ControllerContext,\n\t\t\tCluster: cluster,\n\t\t\tVSphereCluster: vsphereCluster,\n\t\t},\n\t\tMachine: machine,\n\t\tVSphereMachine: vsphereMachine,\n\t\tSession: authSession,\n\t\tLogger: r.Logger.WithName(req.Namespace).WithName(req.Name),\n\t\tPatchHelper: patchHelper,\n\t}\n\n\t// Print the task-ref upon entry and upon exit.\n\tmachineContext.Logger.V(4).Info(\n\t\t\"VSphereMachine.Status.TaskRef OnEntry\",\n\t\t\"task-ref\", machineContext.VSphereMachine.Status.TaskRef)\n\tdefer func() {\n\t\tmachineContext.Logger.V(4).Info(\n\t\t\t\"VSphereMachine.Status.TaskRef OnExit\",\n\t\t\t\"task-ref\", machineContext.VSphereMachine.Status.TaskRef)\n\t}()\n\n\t// Always issue a patch when exiting this function so changes to the\n\t// resource are patched back to the API server.\n\tdefer func() {\n\t\t// Patch the VSphereMachine resource.\n\t\tif err := machineContext.Patch(); err != nil {\n\t\t\tif reterr == nil {\n\t\t\t\treterr = err\n\t\t\t}\n\t\t\tmachineContext.Logger.Error(err, \"patch failed\", \"machine\", machineContext.String())\n\t\t}\n\n\t\t// localObj is a deep copy of the VSphereMachine resource that was\n\t\t// fetched at the top of this Reconcile function.\n\t\tlocalObj := machineContext.VSphereMachine.DeepCopy()\n\n\t\t// Fetch the up-to-date VSphereMachine resource into remoteObj until the\n\t\t// fetched resource has a a different ResourceVersion than the local\n\t\t// object.\n\t\t//\n\t\t// FYI - resource versions are opaque, numeric strings and should not\n\t\t// be compared with < or >, only for equality -\n\t\t// https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions.\n\t\t//\n\t\t// Since CAPV is currently deployed with a single replica, and this\n\t\t// controller has a max concurrency of one, the only agent updating the\n\t\t// VSphereMachine resource should be this controller.\n\t\t//\n\t\t// So if the remote resource's ResourceVersion is different than the\n\t\t// ResourceVersion of the resource fetched at the beginning of this\n\t\t// reconcile request, then that means the remote resource should be\n\t\t// newer than the local resource.\n\t\twait.PollImmediateInfinite(time.Second*1, func() (bool, error) {\n\t\t\t// remoteObj refererences the same VSphereMachine resource as it exists\n\t\t\t// on the API server post the patch operation above. In a perfect world,\n\t\t\t// the Status for localObj and remoteObj should be the same.\n\t\t\tremoteObj := &infrav1.VSphereMachine{}\n\t\t\tif err := machineContext.Client.Get(machineContext, req.NamespacedName, remoteObj); err != nil {\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\t// It's possible that the remote resource cannot be found\n\t\t\t\t\t// because it has been removed. Do not error, just exit.\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\n\t\t\t\t// There was an issue getting the remote resource. Sleep for a\n\t\t\t\t// second and try again.\n\t\t\t\tmachineContext.Logger.Error(err, \"failed to get VSphereMachine while exiting reconcile\")\n\t\t\t\treturn false, nil\n\t\t\t}\n\n\t\t\t// If the remote resource version is not the same as the local\n\t\t\t// resource version, then it means we were able to get a resource\n\t\t\t// newer than the one we already had.\n\t\t\tif localObj.ResourceVersion != remoteObj.ResourceVersion {\n\t\t\t\tmachineContext.Logger.Info(\n\t\t\t\t\t\"resource is patched\",\n\t\t\t\t\t\"local-resource-version\", localObj.ResourceVersion,\n\t\t\t\t\t\"remote-resource-version\", remoteObj.ResourceVersion)\n\t\t\t\treturn true, nil\n\t\t\t}\n\n\t\t\t// If the resources are the same resource version, then a previous\n\t\t\t// patch may not have resulted in any changes. Check to see if the\n\t\t\t// remote status is the same as the local status.\n\t\t\tif cmp.Equal(localObj.Status, remoteObj.Status, cmpopts.EquateEmpty()) {\n\t\t\t\tmachineContext.Logger.Info(\n\t\t\t\t\t\"resource patch was not required\",\n\t\t\t\t\t\"local-resource-version\", localObj.ResourceVersion,\n\t\t\t\t\t\"remote-resource-version\", remoteObj.ResourceVersion)\n\t\t\t\treturn true, nil\n\t\t\t}\n\n\t\t\t// The remote resource version is the same as the local resource\n\t\t\t// version, which means the local cache is not yet up-to-date.\n\t\t\tmachineContext.Logger.Info(\n\t\t\t\t\"resource is not patched\",\n\t\t\t\t\"local-resource-version\", localObj.ResourceVersion,\n\t\t\t\t\"remote-resource-version\", remoteObj.ResourceVersion)\n\t\t\treturn false, nil\n\t\t})\n\t}()\n\n\t// Handle deleted machines\n\tif !vsphereMachine.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(machineContext)\n\t}\n\n\t// Handle non-deleted machines\n\treturn r.reconcileNormal(machineContext)\n}", "func (r *ReconcileKedaController) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling KedaController\")\n\n\t// Fetch the KedaController instance\n\tinstance := &kedav1alpha1.KedaController{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif !isInteresting(request) {\n\t\tmsg := fmt.Sprintf(\"The KedaController resource needs to be created in namespace %s with name %s, otherwise it will be ignored\", kedaControllerResourceNamespace, kedaControllerResourceName)\n\t\treqLogger.Info(msg)\n\t\tstatus := instance.Status.DeepCopy()\n\t\tstatus.MarkIgnored(msg)\n\t\terr = util.UpdateKedaControllerStatus(r.client, instance, status)\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tif instance.GetDeletionTimestamp() != nil {\n\t\tif contains(instance.GetFinalizers(), kedaControllerFinalizer) {\n\t\t\t// Run finalization logic for kedaControllerFinalizer. If the\n\t\t\t// finalization logic fails, don't remove the finalizer so\n\t\t\t// that we can retry during the next reconciliation.\n\t\t\tif err := r.finalizeKedaController(reqLogger, instance); err != nil {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t\t// Remove kedaControllerFinalizer. Once all finalizers have been\n\t\t\t// removed, the object will be deleted.\n\t\t\tpatch := client.MergeFrom(instance.DeepCopy())\n\t\t\tinstance.SetFinalizers(remove(instance.GetFinalizers(), kedaControllerFinalizer))\n\t\t\terr := r.client.Patch(context.TODO(), instance, patch)\n\t\t\tif err != nil {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Add finalizer for this CR\n\tif !contains(instance.GetFinalizers(), kedaControllerFinalizer) {\n\t\tif err := r.addFinalizer(reqLogger, instance); err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\tstatus := instance.Status.DeepCopy()\n\tdefer util.UpdateKedaControllerStatus(r.client, instance, status)\n\n\t// DO NOT manage creation of namespace at the moment (we expect that it is precreated manually)\n\t// if err := r.createNamespace(installationNamespace); err != nil {\n\t// \tstatus.MarkInstallFailed(fmt.Sprintf(\"Not able to create Namespace '%s'\", installationNamespace))\n\t// \treturn reconcile.Result{}, err\n\t// }\n\n\tif err := r.installSA(instance); err != nil {\n\t\tstatus.MarkInstallFailed(\"Not able to create ServiceAccount\")\n\t\treturn reconcile.Result{}, err\n\t}\n\tif err := r.installController(instance); err != nil {\n\t\tstatus.MarkInstallFailed(\"Not able to install KEDA Controller\")\n\t\treturn reconcile.Result{}, err\n\t}\n\tif err := r.installMetricsServer(instance); err != nil {\n\t\tstatus.MarkInstallFailed(\"Not able to install KEDA Metrics Server\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tstatus.Version = version.Version\n\tstatus.MarkInstallSucceeded(fmt.Sprintf(\"KEDA v%s is installed in namespace '%s'\", version.Version, installationNamespace))\n\treturn reconcile.Result{}, nil\n}", "func (r *CIBuildReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"cibuild\", req.NamespacedName)\n\n\t// Fetch the CIBuild instance\n\tinstance := &cicdv1alpha1.CIBuild{}\n\terr := r.Client.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = r.createBuildJobFromTemplate(log, instance)\n\tif err != nil {\n\t\tlog.Error(err, \"An unexpected error has happen when creating a Job\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check if the CIBuild instance is marked to be deleted, which is\n\t// indicated by the deletion timestamp being set.\n\tisCIBuildMarkedToBeDeleted := instance.GetDeletionTimestamp() != nil\n\tif isCIBuildMarkedToBeDeleted {\n\t\tif contains(instance.GetFinalizers(), ciBuildFinalizer) {\n\t\t\t// Run finalization logic for ciBuildFinalizer. If the\n\t\t\t// finalization logic fails, don't remove the finalizer so\n\t\t\t// that we can retry during the next reconciliation.\n\t\t\tif err := r.finalizeCIBuild(log, instance); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// Remove ciBuildFinalizer. Once all finalizers have been\n\t\t\t// removed, the object will be deleted.\n\t\t\tcontrollerutil.RemoveFinalizer(instance, ciBuildFinalizer)\n\t\t\terr := r.Update(ctx, instance)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Add finalizer for this CR\n\tif !contains(instance.GetFinalizers(), ciBuildFinalizer) {\n\t\tif err := r.addFinalizer(log, instance); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tlog.Info(\"CIBuild reconciliation success\")\n\treturn ctrl.Result{}, nil\n}", "func (r *TestWorkloadReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"testworkload\", req.NamespacedName)\n\tworkload := new(naglfarv1.TestWorkload)\n\tif err := r.Get(ctx, req.NamespacedName, workload); err != nil {\n\t\tlog.Error(err, \"unable to fetch testworkload\")\n\t\t// maybe resource deleted\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tif workload.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tif !util.StringsContains(workload.ObjectMeta.Finalizers, testWorkloadFinalizer) {\n\t\t\tworkload.ObjectMeta.Finalizers = append(workload.ObjectMeta.Finalizers, testWorkloadFinalizer)\n\t\t\tif err := r.Update(ctx, workload); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif util.StringsContains(workload.ObjectMeta.Finalizers, testWorkloadFinalizer) {\n\t\t\tif err := r.uninstallWorkload(ctx, workload); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\tworkload.Finalizers = util.StringsRemove(workload.Finalizers, testWorkloadFinalizer)\n\t\tif err := r.Update(ctx, workload); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\tswitch workload.Status.State {\n\tcase \"\":\n\t\tworkload.Status.State = naglfarv1.TestWorkloadStatePending\n\t\tworkload.Status.WorkloadStatus = make(map[string]naglfarv1.WorkloadStatus)\n\t\terr := r.Status().Update(ctx, workload)\n\t\treturn ctrl.Result{}, err\n\tcase naglfarv1.TestWorkloadStatePending:\n\t\treturn r.reconcilePending(ctx, workload)\n\tcase naglfarv1.TestWorkloadStateRunning:\n\t\treturn r.reconcileRunning(ctx, workload)\n\tcase naglfarv1.TestWorkloadStateSucceeded, naglfarv1.TestWorkloadStateFailed:\n\t\treturn r.reconcileFinish(workload)\n\t}\n\treturn ctrl.Result{}, nil\n}", "func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)", "func (r *CassandraRestoreReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\t_ = r.Log.WithValues(\"cassandrarestore\", req.NamespacedName)\n\n\tinstance := &api.CassandraRestore{}\n\terr := r.Get(ctx, req.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t}\n\n\trestore := instance.DeepCopy()\n\n\tif len(restore.Status.RestoreKey) == 0 {\n\t\tif err = r.setRestoreKey(ctx, restore); err != nil {\n\t\t\tr.Log.Error(err, \"failed to set restore key\")\n\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t}\n\t}\n\n\t// See if the restore is already in progress\n\tif !restore.Status.StartTime.IsZero() {\n\t\tcassdcKey := types.NamespacedName{Namespace: req.Namespace, Name: restore.Spec.CassandraDatacenter.Name}\n\t\tcassdc := &cassdcapi.CassandraDatacenter{}\n\n\t\tif err = r.Get(ctx, cassdcKey, cassdc); err != nil {\n\t\t\t// TODO add some additional logging and/or generate an event if the error is not found\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\tr.Log.Error(err, \"cassandradatacenter not found\", \"CassandraDatacenter\", cassdcKey)\n\n\t\t\t\tpatch := client.MergeFrom(restore.DeepCopy())\n\t\t\t\trestore.Status.FinishTime = metav1.Now()\n\t\t\t\tif err = r.Status().Patch(ctx, restore, patch); err == nil {\n\t\t\t\t\treturn ctrl.Result{Requeue: false}, err\n\t\t\t\t} else {\n\t\t\t\t\tr.Log.Error(err, \"failed to patch status with end time\")\n\t\t\t\t\treturn ctrl.Result{RequeueAfter: 5 * time.Second}, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tr.Log.Error(err, \"failed to get cassandradatacenter\", \"CassandraDatacenter\", cassdcKey)\n\t\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t\t}\n\t\t}\n\n\t\tif isCassdcReady(cassdc) {\n\t\t\tr.Log.Info(\"the cassandradatacenter has been restored and is ready\", \"CassandraDatacenter\", cassdcKey)\n\n\t\t\tpatch := client.MergeFrom(restore.DeepCopy())\n\t\t\trestore.Status.FinishTime = metav1.Now()\n\t\t\tif err = r.Status().Patch(ctx, restore, patch); err == nil {\n\t\t\t\treturn ctrl.Result{Requeue: false}, err\n\t\t\t} else {\n\t\t\t\tr.Log.Error(err, \"failed to patch status with end time\")\n\t\t\t\treturn ctrl.Result{RequeueAfter: 5 * time.Second}, err\n\t\t\t}\n\t\t}\n\n\t\t// TODO handle scenarios in which the CassandraDatacenter fails to become ready\n\n\t\treturn ctrl.Result{RequeueAfter: 5 * time.Second}, nil\n\t}\n\n\tbackupKey := types.NamespacedName{Namespace: req.Namespace, Name: restore.Spec.Backup}\n\tbackup := &api.CassandraBackup{}\n\n\tif err = r.Get(ctx, backupKey, backup); err != nil {\n\t\t// TODO add some additional logging and/or generate an event if the error is not found\n\t\tr.Log.Error(err, \"failed to get backup\", \"CassandraBackup\", backupKey)\n\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t}\n\n\tif restore.Spec.InPlace {\n\t\tr.Log.Info(\"performing in place restore\")\n\n\t\tcassdcKey := types.NamespacedName{Namespace: req.Namespace, Name: restore.Spec.CassandraDatacenter.Name}\n\t\tcassdc := &cassdcapi.CassandraDatacenter{}\n\n\t\tif err = r.Get(ctx, cassdcKey, cassdc); err != nil {\n\t\t\tr.Log.Error(err, \"failed to get cassandradatacenter\", \"CassandraDatacenter\", cassdcKey)\n\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t}\n\n\t\tcassdc = cassdc.DeepCopy()\n\n\t\tif err = setBackupNameInRestoreContainer(backup.Spec.Name, cassdc); err != nil {\n\t\t\tr.Log.Error(err, \"failed to set backup name in restore container\", \"CassandraDatacenter\", cassdcKey)\n\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t}\n\n\t\tif err = setRestoreKeyInRestoreContainer(restore.Status.RestoreKey, cassdc); err != nil {\n\t\t\tr.Log.Error(err, \"failed to set restore key in restore container\", \"CassandraDatacenter\", cassdcKey)\n\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t}\n\n\t\tpatch := client.MergeFrom(restore.DeepCopy())\n\t\trestore.Status.StartTime = metav1.Now()\n\t\tif err = r.Status().Patch(ctx, restore, patch); err != nil {\n\t\t\tr.Log.Error(err, \"fail to patch status with start time\")\n\t\t\treturn ctrl.Result{RequeueAfter: 5 * time.Second}, err\n\t\t}\n\n\t\tif err = r.Update(ctx, cassdc); err == nil {\n\t\t\tr.Log.Info(\"the cassandradatacenter has been updated and will be restarted\", \"CassandraDatacenter\", cassdcKey)\n\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t} else {\n\t\t\tr.Log.Error(err, \"failed to update the cassandradatacenter\", \"CassandraDatacenter\", cassdcKey)\n\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t}\n\t}\n\n\tr.Log.Info(\"restoring to new cassandradatacenter\")\n\n\tnewCassdc, err := buildNewCassandraDatacenter(restore, backup)\n\tif err != nil {\n\t\tr.Log.Error(err, \"failed to build new cassandradatacenter\")\n\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t}\n\n\tcassdcKey := types.NamespacedName{Namespace: newCassdc.Namespace, Name: newCassdc.Name}\n\n\tr.Log.Info(\"creating new cassandradatacenter\", \"CassandraDatacenter\", cassdcKey)\n\n\tif err = r.Create(ctx, newCassdc); err == nil {\n\t\tpatch := client.MergeFrom(restore.DeepCopy())\n\t\trestore.Status.StartTime = metav1.Now()\n\t\tif err = r.Status().Patch(ctx, restore, patch); err != nil {\n\t\t\tr.Log.Error(err, \"fail to patch status with start time\")\n\t\t\treturn ctrl.Result{RequeueAfter: 5 * time.Second}, err\n\t\t} else {\n\t\t\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, err\n\t\t}\n\t} else {\n\t\tr.Log.Error(err, \"failed to create cassandradatacenter\", \"CassandraDatacenter\", cassdcKey)\n\t\treturn ctrl.Result{RequeueAfter: 30 * time.Second}, nil\n\t}\n}", "func (r *KonfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.FromContext(ctx)\n\treconcileStart := time.Now()\n\n\treqLogger.Info(\"Reconciling konfiguration\")\n\n\t// Look up the konfiguration that triggered this request\n\tkonfig := &konfigurationv1.Konfiguration{}\n\tif err := r.Client.Get(ctx, req.NamespacedName, konfig); err != nil {\n\t\t// Check if object was deleted\n\t\tif client.IgnoreNotFound(err) == nil {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Record suspended status metric\n\tdefer r.recordSuspension(ctx, konfig)\n\n\t// Add our finalizer if it does not exist\n\tif !controllerutil.ContainsFinalizer(konfig, konfigurationv1.KonfigurationFinalizer) {\n\t\treqLogger.Info(\"Registering finalizer to Konfiguration\")\n\t\tcontrollerutil.AddFinalizer(konfig, konfigurationv1.KonfigurationFinalizer)\n\t\tif err := r.Update(ctx, konfig); err != nil {\n\t\t\treqLogger.Error(err, \"failed to register finalizer\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// Examine if the object is under deletion\n\tif !konfig.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(ctx, konfig)\n\t}\n\n\t// Check if the konfiguration is suspended\n\tif konfig.IsSuspended() {\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: konfig.GetInterval(),\n\t\t}, nil\n\t}\n\n\t// Get the revision and the path we are going to operate on\n\trevision, path, clean, err := r.prepareSource(ctx, konfig)\n\tif err != nil {\n\t\tr.recordReadiness(ctx, konfig)\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: konfig.GetRetryInterval(),\n\t\t}, nil\n\t}\n\tdefer clean()\n\n\t// Check if there are any dependencies and that they are all ready\n\tif err := r.checkDependencies(ctx, konfig); err != nil {\n\t\tif statusErr := konfig.SetNotReady(ctx, r.Client, konfigurationv1.NewStatusMeta(\n\t\t\trevision, meta.DependencyNotReadyReason, err.Error(),\n\t\t)); statusErr != nil {\n\t\t\treqLogger.Error(err, \"failed to update status for dependency not ready\")\n\t\t}\n\t\tmsg := fmt.Sprintf(\"Dependencies do not meet ready condition, retrying in %s\", r.dependencyRequeueDuration.String())\n\t\treqLogger.Info(msg)\n\t\tr.event(ctx, konfig, &EventData{\n\t\t\tRevision: revision,\n\t\t\tSeverity: events.EventSeverityInfo,\n\t\t\tMessage: msg,\n\t\t})\n\t\tr.recordReadiness(ctx, konfig)\n\t\treturn ctrl.Result{RequeueAfter: r.dependencyRequeueDuration}, nil\n\t}\n\n\t// record reconciliation duration\n\tif r.MetricsRecorder != nil {\n\t\tobjRef, err := reference.GetReference(r.Scheme, konfig)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tdefer r.MetricsRecorder.RecordDuration(*objRef, reconcileStart)\n\t}\n\n\t// set the status to progressing\n\tif err := konfig.SetProgressing(ctx, r.Client); err != nil {\n\t\treqLogger.Error(err, \"unable to update status to progressing\")\n\t\treturn ctrl.Result{Requeue: true}, err\n\t}\n\tr.recordReadiness(ctx, konfig)\n\n\t// Do reconciliation\n\tsnapshot, err := r.reconcile(ctx, konfig, revision, path)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Error during reconciliation\")\n\t\tr.event(ctx, konfig, &EventData{\n\t\t\tRevision: revision,\n\t\t\tSeverity: events.EventSeverityError,\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: konfig.GetRetryInterval(),\n\t\t}, nil\n\t}\n\n\tupdated := konfig.Status.Snapshot == nil || snapshot.Checksum != konfig.Status.Snapshot.Checksum\n\n\t// Set the konfiguration as ready\n\tmsg := fmt.Sprintf(\"Applied revision: %s\", revision)\n\tif err := konfig.SetReady(ctx, r.Client, snapshot, konfigurationv1.NewStatusMeta(\n\t\trevision, meta.ReconciliationSucceededReason, msg),\n\t); err != nil {\n\t\treturn ctrl.Result{Requeue: true}, err\n\t}\n\n\treqLogger.Info(fmt.Sprintf(\"Reconcile finished, next run in %s\", konfig.GetInterval().String()), \"Revision\", revision)\n\n\tif updated {\n\t\tr.event(ctx, konfig, &EventData{\n\t\t\tRevision: revision,\n\t\t\tSeverity: events.EventSeverityInfo,\n\t\t\tMessage: \"Update Complete\",\n\t\t\tMetadata: map[string]string{\n\t\t\t\t\"commit_status\": \"update\",\n\t\t\t},\n\t\t})\n\t}\n\treturn ctrl.Result{\n\t\tRequeueAfter: konfig.GetInterval(),\n\t}, nil\n}", "func (r *TerminalReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tif err := r.increaseCounterForNamespace(req.Namespace); err != nil {\n\t\tr.Log.Info(\"maximum parallel reconciles reached for namespace - requeuing the req\", \"namespace\", req.Namespace, \"name\", req.Name)\n\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: wait.Jitter(time.Duration(int64(100*time.Millisecond)), 50), // requeue after 100ms - 5s\n\t\t}, nil\n\t}\n\n\tres, err := r.handleRequest(req)\n\n\tr.decreaseCounterForNamespace(req.Namespace)\n\n\treturn res, err\n}", "func (bc *ReconcileJenkinsInstance) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tjenkinsInstance, err := bc.getJenkinsInstance(request.NamespacedName)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tglog.Errorf(\"JenkinsInstance key '%s' in work queue no longer exists\", request.String())\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tadminSecretName := jenkinsInstance.Spec.AdminSecret\n\tif adminSecretName == \"\" {\n\t\t// We choose to absorb the error here as the worker would requeue the\n\t\t// resource otherwise. Instead, the next time the resource is updated\n\t\t// the resource will be queued again.\n\t\tglog.Errorf(\"%s: AdminSecret name must be specified\", request.String())\n\t\treturn reconcile.Result{}, nil\n\t}\n\tadminSecretKey := types.NewNamespacedNameFromString(\n\t\tfmt.Sprintf(\"%s%c%s\", request.Namespace, types.Separator, adminSecretName))\n\n\tadminSecret := &corev1.Secret{}\n\terr = bc.Client.Get(context.TODO(), adminSecretKey, adminSecret)\n\tif errors.IsNotFound(err) {\n\t\tglog.Errorf(\"AdminSecret %s does not exist yet: %v\", adminSecretKey.String(), err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Get the setup utility secret managed by this controller\n\t_, err = bc.newSetupSecret(request.NamespacedName)\n\t// If an error occurs during Get/Create, we'll requeue the item so we can\n\t// attempt processing again later. This could have been caused by a\n\t// temporary network failure, or any other transient reason.\n\tif err != nil {\n\t\tglog.Errorf(\"Error creating setup secret: %s\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t_, err = bc.newDeployment(request.NamespacedName)\n\t// If an error occurs during Get/Create, we'll requeue the item so we can\n\t// attempt processing again later. This could have been caused by a\n\t// temporary network failure, or any other transient reason.\n\tif err != nil {\n\t\tglog.Errorf(\"Error creating deployment: %s\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t_, err = bc.newService(request.NamespacedName)\n\t// If an error occurs during Get/Create, we'll requeue the item so we can\n\t// attempt processing again later. This could have been caused by a\n\t// temporary network failure, or any other transient reason.\n\tif err != nil {\n\t\tglog.Errorf(\"Error creating service: %s\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Get the ingress with the name specified in JenkinsInstance.spec\n\t_, err = bc.newIngress(request.NamespacedName)\n\t// If an error occurs during Get/Create, we'll requeue the item so we can\n\t// attempt processing again later. This could have been caused by a\n\t// temporary network failure, or any other transient reason.\n\tif err != nil {\n\t\tglog.Errorf(\"Error creating ingress: %s\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Setup Network policy if specified in JenkinsInstance.spec\n\t_, err = bc.newNetworkPolicy(request.NamespacedName)\n\t// If an error occurs during Get/Create, we'll requeue the item so we can\n\t// attempt processing again later. This could have been caused by a\n\t// temporary network failure, or any other transient reason.\n\tif err != nil {\n\t\tglog.Errorf(\"Error creating network policy: %s\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Finally, we update the status block of the JenkinsInstance resource to reflect the\n\t// current state of the world\n\terr = bc.updateJenkinsInstanceStatus(request.NamespacedName)\n\tif err != nil {\n\t\tglog.Errorf(\"Error updating JenkinsInstance %s: %v\", request.String(), err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tbc.Event(jenkinsInstance, corev1.EventTypeNormal, SuccessSynced, MessageResourceSynced)\n\treturn reconcile.Result{}, nil\n}", "func (r *HybrisBaseReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"hybrisbase\", req.NamespacedName)\n\n\t// Fetch the HybrisBase instance\n\thybrisBase := &hybrisv1alpha1.HybrisBase{}\n\terr := r.Get(ctx, req.NamespacedName, hybrisBase)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\tlog.Info(\"HybrisBase resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get HybrisBase\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tupdated, err := r.ensureImageStream(hybrisBase, ctx, log)\n\tif updated {\n\t\treturn ctrl.Result{}, nil\n\t} else if err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tupdated, err = r.ensureSecret(hybrisBase, ctx, log)\n\tif updated {\n\t\treturn ctrl.Result{}, nil\n\t} else if err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tupdated, err = r.ensureBuildConfig(hybrisBase, ctx, log)\n\tif updated {\n\t\treturn ctrl.Result{}, nil\n\t} else if err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif hybrisBase.Status.BuildConditions == nil {\n\t\thybrisBase.Status.BuildConditions = []hybrisv1alpha1.BuildStatusCondition{}\n\t}\n\n\tbuilding, updated, err := r.updateBuildStatus(hybrisBase, ctx, log)\n\n\tif updated {\n\t\terr = r.Status().Update(ctx, hybrisBase)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to update HybrisBase status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"HybrisBase status updated\")\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t} else if building {\n\t\tlog.Info(\"HybrisBase building in process\")\n\t\treturn ctrl.Result{RequeueAfter: time.Minute}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (c *controller) Reconcile(request reconciler.Request) (reconciler.Result, error) {\n\tklog.V(4).Infof(\"reconcile node %s for cluster %s\", request.Name, request.ClusterName)\n\tvExists := true\n\tvNodeObj, err := c.MultiClusterController.Get(request.ClusterName, request.Namespace, request.Name)\n\tif err != nil {\n\t\tif !errors.IsNotFound(err) {\n\t\t\treturn reconciler.Result{Requeue: true}, err\n\t\t}\n\t\tvExists = false\n\t}\n\n\tif vExists {\n\t\tvNode := vNodeObj.(*v1.Node)\n\t\tif vNode.Labels[constants.LabelVirtualNode] != \"true\" {\n\t\t\t// We only handle virtual nodes created by syncer\n\t\t\treturn reconciler.Result{}, nil\n\t\t}\n\t\tc.Lock()\n\t\tif _, exist := c.nodeNameToCluster[request.Name]; !exist {\n\t\t\tc.nodeNameToCluster[request.Name] = make(map[string]struct{})\n\t\t}\n\t\tc.nodeNameToCluster[request.Name][request.ClusterName] = struct{}{}\n\t\tc.Unlock()\n\t} else {\n\t\tc.Lock()\n\t\tif _, exists := c.nodeNameToCluster[request.Name]; exists {\n\t\t\tdelete(c.nodeNameToCluster[request.Name], request.ClusterName)\n\t\t}\n\t\tc.Unlock()\n\n\t}\n\treturn reconciler.Result{}, nil\n}", "func (r *RunnerImageReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\t// Initialize Logger\n\trunnerImageLogger = r.Log.WithValues(\"runnerImage\", req.NamespacedName)\n\n\t// Fetch the RunnerImage instance\n\trunnerImageInstance := &v1alpha1.RunnerImage{}\n\terr := r.Client.Get(ctx, req.NamespacedName, runnerImageInstance)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\trunnerImageLogger.Info(\"Jenkins RunnerImage with name \" + runnerImageInstance.Name + \" detected\")\n\trunnerImageInstance.Status.Plugins = len(runnerImageInstance.Spec.Plugins)\n\trunnerImageInstance.Status.Phase = PhaseInitialized\n\terr = r.Status().Update(context.TODO(), runnerImageInstance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Initialize the RunnerImage\n\terr = r.InitResources(req, runnerImageInstance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *ReconcileHawtio) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling Hawtio\")\n\n\tctx := context.TODO()\n\n\t// Fetch the Hawtio instance\n\thawtio := &hawtiov1alpha1.Hawtio{}\n\terr := r.client.Get(ctx, request.NamespacedName, hawtio)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Delete phase\n\n\tif hawtio.GetDeletionTimestamp() != nil {\n\t\terr = r.deletion(ctx, hawtio)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, fmt.Errorf(\"deletion failed: %v\", err)\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Add a finalizer, that's needed to clean up cluster-wide resources, like ConsoleLink and OAuthClient\n\tif !controllerutil.ContainsFinalizer(hawtio, hawtioFinalizer) {\n\t\tcontrollerutil.AddFinalizer(hawtio, hawtioFinalizer)\n\t\terr = r.client.Update(ctx, hawtio)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to update finalizer: %v\", err)\n\t\t}\n\t}\n\n\t// Init phase\n\n\tif len(hawtio.Spec.Type) == 0 {\n\t\thawtio.Spec.Type = hawtiov1alpha1.ClusterHawtioDeploymentType\n\t\terr = r.client.Update(ctx, hawtio)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to update type: %v\", err)\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Invariant checks\n\tisClusterDeployment := hawtio.Spec.Type == hawtiov1alpha1.ClusterHawtioDeploymentType\n\tisNamespaceDeployment := hawtio.Spec.Type == hawtiov1alpha1.NamespaceHawtioDeploymentType\n\n\tif !isNamespaceDeployment && !isClusterDeployment {\n\t\terr := fmt.Errorf(\"unsupported type: %s\", hawtio.Spec.Type)\n\t\tif hawtio.Status.Phase != hawtiov1alpha1.HawtioPhaseFailed {\n\t\t\tprevious := hawtio.DeepCopy()\n\t\t\thawtio.Status.Phase = hawtiov1alpha1.HawtioPhaseFailed\n\t\t\terr = r.client.Status().Patch(ctx, hawtio, client.MergeFrom(previous))\n\t\t\tif err != nil {\n\t\t\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to update phase: %v\", err)\n\t\t\t}\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif len(hawtio.Status.Phase) == 0 || hawtio.Status.Phase == hawtiov1alpha1.HawtioPhaseFailed {\n\t\tprevious := hawtio.DeepCopy()\n\t\thawtio.Status.Phase = hawtiov1alpha1.HawtioPhaseInitialized\n\t\terr = r.client.Status().Patch(ctx, hawtio, client.MergeFrom(previous))\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to update phase: %v\", err)\n\t\t}\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\t// Check OpenShift version\n\tvar openShiftSemVer *semver.Version\n\tclusterVersion, err := r.configClient.ConfigV1().ClusterVersions().Get(ctx, \"version\", metav1.GetOptions{})\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Let's default to OpenShift 3 as ClusterVersion API was introduced in OpenShift 4\n\t\t\topenShiftSemVer, _ = semver.NewVersion(\"3\")\n\t\t} else {\n\t\t\treqLogger.Error(err, \"Error reading cluster version\")\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t} else {\n\t\t// Let's take the latest version from the history\n\t\tv := clusterVersion.Status.History[0].Version\n\t\topenShiftSemVer, err = semver.NewVersion(v)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Error parsing cluster semantic version\", \"version\", v)\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\tconstraint4, _ := semver.NewConstraint(\">= 4-0\")\n\tisOpenShift4 := constraint4.Check(openShiftSemVer)\n\tconstraint43, _ := semver.NewConstraint(\">= 4.3\")\n\tisOpenShift43Plus := constraint43.Check(openShiftSemVer)\n\n\tvar openShiftConsoleUrl string\n\tif isOpenShift4 {\n\t\t// Retrieve OpenShift Web console public URL\n\t\tcm, err := r.coreClient.ConfigMaps(\"openshift-config-managed\").Get(ctx, \"console-public\", metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tif !errors.IsNotFound(err) && !errors.IsForbidden(err) {\n\t\t\t\treqLogger.Error(err, \"Error getting OpenShift managed configuration\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t} else {\n\t\t\topenShiftConsoleUrl = cm.Data[\"consoleURL\"]\n\t\t}\n\t}\n\n\tif isOpenShift4 {\n\t\tcronJob := &v1beta1.CronJob{}\n\t\tcronJobName := request.Name + \"-certificate-expiry-check\"\n\t\tcronJobErr := r.client.Get(ctx, client.ObjectKey{Namespace: request.Namespace, Name: cronJobName}, cronJob)\n\n\t\t// Check whether client certificate secret exists\n\t\tsecretName := request.Name + \"-tls-proxying\"\n\t\tclientCertSecret := corev1.Secret{}\n\t\terr := r.client.Get(ctx, client.ObjectKey{Namespace: request.Namespace, Name: secretName}, &clientCertSecret)\n\t\t// TODO: Update the client certificate when the Hawtio resource changes\n\t\tif err != nil {\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\treqLogger.Info(\"Client certificate secret not found, creating a new one\", \"secret\", secretName)\n\n\t\t\t\tcaSecret, err := r.coreClient.Secrets(\"openshift-service-ca\").Get(ctx, \"signing-key\", metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treqLogger.Error(err, \"Reading certificate authority signing key failed\")\n\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t}\n\n\t\t\t\tcommonName := hawtio.Spec.Auth.ClientCertCommonName\n\t\t\t\tif commonName == \"\" {\n\t\t\t\t\tif r.ClientCertCommonName == \"\" {\n\t\t\t\t\t\tcommonName = \"hawtio-online.hawtio.svc\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcommonName = r.ClientCertCommonName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Let's default to one year validity period\n\t\t\t\texpirationDate := time.Now().AddDate(1, 0, 0)\n\t\t\t\tif date := hawtio.Spec.Auth.ClientCertExpirationDate; date != nil && !date.IsZero() {\n\t\t\t\t\texpirationDate = date.Time\n\t\t\t\t}\n\t\t\t\tcertSecret, err := generateCertificateSecret(secretName, request.Namespace, caSecret, commonName, expirationDate)\n\t\t\t\tif err != nil {\n\t\t\t\t\treqLogger.Error(err, \"Generating the client certificate failed\")\n\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t}\n\t\t\t\terr = controllerutil.SetControllerReference(hawtio, certSecret, r.scheme)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t}\n\t\t\t\t_, err = r.coreClient.Secrets(request.Namespace).Create(ctx, certSecret, metav1.CreateOptions{})\n\t\t\t\treqLogger.Info(\"Client certificate created successfully\", \"secret\", secretName)\n\t\t\t\tif err != nil {\n\t\t\t\t\treqLogger.Error(err, \"Creating the client certificate secret failed\")\n\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t}\n\n\t\t\t\t// check if certificate rotation is enabled\n\t\t\t\tif hawtio.Spec.Auth.ClientCertCheckSchedule != \"\" {\n\t\t\t\t\t// generate auto-renewal cron job for the secret if it already hasn't been generated.\n\t\t\t\t\tif cronJobErr != nil && errors.IsNotFound(cronJobErr) {\n\t\t\t\t\t\tpod, err := getOperatorPod(ctx, r.client, request.Namespace)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//create cronJob to validate the Cert\n\t\t\t\t\t\tcronJob = createCertValidationCronJob(cronJobName, request.Namespace,\n\t\t\t\t\t\t\thawtio.Spec.Auth.ClientCertCheckSchedule, pod.Spec.ServiceAccountName, pod.Spec.Containers[0],\n\t\t\t\t\t\t\thawtio.Spec.Auth.ClientCertExpirationPeriod)\n\n\t\t\t\t\t\terr = controllerutil.SetControllerReference(hawtio, cronJob, r.scheme)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\terr = r.client.Create(ctx, cronJob)\n\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Error(err, \"Cronjob haven't been created\")\n\t\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif cm := hawtio.Spec.RBAC.ConfigMap; cm != \"\" {\n\t\t// Check that the ConfigMap exists\n\t\tvar rbacConfigMap corev1.ConfigMap\n\t\terr := r.client.Get(ctx, types.NamespacedName{Namespace: request.Namespace, Name: cm}, &rbacConfigMap)\n\t\tif err != nil {\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\treqLogger.Info(\"RBAC ConfigMap must be created\", \"ConfigMap\", cm)\n\t\t\t\t// Let's poll for the RBAC ConfigMap to be created\n\t\t\t\treturn reconcile.Result{Requeue: true, RequeueAfter: 5 * time.Second}, nil\n\t\t\t} else {\n\t\t\t\treqLogger.Error(err, \"Failed to get RBAC ConfigMap\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t\tif _, ok := rbacConfigMap.Data[resources.RBACConfigMapKey]; !ok {\n\t\t\treqLogger.Info(\"RBAC ConfigMap does not contain expected key: \"+resources.RBACConfigMapKey, \"ConfigMap\", cm)\n\t\t\t// Let's poll for the RBAC ConfigMap to contain the expected key\n\t\t\treturn reconcile.Result{Requeue: true, RequeueAfter: 5 * time.Second}, nil\n\t\t}\n\t}\n\n\t_, err = r.reconcileConfigMap(hawtio)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Error reconciling ConfigMap\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tconfigMap := &corev1.ConfigMap{}\n\terr = r.client.Get(ctx, request.NamespacedName, configMap)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Failed to get config map\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tsecretName := request.Name + \"-tls-proxying\"\n\tvar clientCertSecret = &corev1.Secret{}\n\terr = r.client.Get(ctx, client.ObjectKey{Namespace: request.Namespace, Name: secretName}, clientCertSecret)\n\tif err != nil {\n\t\t// clientCertSecret isn't used on openshift 3\n\t\tclientCertSecret = nil\n\t}\n\n\ttlsRouteSecret := &corev1.Secret{}\n\tif secretName := hawtio.Spec.Route.CertSecret.Name; secretName != \"\" {\n\t\terr = r.client.Get(ctx, client.ObjectKey{Namespace: request.Namespace, Name: secretName}, tlsRouteSecret)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t} else {\n\t\ttlsRouteSecret = nil\n\t}\n\tcaCertRouteSecret := &corev1.Secret{}\n\tif caCertSecretName := hawtio.Spec.Route.CaCert.Name; caCertSecretName != \"\" {\n\t\terr = r.client.Get(ctx, client.ObjectKey{Namespace: request.Namespace, Name: caCertSecretName}, caCertRouteSecret)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t} else {\n\t\tcaCertRouteSecret = nil\n\t}\n\n\t_, err = r.reconcileDeployment(hawtio, isOpenShift4, openShiftSemVer.String(), openShiftConsoleUrl,\n\t\thawtio.Spec.Version, configMap, clientCertSecret, tlsRouteSecret, caCertRouteSecret)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Error reconciling deployment\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\troute := &routev1.Route{}\n\terr = r.client.Get(ctx, request.NamespacedName, route)\n\tif err != nil && errors.IsNotFound(err) {\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t} else if err != nil {\n\t\treqLogger.Error(err, \"Failed to get route\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif isClusterDeployment {\n\t\t// Add OAuth client\n\t\toauthClient := resources.NewOAuthClient(resources.OAuthClientName)\n\t\terr = r.client.Create(ctx, oauthClient)\n\t\tif err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\n\t// Read Hawtio configuration\n\thawtconfig, err := resources.GetHawtioConfig(configMap)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Failed to get hawtconfig\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Add link to OpenShift console\n\tconsoleLinkName := request.Name + \"-\" + request.Namespace\n\tif isOpenShift4 && hawtio.Status.Phase == hawtiov1alpha1.HawtioPhaseInitialized {\n\t\tconsoleLink := &consolev1.ConsoleLink{}\n\t\terr = r.client.Get(ctx, types.NamespacedName{Name: consoleLinkName}, consoleLink)\n\t\tif err != nil {\n\t\t\tif !errors.IsNotFound(err) {\n\t\t\t\treqLogger.Error(err, \"Failed to get console link\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t} else {\n\t\t\terr = r.client.Delete(ctx, consoleLink)\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to delete console link\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t\tconsoleLink = &consolev1.ConsoleLink{}\n\t\tif isClusterDeployment {\n\t\t\tconsoleLink = openshift.NewApplicationMenuLink(consoleLinkName, route, hawtconfig)\n\t\t} else if isOpenShift43Plus {\n\t\t\tconsoleLink = openshift.NewNamespaceDashboardLink(consoleLinkName, request.Namespace, route, hawtconfig)\n\t\t}\n\t\tif consoleLink.Spec.Location != \"\" {\n\t\t\terr = r.client.Create(ctx, consoleLink)\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to create console link\", \"name\", consoleLink.Name)\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Update status\n\tif hawtio.Status.Phase != hawtiov1alpha1.HawtioPhaseDeployed {\n\t\tprevious := hawtio.DeepCopy()\n\t\thawtio.Status.Phase = hawtiov1alpha1.HawtioPhaseDeployed\n\t\terr = r.client.Status().Patch(ctx, hawtio, client.MergeFrom(previous))\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to update phase: %v\", err)\n\t\t}\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\t// Update phase\n\n\thawtioCopy := hawtio.DeepCopy()\n\n\tdeployment := &appsv1.Deployment{}\n\terr = r.client.Get(ctx, request.NamespacedName, deployment)\n\tif err != nil && errors.IsNotFound(err) {\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t} else if err != nil {\n\t\treqLogger.Error(err, \"Failed to get deployment\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile replicas into Hawtio status\n\thawtioCopy.Status.Replicas = deployment.Status.Replicas\n\n\t// Reconcile scale sub-resource labelSelectorPath from deployment spec to CR status\n\tselector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector)\n\tif err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to parse selector: %v\", err)\n\t}\n\thawtioCopy.Status.Selector = selector.String()\n\n\t// Reconcile Hawtio status image field from deployment container image\n\thawtioCopy.Status.Image = deployment.Spec.Template.Spec.Containers[0].Image\n\n\t// Reconcile route URL into Hawtio status\n\turl := resources.GetRouteURL(route)\n\thawtioCopy.Status.URL = url\n\n\t// Reconcile route host from routeHostName field\n\tif hostName := hawtio.Spec.RouteHostName; len(hostName) == 0 && !strings.EqualFold(route.Annotations[hostGeneratedAnnotation], \"true\") {\n\t\t// Emptying route host is ignored so it's not possible to re-generate the host\n\t\t// See https://github.com/openshift/origin/pull/9425\n\t\t// In that case, let's delete the route\n\t\terr := r.client.Delete(ctx, route)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Failed to delete route to auto-generate hostname\")\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\t// And requeue to create a new route in the next reconcile loop\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\t// Reconcile console link in OpenShift console\n\tif isOpenShift4 {\n\t\tconsoleLink := &consolev1.ConsoleLink{}\n\t\terr = r.client.Get(ctx, types.NamespacedName{Name: consoleLinkName}, consoleLink)\n\t\tif err != nil {\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t// If not found, create a console link\n\t\t\t\tif isClusterDeployment {\n\t\t\t\t\tconsoleLink = openshift.NewApplicationMenuLink(consoleLinkName, route, hawtconfig)\n\t\t\t\t} else if isOpenShift43Plus {\n\t\t\t\t\tconsoleLink = openshift.NewNamespaceDashboardLink(consoleLinkName, request.Namespace, route, hawtconfig)\n\t\t\t\t}\n\t\t\t\tif consoleLink.Spec.Location != \"\" {\n\t\t\t\t\terr = r.client.Create(ctx, consoleLink)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treqLogger.Error(err, \"Failed to create console link\", \"name\", consoleLink.Name)\n\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treqLogger.Error(err, \"Failed to get console link\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t} else {\n\t\t\tconsoleLinkCopy := consoleLink.DeepCopy()\n\t\t\tif isClusterDeployment {\n\t\t\t\topenshift.UpdateApplicationMenuLink(consoleLinkCopy, route, hawtconfig)\n\t\t\t} else if isOpenShift43Plus {\n\t\t\t\topenshift.UpdateNamespaceDashboardLink(consoleLinkCopy, route, hawtconfig)\n\t\t\t}\n\t\t\terr = r.client.Patch(ctx, consoleLinkCopy, client.MergeFrom(consoleLink))\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to update console link\", \"name\", consoleLink.Name)\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\t// Reconcile the client certificate cronJob\n\tcronJob := &v1beta1.CronJob{}\n\tcronJobName := request.Name + \"-certificate-expiry-check\"\n\n\tif cronJobErr := r.client.Get(ctx, client.ObjectKey{Namespace: request.Namespace, Name: cronJobName}, cronJob); cronJobErr == nil {\n\t\tupdate := false\n\t\tif hawtio.Spec.Auth.ClientCertCheckSchedule != \"\" {\n\t\t\tif cronJob.Spec.Schedule != hawtio.Spec.Auth.ClientCertCheckSchedule {\n\t\t\t\tcronJob.Spec.Schedule = hawtio.Spec.Auth.ClientCertCheckSchedule\n\t\t\t\tupdate = true\n\t\t\t}\n\t\t\tif update || updateExpirationPeriod(cronJob, hawtio.Spec.Auth.ClientCertExpirationPeriod) {\n\t\t\t\terr = r.client.Update(ctx, cronJob)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err, \"CronJob haven't been updated\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//if cronjob exists and ClientCertRotate is disabled, cronjob has to be deleted\n\t\t} else {\n\t\t\terr = r.client.Delete(ctx, cronJob)\n\t\t}\n\t}\n\n\t// Reconcile OAuth client\n\t// Do not use the default client whose cached informers require\n\t// permission to list cluster wide oauth clients\n\t// err = r.client.Get(ctx, types.NamespacedName{Name: resources.OAuthClientName}, oc)\n\toc, err := r.oauthClient.OauthV1().OAuthClients().Get(ctx, resources.OAuthClientName, metav1.GetOptions{})\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// OAuth client should not be found for namespace deployment type\n\t\t\t// except when it changes from \"cluster\" to \"namespace\"\n\t\t\tif isClusterDeployment {\n\t\t\t\treturn reconcile.Result{Requeue: true}, nil\n\t\t\t}\n\t\t} else if !(errors.IsForbidden(err) && isNamespaceDeployment) {\n\t\t\t// We tolerate 403 for namespace deployment as the operator\n\t\t\t// may not have permission to read cluster wide resources\n\t\t\t// like OAuth clients\n\t\t\treqLogger.Error(err, \"Failed to get OAuth client\")\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\t// TODO: OAuth client reconciliation triggered by roll-out deployment should ideally\n\t// wait until the deployment is successful before deleting resources\n\tif isClusterDeployment {\n\t\t// First remove old URL from OAuthClient\n\t\tif resources.RemoveRedirectURIFromOauthClient(oc, hawtio.Status.URL) {\n\t\t\terr := r.client.Update(ctx, oc)\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to reconcile OAuth client\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t\t// Add route URL to OAuthClient authorized redirect URIs\n\t\tif ok, _ := resources.OauthClientContainsRedirectURI(oc, url); !ok {\n\t\t\toc.RedirectURIs = append(oc.RedirectURIs, url)\n\t\t\terr := r.client.Update(ctx, oc)\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to reconcile OAuth client\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\tif isNamespaceDeployment && oc != nil {\n\t\t// Clean-up OAuth client if any. This happens when the deployment type is changed\n\t\t// from \"cluster\" to \"namespace\".\n\t\tif resources.RemoveRedirectURIFromOauthClient(oc, url) {\n\t\t\terr := r.client.Update(ctx, oc)\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to reconcile OAuth client\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\terr = r.client.Status().Patch(ctx, hawtioCopy, client.MergeFrom(hawtio))\n\tif err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to patch status: %v\", err)\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\t_ = r.Log.WithValues(\"contour\", req.NamespacedName)\n\n\tr.Log.Info(\"reconciling\", \"request\", req)\n\n\t// Only proceed if we can get the state of contour.\n\tcontour := &operatorv1alpha1.Contour{}\n\tif err := r.Client.Get(ctx, req.NamespacedName, contour); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// This means the contour was already deleted/finalized and there are\n\t\t\t// stale queue entries (or something edge triggering from a related\n\t\t\t// resource that got deleted async).\n\t\t\tr.Log.Info(\"contour not found; reconciliation will be skipped\", \"request\", req)\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object, so requeue the request.\n\t\treturn ctrl.Result{}, fmt.Errorf(\"failed to get contour %q: %w\", req, err)\n\t}\n\n\t// The contour is safe to process, so ensure current state matches desired state.\n\tdesired := contour.ObjectMeta.DeletionTimestamp.IsZero()\n\tif desired {\n\t\tswitch {\n\t\tcase contourFinalized(contour):\n\t\t\tif err := r.ensureContour(ctx, contour); err != nil {\n\t\t\t\tswitch e := err.(type) {\n\t\t\t\tcase retryable.Error:\n\t\t\t\t\tr.Log.Error(e, \"got retryable error; requeueing\", \"after\", e.After())\n\t\t\t\t\treturn ctrl.Result{RequeueAfter: e.After()}, nil\n\t\t\t\tdefault:\n\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\t// Before doing anything with the contour, ensure it has a finalizer\n\t\t\t// so it can cleaned-up later.\n\t\t\tif err := r.ensureFinalizer(ctx, contour); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif err := r.ensureContourRemoved(ctx, contour); err != nil {\n\t\t\tswitch e := err.(type) {\n\t\t\tcase retryable.Error:\n\t\t\t\tr.Log.Error(e, \"got retryable error; requeueing\", \"after\", e.After())\n\t\t\t\treturn ctrl.Result{RequeueAfter: e.After()}, nil\n\t\t\tdefault:\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (s *StatusReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error) {\n\t// We base our status on the pod facts, so ensure our facts are up to date.\n\tif err := s.PFacts.Collect(ctx, s.Vdb); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Use all subclusters, even ones that are scheduled for removal. We keep\n\t// reporting status on the deleted ones until the statefulsets are gone.\n\tfinder := MakeSubclusterFinder(s.Client, s.Vdb)\n\tsubclusters, err := finder.FindSubclusters(ctx, FindAll)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trefreshStatus := func(vdbChg *vapi.VerticaDB) error {\n\t\tvdbChg.Status.Subclusters = []vapi.SubclusterStatus{}\n\t\tfor i := range subclusters {\n\t\t\tif i == len(vdbChg.Status.Subclusters) {\n\t\t\t\tvdbChg.Status.Subclusters = append(vdbChg.Status.Subclusters, vapi.SubclusterStatus{})\n\t\t\t}\n\t\t\tif err := s.calculateSubclusterStatus(ctx, subclusters[i], &vdbChg.Status.Subclusters[i]); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to calculate subcluster status %s %w\", subclusters[i].Name, err)\n\t\t\t}\n\t\t}\n\t\ts.calculateClusterStatus(&vdbChg.Status)\n\t\treturn nil\n\t}\n\n\tif err := status.Update(ctx, s.Client, s.Vdb, refreshStatus); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\treturn ctrl.Result{}, nil\n}", "func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error) {\n\tlog := r.log.WithValues(\"request\", req)\n\tlog.Debug(\"Reconciling\")\n\n\tctx, cancel := context.WithTimeout(context.Background(), claimSchedulingReconcileTimeout)\n\tdefer cancel()\n\n\tclaim := r.newClaim()\n\tif err := r.client.Get(ctx, req.NamespacedName, claim); err != nil {\n\t\t// There's no need to requeue if we no longer exist. Otherwise we'll be\n\t\t// requeued implicitly because we return an error.\n\t\tlog.Debug(\"Cannot get resource claim\", \"error\", err)\n\t\treturn reconcile.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetClaim)\n\t}\n\n\trecord := r.record.WithAnnotations(\n\t\t\"external-name\", meta.GetExternalName(claim),\n\t\t\"class-kind\", r.classKind.Kind,\n\t)\n\tlog = log.WithValues(\n\t\t\"uid\", claim.GetUID(),\n\t\t\"version\", claim.GetResourceVersion(),\n\t\t\"external-name\", meta.GetExternalName(claim),\n\t\t\"class-kind\", r.classKind.Kind,\n\t)\n\n\t// There could be several controllers racing to schedule this claim. If it\n\t// was scheduled since we were queued then another controller won and we\n\t// should abort.\n\tif claim.GetClassReference() != nil {\n\t\tlog.Debug(\"Resource class is already set\")\n\t\treturn reconcile.Result{Requeue: false}, nil\n\t}\n\n\tclasses := &unstructured.UnstructuredList{}\n\tclasses.SetGroupVersionKind(r.classKind.List())\n\n\tif err := r.client.List(ctx, classes, client.MatchingLabels(claim.GetClassSelector().MatchLabels)); err != nil {\n\t\t// Claim scheduler controllers don't update the synced status because\n\t\t// no one scheduler has the full view of whether the process failed or\n\t\t// succeeded. It's possible another controller can successfully set a\n\t\t// class even though we can't, so it would be confusing to mark this\n\t\t// claim as failing to be reconciled. Instead we return an error - we'll\n\t\t// be requeued but abort immediately if the claim was scheduled.\n\t\tlog.Debug(\"Cannot list resource classes\", \"error\", err)\n\t\treturn reconcile.Result{}, errors.Wrap(err, errListClasses)\n\t}\n\n\tif len(classes.Items) == 0 {\n\t\t// None of our classes matched the selector. We can't be sure whether\n\t\t// another controller owns classes that matched the selector, or whether\n\t\t// no classes match, so we requeue after a short wait. We'll abort the\n\t\t// next reconcile immediately if another controller scheduled the claim.\n\t\tlog.Debug(\"No matching resource classes found\", \"requeue-after\", time.Now().Add(aShortWait))\n\t\treturn reconcile.Result{RequeueAfter: aShortWait}, nil\n\t}\n\n\trandom := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tselected := classes.Items[random.Intn(len(classes.Items))]\n\tclaim.SetClassReference(meta.ReferenceTo(&selected, schema.GroupVersionKind(r.classKind)))\n\n\t// There could be several controllers racing to schedule this claim to a\n\t// class. We sleep for a randomly jittered amount of time before trying to\n\t// update the class reference to decrease the chance of any one controller\n\t// predictably winning the race, for example because it has fewer classes to\n\t// list and select from than its competitors.\n\tr.jitter()\n\n\t// Attempt to set the class reference. If a competing controller beat us\n\t// we'll fail the write because the claim's resource version has changed\n\t// since we read it. We'll be requeued, but will abort immediately if the\n\t// claim was scheduled.\n\tlog.Debug(\"Attempting to set resource class\", \"class-name\", selected.GetName())\n\trecord.Event(claim, event.Normal(reasonClassFound, \"Selected matching resource class\", \"class-name\", selected.GetName()))\n\treturn reconcile.Result{Requeue: false}, errors.Wrap(r.client.Update(ctx, claim), errUpdateClaim)\n}", "func (r *NetworkReconciler) Reconcile(req ctrl.Request) (result ctrl.Result, err error) {\n\tvar _ = context.Background()\n\n\tvar network ethereumv1alpha1.Network\n\n\t// Get desired ethereum network\n\tif err = r.Client.Get(context.Background(), req.NamespacedName, &network); err != nil {\n\t\terr = client.IgnoreNotFound(err)\n\t\treturn\n\t}\n\n\t// update network status\n\tif err = r.updateStatus(&network); err != nil {\n\t\treturn\n\t}\n\n\t// reconcile network nodes\n\tif err = r.reconcileNodes(&network); err != nil {\n\t\treturn\n\t}\n\n\treturn\n\n}", "func (r *ReconcilePod) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\n\t// Fetch the Pod instance\n\tcachePod := &corev1.Pod{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, cachePod)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\tpodNotRunningErr := errors.NewServiceUnavailable(\"pod not in running phase\")\n\tif cachePod.Status.Phase != corev1.PodRunning {\n\t\treqLogger.Info(\"Pod not running\", \"pod status:\", cachePod.Status.Phase)\n\t\treturn reconcile.Result{}, podNotRunningErr\n\t}\n\n\t// Get node-agent pod to compare host node with cachePod\n\tnodeAgentPod, err := r.getNodeAgentPod()\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif cachePod.Status.HostIP != nodeAgentPod.Status.HostIP {\n\t\treqLogger.Info(\"Pod does not belong to same node as node agent\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\trmdWorkloads, err := r.buildRmdWorkload(cachePod)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif len(rmdWorkloads) == 0 {\n\t\treturn reconcile.Result{}, nil\n\t}\n\tfor _, rmdWorkload := range rmdWorkloads {\n\t\trmdWorkloadName := rmdWorkload.GetObjectMeta().GetName()\n\t\terr = r.client.Get(context.TODO(), types.NamespacedName{\n\t\t\tName: rmdWorkloadName, Namespace: request.Namespace}, rmdWorkload)\n\n\t\tif err != nil {\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t// RmdWorkload not found, create it\n\t\t\t\tif err := controllerutil.SetControllerReference(cachePod, rmdWorkload, r.scheme); err != nil {\n\t\t\t\t\treqLogger.Error(err, \"unable to set owner reference on new rmdWorkload\")\n\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t}\n\t\t\t\treqLogger.Info(\"Create workload for pod container requesting cache\", \"workload name\", rmdWorkloadName)\n\t\t\t\terr = r.client.Create(context.TODO(), rmdWorkload)\n\t\t\t\tif err != nil {\n\t\t\t\t\treqLogger.Error(err, \"Failed to create rmdWorkload\")\n\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t}\n\t\t\t\t// Continue to next workload\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\t// RmdWorkload found, update it.\n\t\terr = r.client.Update(context.TODO(), rmdWorkload)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Failed to update rmdWorkload\")\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\treturn reconcile.Result{}, nil\n}", "func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error) {\n\tlog.V(logging.Debug).Info(\"reconciling\", \"kind\", v1alpha1.ResourceGroupKindAPIVersion, \"request\", req)\n\n\tctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)\n\tdefer cancel()\n\n\trg := &v1alpha1.ResourceGroup{}\n\tif err := r.kube.Get(ctx, req.NamespacedName, rg); err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{Requeue: false}, nil\n\t\t}\n\t\treturn reconcile.Result{Requeue: false}, errors.Wrapf(err, \"cannot get resource %s\", req.NamespacedName)\n\t}\n\n\tclient, err := r.Connect(ctx, rg)\n\tif err != nil {\n\t\trg.Status.SetFailed(reasonFetchingClient, err.Error())\n\t\treturn reconcile.Result{Requeue: true}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource has been deleted from the API server. Delete from Azure.\n\tif rg.DeletionTimestamp != nil {\n\t\treturn reconcile.Result{Requeue: client.Delete(ctx, rg)}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource is unnamed. Assume it has not been created in Azure.\n\tif rg.Status.Name == \"\" {\n\t\treturn reconcile.Result{Requeue: client.Create(ctx, rg)}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource exists in the API server and Azure. Sync it.\n\treturn reconcile.Result{Requeue: client.Sync(ctx, rg)}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n}", "func (r *ReconcileClusterSync) Reconcile(context context.Context, request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling ClusterSync\")\n\n\t// Fetch the ClusterSync instance\n\tinstance := &hiveinternal.ClusterSync{}\n\terr := r.client.Get(context, request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treqLogger.Error(err, fmt.Sprintf(\"failed to retrieve ClusterSync %s/%s\", request.Namespace, request.Name))\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif err := countErrors(instance, reqLogger); err != nil {\n\t\treqLogger.Error(err, \"error counting errors\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "func (r *PrestoClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\t_ = r.Log.WithValues(\"prestocluster\", req.NamespacedName)\n\tvar log = r.Log.WithValues(\n\t\t\"cluster\", req.NamespacedName)\n\tvar controller = PrestoClusterController{\n\t\tk8sClient: r.Client,\n\t\trequest: req,\n\t\tinspected: InspectedClusterState{},\n\t\tcontext: context.Background(),\n\t\tlog: log,\n\t\trecorder: r.Recorder,\n\t}\n\treturn controller.reconcile(req)\n}", "func (r *ProcChaosReconciler) Reconcile(req ctrl.Request) (result ctrl.Result, err error) {\n\tlog := r.Log.WithValues(\"procchaos\", req.NamespacedName)\n\n\t// your logic here\n\n\tvar procChaos naglfarv1.ProcChaos\n\tif err = r.Get(r.Ctx, req.NamespacedName, &procChaos); err != nil {\n\t\tlog.Error(err, \"unable to fetch ProcChaos\")\n\n\t\t// we'll ignore not-found errors, since they can't be fixed by an immediate\n\t\t// requeue (we'll need to wait for a new notification), and we can get them\n\t\t// on deleted requests.\n\t\terr = client.IgnoreNotFound(err)\n\t\treturn\n\t}\n\n\tvar request naglfarv1.TestResourceRequest\n\tif err = r.Get(r.Ctx, types.NamespacedName{Namespace: req.Namespace, Name: procChaos.Spec.Request}, &request); err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"unable to fetch Request(%s)\", procChaos.Spec.Request))\n\t\terr = client.IgnoreNotFound(err)\n\t\treturn\n\t}\n\n\tif request.Status.State != naglfarv1.TestResourceRequestReady {\n\t\tlog.Info(fmt.Sprintf(\"Request(%s) not ready\", procChaos.Spec.Request))\n\t\tresult.Requeue = true\n\t\tresult.RequeueAfter = time.Second\n\t\treturn\n\t}\n\n\tvar kill = func(task *naglfarv1.ProcChaosTask, state *naglfarv1.ProcChaosState) (killErr error) {\n\t\tstate.KilledNode, killErr = r.killProc(log, task, &request)\n\t\tif killErr != nil {\n\t\t\treturn\n\t\t}\n\t\tstate.KilledTime = util.NewTime(time.Now())\n\t\treturn\n\t}\n\n\tif len(procChaos.Status.States) < len(procChaos.Spec.Tasks) {\n\t\tstate := new(naglfarv1.ProcChaosState)\n\t\ttask := procChaos.Spec.Tasks[len(procChaos.Status.States)]\n\t\tprocChaos.Status.States = append(procChaos.Status.States, state)\n\n\t\tif task.Period != \"\" {\n\t\t\tstate.KilledTime = util.NewTime(time.Now())\n\t\t} else if err = kill(task, state); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\terr = r.Status().Update(r.Ctx, &procChaos)\n\t\treturn\n\t}\n\n\tvar durations []time.Duration\n\tfor index, task := range procChaos.Spec.Tasks {\n\t\tif task.Period == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tstate := procChaos.Status.States[index]\n\t\tduration := task.Period.Unwrap() - time.Since(state.KilledTime.Unwrap())\n\t\tif duration <= 0 {\n\t\t\tif err = kill(task, state); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = r.Status().Update(r.Ctx, &procChaos)\n\t\t\treturn\n\t\t}\n\t\tdurations = append(durations, duration)\n\t}\n\n\tminDuration := util.MinDuration(durations...)\n\n\tlog.Info(fmt.Sprintf(\"sleep for %s\", minDuration.String()))\n\tresult.Requeue = true\n\tresult.RequeueAfter = minDuration\n\treturn\n}", "func (r *ConsumerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treconcileTotal.WithLabelValues(req.Name).Inc()\n\tstart := time.Now()\n\tdefer func() {\n\t\treconcileDuration.WithLabelValues(req.Name).Observe(time.Since(start).Seconds())\n\t}()\n\n\tlog := r.Log.WithValues(\"consumer\", req.NamespacedName)\n\tresult := ctrl.Result{RequeueAfter: defaultMinSyncPeriod}\n\n\tvar consumer konsumeratorv1.Consumer\n\tif err := r.Get(ctx, req.NamespacedName, &consumer); err != nil {\n\t\t// we'll ignore not-found errors, since they can't be fixed by an immediate\n\t\t// requeue (we'll need to wait for a new notification), and we can get them\n\t\t// on deleted requests.\n\t\treconcileErrors.WithLabelValues(req.Name).Inc()\n\t\treturn ctrl.Result{}, errors.IgnoreNotFound(err)\n\t}\n\tvar managedDeploys appsv1.DeploymentList\n\tif err := r.List(ctx, &managedDeploys, client.InNamespace(req.Namespace), client.MatchingFields{consumerOwnerKey: req.Name}); err != nil {\n\t\teMsg := \"unable to list managed deployments\"\n\t\tlog.Error(err, eMsg)\n\t\tr.Recorder.Event(&consumer, corev1.EventTypeWarning, \"ListDeployFailure\", eMsg)\n\t\treconcileErrors.WithLabelValues(req.Name).Inc()\n\t\treturn ctrl.Result{}, err\n\t}\n\n\to := &operator{\n\t\tRecorder: r.Recorder,\n\t\tclock: r.Clock,\n\t\tlog: log,\n\t\tScheme: r.Scheme,\n\t\towner: &consumer,\n\t}\n\terr := o.init(consumer.DeepCopy(), managedDeploys)\n\tif err != nil {\n\t\treconcileErrors.WithLabelValues(req.Name).Inc()\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif cmp.Equal(consumer.Status, o.consumer.Status) {\n\t\tlog.V(1).Info(\"no change detected...\")\n\t\treturn result, nil\n\t}\n\to.log.Info(\n\t\t\"deployments count\",\n\t\t\"metricsUpdated\", o.metricsUpdated,\n\t\t\"expected\", consumer.Status.Expected,\n\t\t\"running\", consumer.Status.Running,\n\t\t\"paused\", consumer.Status.Paused,\n\t\t\"missing\", consumer.Status.Missing,\n\t\t\"lagging\", consumer.Status.Lagging,\n\t\t\"toUpdate\", consumer.Status.Outdated,\n\t\t\"redundant\", consumer.Status.Redundant,\n\t\t\"toEstimate\", len(o.toEstimateInstances),\n\t)\n\tstart = time.Now()\n\tif err := r.Status().Update(ctx, o.consumer); err != nil {\n\t\tproperError := errors.IgnoreConflict(err)\n\t\tif properError != nil {\n\t\t\teMsg := \"unable to update Consumer status\"\n\t\t\tlog.Error(err, eMsg)\n\t\t\to.Recorder.Event(o.consumer, corev1.EventTypeWarning, \"UpdateConsumerStatus\", eMsg)\n\t\t\treconcileErrors.WithLabelValues(req.Name).Inc()\n\t\t}\n\t\treturn result, properError\n\t}\n\tstatusUpdateDuration.WithLabelValues(req.Name).Observe(time.Since(start).Seconds())\n\n\tif err := o.reconcile(r.Client, req); err != nil {\n\t\treconcileErrors.WithLabelValues(req.Name).Inc()\n\t\treturn result, err\n\t}\n\n\treturn result, nil\n}", "func (r *AzureMachineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, reterr error) {\n\tctx := context.TODO()\n\tlogger := r.Log.WithValues(\"namespace\", req.Namespace, \"azureMachine\", req.Name)\n\n\t// Fetch the AzureMachine VM.\n\tazureMachine := &infrav1.AzureMachine{}\n\terr := r.Get(ctx, req.NamespacedName, azureMachine)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Fetch the Machine.\n\tmachine, err := util.GetOwnerMachine(ctx, r.Client, azureMachine.ObjectMeta)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif machine == nil {\n\t\tlogger.Info(\"Machine Controller has not yet set OwnerRef\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tlogger = logger.WithValues(\"machine\", machine.Name)\n\n\t// Fetch the Cluster.\n\tcluster, err := util.GetClusterFromMetadata(ctx, r.Client, machine.ObjectMeta)\n\tif err != nil {\n\t\tlogger.Info(\"Machine is missing cluster label or cluster does not exist\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tlogger = logger.WithValues(\"cluster\", cluster.Name)\n\n\tazureCluster := &infrav1.AzureCluster{}\n\n\tazureClusterName := client.ObjectKey{\n\t\tNamespace: azureMachine.Namespace,\n\t\tName: cluster.Spec.InfrastructureRef.Name,\n\t}\n\tif err := r.Client.Get(ctx, azureClusterName, azureCluster); err != nil {\n\t\tlogger.Info(\"AzureCluster is not available yet\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tlogger = logger.WithValues(\"AzureCluster\", azureCluster.Name)\n\n\t// Create the cluster scope\n\tclusterScope, err := scope.NewClusterScope(scope.ClusterScopeParams{\n\t\tClient: r.Client,\n\t\tLogger: logger,\n\t\tCluster: cluster,\n\t\tAzureCluster: azureCluster,\n\t})\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Create the machine scope\n\tmachineScope, err := scope.NewMachineScope(scope.MachineScopeParams{\n\t\tLogger: logger,\n\t\tClient: r.Client,\n\t\tCluster: cluster,\n\t\tMachine: machine,\n\t\tAzureCluster: azureCluster,\n\t\tAzureMachine: azureMachine,\n\t})\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Errorf(\"failed to create scope: %+v\", err)\n\t}\n\n\t// Always close the scope when exiting this function so we can persist any AzureMachine changes.\n\tdefer func() {\n\t\tif err := machineScope.Close(); err != nil && reterr == nil {\n\t\t\treterr = err\n\t\t}\n\t}()\n\n\t// Handle deleted machines\n\tif !azureMachine.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(machineScope, clusterScope)\n\t}\n\n\t// Handle non-deleted machines\n\treturn r.reconcileNormal(ctx, machineScope, clusterScope)\n}", "func (r *KubeCarrierReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"kubecarrier\", req.NamespacedName)\n\n\t// 1. Fetch the KubeCarrier object.\n\tkubeCarrier := &operatorv1alpha1.KubeCarrier{}\n\tif err := r.Get(ctx, req.NamespacedName, kubeCarrier); err != nil {\n\t\t// If the KubeCarrier object is already gone, we just ignore the NotFound error.\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\t// 2. Handle the deletion of the KubeCarrier object (Remove the objects that the KubeCarrier owns, and remove the finalizer).\n\tif !kubeCarrier.DeletionTimestamp.IsZero() {\n\t\tif err := r.handleDeletion(ctx, kubeCarrier); err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"handle deletion: %w\", err)\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Add finalizer\n\tif util.AddFinalizer(kubeCarrier, kubeCarrierControllerFinalizer) {\n\t\tif err := r.Update(ctx, kubeCarrier); err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"updating KubeCarrier finalizers: %w\", err)\n\t\t}\n\t}\n\n\t// 3. Reconcile the objects that owned by KubeCarrier object.\n\t// Build the manifests of the KubeCarrier controller manager.\n\tobjects, err := manager.Manifests(\n\t\tmanager.Config{\n\t\t\tNamespace: kubeCarrier.Namespace,\n\t\t})\n\tif err != nil {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"creating manager manifests: %w\", err)\n\t}\n\n\tdeploymentIsReady, err := r.reconcileOwnedObjects(ctx, log, kubeCarrier, objects)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 4. Update the status of the KubeCarrier object.\n\tif err := r.updateKubeCarrierStatus(ctx, kubeCarrier, deploymentIsReady); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *ScaledObjectReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := r.Log.WithValues(\"ScaledObject.Namespace\", req.Namespace, \"ScaledObject.Name\", req.Name)\n\n\t// Fetch the ScaledObject instance\n\tscaledObject := &kedav1alpha1.ScaledObject{}\n\terr := r.Client.Get(context.TODO(), req.NamespacedName, scaledObject)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treqLogger.Error(err, \"Failed to get ScaledObject\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treqLogger.Info(\"Reconciling ScaledObject\")\n\n\t// Check if the ScaledObject instance is marked to be deleted, which is\n\t// indicated by the deletion timestamp being set.\n\tif scaledObject.GetDeletionTimestamp() != nil {\n\t\treturn ctrl.Result{}, r.finalizeScaledObject(reqLogger, scaledObject)\n\t}\n\n\t// ensure finalizer is set on this CR\n\tif err := r.ensureFinalizer(reqLogger, scaledObject); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// ensure Status Conditions are initialized\n\tif !scaledObject.Status.Conditions.AreInitialized() {\n\t\tconditions := kedav1alpha1.GetInitializedConditions()\n\t\tkedacontrollerutil.SetStatusConditions(r.Client, reqLogger, scaledObject, conditions)\n\t}\n\n\t// reconcile ScaledObject and set status appropriately\n\tmsg, err := r.reconcileScaledObject(reqLogger, scaledObject)\n\tconditions := scaledObject.Status.Conditions.DeepCopy()\n\tif err != nil {\n\t\treqLogger.Error(err, msg)\n\t\tconditions.SetReadyCondition(metav1.ConditionFalse, \"ScaledObjectCheckFailed\", msg)\n\t\tconditions.SetActiveCondition(metav1.ConditionUnknown, \"UnkownState\", \"ScaledObject check failed\")\n\t} else {\n\t\treqLogger.V(1).Info(msg)\n\t\tconditions.SetReadyCondition(metav1.ConditionTrue, \"ScaledObjectReady\", msg)\n\t}\n\tkedacontrollerutil.SetStatusConditions(r.Client, reqLogger, scaledObject, &conditions)\n\treturn ctrl.Result{}, err\n}", "func (r *NicClusterPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := r.Log.WithValues(\"nicclusterpolicy\", req.NamespacedName)\n\treqLogger.V(consts.LogLevelInfo).Info(\"Reconciling NicClusterPolicy\")\n\n\t// Fetch the NicClusterPolicy instance\n\tinstance := &mellanoxv1alpha1.NicClusterPolicy{}\n\terr := r.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif apiErrors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treqLogger.V(consts.LogLevelError).Info(\"Error occurred on GET CRD request from API server.\", \"error:\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif req.Name != consts.NicClusterPolicyResourceName {\n\t\terr := r.handleUnsupportedInstance(instance, req, reqLogger)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Create a new State service catalog\n\tsc := state.NewInfoCatalog()\n\tif instance.Spec.OFEDDriver != nil || instance.Spec.NVPeerDriver != nil ||\n\t\tinstance.Spec.RdmaSharedDevicePlugin != nil {\n\t\t// Create node infoProvider and add to the service catalog\n\t\treqLogger.V(consts.LogLevelInfo).Info(\"Creating Node info provider\")\n\t\tnodeList := &corev1.NodeList{}\n\t\terr = r.List(context.TODO(), nodeList, nodeinfo.MellanoxNICListOptions...)\n\t\tif err != nil {\n\t\t\t// Failed to get node list\n\t\t\treqLogger.V(consts.LogLevelError).Info(\"Error occurred on LIST nodes request from API server.\", \"error:\", err)\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tnodePtrList := make([]*corev1.Node, len(nodeList.Items))\n\t\tnodeNames := make([]*string, len(nodeList.Items))\n\t\tfor i := range nodePtrList {\n\t\t\tnodePtrList[i] = &nodeList.Items[i]\n\t\t\tnodeNames[i] = &nodeList.Items[i].Name\n\t\t}\n\t\treqLogger.V(consts.LogLevelDebug).Info(\"Node info provider with\", \"Nodes:\", nodeNames)\n\t\tinfoProvider := nodeinfo.NewProvider(nodePtrList)\n\t\tsc.Add(state.InfoTypeNodeInfo, infoProvider)\n\t}\n\t// Create manager\n\tmanagerStatus, err := r.stateManager.SyncState(instance, sc)\n\tr.updateCrStatus(instance, managerStatus)\n\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\terr = r.updateNodeLabels(instance)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif managerStatus.Status != state.SyncStateReady {\n\t\treturn reconcile.Result{\n\t\t\tRequeueAfter: time.Duration(config.FromEnv().Controller.RequeueTimeSeconds) * time.Second,\n\t\t}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *VisitorAppReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := ctrllog.FromContext(ctx)\n\n\tlog.Info(\"Reconciling VisitorsApp\", \"Request.Namespace\", req.Namespace, \"Request.Name\", req.Name)\n\n\t// Fetch the VisitorsApp instance\n\tv := &javiromanv1alpha1.VisitorApp{}\n\terr := r.Client.Get(context.TODO(), req.NamespacedName, v)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after ctrl req.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the req.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tvar result *ctrl.Result\n\n\t// == MySQL ==========\n\tresult, err = r.ensureSecret(req, v, r.mysqlAuthSecret(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureDeployment(req, v, r.mysqlDeployment(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureService(req, v, r.mysqlService(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tmysqlRunning := r.isMysqlUp(v)\n\n\tif !mysqlRunning {\n\t\t// If MySQL isn't running yet, requeue the reconcile\n\t\t// to run again after a delay\n\t\tdelay := time.Second * time.Duration(5)\n\n\t\tlog.Info(fmt.Sprintf(\"MySQL isn't running, waiting for %s\", delay))\n\t\treturn ctrl.Result{RequeueAfter: delay}, nil\n\t}\n\n\t// == Visitors Backend ==========\n\tresult, err = r.ensureDeployment(req, v, r.backendDeployment(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureService(req, v, r.backendService(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\terr = r.updateBackendStatus(v)\n\tif err != nil {\n\t\t// Requeue the req if the status could not be updated\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err = r.handleBackendChanges(v)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// == Visitors Frontend ==========\n\tresult, err = r.ensureDeployment(req, v, r.frontendDeployment(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureService(req, v, r.frontendService(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\terr = r.updateFrontendStatus(v)\n\tif err != nil {\n\t\t// Requeue the req\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err = r.handleFrontendChanges(v)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// == Finish ==========\n\t// Everything went fine, don't requeue\n\n\treturn ctrl.Result{}, nil\n}", "func (r *ReconcileImageRegistry) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling ImageRegistry\")\n\n\t// Fetch the ImageRegistry instance\n\tinstance := &registryv1alpha1.ImageRegistry{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tconditions := instance.Status.Conditions\n\tinstance.Status.Conditions = map[status.ConditionType]status.Condition{}\n\n\t// Run reconcile tasks (may write ImageRegistry conditions)\n\tfor _, task := range r.reconcileTasks {\n\t\tif err = task(instance, reqLogger); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Update ImageRegistry status\n\tsyncCond := status.Condition{\n\t\tType: registryv1alpha1.ConditionSynced,\n\t\tStatus: corev1.ConditionTrue,\n\t}\n\tif err != nil {\n\t\tsyncCond.Status = corev1.ConditionFalse\n\t\tsyncCond.Message = err.Error()\n\t}\n\tinstance.Status.Conditions.SetCondition(syncCond)\n\tif syncCond.Status == corev1.ConditionFalse {\n\t\tinstance.Status.Conditions.SetCondition(status.Condition{\n\t\t\tType: registryv1alpha1.ConditionReady,\n\t\t\tStatus: corev1.ConditionFalse,\n\t\t\tReason: registryv1alpha1.ReasonFailedSync,\n\t\t})\n\t}\n\tchangedCond := false\n\tfor _, c := range instance.Status.Conditions {\n\t\tif conditions.SetCondition(c) {\n\t\t\tchangedCond = true\n\t\t}\n\t}\n\tinstance.Status.Conditions = conditions\n\thostname := r.externalHostnameForCR(instance)\n\ttlsSecretName := tlsSecretNameForCR(instance)\n\tchangedGeneration := instance.Status.ObservedGeneration != instance.Generation\n\tchangedHost := instance.Status.Hostname != hostname\n\tchangedTLSSecretName := instance.Status.TLSSecretName != tlsSecretName\n\tif changedCond || changedGeneration || changedHost || changedTLSSecretName {\n\t\tinstance.Status.ObservedGeneration = instance.Generation\n\t\tinstance.Status.Hostname = hostname\n\t\tinstance.Status.TLSSecretName = tlsSecretName\n\t\tif e := r.client.Status().Update(context.TODO(), instance); e != nil && err == nil {\n\t\t\terr = e\n\t\t}\n\t}\n\n\treturn reconcile.Result{}, err\n}", "func (r *KindClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := log.FromContext(ctx).WithValues(\"kindcluster\", req.NamespacedName)\n\n\t// Fetch the KindCluster instance\n\tkindCluster := &infrastructurev1alpha4.KindCluster{}\n\tif err := r.Get(ctx, req.NamespacedName, kindCluster); err != nil {\n\t\tif client.IgnoreNotFound(err) != nil {\n\t\t\tlog.Error(err, \"unable to fetch KindCluster\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Cluster no longer exists so lets stop now\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Fetch the owner Cluster\n\tcluster, err := util.GetOwnerCluster(ctx, r.Client, kindCluster.ObjectMeta)\n\tif err != nil {\n\t\tlog.Error(err, \"failed to get owner cluster\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif cluster == nil {\n\t\tlog.Info(\"Cluster Controller has not yet set OwnerRef\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif annotations.IsPaused(cluster, kindCluster) {\n\t\tlog.Info(\"KindCluster or linked Cluster is marked as paused. Won't reconcile\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlog = log.WithValues(\"cluster\", kindCluster.Name)\n\thelper, err := patch.NewHelper(kindCluster, r.Client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrap(err, \"failed to init patch helper\")\n\t}\n\n\t// Ensure we always patch the resource with the latest changes when exiting function\n\tdefer func() {\n\t\thelper.Patch(\n\t\t\tcontext.TODO(),\n\t\t\tkindCluster,\n\t\t\tpatch.WithOwnedConditions{\n\t\t\t\tConditions: []clusterv1.ConditionType{\n\t\t\t\t\tclusterv1.ReadyCondition,\n\t\t\t\t}},\n\t\t)\n\t}()\n\n\tif !kindCluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t// The KindCluster is being deleted\n\t\tif controllerutil.ContainsFinalizer(kindCluster, finalizerName) {\n\t\t\tlog.Info(\"Deleting cluster\")\n\n\t\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseDeleting\n\t\t\tkindCluster.Status.Ready = false\n\t\t\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\t\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\tif err := kindClient.DeleteCluster(kindCluster.NamespacedName()); err != nil {\n\t\t\t\tlog.Error(err, \"failed to delete cluster\")\n\t\t\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonDeleteFailed\n\t\t\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\tcontrollerutil.RemoveFinalizer(kindCluster, finalizerName)\n\t\t\tlog.Info(\"Removed finalizer\")\n\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Ensure our finalizer is present\n\tcontrollerutil.AddFinalizer(kindCluster, finalizerName)\n\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif kindCluster.Status.Phase == nil || *kindCluster.Status.Phase == infrastructurev1alpha4.KindClusterPhasePending {\n\t\tlog.Info(\"Creating new cluster in Kind\")\n\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseCreating\n\t\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tif err := kindClient.CreateCluster(kindCluster); err != nil {\n\t\t\tlog.Error(err, \"failed to create cluster in kind\")\n\t\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonCreateFailed\n\t\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tkindCluster.Status.Ready = true\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseReady\n\t\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tlog.Info(\"Cluster created\")\n\t}\n\n\t// Ensure ready status is up-to-date\n\tisReady, err := kindClient.IsReady(kindCluster.NamespacedName())\n\tif err != nil {\n\t\tlog.Error(err, \"failed to check status of cluster\")\n\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonClusterNotFound\n\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\treturn ctrl.Result{}, err\n\t}\n\tkindCluster.Status.Ready = isReady\n\tif isReady {\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseReady\n\t} else {\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseCreating\n\t}\n\n\t// Ensure kubeconfig is up-to-date\n\tkc, err := kindClient.GetKubeConfig(kindCluster.NamespacedName())\n\tif err != nil {\n\t\tlog.Error(err, \"failed to check status of cluster\")\n\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonKubeConfig\n\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\treturn ctrl.Result{}, err\n\t}\n\tkindCluster.Status.KubeConfig = &kc\n\n\t// Populate the server endpoint details\n\tendpoint, err := kubeconfig.ExtractEndpoint(kc, kindCluster.NamespacedName())\n\tif err != nil {\n\t\tlog.Error(err, \"failed to get control plane endpoint\")\n\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonEndpoint\n\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\treturn ctrl.Result{}, err\n\t}\n\tkindCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{\n\t\tHost: endpoint.Host,\n\t\tPort: endpoint.Port,\n\t}\n\n\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *Reconciler) Reconcile() (reconcile.Result, error) {\n\n\tlog := r.Logger.WithField(\"func\", \"Reconcile\")\n\tlog.Infof(\"Start ...\")\n\n\tutil.KubeCheck(r.NooBaa)\n\n\tif r.NooBaa.UID == \"\" {\n\t\tlog.Infof(\"NooBaa not found or already deleted. Skip reconcile.\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\terr := r.RunReconcile()\n\n\tif util.IsPersistentError(err) {\n\t\tlog.Errorf(\"❌ Persistent Error: %s\", err)\n\t\tutil.SetErrorCondition(&r.NooBaa.Status.Conditions, err)\n\t\tr.UpdateStatus()\n\t\treturn reconcile.Result{}, nil\n\t}\n\tif err != nil {\n\t\tlog.Warnf(\"⏳ Temporary Error: %s\", err)\n\t\tutil.SetErrorCondition(&r.NooBaa.Status.Conditions, err)\n\t\tr.UpdateStatus()\n\t\treturn reconcile.Result{RequeueAfter: 2 * time.Second}, nil\n\t}\n\tr.UpdateStatus()\n\tlog.Infof(\"✅ Done\")\n\treturn reconcile.Result{}, nil\n}", "func (reconciler *ClusterReconciler) reconcile() (ctrl.Result, error) {\n\tvar err error\n\n\t// Child resources of the cluster CR will be automatically reclaimed by K8S.\n\tif reconciler.observed.cluster == nil {\n\t\treconciler.log.Info(\"The cluster has been deleted, no action to take\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\terr = reconciler.reconcileConfigMap()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileJobManagerDeployment()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileJobManagerService()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileJobManagerIngress()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileTaskManagerDeployment()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err := reconciler.reconcileJob()\n\n\treturn result, nil\n}", "func (r *NuxeoReconciler) doReconcile(request reconcile.Request) (reconcile.Result, error) {\n\temptyResult := reconcile.Result{}\n\tkv := []interface{}{\"nuxeo\", request.NamespacedName}\n\tr.Log.Info(\"reconciling Nuxeo\", kv...)\n\t// Get the Nuxeo CR from the request namespace\n\tinstance := &v1alpha1.Nuxeo{}\n\terr := r.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tr.Log.Info(\"nuxeo resource not found. Ignoring since object must be deleted\", kv...)\n\t\t\treturn emptyResult, nil\n\t\t}\n\t\treturn reconcile.Result{Requeue: true}, err\n\t}\n\t// only configure service/ingress/route for the interactive NodeSet\n\tvar interactiveNodeSet v1alpha1.NodeSet\n\tif interactiveNodeSet, err = getInteractiveNodeSet(instance.Spec.NodeSets); err != nil {\n\t\treturn emptyResult, err\n\t}\n\tif err = r.reconcileService(instance.Spec.Service, interactiveNodeSet, instance); err != nil {\n\t\treturn emptyResult, err\n\t}\n\tif err = r.reconcileAccess(instance.Spec.Access, interactiveNodeSet, instance); err != nil {\n\t\treturn emptyResult, err\n\t}\n\tif err = r.reconcileServiceAccount(instance); err != nil {\n\t\treturn emptyResult, err\n\t}\n\tif err = r.reconcilePvc(instance); err != nil {\n\t\treturn emptyResult, err\n\t}\n\tif err = r.reconcileClid(instance); err != nil {\n\t\treturn emptyResult, err\n\t}\n\tif requeue, err := r.reconcileNodeSets(instance); err != nil {\n\t\treturn emptyResult, err\n\t} else if requeue {\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\tif err := r.updateNuxeoStatus(instance); err != nil {\n\t\treturn emptyResult, err\n\t}\n\tr.Log.Info(\"finished\", kv...)\n\treturn emptyResult, nil\n}", "func (r *Reconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.FromContext(ctx)\n\treqLogger.Info(\"Reconciling ChangeTierRequest\")\n\n\t// Fetch the ChangeTierRequest instance\n\tchangeTierRequest := &toolchainv1alpha1.ChangeTierRequest{}\n\terr := r.Client.Get(context.TODO(), request.NamespacedName, changeTierRequest)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// if is complete, then check when status was changed and delete it if the requested duration has passed\n\tcompleteCond, found := condition.FindConditionByType(changeTierRequest.Status.Conditions, toolchainv1alpha1.ChangeTierRequestComplete)\n\tif found && completeCond.Status == corev1.ConditionTrue {\n\t\tdeleted, requeueAfter, err := r.checkTransitionTimeAndDelete(reqLogger, changeTierRequest, completeCond)\n\t\tif deleted {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, r.wrapErrorWithStatusUpdate(reqLogger, changeTierRequest, r.setStatusChangeTierRequestDeletionFailed, err, \"failed to delete changeTierRequest\")\n\t\t}\n\t\treturn reconcile.Result{\n\t\t\tRequeue: true,\n\t\t\tRequeueAfter: requeueAfter,\n\t\t}, nil\n\t}\n\n\terr = r.changeTier(reqLogger, changeTierRequest, request.Namespace)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treqLogger.Info(\"Change of the tier is completed\")\n\terr = r.setStatusChangeComplete(changeTierRequest)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to set change complete status to ChangeTierRequest\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{\n\t\tRequeue: true,\n\t\tRequeueAfter: r.Config.GetDurationBeforeChangeTierRequestDeletion(),\n\t}, nil\n}", "func (r *AtReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := ctrllog.FromContext(ctx)\n\treqLogger := log.WithValues(\"namespace\", req.Namespace, \"at\", req.Name)\n\treqLogger.Info(\"=== Reconciling At\")\n\t// Fetch the At instance\n\tinstance := &cnatv1alpha1.At{}\n\terr := r.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request - return and don't requeue:\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request:\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// If no phase set, default to pending (the initial phase):\n\tif instance.Status.Phase == \"\" {\n\t\tinstance.Status.Phase = cnatv1alpha1.PhasePending\n\t}\n\n\t// Now let's make the main case distinction: implementing\n\t// the state diagram PENDING -> RUNNING -> DONE\n\tswitch instance.Status.Phase {\n\tcase cnatv1alpha1.PhasePending:\n\t\treqLogger.Info(\"Phase: PENDING\")\n\t\t// As long as we haven't executed the command yet, we need to check if it's time already to act:\n\t\treqLogger.Info(\"Checking schedule\", \"Target\", instance.Spec.Schedule)\n\t\t// Check if it's already time to execute the command with a tolerance of 2 seconds:\n\t\td, err := timeUntilSchedule(instance.Spec.Schedule)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Schedule parsing failure\")\n\t\t\t// Error reading the schedule. Wait until it is fixed.\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treqLogger.Info(\"Schedule parsing done\", \"diff\", fmt.Sprintf(\"%v\", d))\n\t\tif d > 0 {\n\t\t\t// Not yet time to execute the command, wait until the scheduled time\n\t\t\treturn reconcile.Result{RequeueAfter: d}, nil\n\t\t}\n\t\treqLogger.Info(\"It's time!\", \"Ready to execute\", instance.Spec.Command)\n\t\tinstance.Status.Phase = cnatv1alpha1.PhaseRunning\n\tcase cnatv1alpha1.PhaseRunning:\n\t\treqLogger.Info(\"Phase: RUNNING\")\n\t\tpod := newPodForCR(instance)\n\t\t// Set At instance as the owner and controller\n\t\tif err := controllerutil.SetControllerReference(instance, pod, r.Scheme); err != nil {\n\t\t\t// requeue with error\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tfound := &corev1.Pod{}\n\t\terr = r.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, found)\n\t\t// Try to see if the pod already exists and if not\n\t\t// (which we expect) then create a one-shot pod as per spec:\n\t\tif err != nil && errors.IsNotFound(err) {\n\t\t\terr = r.Create(context.TODO(), pod)\n\t\t\tif err != nil {\n\t\t\t\t// requeue with error\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treqLogger.Info(\"Pod launched\", \"name\", pod.Name)\n\t\t} else if err != nil {\n\t\t\t// requeue with error\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if found.Status.Phase == corev1.PodFailed || found.Status.Phase == corev1.PodSucceeded {\n\t\t\treqLogger.Info(\"Container terminated\", \"reason\", found.Status.Reason, \"message\", found.Status.Message)\n\t\t\tinstance.Status.Phase = cnatv1alpha1.PhaseDone\n\t\t} else {\n\t\t\t// don't requeue because it will happen automatically when the pod status changes\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\tcase cnatv1alpha1.PhaseDone:\n\t\treqLogger.Info(\"Phase: DONE\")\n\t\treturn ctrl.Result{}, nil\n\tdefault:\n\t\treqLogger.Info(\"NOP\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Update the At instance, setting the status to the respective phase:\n\terr = r.Status().Update(context.TODO(), instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Don't requeue. We should be reconcile because either the pod or the CR changes.\n\n\treturn ctrl.Result{}, nil\n}", "func (r *Reconciler) Reconcile() (reconcile.Result, error) {\n\n\tres := reconcile.Result{}\n\tlog := r.Logger\n\tlog.Infof(\"Start ...\")\n\n\tutil.KubeCheck(r.NooBaaAccount)\n\n\tif r.NooBaaAccount.UID == \"\" {\n\t\tlog.Infof(\"NooBaaAccount %q not found or deleted. Skip reconcile.\", r.NooBaaAccount.Name)\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tif util.EnsureCommonMetaFields(r.NooBaaAccount, nbv1.Finalizer) {\n\t\tif !util.KubeUpdate(r.NooBaaAccount) {\n\t\t\tlog.Errorf(\"❌ NooBaaAccount %q failed to add mandatory meta fields\", r.NooBaaAccount.Name)\n\n\t\t\tres.RequeueAfter = 3 * time.Second\n\t\t\treturn res, nil\n\t\t}\n\t}\n\n\tsystem.CheckSystem(r.NooBaa)\n\n\tvar err error\n\tif r.NooBaaAccount.DeletionTimestamp != nil {\n\t\terr = r.ReconcileDeletion()\n\t} else {\n\t\terr = r.ReconcilePhases()\n\t}\n\tif err != nil {\n\t\tif perr, isPERR := err.(*util.PersistentError); isPERR {\n\t\t\tr.SetPhase(nbv1.NooBaaAccountPhaseRejected, perr.Reason, perr.Message)\n\t\t\tlog.Errorf(\"❌ Persistent Error: %s\", err)\n\t\t\tif r.Recorder != nil {\n\t\t\t\tr.Recorder.Eventf(r.NooBaaAccount, corev1.EventTypeWarning, perr.Reason, perr.Message)\n\t\t\t}\n\t\t} else {\n\t\t\tres.RequeueAfter = 3 * time.Second\n\t\t\t// leave current phase as is\n\t\t\tr.SetPhase(\"\", \"TemporaryError\", err.Error())\n\t\t\tlog.Warnf(\"⏳ Temporary Error: %s\", err)\n\t\t}\n\t} else {\n\t\tr.SetPhase(\n\t\t\tnbv1.NooBaaAccountPhaseReady,\n\t\t\t\"NooBaaAccountPhaseReady\",\n\t\t\t\"noobaa operator completed reconcile - noobaa account is ready\",\n\t\t)\n\t\tlog.Infof(\"✅ Done\")\n\t}\n\n\terr = r.UpdateStatus()\n\t// if updateStatus will fail to update the CR for any reason we will continue to requeue the reconcile\n\t// until the spec status will reflect the actual status of the bucketclass\n\tif err != nil {\n\t\tres.RequeueAfter = 3 * time.Second\n\t\tlog.Warnf(\"⏳ Temporary Error: %s\", err)\n\t}\n\treturn res, nil\n}", "func (r *AWSIPAMReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = r.log.WithValues(\"ipam-controller\", req.NamespacedName)\n\n\tnode := &corev1.Node{}\n\tif err := r.client.Get(ctx, req.NamespacedName, node); err != nil {\n\t\tklog.Warningf(\"unable to fetch node %s: %v\", node.Name, err)\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// we'll ignore not-found errors, since they can't be fixed by an immediate\n\t\t\t// requeue (we'll need to wait for a new notification), and we can get them\n\t\t\t// on deleted requests.\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif len(node.Spec.PodCIDRs) == 0 {\n\t\t// CCM Node Controller has not done its thing yet\n\t\tif node.Spec.ProviderID == \"\" {\n\t\t\tklog.Infof(\"Node %q has empty provider ID\", node.Name)\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\n\t\t// aws:///eu-central-1a/i-07577a7bcf3e576f2\n\t\tproviderURL, err := url.Parse(node.Spec.ProviderID)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tinstanceID := strings.Split(providerURL.Path, \"/\")[2]\n\t\teni, err := r.ec2Client.DescribeNetworkInterfaces(&ec2.DescribeNetworkInterfacesInput{\n\t\t\tFilters: []*ec2.Filter{\n\t\t\t\t{\n\t\t\t\t\tName: fi.PtrTo(\"attachment.instance-id\"),\n\t\t\t\t\tValues: []*string{\n\t\t\t\t\t\t&instanceID,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tif len(eni.NetworkInterfaces) != 1 {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unexpected number of network interfaces for instance %q: %v\", instanceID, len(eni.NetworkInterfaces))\n\t\t}\n\n\t\tif len(eni.NetworkInterfaces[0].Ipv6Prefixes) != 1 {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unexpected amount of ipv6 prefixes on interface %q: %v\", *eni.NetworkInterfaces[0].NetworkInterfaceId, len(eni.NetworkInterfaces[0].Ipv6Prefixes))\n\t\t}\n\n\t\tipv6Address := aws.StringValue(eni.NetworkInterfaces[0].Ipv6Prefixes[0].Ipv6Prefix)\n\t\tif err := patchNodePodCIDRs(r.coreV1Client, ctx, node, ipv6Address); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (r *SimulationReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\n\tvar sim toolsv1.Simulation\n\tif err := r.Get(ctx, req.NamespacedName, &sim); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\tr.log.WithValues(\"simulation\", req.NamespacedName).Error(err, \"unable to fetch Simulation resource\")\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: time.Second * 30,\n\t\t}, err\n\t}\n\n\tif r.setSimulationDefaults(&sim) {\n\t\treturn ctrl.Result{Requeue: true}, r.Update(ctx, &sim)\n\t}\n\n\tr.log.WithValues(\"simulation\", sim.Name).Info(\"reconciling\")\n\treturn ctrl.Result{}, r.ReconcileSimulation(ctx, &sim)\n}", "func (r *yandexContainerRegistryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := r.log.WithValues(\"name\", req.NamespacedName)\n\tlog.V(1).Info(\"started reconciliation\")\n\n\t// Try to retrieve object from k8s\n\tvar object connectorsv1.YandexContainerRegistry\n\tif err := r.Get(ctx, req.NamespacedName, &object); err != nil {\n\t\t// It still can be OK if we have not found it, and we do not need to reconcile it again\n\n\t\t// This outcome signifies that we just cannot find object, that is ok\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlog.V(1).Info(\"object not found in k8s, reconciliation not possible\")\n\t\t\treturn config.GetNeverResult()\n\t\t}\n\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to get object from k8s: %w\", err))\n\t}\n\n\t// If object must be currently finalized, do it and quit\n\tif phase.MustBeFinalized(&object.ObjectMeta, ycrconfig.FinalizerName) {\n\t\tif err := r.finalize(ctx, log.WithName(\"finalize\"), &object); err != nil {\n\t\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to finalize object: %w\", err))\n\t\t}\n\t\treturn config.GetNormalResult()\n\t}\n\n\tif err := phase.RegisterFinalizer(\n\t\tctx, r.Client, log, &object.ObjectMeta, &object, ycrconfig.FinalizerName,\n\t); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to register finalizer: %w\", err))\n\t}\n\n\tres, err := r.allocateResource(ctx, log.WithName(\"allocate-resource\"), &object)\n\tif err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to allocate resource: %w\", err))\n\t}\n\n\tif err := r.matchSpec(ctx, log.WithName(\"match-spec\"), &object, res); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to match spec: %w\", err))\n\t}\n\n\tif err := r.updateStatus(ctx, log.WithName(\"update-status\"), &object, res); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to update status: %w\", err))\n\t}\n\n\tif err := phase.ProvideConfigmap(\n\t\tctx,\n\t\tr.Client,\n\t\tlog.WithName(\"provide-configmap\"),\n\t\tobject.Name, ycrconfig.ShortName, object.Namespace,\n\t\tmap[string]string{\"ID\": object.Status.ID},\n\t); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to provide configmap: %w\", err))\n\t}\n\n\tlog.V(1).Info(\"finished reconciliation\")\n\treturn config.GetNormalResult()\n}", "func (r *ReconcileInfluxdb) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tlog.Printf(\"Reconciling Influxdb %s/%s\\n\", request.Namespace, request.Name)\n\n\t// Fetch the Influxdb instance\n\tinfluxdb := &influxdatav1alpha1.Influxdb{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, influxdb)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\tlog.Printf(\"Influxdb %s/%s not found. Ignoring since object must be deleted\\n\", request.Namespace, request.Name)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Printf(\"Failed to get Influxdb: %v\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tlog.Printf(\"Reconciling Influxdb Service\\n\")\n\t// Reconcile the cluster service\n\terr = r.reconcileService(influxdb)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tlog.Printf(\"Reconciling Influxdb Persistent Volume Claim\\n\")\n\t// Reconcile the persistent volume claim\n\terr = r.reconcilePVC(influxdb)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tlog.Printf(\"Reconciling Influxdb StatefulSet\\n\")\n\t// Check if the statefulset already exists, if not create a new one\n\tfound := &appsv1.StatefulSet{}\n\terr = r.client.Get(context.TODO(), types.NamespacedName{Name: influxdb.Name, Namespace: influxdb.Namespace}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\t// Define a new statefulset\n\t\tdep := r.statefulsetForInfluxdb(influxdb)\n\t\tlog.Printf(\"Creating a new Deployment %s/%s\\n\", dep.Namespace, dep.Name)\n\t\terr = r.client.Create(context.TODO(), dep)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to create new Deployment: %v\\n\", err)\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\t// Deployment created successfully - return and requeue\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t} else if err != nil {\n\t\tlog.Printf(\"Failed to get Deployment: %v\\n\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Ensure the statefulset size is the same as the spec\n\tlog.Printf(\"Matching size in spec\")\n\tsize := influxdb.Spec.Size\n\tif *found.Spec.Replicas != size {\n\t\tfound.Spec.Replicas = &size\n\t\terr = r.client.Update(context.TODO(), found)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to update Deployment: %v\\n\", err)\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\t\tlog.Printf(\"Spec was updated, so request is getting re-queued\")\n\t\t// Spec updated - return and requeue\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\tlog.Printf(\"Matching size in spec\\n\")\n\t// Update the Influxdb status with the pod names\n\t// List the pods for this influxdb's statefulset\n\tpodList := &corev1.PodTemplateList{}\n\tlabelSelector := labels.SelectorFromSet(labelsForInfluxdb(influxdb.Name))\n\tlistOps := &client.ListOptions{Namespace: influxdb.Namespace, LabelSelector: labelSelector}\n\terr = r.client.List(context.TODO(), listOps, podList)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to list pods: %v\\n\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\tpodNames := getPodNames(podList.Items)\n\n\tlog.Printf(\"Updating status nodes\\n\")\n\t// Update status.Nodes if needed\n\tif !reflect.DeepEqual(podNames, influxdb.Status.Nodes) {\n\t\tinfluxdb.Status.Nodes = podNames\n\t\terr := r.client.Update(context.TODO(), influxdb)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"failed to update influxdb status: %v\", err)\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\n\tlog.Printf(\"Reconcile completed successfully\")\n\treturn reconcile.Result{}, nil\n}", "func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {\n\tlog := logf.FromContext(ctx)\n\n\tgardenCtx, cancel := controllerutils.GetMainReconciliationContext(ctx, controllerutils.DefaultReconciliationTimeout)\n\tdefer cancel()\n\tseedCtx, cancel := controllerutils.GetChildReconciliationContext(ctx, controllerutils.DefaultReconciliationTimeout)\n\tdefer cancel()\n\n\tcontrollerInstallation := &gardencorev1beta1.ControllerInstallation{}\n\tif err := r.GardenClient.Get(gardenCtx, request.NamespacedName, controllerInstallation); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlog.V(1).Info(\"Object is gone, stop reconciling\")\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, fmt.Errorf(\"error retrieving object from store: %w\", err)\n\t}\n\n\tif controllerInstallation.DeletionTimestamp != nil {\n\t\treturn r.delete(gardenCtx, seedCtx, log, controllerInstallation)\n\t}\n\treturn r.reconcile(gardenCtx, seedCtx, log, controllerInstallation)\n}", "func (r *ReconcileDeployable) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\t// Fetch the Deployable instance\n\tlog := r.Log.WithValues(\"obj-reconcile\", request.NamespacedName)\n\tlog.Info(fmt.Sprintf(\"Starting %v reconcile loop for %v\", controllerName, request.NamespacedName))\n\n\tdefer log.Info(fmt.Sprintf(\"Finish %v reconcile loop for %v\", controllerName, request.NamespacedName))\n\n\tinstance := &dplv1.Deployable{}\n\terr := r.KubeClient.Get(context.TODO(), request.NamespacedName, instance)\n\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tif err := r.deleteDeployableInObjectBucket(request.NamespacedName, log); err != nil {\n\t\t\t\tlog.Error(err, fmt.Sprintf(\"failed to delete deployable %v\", request.NamespacedName))\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Reconciling - Errored.\")\n\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif err := r.createOrUpdateDeployableInObjectBucket(instance, log); err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"failed to reconcile deployable for channel %v\", request.String()))\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "func (r *yandexMessageQueueReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := r.log.WithValues(\"name\", req.NamespacedName)\n\tlog.V(1).Info(\"started reconciliation\")\n\n\t// Try to retrieve object from k8s\n\tvar object connectorsv1.YandexMessageQueue\n\tif err := r.Get(ctx, req.NamespacedName, &object); err != nil {\n\t\t// It still can be OK if we have not found it, and we do not need to reconcile it again\n\n\t\t// This outcome signifies that we just cannot find object, that is ok\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlog.V(1).Info(\"object not found in k8s, reconciliation not possible\")\n\t\t\treturn config.GetNeverResult()\n\t\t}\n\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to get object from k8s: %w\", err))\n\t}\n\n\tcred, err := awsutils.CredentialsFromStaticAccessKey(ctx, object.Namespace, object.Spec.SAKeyName, r.Client)\n\tif err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to retrieve credentials: %w\", err))\n\t}\n\tsdk, err := ymqutils.NewSQSClient(ctx, cred)\n\tif err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to build sdk: %w\", err))\n\t}\n\n\t// If object must be currently finalized, do it and quit\n\tif phase.MustBeFinalized(&object.ObjectMeta, ymqconfig.FinalizerName) {\n\t\tif err := r.finalize(ctx, log.WithName(\"finalize\"), &object, sdk); err != nil {\n\t\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to finalize object: %w\", err))\n\t\t}\n\t\treturn config.GetNormalResult()\n\t}\n\n\tif err := phase.RegisterFinalizer(\n\t\tctx, r.Client, log.WithName(\"register-finalizer\"), &object.ObjectMeta, &object, ymqconfig.FinalizerName,\n\t); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to register finalizer: %w\", err))\n\t}\n\n\tif err := r.allocateResource(ctx, log.WithName(\"allocate-resource\"), &object, sdk); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to allocate resource: %w\", err))\n\t}\n\n\tif err := r.matchSpec(ctx, log.WithName(\"match-spec\"), &object, sdk); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to match spec: %w\", err))\n\t}\n\n\tif err := phase.ProvideConfigmap(\n\t\tctx,\n\t\tr.Client,\n\t\tlog.WithName(\"provide-configmap\"),\n\t\tobject.Name, ymqconfig.ShortName, object.Namespace,\n\t\tmap[string]string{\"URL\": object.Status.QueueURL},\n\t); err != nil {\n\t\treturn config.GetErroredResult(fmt.Errorf(\"unable to provide configmap: %w\", err))\n\t}\n\n\tlog.V(1).Info(\"finished reconciliation\")\n\treturn config.GetNormalResult()\n}", "func (crc *clusterReconcileContext) reconcile() error {\n\tif crc.tinkerbellCluster.Spec.ControlPlaneEndpoint.Host == \"\" {\n\t\tif err := crc.populateControlplaneHost(); err != nil {\n\t\t\treturn fmt.Errorf(\"populating controlplane host: %w\", err)\n\t\t}\n\t}\n\n\t// TODO: How can we support changing that?\n\tif crc.tinkerbellCluster.Spec.ControlPlaneEndpoint.Port != KubernetesAPIPort {\n\t\tcrc.tinkerbellCluster.Spec.ControlPlaneEndpoint.Port = KubernetesAPIPort\n\t}\n\n\tcrc.tinkerbellCluster.Status.Ready = true\n\n\tcontrollerutil.AddFinalizer(crc.tinkerbellCluster, infrastructurev1alpha3.ClusterFinalizer)\n\n\tcrc.log.Info(\"Setting cluster status to ready\")\n\n\tif err := crc.patchHelper.Patch(crc.ctx, crc.tinkerbellCluster); err != nil {\n\t\treturn fmt.Errorf(\"patching cluster object: %w\", err)\n\t}\n\n\treturn nil\n}", "func (r clusterReconciler) Reconcile(_ context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {\n\t// Get the VSphereCluster resource for this request.\n\tvsphereCluster := &infrav1.VSphereCluster{}\n\tif err := r.Client.Get(r, req.NamespacedName, vsphereCluster); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tr.Logger.V(4).Info(\"VSphereCluster not found, won't reconcile\", \"key\", req.NamespacedName)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Fetch the CAPI Cluster.\n\tcluster, err := clusterutilv1.GetOwnerCluster(r, r.Client, vsphereCluster.ObjectMeta)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif cluster == nil {\n\t\tr.Logger.Info(\"Waiting for Cluster Controller to set OwnerRef on VSphereCluster\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\tif annotations.IsPaused(cluster, vsphereCluster) {\n\t\tr.Logger.V(4).Info(\"VSphereCluster %s/%s linked to a cluster that is paused\",\n\t\t\tvsphereCluster.Namespace, vsphereCluster.Name)\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Create the patch helper.\n\tpatchHelper, err := patch.NewHelper(vsphereCluster, r.Client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to init patch helper for %s %s/%s\",\n\t\t\tvsphereCluster.GroupVersionKind(),\n\t\t\tvsphereCluster.Namespace,\n\t\t\tvsphereCluster.Name)\n\t}\n\n\t// Create the cluster context for this request.\n\tclusterContext := &capvcontext.ClusterContext{\n\t\tControllerContext: r.ControllerContext,\n\t\tCluster: cluster,\n\t\tVSphereCluster: vsphereCluster,\n\t\tLogger: r.Logger.WithName(req.Namespace).WithName(req.Name),\n\t\tPatchHelper: patchHelper,\n\t}\n\n\t// Always issue a patch when exiting this function so changes to the\n\t// resource are patched back to the API server.\n\tdefer func() {\n\t\tif err := clusterContext.Patch(); err != nil {\n\t\t\tif reterr == nil {\n\t\t\t\treterr = err\n\t\t\t}\n\t\t\tclusterContext.Logger.Error(err, \"patch failed\", \"cluster\", clusterContext.String())\n\t\t}\n\t}()\n\n\tif err := setOwnerRefsOnVsphereMachines(clusterContext); err != nil {\n\t\treturn reconcile.Result{}, errors.Wrapf(err, \"failed to set owner refs on VSphereMachine objects\")\n\t}\n\n\t// Handle deleted clusters\n\tif !vsphereCluster.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(clusterContext)\n\t}\n\n\t// If the VSphereCluster doesn't have our finalizer, add it.\n\t// Requeue immediately after adding finalizer to avoid the race condition between init and delete\n\tif !ctrlutil.ContainsFinalizer(vsphereCluster, infrav1.ClusterFinalizer) {\n\t\tctrlutil.AddFinalizer(vsphereCluster, infrav1.ClusterFinalizer)\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Handle non-deleted clusters\n\treturn r.reconcileNormal(clusterContext)\n}", "func (r *DiscoveryConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := logr.FromContext(ctx)\n\n\t// Get discovery config. Die if there is none\n\tconfig := &discoveryv1.DiscoveryConfig{}\n\tif err := r.Get(ctx, types.NamespacedName{\n\t\tName: req.Name,\n\t\tNamespace: req.Namespace,\n\t}, config); err != nil {\n\t\tlog.Error(err, \"unable to fetch DiscoveryConfig\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Update the DiscoveryConfig status\n\t// config.Status.LastUpdateTime = &metav1.Time{Time: time.Now()}\n\t// if err := r.Status().Update(ctx, config); err != nil {\n\t// \tlog.Error(err, \"unable to update discoveryconfig status\")\n\t// \treturn ctrl.Result{}, err\n\t// }\n\n\t// Get user token from secret provided in config\n\tif len(config.Spec.ProviderConnections) == 0 {\n\t\tlog.Info(\"No provider connections in config. Returning.\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\tsecretName := config.Spec.ProviderConnections[0]\n\tocmSecret := &corev1.Secret{}\n\terr := r.Get(context.TODO(), types.NamespacedName{Name: secretName, Namespace: req.Namespace}, ocmSecret)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif _, ok := ocmSecret.Data[\"metadata\"]; !ok {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"Secret '%s' does not contain 'metadata' field\", secretName)\n\t}\n\n\tproviderConnection := &CloudRedHatProviderConnection{}\n\terr = yaml.Unmarshal(ocmSecret.Data[\"metadata\"], providerConnection)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tuserToken := providerConnection.OCMApiToken\n\n\t// Request ephemeral access token with user token. This will be used for OCM requests\n\tauthRequest := auth_domain.AuthRequest{\n\t\tToken: userToken,\n\t}\n\tif annotations := config.GetAnnotations(); annotations != nil {\n\t\tauthRequest.BaseURL = annotations[\"ocmBaseURL\"]\n\t}\n\taccessToken, err := auth_service.AuthClient.GetToken(authRequest)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// List all already-discovered clusters\n\tvar discoveredList discoveryv1.DiscoveredClusterList\n\tif err := r.List(ctx, &discoveredList, client.InNamespace(req.Namespace)); err != nil {\n\t\tlog.Error(err, \"unable to list discovered clusters\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\texisting := make(map[string]int, len(discoveredList.Items))\n\tfor i, cluster := range discoveredList.Items {\n\t\texisting[cluster.Name] = i\n\t}\n\n\t// List all managed clusters\n\tmanagedClusters := &unstructured.UnstructuredList{}\n\tmanagedClusters.SetGroupVersionKind(managedClusterGVK)\n\tif err := r.List(ctx, managedClusters); err != nil {\n\t\t// Capture case were ManagedClusters resource does not exist\n\t\tif !apimeta.IsNoMatchError(err) {\n\t\t\treturn ctrl.Result{}, errors.Wrapf(err, \"error listing managed clusters\")\n\t\t}\n\t}\n\n\tmanagedClusterIDs := make(map[string]int, len(managedClusters.Items))\n\tfor i, mc := range managedClusters.Items {\n\t\tname := getClusterID(mc)\n\t\tif name != \"\" {\n\t\t\tmanagedClusterIDs[getClusterID(mc)] = i\n\t\t}\n\t}\n\n\tvar createClusters []discoveryv1.DiscoveredCluster\n\tvar updateClusters []discoveryv1.DiscoveredCluster\n\tvar deleteClusters []discoveryv1.DiscoveredCluster\n\tvar unchangedClusters []discoveryv1.DiscoveredCluster\n\n\trequestConfig := cluster_domain.ClusterRequest{\n\t\tToken: accessToken,\n\t\tFilter: config.Spec.Filters,\n\t}\n\tif annotations := config.GetAnnotations(); annotations != nil {\n\t\trequestConfig.BaseURL = annotations[\"ocmBaseURL\"]\n\t}\n\tclusterClient := cluster_service.ClusterClientGenerator.NewClient(requestConfig)\n\n\tnewClusters, err := clusterClient.GetClusters()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tfor _, cluster := range newClusters {\n\t\t// Build a DiscoveredCluster object from the cluster information\n\t\tdiscoveredCluster := discoveredCluster(cluster)\n\t\tdiscoveredCluster.SetNamespace(req.Namespace)\n\n\t\t// Assign dummy status\n\t\tdiscoveredCluster.Spec.Subscription = discoveryv1.SubscriptionSpec{\n\t\t\tStatus: \"Active\",\n\t\t\tSupportLevel: \"None\",\n\t\t\tManaged: false,\n\t\t\tCreatorID: \"abc123\",\n\t\t}\n\n\t\t// Assign managed status\n\t\tif _, managed := managedClusterIDs[discoveredCluster.Spec.Name]; managed {\n\t\t\tsetManagedStatus(&discoveredCluster)\n\t\t}\n\n\t\t// Add reference to secret used for authentication\n\t\tdiscoveredCluster.Spec.ProviderConnections = nil\n\t\tsecretRef, err := ref.GetReference(r.Scheme, ocmSecret)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"unable to make reference to secret\", \"secret\", secretRef)\n\t\t}\n\t\tdiscoveredCluster.Spec.ProviderConnections = append(discoveredCluster.Spec.ProviderConnections, *secretRef)\n\n\t\tind, exists := existing[discoveredCluster.Name]\n\t\tif !exists {\n\t\t\t// Newly discovered cluster\n\t\t\tcreateClusters = append(createClusters, discoveredCluster)\n\t\t\tdelete(existing, discoveredCluster.Name)\n\t\t\tcontinue\n\t\t}\n\t\t// Cluster has already been discovered. Check for changes.\n\t\tif same(discoveredCluster, discoveredList.Items[ind]) {\n\t\t\tunchangedClusters = append(unchangedClusters, discoveredCluster)\n\t\t\tdelete(existing, discoveredCluster.Name)\n\t\t} else {\n\t\t\tupdated := discoveredList.Items[ind]\n\t\t\tupdated.Spec = discoveredCluster.Spec\n\t\t\tupdateClusters = append(updateClusters, updated)\n\t\t\tdelete(existing, discoveredCluster.Name)\n\t\t}\n\t}\n\n\t// Remaining clusters are no longer found by OCM and should be labeled for delete\n\tfor _, ind := range existing {\n\t\tdeleteClusters = append(deleteClusters, discoveredList.Items[ind])\n\t}\n\n\t// Create new clusters and clean up old ones\n\tfor _, cluster := range createClusters {\n\t\tcluster := cluster\n\t\tif err := ctrl.SetControllerReference(config, &cluster, r.Scheme); err != nil {\n\t\t\tlog.Error(err, \"failed to set controller reference\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tif err := r.Create(ctx, &cluster); err != nil {\n\t\t\tlog.Error(err, \"unable to create discovered cluster\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Created cluster\", \"Name\", cluster.Name)\n\t}\n\tfor _, cluster := range updateClusters {\n\t\tcluster := cluster\n\t\tif err := r.Update(ctx, &cluster); err != nil {\n\t\t\tlog.Error(err, \"unable to update discovered cluster\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Updated cluster\", \"Name\", cluster.Name)\n\t}\n\tfor _, cluster := range deleteClusters {\n\t\tcluster := cluster\n\t\tif err := r.Delete(ctx, &cluster); err != nil {\n\t\t\tlog.Error(err, \"unable to delete discovered cluster\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Deleted cluster\", \"Name\", cluster.Name)\n\t}\n\n\tlog.Info(\"Cluster categories\", \"Created\", len(createClusters), \"Updated\", len(updateClusters), \"Deleted\", len(deleteClusters), \"Unchanged\", len(unchangedClusters))\n\n\treturn ctrl.Result{RequeueAfter: reconciler.RefreshInterval}, nil\n}", "func (r *CFKpackBuildReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlogger := log.FromContext(ctx)\n\n\tvar kpackBuild buildv1alpha1.Build\n\n\tlogger.Info(fmt.Sprintf(\"Attempting to reconcile %s\", req.NamespacedName))\n\tif err := r.Get(ctx, req.NamespacedName, &kpackBuild); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlogger.Info(\"Kpack Build no longer exists\")\n\t\t}\n\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tvar cfBuild cfappsv1alpha1.Build\n\tif err := r.Get(ctx, types.NamespacedName{Name: kpackBuild.ObjectMeta.Labels[BuildGUIDLabel], Namespace: req.Namespace}, &cfBuild); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlogger.Info(\"CF Build no longer exists\")\n\t\t}\n\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tcondition := kpackBuild.Status.GetCondition(corev1alpha1.ConditionSucceeded)\n\tif condition.IsTrue() {\n\t\treturn r.reconcileSuccessfulBuild(ctx, &kpackBuild, &cfBuild, logger)\n\t}\n\n\tfailureMessage := fmt.Sprintf(\n\t\t\"Kpack build unsuccessful: Build failure reason: '%s', message: '%s'.\",\n\t\tcondition.Reason,\n\t\tcondition.Message,\n\t)\n\n\tfailedContainerState := findAnyFailedContainerState(kpackBuild.Status.StepStates)\n\tif failedContainerState != nil {\n\t\tfailureMessage = fmt.Sprintf(\n\t\t\t\"Kpack build failed during container execution: Step failure reason: '%s', message: '%s'.\",\n\t\t\tfailedContainerState.Terminated.Reason,\n\t\t\tfailedContainerState.Terminated.Message,\n\t\t)\n\t}\n\n\treturn r.reconcileFailedBuild(ctx, &kpackBuild, &cfBuild, failureMessage, logger)\n}", "func (r *DatadogMonitorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treturn r.internal.Reconcile(ctx, req)\n}", "func (r *AlertsConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = r.Log.WithValues(\"alertsconfig\", req.NamespacedName)\n\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}()\n\tctx = context.WithValue(ctx, requestId, uuid.New())\n\tlog := log.Logger(ctx, \"controllers\", \"alertconfig_controller\", \"Reconcile\")\n\tlog = log.WithValues(\"alertconfig_cr\", req.NamespacedName)\n\tlog.Info(\"Start of the request\")\n\n\t// Get the CR\n\tvar alertsConfig alertmanagerv1alpha1.AlertsConfig\n\tif err := r.Get(ctx, req.NamespacedName, &alertsConfig); err != nil {\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\t// Check if it is delete request\n\tif !alertsConfig.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\trequeueFlag := false\n\t\t// Delete use case\n\t\tif err := r.HandleDelete(ctx, &alertsConfig); err != nil {\n\t\t\tlog.Error(err, \"unable to delete the alert\")\n\t\t\trequeueFlag = true\n\t\t}\n\t\treturn ctrl.Result{Requeue: requeueFlag}, nil\n\t}\n\n\t//First time use case\n\tif !utils.ContainsString(alertsConfig.ObjectMeta.Finalizers, alertsConfigFinalizerName) {\n\t\tlog.Info(\"New alerts config resource. Adding the finalizer\", \"finalizer\", alertsConfigFinalizerName)\n\n\t\talertsConfig.ObjectMeta.Finalizers = append(alertsConfig.ObjectMeta.Finalizers, alertsConfigFinalizerName)\n\t\tr.CommonClient.UpdateMeta(ctx, &alertsConfig)\n\t\t//That's fine- Let it come for requeue and we can create the alert\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\talertHashMap := alertsConfig.Status.AlertsStatus\n\tglobalMap := alertsConfig.Spec.GlobalParams\n\t// Handle create/update here\n\tfor alertName, config := range alertsConfig.Spec.Alerts {\n\n\t\t// Calculate checksum and compare it with the status checksum\n\t\texist, reqChecksum := utils.CalculateAlertConfigChecksum(ctx, config, globalMap)\n\t\t// if request and status checksum matches then there is NO change in this specific alert config\n\t\tif exist && alertHashMap[alertName].LastChangeChecksum == reqChecksum {\n\t\t\tlog.V(1).Info(\"checksum is equal so there is no change. skipping\", \"alertName\", alertName)\n\t\t\t//skip it\n\t\t\tcontinue\n\t\t}\n\t\t// if there is a diff\n\t\t// Get Alert CR\n\n\t\tvar wfAlert alertmanagerv1alpha1.WavefrontAlert\n\t\twfAlertNamespacedName := types.NamespacedName{Namespace: req.Namespace, Name: alertName}\n\t\tif err := r.Get(ctx, wfAlertNamespacedName, &wfAlert); err != nil {\n\t\t\tlog.Error(err, \"unable to get the wavefront alert details for the requested name\", \"wfAlertName\", alertName)\n\t\t\t// This means wavefront alert itself is not created.\n\t\t\t// There could be 2 use cases\n\t\t\t// 1. There was a race condition if wavefrontalert and alerts config got created 'almost at the same time'\n\t\t\t// 2. Wrong alert name and user is going to correct\n\t\t\t// Ideal way to handle this is to make the alert config status to error and requeue it once in 5 mins or so instead of standard kube builder requeue time\n\t\t\t// Update the status and retry it\n\t\t\treturn r.PatchIndividualAlertsConfigError(ctx, &alertsConfig, alertName, alertmanagerv1alpha1.Error, err)\n\t\t}\n\t\tvar alert wf.Alert\n\t\t//Get the processed wf alert\n\t\t//merge the alerts config global params and individual params\n\t\tparams := utils.MergeMaps(ctx, globalMap, config.Params)\n\n\t\tif err := controllercommon.GetProcessedWFAlert(ctx, &wfAlert, params, &alert); err != nil {\n\t\t\treturn r.PatchIndividualAlertsConfigError(ctx, &alertsConfig, alertName, alertmanagerv1alpha1.Error, err)\n\t\t}\n\t\t// Create/Update Alert\n\t\tif alertHashMap[alertName].ID == \"\" {\n\t\t\t// Create use case\n\t\t\tif err := r.WavefrontClient.CreateAlert(ctx, &alert); err != nil {\n\t\t\t\tr.Recorder.Event(&alertsConfig, v1.EventTypeWarning, err.Error(), \"unable to create the alert\")\n\t\t\t\tstate := alertmanagerv1alpha1.Error\n\t\t\t\tif strings.Contains(err.Error(), \"Exceeded limit setting\") {\n\t\t\t\t\t// For ex: error is \"Exceeded limit setting: 100 alerts allowed per customer\"\n\t\t\t\t\tstate = alertmanagerv1alpha1.ClientExceededLimit\n\t\t\t\t}\n\t\t\t\tlog.Error(err, \"unable to create the alert\")\n\n\t\t\t\treturn r.PatchIndividualAlertsConfigError(ctx, &alertsConfig, alertName, state, err)\n\t\t\t}\n\t\t\talertStatus := alertmanagerv1alpha1.AlertStatus{\n\t\t\t\tID: *alert.ID,\n\t\t\t\tName: alert.Name,\n\t\t\t\tLastChangeChecksum: reqChecksum,\n\t\t\t\tLink: fmt.Sprintf(\"https://%s/alerts/%s\", internalconfig.Props.WavefrontAPIUrl(), *alert.ID),\n\t\t\t\tState: alertmanagerv1alpha1.Ready,\n\t\t\t\tAssociatedAlert: alertmanagerv1alpha1.AssociatedAlert{\n\t\t\t\t\tCR: alertName,\n\t\t\t\t},\n\t\t\t\tAssociatedAlertsConfig: alertmanagerv1alpha1.AssociatedAlertsConfig{\n\t\t\t\t\tCR: alertsConfig.Name,\n\t\t\t\t},\n\t\t\t}\n\t\t\tif err := r.CommonClient.PatchWfAlertAndAlertsConfigStatus(ctx, alertmanagerv1alpha1.Ready, &wfAlert, &alertsConfig, alertStatus); err != nil {\n\t\t\t\tlog.Error(err, \"unable to patch wfalert and alertsconfig status objects\")\n\t\t\t\treturn r.PatchIndividualAlertsConfigError(ctx, &alertsConfig, alertName, alertmanagerv1alpha1.Error, err)\n\t\t\t}\n\t\t\tlog.Info(\"alert successfully got created\", \"alertID\", alert.ID)\n\n\t\t} else {\n\t\t\talertID := alertHashMap[alertName].ID\n\t\t\talert.ID = &alertID\n\t\t\t//TODO: Move this to common so it can be used for both wavefront and alerts config\n\t\t\t//Update use case\n\t\t\tif err := r.WavefrontClient.UpdateAlert(ctx, &alert); err != nil {\n\t\t\t\tr.Recorder.Event(&alertsConfig, v1.EventTypeWarning, err.Error(), \"unable to update the alert\")\n\t\t\t\tstate := alertmanagerv1alpha1.Error\n\t\t\t\tif strings.Contains(err.Error(), \"Exceeded limit setting\") {\n\t\t\t\t\t// For ex: error is \"Exceeded limit setting: 100 alerts allowed per customer\"\n\t\t\t\t\tstate = alertmanagerv1alpha1.ClientExceededLimit\n\t\t\t\t}\n\t\t\t\tlog.Error(err, \"unable to create the alert\")\n\n\t\t\t\treturn r.PatchIndividualAlertsConfigError(ctx, &alertsConfig, alertName, state, err)\n\t\t\t}\n\n\t\t\talertStatus := alertHashMap[alertName]\n\t\t\talertStatus.LastChangeChecksum = reqChecksum\n\n\t\t\tif err := r.CommonClient.PatchWfAlertAndAlertsConfigStatus(ctx, alertmanagerv1alpha1.Ready, &wfAlert, &alertsConfig, alertStatus); err != nil {\n\t\t\t\tlog.Error(err, \"unable to patch wfalert and alertsconfig status objects\")\n\t\t\t\treturn r.PatchIndividualAlertsConfigError(ctx, &alertsConfig, alertName, alertmanagerv1alpha1.Error, err)\n\t\t\t}\n\t\t\tlog.Info(\"alert successfully got updated\", \"alertID\", alert.ID)\n\t\t}\n\t}\n\n\t// Now - lets see if there is any config is removed compared to the status\n\t// If there is any, we need to make a call to delete the alert\n\treturn r.HandleIndividalAlertConfigRemoval(ctx, req.NamespacedName)\n}", "func (r *azureClusterReconciler) Reconcile(ctx context.Context) error {\n\tif err := r.createOrUpdateNetworkAPIServerIP(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to create or update network API server IP for cluster %s in location %s\", r.scope.ClusterName(), r.scope.Location())\n\t}\n\n\tif err := r.setFailureDomainsForLocation(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get availability zones\")\n\t}\n\n\tr.scope.SetControlPlaneIngressRules()\n\n\tif err := r.groupsSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile resource group\")\n\t}\n\n\tif err := r.vnetSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile virtual network\")\n\t}\n\n\tif err := r.securityGroupSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile network security group\")\n\t}\n\n\tif err := r.routeTableSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile route table\")\n\t}\n\n\tif err := r.subnetsSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile subnet\")\n\t}\n\n\tif err := r.publicIPSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile public IP\")\n\t}\n\n\tif err := r.loadBalancerSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile load balancer\")\n\t}\n\n\treturn nil\n}", "func (r *ReconcileRunner) run(ctx context.Context) (ctrl.Result, error) {\n\n\t// Verify that all dependencies are present in the cluster, and they are\n\towner := r.Owner\n\tvar allDeps []*Dependency\n\tif owner != nil {\n\t\tallDeps = append([]*Dependency{owner}, r.Dependencies...)\n\t} else {\n\t\tallDeps = r.Dependencies\n\t}\n\tstatus := r.status\n\tr.dependencies = map[types.NamespacedName]runtime.Object{}\n\n\t// jump out and requeue if any of the dependencies are missing\n\tfor i, dep := range allDeps {\n\t\tinstance := dep.InitialInstance\n\t\terr := r.KubeClient.Get(ctx, dep.NamespacedName, instance)\n\t\tlog := r.log.WithValues(\"Dependency\", dep.NamespacedName)\n\n\t\t// if any of the dependencies are not found, we jump out.\n\t\tif err != nil { // note that dependencies should be an empty array\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tlog.Info(\"Dependency not found for \" + dep.NamespacedName.Name + \". Requeuing request.\")\n\t\t\t} else {\n\t\t\t\tlog.Info(fmt.Sprintf(\"Unable to retrieve dependency for %s: %v\", dep.NamespacedName.Name, err.Error()))\n\t\t\t}\n\t\t\treturn r.applyTransition(ctx, \"Dependency\", Pending, client.IgnoreNotFound(err))\n\t\t}\n\n\t\t// set the owner reference if owner is present and references have not been set\n\t\t// currently we only have single object ownership, but it is poosible to have multiple owners\n\t\tif owner != nil && i == 0 {\n\t\t\tif len(r.objectMeta.GetOwnerReferences()) == 0 {\n\t\t\t\treturn r.setOwner(ctx, instance)\n\t\t\t}\n\t\t\tr.owner = instance\n\t\t}\n\t\tr.dependencies[dep.NamespacedName] = instance\n\n\t\tsucceeded, err := dep.SucceededAccessor(instance)\n\t\tif err != nil {\n\t\t\tlog.Info(fmt.Sprintf(\"Cannot get success state for %s. terminal failure.\", dep.NamespacedName.Name))\n\t\t\t// Fail if cannot get Status accessor for dependency\n\t\t\treturn r.applyTransition(ctx, \"Dependency\", Failed, err)\n\t\t}\n\n\t\tif !succeeded {\n\t\t\tlog.Info(\"One of the dependencies is not in 'Succeeded' state, requeuing\")\n\t\t\treturn r.applyTransition(ctx, \"Dependency\", Pending, nil)\n\t\t}\n\t}\n\t// status = &Status{State: Checking}\n\tr.log.Info(fmt.Sprintf(\"ReconcileState: %s\", status))\n\t// **** checking for termination of dockerfile\n\tif status.IsChecking() {\n\t\treturn r.check(ctx)\n\t}\n\n\t// **** podPreviousPod for termination of dockerfile\n\tif status.IsPodDeleting() {\n\t\treturn r.podDelete(ctx)\n\t}\n\n\tif status.IsCompleted(){\n\t\treturn r.applyTransition(ctx, \"from completed\", Pending, nil)\n\t}\n\n\tif status.IsFailed(){\n\t\treturn r.applyTransition(ctx, \"from failed\", Pending, nil)\n\t}\n\n\t// Verify the resource state\n\tif status.IsVerifying() || status.IsPending() || status.IsSucceeded() || status.IsRecreating() {\n\t\tpodSpec, _ := r.ResourceManager.Verify(ctx)\n\t\tpodValue, err := r.spawnPod(\"verify\", podSpec)\n\t\tfmt.Printf(\"%+v\\n\", err)\n\t\tr.instanceUpdater.setPodConfig(podValue)\n\t\treturn r.applyTransition(ctx, \"Check\", Checking, nil)\n\t}\n\n\t// dependencies are now satisfied, can now reconcile the manifest and create or update the resource\n\tif status.IsCreating() {\n\t\tpodSpec, _ := r.ResourceManager.Create(ctx)\n\t\tpodValue, err := r.spawnPod(\"create\", podSpec)\n\t\tfmt.Printf(\"%+v\\n\", err)\n\t\tr.instanceUpdater.setPodConfig(podValue)\n\t\treturn r.applyTransition(ctx, \"Check\", Checking, nil)\n\t}\n\n\t// **** Updating\n\tif status.IsUpdating() {\n\t\tpodSpec, _ := r.ResourceManager.Update(ctx)\n\t\tpodValue, err := r.spawnPod(\"update\", podSpec)\n\t\tfmt.Printf(\"%+v\\n\", err)\n\t\tr.instanceUpdater.setPodConfig(podValue)\n\t\treturn r.applyTransition(ctx, \"Check\", Checking, nil)\n\t}\n\n\t// **** Completing\n\t// has created or updated, running completion step\n\tif status.IsCompleting() {\n\t\treturn r.runCompletion(ctx)\n\t}\n\n\t// **** Terminating\n\tif status.IsTerminating() {\n\t\tr.log.Info(\"unexpected condition. Terminating state should be handled in finalizer\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// if has no Status, set to pending\n\treturn r.applyTransition(ctx, \"run\", Pending, nil)\n}", "func (r *VisitorsAppReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = log.FromContext(ctx)\n\n\treqlogger := log.Log.WithValues(\"Request.Namespace\", req.Namespace, \"Request.Name\", req.Name)\n\treqlogger.Info(\"Reconciling VisitorApp\")\n\n\t// your logic here\n\n\tv := &webv1.VisitorsApp{}\n\n\terr := r.Get(ctx, req.NamespacedName, v)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tvar result *ctrl.Result\n\n\t// ========== MySQL ====================\n\n\tresult, err = r.ensureSecret(req, v, r.mysqlAuthSecret(v))\n\n\tif err != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureDeployment(req, v, r.mysqlDeployment(v))\n\n\tif err != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureService(req, v, r.mysqlService(v))\n\n\tif err != nil {\n\t\treturn *result, err\n\t}\n\n\tmysqlRunning := r.mysqlIsUp(v)\n\n\tif !mysqlRunning {\n\t\t// If MySQL isn't running yet, requeue the reconcile\n\t\t// to run again after a delay\n\t\tdelay := time.Second * time.Duration(5)\n\n\t\tlog.Log.Info(fmt.Sprintf(\"MySQL isn't running, waiting for %s\", delay))\n\t\treturn ctrl.Result{RequeueAfter: delay}, nil\n\t}\n\n\t// == Visitors Backend ==========\n\tresult, err = r.ensureDeployment(req, v, r.backendDeployment(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureService(req, v, r.backendService(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\terr = r.updateBackendStatus(v)\n\tif err != nil {\n\t\t// Requeue the request if the status could not be updated\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err = r.handleBackendChanges(v)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// == Visitors Frontend ==========\n\tresult, err = r.ensureDeployment(req, v, r.frontendDeployment(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tresult, err = r.ensureService(req, v, r.frontendService(v))\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\terr = r.updateFrontendStatus(v)\n\tif err != nil {\n\t\t// Requeue the request\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err = r.handleFrontendChanges(v)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// == Finish ==========\n\t// Everything went fine, don't requeue\n\n\treturn ctrl.Result{}, nil\n}", "func (r *ErrandReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tr.log.Info(\"Reconciling errand job \", request.NamespacedName)\n\n\tvar result = reconcile.Result{}\n\textJob := &ejv1.ExtendedJob{}\n\n\t// Set the ctx to be Background, as the top-level context for incoming requests.\n\tctx, cancel := context.NewBackgroundContextWithTimeout(r.config.CtxType, r.config.CtxTimeOut)\n\tdefer cancel()\n\n\terr := r.client.Get(ctx, request.NamespacedName, extJob)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// do not requeue, extended job is probably deleted\n\t\t\tr.log.Infof(\"Failed to find extended job '%s', not retrying: %s\", request.NamespacedName, err)\n\t\t\terr = nil\n\t\t\treturn result, err\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tr.log.Errorf(\"Failed to get the extended job '%s': %s\", request.NamespacedName, err)\n\t\treturn result, err\n\t}\n\n\tif extJob.Spec.Trigger.Strategy == ejv1.TriggerNow {\n\t\t// set Strategy back to manual for errand jobs\n\t\textJob.Spec.Trigger.Strategy = ejv1.TriggerManual\n\t\terr = r.client.Update(ctx, extJob)\n\t\tif err != nil {\n\t\t\tr.log.Errorf(\"Failed to revert to 'trigger.strategy=manual' on job '%s': %s\", extJob.Name, err)\n\t\t\treturn result, err\n\t\t}\n\t}\n\n\t// We might want to retrigger an old job due to a config change. In any\n\t// case, if it's an auto-errand, let's keep track of the referenced\n\t// configs and make sure the finalizer is in place to clean up ownership.\n\tif extJob.Spec.UpdateOnConfigChange == true && extJob.Spec.Trigger.Strategy == ejv1.TriggerOnce {\n\t\tr.log.Debugf(\"Synchronizing ownership on configs for extJob '%s' in namespace\", extJob.Name)\n\t\terr := r.owner.Sync(ctx, extJob, extJob.Spec.Template.Spec)\n\t\tif err != nil {\n\t\t\treturn result, errors.Wrapf(err, \"could not synchronize ownership for '%s'\", extJob.Name)\n\t\t}\n\t\tif !finalizer.HasFinalizer(extJob) {\n\t\t\tr.log.Debugf(\"Add finalizer to extendedJob '%s' in namespace '%s'.\", extJob.Name, extJob.Namespace)\n\t\t\tfinalizer.AddFinalizer(extJob)\n\t\t\terr = r.client.Update(ctx, extJob)\n\t\t\tif err != nil {\n\t\t\t\tr.log.Errorf(\"Could not remove finalizer from ExtJob '%s': \", extJob.GetName(), err)\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\n\t\t}\n\t}\n\n\terr = r.createJob(ctx, *extJob)\n\tif err != nil {\n\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\tr.log.Infof(\"Skip '%s' triggered manually: already running\", extJob.Name)\n\t\t\t// we don't want to requeue the job\n\t\t\terr = nil\n\t\t} else {\n\t\t\tr.log.Errorf(\"Failed to create job '%s': %s\", extJob.Name, err)\n\t\t}\n\t\treturn result, err\n\t}\n\tr.log.Infof(\"Created errand job for '%s'\", extJob.Name)\n\n\tif extJob.Spec.Trigger.Strategy == ejv1.TriggerOnce {\n\t\t// traverse Strategy into the final 'done' state\n\t\textJob.Spec.Trigger.Strategy = ejv1.TriggerDone\n\t\terr = r.client.Update(ctx, extJob)\n\t\tif err != nil {\n\t\t\tr.log.Errorf(\"Failed to traverse to 'trigger.strategy=done' on job '%s': %s\", extJob.Name, err)\n\t\t\treturn result, err\n\t\t}\n\t}\n\n\treturn result, err\n}", "func (r *ReconcileCollectd) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling Collectd\")\n\n\t// Fetch the Collectd instance\n\tinstance := &collectdmonv1alpha1.Collectd{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treqLogger.Info(\"Request object not found\")\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Assign the generated resource version to the status\n\tif instance.Status.RevNumber == \"\" {\n\t\tinstance.Status.RevNumber = instance.ObjectMeta.ResourceVersion\n\t\tr.UpdateCondition(instance, \"provision spec to desired state\", reqLogger)\n\t}\n\n\t// Check if serviceaccount already exists, if not create a new one\n\treturnValues := r.ReconcileServiceAccount(instance, reqLogger)\n\tif returnValues.err != nil {\n\t\treturn reconcile.Result{}, err\n\t} else if returnValues.reQueue {\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\t//currentConfigHash, err := r.ReconcileConfigMap(instance, reqLogger)\n\treturnValues = r.ReconcileConfigMapWithHash(instance, reqLogger)\n\tif returnValues.err != nil {\n\t\treturn reconcile.Result{}, err\n\t} else if returnValues.reQueue {\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\t//desiredConfigMap := &corev1.ConfigMap{} // where to ge desired configmap\n\t//eq := reflect.DeepEqual(currentConfigMap, currentConfigMap)\n\t//currentConfigHash\n\treturnValues = r.ReconcileDeployment(instance, returnValues.hash256String, reqLogger)\n\tif returnValues.err != nil {\n\t\treturn reconcile.Result{}, err\n\t} else if returnValues.reQueue {\n\t\treturn reconcile.Result{Requeue: true}, nil\n\t}\n\n\t//size := instance.Spec.DeploymentPlan.Size\n\n\t// Pod already exists - don't requeue\n\n\treturn reconcile.Result{}, nil\n}", "func (r *reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {\n\tlog := r.log.With(\"request\", request)\n\tlog.Debug(\"Reconciling\")\n\n\tresourceQuota := &kubermaticv1.ResourceQuota{}\n\tif err := r.masterClient.Get(ctx, request.NamespacedName, resourceQuota); err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to get resource quota %q: %w\", resourceQuota.Name, err)\n\t}\n\n\terr := r.reconcile(ctx, resourceQuota, log)\n\tif err != nil {\n\t\tlog.Errorw(\"ReconcilingError\", zap.Error(err))\n\t\tr.recorder.Event(resourceQuota, corev1.EventTypeWarning, \"ReconcilingError\", err.Error())\n\t}\n\n\treturn reconcile.Result{}, err\n}", "func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tctx := context.TODO()\n\tlogger := logging.FromContext(ctx)\n\n\tlogger.Infof(\"Reconciling %s %v\", r.provider.Parent.GetObjectKind(), request)\n\n\tobj := r.provider.Parent.DeepCopyObject()\n\n\terr := r.client.Get(context.TODO(), request.NamespacedName, obj)\n\n\tif errors.IsNotFound(err) {\n\t\tlogger.Errorf(\"could not find %s %v\\n\", r.provider.Parent.GetObjectKind(), request)\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tif err != nil {\n\t\tlogger.Errorf(\"could not fetch %s %v for %+v\\n\", r.provider.Parent.GetObjectKind(), err, request)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\toriginal := obj.DeepCopyObject()\n\n\t// Reconcile this copy of the Source and then write back any status\n\t// updates regardless of whether the reconcile error out.\n\tobj, err = r.provider.Reconciler.Reconcile(ctx, obj)\n\tif err != nil {\n\t\tlogger.Warnf(\"Failed to reconcile %s: %v\", r.provider.Parent.GetObjectKind(), err)\n\t}\n\n\tif chg, err := r.statusHasChanged(ctx, original, obj); err != nil || !chg {\n\t\t// If we didn't change anything then don't call updateStatus.\n\t\t// This is important because the copy we loaded from the informer's\n\t\t// cache may be stale and we don't want to overwrite a prior update\n\t\t// to status with this stale state.\n\t\treturn reconcile.Result{}, err\n\t} else if _, err := r.updateStatus(ctx, request, obj); err != nil {\n\t\tlogger.Warnf(\"Failed to update %s status: %v\", r.provider.Parent.GetObjectKind(), err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Requeue if the resource is not ready:\n\treturn reconcile.Result{}, err\n}", "func (r *ReconcileThreeScale) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tlog.Printf(\"Reconciling ThreeScale %s/%s\\n\", request.Namespace, request.Name)\n\n\t// Fetch the ThreeScale instance\n\tinstance := &threescalev1alpha1.ThreeScale{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif k8errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tswitch instance.Status.Phase {\n\tcase threescalev1alpha1.NoPhase:\n\t\ttsState, err := r.Initialise(instance)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, errors.Wrap(err, \"failed to init resource\")\n\t\t}\n\t\treturn reconcile.Result{Requeue: true}, r.client.Update(context.TODO(), tsState)\n\tcase threescalev1alpha1.PhaseProvisionCredentials:\n\t\ttsState, err := r.Credentials(instance)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, errors.Wrap(err, \"phase provision credentials failed\")\n\t\t}\n\t\treturn reconcile.Result{Requeue: true}, r.client.Update(context.TODO(), tsState)\n\tcase threescalev1alpha1.PhaseReconcileThreescale:\n\t\ttsState, err := r.ReconcileThreeScale(instance)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"phase reconcile threescale failed: %+v\", err)\n\t\t\treturn reconcile.Result{}, errors.Wrap(err, \"phase reconcile threescale failed\")\n\t\t}\n\t\tresyncDuration := time.Second * time.Duration(60)\n\t\treturn reconcile.Result{Requeue: true, RequeueAfter: resyncDuration}, r.client.Update(context.TODO(), tsState)\n\t}\n\n\treturn reconcile.Result{Requeue: true}, nil\n}", "func (r *FooReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\tctx := context.Background()\n\tlogger := r.Log.WithValues(\"foo\", req.NamespacedName)\n\n\tlogger.V(1).Info(\"foo reconcile begin...\")\n\tvar foo sampleoperatorv1alpha1.Foo\n\tif err := r.Get(ctx, req.NamespacedName, &foo); err != nil {\n\t\tlogger.Error(err, \"unable to fetch foo\")\n\t\t// we'll ignore not-found errors, since they can't be fixed by an immediate\n\t\t// requeue (we'll need to wait for a new notification), and we can get them\n\t\t// on deleted requests.\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tdeploymentName := foo.Spec.DeploymentName\n\tif deploymentName == \"\" {\n\t\t// We choose to absorb the error here as the worker would requeue the\n\t\t// resource otherwise. Instead, the next time the resource is updated\n\t\t// the resource will be queued again.\n\t\treturn ctrl.Result{}, fmt.Errorf(\"BlankDeploymentName\")\n\t}\n\n\tscheduledResult := ctrl.Result{RequeueAfter: time.Second * 5} // save this so we can re-use it elsewhere\n\n\tvar deployment appsv1.Deployment\n\tif err := r.Get(ctx, namespacedName(req.Namespace, deploymentName), &deployment); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tif err = r.Create(ctx, newDeployment(&foo)); err != nil {\n\t\t\t\treturn scheduledResult, fmt.Errorf(\"FoosDeploymentCreateFailed\")\n\t\t\t}\n\t\t} else {\n\t\t\treturn scheduledResult, fmt.Errorf(\"FoosDeploymentNotFound\")\n\t\t}\n\t}\n\t// If the Deployment is not controlled by this Foo resource, we should log\n\t// a warning to the event recorder and return error msg.\n\tif !metav1.IsControlledBy(&deployment, &foo) {\n\t\tmsg := fmt.Sprintf(MessageResourceExists, deployment.Name)\n\t\treturn ctrl.Result{}, fmt.Errorf(msg)\n\t}\n\n\t// If this number of the replicas on the Foo resource is specified, and the\n\t// number does not equal the current desired replicas on the Deployment, we\n\t// should update the Deployment resource.\n\tif foo.Spec.Replicas != nil && *foo.Spec.Replicas != *deployment.Spec.Replicas {\n\t\tlogger.V(4).Info(fmt.Sprintf(\"Foo %s replicas: %d, deployment replicas: %d\",\n\t\t\treq.NamespacedName, *foo.Spec.Replicas, *deployment.Spec.Replicas))\n\t\tif err := r.Update(ctx, newDeployment(&foo)); err != nil {\n\t\t\treturn scheduledResult, fmt.Errorf(\"FoosDeploymentUpdateFailed\")\n\t\t}\n\t}\n\tif err := r.updateFooStatus(ctx, &foo, &deployment); err != nil {\n\t\treturn scheduledResult, err\n\t}\n\treturn ctrl.Result{}, nil\n}", "func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error) {\n\tlog := r.log.WithValues(strings.ToLower(r.gvk.Kind), req.NamespacedName)\n\tlog.V(1).Info(\"Reconciliation triggered\")\n\n\tobj := &unstructured.Unstructured{}\n\tobj.SetGroupVersionKind(*r.gvk)\n\terr = r.client.Get(ctx, req.NamespacedName, obj)\n\tif apierrors.IsNotFound(err) {\n\t\tlog.V(1).Info(\"Resource %s/%s not found, nothing to do\", req.NamespacedName.Namespace, req.NamespacedName.Name)\n\t\treturn ctrl.Result{}, nil\n\t}\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tu := updater.New(r.client)\n\tdefer func() {\n\t\tapplyErr := u.Apply(ctx, obj)\n\t\tif err == nil && !apierrors.IsNotFound(applyErr) {\n\t\t\terr = applyErr\n\t\t}\n\t}()\n\n\tactionClient, err := r.actionClientGetter.ActionClientFor(obj)\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingClient, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeDeployed),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeInitialized),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\tupdater.EnsureDeployedRelease(nil),\n\t\t)\n\t\t// NOTE: If obj has the uninstall finalizer, that means a release WAS deployed at some point\n\t\t// in the past, but we don't know if it still is because we don't have an actionClient to check.\n\t\t// So the question is, what do we do with the finalizer? We could:\n\t\t// - Leave it in place. This would make the CR impossible to delete without either resolving this error, or\n\t\t// manually uninstalling the release, deleting the finalizer, and deleting the CR.\n\t\t// - Remove the finalizer. This would make it possible to delete the CR, but it would leave around any\n\t\t// release resources that are not owned by the CR (those in the cluster scope or in other namespaces).\n\t\t//\n\t\t// The decision made for now is to leave the finalizer in place, so that the user can intervene and try to\n\t\t// resolve the issue, instead of the operator silently leaving some dangling resources hanging around after the\n\t\t// CR is deleted.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// As soon as we get the actionClient, lookup the release and\n\t// update the status with this info. We need to do this as\n\t// early as possible in case other irreconcilable errors occur.\n\t//\n\t// We also make sure not to return any errors we encounter so\n\t// we can still attempt an uninstall if the CR is being deleted.\n\trel, err := actionClient.Get(obj.GetName())\n\tif errors.Is(err, driver.ErrReleaseNotFound) {\n\t\tu.UpdateStatus(updater.EnsureCondition(conditions.Deployed(corev1.ConditionFalse, \"\", \"\")))\n\t} else if err == nil {\n\t\tensureDeployedRelease(&u, rel)\n\t}\n\tu.UpdateStatus(updater.EnsureCondition(conditions.Initialized(corev1.ConditionTrue, \"\", \"\")))\n\n\tif obj.GetDeletionTimestamp() != nil {\n\t\terr := r.handleDeletion(ctx, actionClient, obj, log)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tvals, err := r.getValues(ctx, obj)\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingValues, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trel, state, err := r.getReleaseState(actionClient, obj, vals.AsMap())\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingReleaseState, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeDeployed),\n\t\t\tupdater.EnsureDeployedRelease(nil),\n\t\t)\n\t\treturn ctrl.Result{}, err\n\t}\n\tu.UpdateStatus(updater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionFalse, \"\", \"\")))\n\n\tfor _, h := range r.preHooks {\n\t\tif err := h.Exec(obj, vals, log); err != nil {\n\t\t\tlog.Error(err, \"pre-release hook failed\")\n\t\t}\n\t}\n\n\tswitch state {\n\tcase stateNeedsInstall:\n\t\trel, err = r.doInstall(actionClient, &u, obj, vals.AsMap(), log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\tcase stateNeedsUpgrade:\n\t\trel, err = r.doUpgrade(actionClient, &u, obj, vals.AsMap(), log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\tcase stateUnchanged:\n\t\tif err := r.doReconcile(actionClient, &u, rel, log); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\tdefault:\n\t\treturn ctrl.Result{}, fmt.Errorf(\"unexpected release state: %s\", state)\n\t}\n\n\tfor _, h := range r.postHooks {\n\t\tif err := h.Exec(obj, *rel, log); err != nil {\n\t\t\tlog.Error(err, \"post-release hook failed\", \"name\", rel.Name, \"version\", rel.Version)\n\t\t}\n\t}\n\n\tensureDeployedRelease(&u, rel)\n\tu.UpdateStatus(\n\t\tupdater.EnsureCondition(conditions.ReleaseFailed(corev1.ConditionFalse, \"\", \"\")),\n\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionFalse, \"\", \"\")),\n\t)\n\n\treturn ctrl.Result{RequeueAfter: r.reconcilePeriod}, nil\n}", "func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error) {\n\tlog.V(logging.Debug).Info(\"reconciling\", \"kind\", v1alpha1.ReplicationGroupKindAPIVersion, \"request\", req)\n\n\tctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)\n\tdefer cancel()\n\n\trd := &v1alpha1.ReplicationGroup{}\n\tif err := r.kube.Get(ctx, req.NamespacedName, rd); err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{Requeue: false}, nil\n\t\t}\n\t\treturn reconcile.Result{Requeue: false}, errors.Wrapf(err, \"cannot get resource %s\", req.NamespacedName)\n\t}\n\n\tclient, err := r.Connect(ctx, rd)\n\tif err != nil {\n\t\trd.Status.SetFailed(reasonFetchingClient, err.Error())\n\t\treturn reconcile.Result{Requeue: true}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource has been deleted from the API server. Delete from AWS.\n\tif rd.DeletionTimestamp != nil {\n\t\treturn reconcile.Result{Requeue: client.Delete(ctx, rd)}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The group is unnamed. Assume it has not been created in AWS.\n\tif rd.Status.GroupName == \"\" {\n\t\trequeue, authToken := client.Create(ctx, rd)\n\t\tif err := r.upsertSecret(ctx, connectionSecretWithPassword(rd, authToken)); err != nil {\n\t\t\trd.Status.SetFailed(reasonSyncingSecret, err.Error())\n\t\t\trequeue = true\n\t\t}\n\t\treturn reconcile.Result{Requeue: requeue}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\tif err := r.upsertSecret(ctx, connectionSecret(rd)); err != nil {\n\t\trd.Status.SetFailed(reasonSyncingSecret, err.Error())\n\t\treturn reconcile.Result{Requeue: true}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource exists in the API server and AWS. Sync it.\n\treturn reconcile.Result{Requeue: client.Sync(ctx, rd)}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n}", "func (r *ReconcileContainerJFR) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling ContainerJFR\")\n\n\t// Fetch the ContainerJFR instance\n\tinstance := &rhjmcv1alpha1.ContainerJFR{}\n\terr := r.client.Get(context.Background(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treqLogger.Info(\"ContainerJFR instance not found\")\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treqLogger.Error(err, \"Error reading ContainerJFR instance\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treqLogger.Info(\"Spec\", \"Minimal\", instance.Spec.Minimal)\n\n\tpvc := resources.NewPersistentVolumeClaimForCR(instance)\n\tif err := controllerutil.SetControllerReference(instance, pvc, r.scheme); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif err = r.createObjectIfNotExists(context.Background(), types.NamespacedName{Name: pvc.Name, Namespace: pvc.Namespace}, &corev1.PersistentVolumeClaim{}, pvc); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tgrafanaSecret := resources.NewGrafanaSecretForCR(instance)\n\tif err := controllerutil.SetControllerReference(instance, grafanaSecret, r.scheme); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif err = r.createObjectIfNotExists(context.Background(), types.NamespacedName{Name: grafanaSecret.Name, Namespace: grafanaSecret.Namespace}, &corev1.Secret{}, grafanaSecret); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tjmxAuthSecret := resources.NewJmxSecretForCR(instance)\n\tif err := controllerutil.SetControllerReference(instance, jmxAuthSecret, r.scheme); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif err = r.createObjectIfNotExists(context.Background(), types.NamespacedName{Name: jmxAuthSecret.Name, Namespace: jmxAuthSecret.Namespace}, &corev1.Secret{}, jmxAuthSecret); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Set up TLS using cert-manager, if available\n\tprotocol := \"http\"\n\tvar tlsConfig *resources.TLSConfig\n\tvar routeTLS *openshiftv1.TLSConfig\n\tif r.IsCertManagerEnabled() {\n\t\ttlsConfig, err = r.setupTLS(context.Background(), instance)\n\t\tif err != nil {\n\t\t\tif err == common.ErrCertNotReady {\n\t\t\t\treturn reconcile.Result{RequeueAfter: 5 * time.Second}, nil\n\t\t\t}\n\t\t\treqLogger.Error(err, \"Failed to set up TLS for Container JFR\")\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\t\t// Get CA certificate from secret and set as destination CA in route\n\t\tcaCert, err := r.GetContainerJFRCABytes(context.Background(), instance)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\trouteTLS = &openshiftv1.TLSConfig{\n\t\t\tTermination: openshiftv1.TLSTerminationReencrypt,\n\t\t\tDestinationCACertificate: string(caCert),\n\t\t}\n\t\tprotocol = \"https\"\n\t}\n\n\tserviceSpecs := &resources.ServiceSpecs{}\n\tif !instance.Spec.Minimal {\n\t\tgrafanaSvc := resources.NewGrafanaService(instance)\n\t\turl, err := r.createService(context.Background(), instance, grafanaSvc, &grafanaSvc.Spec.Ports[0], routeTLS)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tserviceSpecs.GrafanaAddress = fmt.Sprintf(\"%s://%s\", protocol, url)\n\n\t\t// check for existing minimal deployment and delete if found\n\t\tdeployment := resources.NewDeploymentForCR(instance, serviceSpecs, nil)\n\t\terr = r.client.Get(context.Background(), types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}, deployment)\n\t\tif err == nil && len(deployment.Spec.Template.Spec.Containers) == 1 {\n\t\t\treqLogger.Info(\"Deleting existing minimal deployment\")\n\t\t\terr = r.client.Delete(context.Background(), deployment)\n\t\t\tif err != nil && !errors.IsNotFound(err) {\n\t\t\t\treturn reconcile.Result{Requeue: true, RequeueAfter: time.Second * 10}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// check for existing non-minimal resources and delete if found\n\t\tsvc := resources.NewGrafanaService(instance)\n\t\treqLogger.Info(\"Deleting existing non-minimal route\", \"route.Name\", svc.Name)\n\t\troute := &openshiftv1.Route{}\n\t\terr = r.client.Get(context.Background(), types.NamespacedName{Name: svc.Name, Namespace: svc.Namespace}, route)\n\t\tif err != nil && !errors.IsNotFound(err) {\n\t\t\treqLogger.Info(\"Non-minimal route could not be retrieved\", \"route.Name\", svc.Name)\n\t\t\treturn reconcile.Result{}, err\n\t\t} else if err == nil {\n\t\t\terr = r.client.Delete(context.Background(), route)\n\t\t\tif err != nil && !errors.IsNotFound(err) {\n\t\t\t\treqLogger.Info(\"Could not delete non-minimal route\", \"route.Name\", svc.Name)\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\n\t\terr = r.client.Get(context.Background(), types.NamespacedName{Name: svc.Name, Namespace: svc.Namespace}, svc)\n\t\tif err == nil {\n\t\t\treqLogger.Info(\"Deleting existing non-minimal service\", \"svc.Name\", svc.Name)\n\t\t\terr = r.client.Delete(context.Background(), svc)\n\t\t\tif err != nil && !errors.IsNotFound(err) {\n\t\t\t\treqLogger.Info(\"Could not delete non-minimal service\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\n\t\tdeployment := resources.NewDeploymentForCR(instance, serviceSpecs, nil)\n\t\terr = r.client.Get(context.Background(), types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}, deployment)\n\t\tif err == nil && len(deployment.Spec.Template.Spec.Containers) > 1 {\n\t\t\treqLogger.Info(\"Deleting existing non-minimal deployment\")\n\t\t\terr = r.client.Delete(context.Background(), deployment)\n\t\t\tif err != nil && !errors.IsNotFound(err) {\n\t\t\t\treqLogger.Info(\"Could not delete non-minimal deployment\")\n\t\t\t\treturn reconcile.Result{Requeue: true, RequeueAfter: time.Second * 10}, err\n\t\t\t}\n\t\t}\n\t}\n\n\texporterSvc := resources.NewExporterService(instance)\n\turl, err := r.createService(context.Background(), instance, exporterSvc, &exporterSvc.Spec.Ports[0], routeTLS)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tserviceSpecs.CoreAddress = url\n\n\tcmdChanSvc := resources.NewCommandChannelService(instance)\n\turl, err = r.createService(context.Background(), instance, cmdChanSvc, &cmdChanSvc.Spec.Ports[0], routeTLS)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tserviceSpecs.CommandAddress = url\n\n\tdeployment := resources.NewDeploymentForCR(instance, serviceSpecs, tlsConfig)\n\tif err := controllerutil.SetControllerReference(instance, deployment, r.scheme); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif err = r.createObjectIfNotExists(context.Background(), types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}, &appsv1.Deployment{}, deployment); err != nil {\n\t\treqLogger.Error(err, \"Could not create deployment\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treqLogger.Info(\"Skip reconcile: Deployment already exists\", \"Deployment.Namespace\", deployment.Namespace, \"Deployment.Name\", deployment.Name)\n\treturn reconcile.Result{}, nil\n}", "func (r *RedisReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"redis\", req.NamespacedName)\n\n\t// Fetch the Redis instance\n\tredis := &redisv1alpha1.Redis{}\n\terr := r.Get(ctx, req.NamespacedName, redis)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use\n\t\t\t// final\n\n\t\t\t// Return and don't requeue\n\t\t\tlog.Info(\"Redis resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get Redis - reque the request.\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Does the StatefulSet exist?\n\tctxtError := []interface{}{\"Redis.Name\", redis.Name, \"Redis.Namespace\", redis.Namespace, \"Redis.Size\",\n\t\tredis.Spec.Size}\n\tfound := &appsv1.StatefulSet{}\n\terr = r.Get(ctx, types.NamespacedName{Name: redis.Name, Namespace: redis.Namespace}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tss := r.statefulSetForRedis(redis)\n\t\tlog.Info(\"Creating a new StatefulSet\", ctxtError...)\n\t\t// We can change create for path. Is it better?\n\t\terr = r.Create(ctx, ss)\n\t\tif err != nil {\n\t\t\terrorSS := []interface{}{\"StatefulSet.Name\", ss.Name, \"StatefulSet.Namespace\", ss.Namespace}\n\t\t\terrorSS = append(errorSS, ctxtError...)\n\t\t\tlog.Error(err, \"Failed to create new StatefulSet\", errorSS)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\t// StatefulSet created successfully - return and requeue\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t} else if err != nil {\n\t\tlog.Error(err, \"Failed to get StatefulSet\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Redis Size == StatefulSet Replicas?\n\tctxtError = append(ctxtError, []interface{}{\"StatefulSet.Name\", found.Name, \"StatefulSet.Replicas\", *found.Spec.Replicas}...)\n\tif *found.Spec.Replicas != redis.Spec.Size {\n\t\t// applyOpts := []client.PatchOption{client.ForceOwnership, client.FieldOwner(\"guestbook\")}\n\t\tlog.Info(\"Fixing replicas mismatch:\", ctxtError...)\n\t\t*found.Spec.Replicas = redis.Spec.Size\n\t\t// *&found.ManagedFields = nil\n\t\t// if err := r.Patch(ctx, found, client.Apply, []client.PatchOption{}...); err != nil {\n\t\t// options := client.PatchOption{}\n\t\t// \"PatchOptions.meta.k8s.io \\\"\\\" is invalid: fieldManager: Required value:\n\t\t// is required for apply patch\"\n\t\t// \"error\": \"metadata.managedFields must be nil\"}\n\t\t// option := &client.PatchOptions{FieldManager: \"main\"}\n\t\t// if err := r.Patch(ctx, found, client.Apply, option); err != nil {\n\t\tif err := r.Update(ctx, found); err != nil {\n\t\t\tlog.Error(err, \"Failed fixing replicas mismatch\", ctxtError...)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\terr := fmt.Errorf(\"Mismatch StatefulSet replicas and Redis size: %+v\", ctxtError...)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Are StatefulSet Pods OK?\n\tif found.Status.ReadyReplicas != redis.Spec.Size {\n\t\t// log.Info(\"Waiting for pods to be ready...\", ctxtError...)\n\t\terr := fmt.Errorf(\"Waiting for Redis pods: %v\", ctxtError...)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// TODO: Add state to status: creating, configuring, running...\n\t// The Redis Pod are in cluster?\n\t// I do cluster meet because it have less cost that answer the nodes their pairs\n\tlog.Info(\"Begining the Redis operations...\", ctxtError...)\n\t// get pod names\n\tpodList := &corev1.PodList{}\n\tlistOpts := []client.ListOption{\n\t\tclient.InNamespace(redis.Namespace),\n\t\tclient.MatchingLabels(labelsForRedis(redis.Name)),\n\t}\n\tif err = r.List(ctx, podList, listOpts...); err != nil {\n\t\tlog.Error(err, \"Failed to list pods\", \"Redis.Namespace\", redis.Namespace, \"Redis.Name\", redis.Name)\n\t\treturn ctrl.Result{}, err\n\t}\n\torderedNodes := k8sutils.NewOrderedNodes(podList.Items)\n\terr = redisutil.ConfigureClusterMode(ctx, orderedNodes.IPs())\n\tif err != nil {\n\t\tlog.Error(err, \"Failed when cofiguring cluster meet\", \"Redis.Namespace\", redis.Namespace, \"Redis.Name\", redis.Name)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// The Slots are assigned?\n\terr = redisutil.ConfigureSlots(ctx, orderedNodes.IPs())\n\n\t// Update status.Nodes if needed\n\tpodNames := orderedNodes.PodNames()\n\tif !reflect.DeepEqual(podNames, redis.Status.Nodes) {\n\t\tredis.Status.Nodes = podNames\n\t\terr := r.Status().Update(ctx, redis)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to update Redis status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}" ]
[ "0.70951104", "0.69379985", "0.6850759", "0.68152356", "0.6779929", "0.6651518", "0.66300046", "0.65981275", "0.65680367", "0.6535361", "0.6516323", "0.647457", "0.6458935", "0.6458045", "0.64567465", "0.64537126", "0.6450495", "0.6439703", "0.64050883", "0.6394995", "0.636814", "0.63461995", "0.63155425", "0.6303695", "0.62964267", "0.62961066", "0.629147", "0.62758416", "0.62667567", "0.626356", "0.62315345", "0.6214237", "0.6211708", "0.6206764", "0.62050843", "0.61898935", "0.6188031", "0.61873907", "0.61621046", "0.61605376", "0.6152661", "0.6124132", "0.61233103", "0.6111337", "0.6105444", "0.60846764", "0.6081556", "0.6068248", "0.60680974", "0.6056784", "0.60472476", "0.6047037", "0.60407174", "0.60310245", "0.60304505", "0.60260975", "0.6025752", "0.6020113", "0.60182524", "0.60036075", "0.59937155", "0.5991065", "0.5990705", "0.5972966", "0.5972334", "0.5970742", "0.5966618", "0.5964605", "0.5957004", "0.5951674", "0.5947448", "0.59418267", "0.5941296", "0.5936885", "0.59364146", "0.59355795", "0.59333265", "0.5932822", "0.5932633", "0.59266543", "0.5918952", "0.59167707", "0.5916465", "0.59126675", "0.5911711", "0.590746", "0.5902503", "0.5901707", "0.58952683", "0.58913195", "0.5883384", "0.58787465", "0.5864487", "0.5852962", "0.5852582", "0.5847758", "0.5847754", "0.58368605", "0.58333504", "0.5828384" ]
0.6573673
8
Deprecated: Use Float32Value.ProtoReflect.Descriptor instead.
func (*Float32Value) Descriptor() ([]byte, []int) { return file_proto_value_value_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*FloatValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{1}\n}", "func (*UInt32Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{5}\n}", "func (*Int32Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{4}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func (*FloatRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_calc_proto_rawDescGZIP(), []int{2}\n}", "func (*Int32Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_value_value_proto_rawDescGZIP(), []int{1}\n}", "func Float32(k string, v float32) Field {\n\treturn Field{Key: k, Value: valf.Float32(v)}\n}", "func (*DoubleValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{0}\n}", "func (*Number) Descriptor() ([]byte, []int) {\n\treturn file_pb_calculator_proto_rawDescGZIP(), []int{1}\n}", "func (*FloatResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_calc_proto_rawDescGZIP(), []int{3}\n}", "func ConstFloats32(k string, v []float32) Field {\n\treturn Field{Key: k, Value: valf.ConstFloats32(v)}\n}", "func toProtoSingular(fd protoreflect.FieldDescriptor, v starlark.Value) protoreflect.Value {\n\t// See https://godoc.org/google.golang.org/protobuf/reflect/protoreflect#Kind\n\t// Also https://developers.google.com/protocol-buffers/docs/proto#scalar\n\tswitch kind := fd.Kind(); kind {\n\tcase protoreflect.BoolKind:\n\t\treturn protoreflect.ValueOf(bool(v.(starlark.Bool)))\n\n\tcase protoreflect.EnumKind:\n\t\treturn protoreflect.ValueOf(protoreflect.EnumNumber(starlarkToInt(v, kind, math.MinInt32, math.MaxInt32)))\n\n\tcase protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:\n\t\treturn protoreflect.ValueOf(int32(starlarkToInt(v, kind, math.MinInt32, math.MaxInt32)))\n\n\tcase protoreflect.Uint32Kind, protoreflect.Fixed32Kind:\n\t\treturn protoreflect.ValueOf(uint32(starlarkToUint(v, kind, math.MaxUint32)))\n\n\tcase protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:\n\t\treturn protoreflect.ValueOf(int64(starlarkToInt(v, kind, math.MinInt64, math.MaxInt64)))\n\n\tcase protoreflect.Uint64Kind, protoreflect.Fixed64Kind:\n\t\treturn protoreflect.ValueOf(uint64(starlarkToUint(v, kind, math.MaxUint64)))\n\n\tcase protoreflect.FloatKind:\n\t\treturn protoreflect.ValueOf(float32(v.(starlark.Float)))\n\n\tcase protoreflect.DoubleKind:\n\t\treturn protoreflect.ValueOf(float64(v.(starlark.Float)))\n\n\tcase protoreflect.StringKind:\n\t\treturn protoreflect.ValueOf(v.(starlark.String).GoString())\n\n\tcase protoreflect.BytesKind:\n\t\treturn protoreflect.ValueOf([]byte(v.(starlark.String).GoString()))\n\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\treturn protoreflect.ValueOf(v.(*Message).ToProto())\n\n\tdefault:\n\t\tpanic(fmt.Errorf(\"internal error: unexpected field kind %s\", fd.Kind()))\n\t}\n}", "func (*Type_FunctionType) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 2}\n}", "func Float32(key string, val float32) Field {\n\treturn Field{Key: key, Type: core.Float32Type, Integer: int64(math.Float32bits(val))}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (ContactPointUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{49, 0}\n}", "func (f genHelperDecoder) DecDecodeFloat32() float32 { return f.d.decodeFloat32() }", "func (*LayerNumber) Descriptor() ([]byte, []int) {\n\treturn file_spacemesh_v1_types_proto_rawDescGZIP(), []int{16}\n}", "func (*Numbers) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{1}\n}", "func (Type_PrimitiveType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Number) Descriptor() ([]byte, []int) {\n\treturn file_drill_exercise_1_filter_protobuf_filter_proto_rawDescGZIP(), []int{0}\n}", "func (*FeatureValue_Metadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_featurestore_online_service_proto_rawDescGZIP(), []int{6, 0}\n}", "func (p Pointer) Float32LE(offset int) float32 {\n\treturn *(*float32)(unsafe.Pointer(uintptr(int(p) + offset)))\n}", "func Float32(v *Value, def float32) float32 {\n\tf, err := v.Float32()\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn f\n}", "func (Instant_Precision) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{7, 0}\n}", "func (tv *TypedFloat) Float32() float32 {\n\tif len(tv.Bytes) == 0 {\n\t\treturn 0.0\n\t}\n\tvar value big.Float\n\t_ = value.GobDecode(tv.Bytes)\n\tflt32, _ := value.Float32()\n\treturn flt32\n}", "func (*Number) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{0}\n}", "func (NumberType) EnumDescriptor() ([]byte, []int) {\n\treturn file_stats_stats_proto_rawDescGZIP(), []int{6}\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func Float32Ptr(v float32) *float32 { return &v }", "func (e Enumset) Float32() Meta {\n\treturn Float32Enumerator{\n\t\tIntegerEnumerator{\n\t\t\tEnumerator{e, &sync.Mutex{}, len(e) != 0},\n\t\t\tfu.KeysOf((map[string]int)(e)).([]string),\n\t\t}}\n}", "func (t *Type) Float32(defaultValue ...float32) Float32Accessor {\n\tnv := &NullFloat32{}\n\tif nv.Error = t.err; t.err != nil {\n\t\treturn nv\n\t}\n\tvalueTo := t.toFloat(reflect.Float32)\n\tnv = &NullFloat32{Float32Common{Error: valueTo.Err()}}\n\tif defaultFloat32(nv, defaultValue...) {\n\t\treturn nv\n\t}\n\tv := float32(valueTo.V())\n\tnv.P = &v\n\treturn nv\n}", "func (*FieldMask) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_types_known_field_mask_proto_rawDescGZIP(), []int{0}\n}", "func (d DataView) Float32(offset uint, littleEndian bool) float32 {\n\tvar decoding binary.ByteOrder\n\tif littleEndian {\n\t\tdecoding = binary.LittleEndian\n\t} else {\n\t\tdecoding = binary.BigEndian\n\t}\n\tbits := decoding.Uint32(d[offset:])\n\treturn math.Float32frombits(bits)\n}", "func (*Amount) Descriptor() ([]byte, []int) {\n\treturn file_spacemesh_v1_types_proto_rawDescGZIP(), []int{2}\n}", "func Floats32(k string, v []float32) Field {\n\treturn Field{Key: k, Value: valf.Floats32(v)}\n}", "func (*ConstantSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{3}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Values) Descriptor() ([]byte, []int) {\n\treturn file_calculator_proto_rawDescGZIP(), []int{0}\n}", "func (*Metrics) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "func (*TypedValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{2}\n}", "func (NameUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{56, 0}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*ContactPointUseCode) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{49}\n}", "func (*NumberProperty) Descriptor() ([]byte, []int) {\n\treturn file_furo_property_proto_rawDescGZIP(), []int{1}\n}", "func (*AllowedValues) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{3}\n}", "func (*Values) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{12}\n}", "func Float32(v float32) *float32 {\n\treturn &v\n}", "func Float32(v float32) *float32 {\n\treturn &v\n}", "func Float32(v float32) *float32 {\n\treturn &v\n}", "func (*FeatureValue) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_featurestore_online_service_proto_rawDescGZIP(), []int{6}\n}", "func (Function_Func) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{1, 0}\n}", "func GetFloat32(key string) float32 {\n\treturn v.GetFloat32(key)\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*Telemetry) Descriptor() ([]byte, []int) {\n\treturn file_protocol_proto_rawDescGZIP(), []int{0}\n}", "func (AddressUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{47, 0}\n}", "func (DateTime_Precision) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{4, 0}\n}", "func (*Fields) Descriptor() ([]byte, []int) {\n\treturn file_cgentron_api_fields_proto_rawDescGZIP(), []int{0}\n}", "func (*VectorClock) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{3}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{44}\n}", "func (*Entity_CompatibilityStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{11, 0}\n}", "func (*MetadataProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{7}\n}", "func (e Entry) Float32(key string, value float32) (entry Entry) {\n\te.Float64(key, float64(value))\n\treturn e\n}", "func (f Float) Float32() float32 {\n\tpanic(\"not yet implemented\")\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*Entity_CompatibilityStatus_Compatibility) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{11, 0, 0}\n}", "func (RefType) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_trace_common_proto_rawDescGZIP(), []int{1}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func UintFloat32(from uint64, defaultValue ...float32) Float32Accessor {\n\tnv := &NullFloat32{}\n\tif safe := isSafeUintToFloat(from, 32); !safe {\n\t\tnv.Error = ErrConvert\n\t\tif defaultFloat32(nv, defaultValue...) {\n\t\t\treturn nv\n\t\t}\n\t}\n\tv := float32(from)\n\tnv.P = &v\n\treturn nv\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{5}\n}", "func (*Decl_FunctionDecl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2, 1}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*Extension_ValueX) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{41, 0}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*PredictionValues) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{2}\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_mtpc_proto_rawDescGZIP(), []int{6}\n}", "func (*Layer) Descriptor() ([]byte, []int) {\n\treturn file_spacemesh_v1_types_proto_rawDescGZIP(), []int{15}\n}", "func (*Signature) Descriptor() ([]byte, []int) {\n\treturn file_spacemesh_v1_types_proto_rawDescGZIP(), []int{10}\n}", "func (*MaximizeConversionValue) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_bidding_proto_rawDescGZIP(), []int{7}\n}", "func (*UnsignedInt) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{14}\n}", "func (*BytesValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{8}\n}", "func (ContactPointSystemCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{48, 0}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*Distance) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{26}\n}", "func (*ContactPoint) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{24}\n}", "func (*Signature) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{38}\n}", "func (c *float32Type) Deserialize(sv []byte) (interface{}, error) {\n\treturn c.DeserializeT(sv)\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (Feature_ValueType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_feature_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*TwoNumbers) Descriptor() ([]byte, []int) {\n\treturn file_pb_calculator_proto_rawDescGZIP(), []int{0}\n}", "func (*RaftClientRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{26}\n}", "func (x *fastReflection_Bech32PrefixRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.Bech32PrefixRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.Bech32PrefixRequest does not contain field %s\", descriptor.FullName()))\n\t}\n}", "func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\tp := &descriptorpb.FieldDescriptorProto{\n\t\tName: proto.String(string(field.Name())),\n\t\tNumber: proto.Int32(int32(field.Number())),\n\t\tLabel: descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(),\n\t\tOptions: proto.Clone(field.Options()).(*descriptorpb.FieldOptions),\n\t}\n\tif field.IsExtension() {\n\t\tp.Extendee = fullNameOf(field.ContainingMessage())\n\t}\n\tif field.Kind().IsValid() {\n\t\tp.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum()\n\t}\n\tif field.Enum() != nil {\n\t\tp.TypeName = fullNameOf(field.Enum())\n\t}\n\tif field.Message() != nil {\n\t\tp.TypeName = fullNameOf(field.Message())\n\t}\n\tif field.HasJSONName() {\n\t\t// A bug in older versions of protoc would always populate the\n\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t// When it did so, it would always use the camel-cased field name.\n\t\tif field.IsExtension() {\n\t\t\tp.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))\n\t\t} else {\n\t\t\tp.JsonName = proto.String(field.JSONName())\n\t\t}\n\t}\n\tif field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {\n\t\tp.Proto3Optional = proto.Bool(true)\n\t}\n\tif field.HasDefault() {\n\t\tdef, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)\n\t\tif err != nil && field.DefaultEnumValue() != nil {\n\t\t\tdef = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values\n\t\t} else if err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%v: %v\", field.FullName(), err))\n\t\t}\n\t\tp.DefaultValue = proto.String(def)\n\t}\n\tif oneof := field.ContainingOneof(); oneof != nil {\n\t\tp.OneofIndex = proto.Int32(int32(oneof.Index()))\n\t}\n\treturn p\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "func (*RateLimitingSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{4}\n}" ]
[ "0.66113853", "0.63156664", "0.59501797", "0.5866494", "0.5859471", "0.58383733", "0.5801807", "0.57993966", "0.5723162", "0.56959796", "0.5686664", "0.56379604", "0.5606566", "0.56039333", "0.56013525", "0.56005836", "0.55492204", "0.5543321", "0.5529038", "0.55228096", "0.5506085", "0.5489254", "0.5488441", "0.54760414", "0.54666364", "0.54540306", "0.5451832", "0.54503304", "0.5449112", "0.5427652", "0.5426788", "0.5412376", "0.5406314", "0.54037774", "0.540063", "0.5400517", "0.53988326", "0.53943336", "0.5394224", "0.53889084", "0.5387482", "0.53866005", "0.53803605", "0.5379424", "0.5376424", "0.5375408", "0.53702927", "0.536394", "0.53620803", "0.53620803", "0.53620803", "0.5358515", "0.5350961", "0.53477955", "0.53453", "0.5344342", "0.53414476", "0.5333572", "0.5330154", "0.53207546", "0.53183186", "0.53179055", "0.5317563", "0.5311814", "0.5308741", "0.53075993", "0.530588", "0.53045946", "0.530439", "0.53010064", "0.52992064", "0.52959925", "0.5292818", "0.5291583", "0.5291018", "0.5289347", "0.52878106", "0.52797854", "0.5279418", "0.52775544", "0.5269185", "0.52669096", "0.5266245", "0.52659214", "0.5265371", "0.52631897", "0.52586424", "0.525789", "0.52538824", "0.52514493", "0.52511144", "0.5251106", "0.52489954", "0.5248758", "0.5248661", "0.5248299", "0.5247444", "0.5243976", "0.5242833", "0.52423865" ]
0.74019045
0
Deprecated: Use Int32Value.ProtoReflect.Descriptor instead.
func (*Int32Value) Descriptor() ([]byte, []int) { return file_proto_value_value_proto_rawDescGZIP(), []int{1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Int32Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{4}\n}", "func (*UInt32Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{5}\n}", "func (Type_PrimitiveType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Integer) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{8}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*Float32Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_value_value_proto_rawDescGZIP(), []int{0}\n}", "func (*PositiveInt) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{11}\n}", "func (*Integers) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{22}\n}", "func (*UnsignedInt) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{14}\n}", "func (NumberType) EnumDescriptor() ([]byte, []int) {\n\treturn file_stats_stats_proto_rawDescGZIP(), []int{6}\n}", "func (Limit) EnumDescriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{0}\n}", "func (*Int) Descriptor() ([]byte, []int) {\n\treturn file_banyandb_model_v1_common_proto_rawDescGZIP(), []int{1}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (Instant_Precision) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*IntegerAttribute) Descriptor() ([]byte, []int) {\n\treturn file_jnx_interfaces_service_proto_rawDescGZIP(), []int{1}\n}", "func (Listener_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*IntegerProperty) Descriptor() ([]byte, []int) {\n\treturn file_furo_property_proto_rawDescGZIP(), []int{3}\n}", "func (IsBounded_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{18, 0}\n}", "func (ContactPointUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{49, 0}\n}", "func (StandardPTransforms_Primitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 0}\n}", "func (Span_SpanKind) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Number) Descriptor() ([]byte, []int) {\n\treturn file_pb_calculator_proto_rawDescGZIP(), []int{1}\n}", "func (MemcacheIncrementResponse_IncrementStatusCode) EnumDescriptor() ([]byte, []int) {\n\treturn file_memcache_service_proto_rawDescGZIP(), []int{10, 0}\n}", "func (EnumValue) EnumDescriptor() ([]byte, []int) {\n\treturn file_runtime_internal_examplepb_proto3_proto_rawDescGZIP(), []int{0}\n}", "func (ApiWarning_SqlApiWarningCode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Int) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{6}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (Severity) EnumDescriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{8}\n}", "func (IPProto) EnumDescriptor() ([]byte, []int) {\n\treturn file_signalling_proto_rawDescGZIP(), []int{8}\n}", "func (SocketAddress_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{1, 0}\n}", "func (IpVersion) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_proto_rawDescGZIP(), []int{0}\n}", "func (AddressUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{47, 0}\n}", "func (ApiWarning_SqlApiWarningCode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{1, 0}\n}", "func (IdentifierUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{52, 0}\n}", "func (Signer_Limit) EnumDescriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{18, 0}\n}", "func (*Int64Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{2}\n}", "func (Span_Link_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 3, 0}\n}", "func (*Int64) Descriptor() ([]byte, []int) {\n\treturn file_github_com_begmaroman_beaconspot_proto_common_types_proto_rawDescGZIP(), []int{0}\n}", "func (CVSSv3_Impact) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_containeranalysis_v1beta1_cvss_cvss_proto_rawDescGZIP(), []int{0, 5}\n}", "func (QuantityComparatorCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{57, 0}\n}", "func (Shifting) EnumDescriptor() ([]byte, []int) {\n\treturn file_public_rules_rules_proto_rawDescGZIP(), []int{3}\n}", "func (DateTime_Precision) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{4, 0}\n}", "func (Type_WellKnownType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 1}\n}", "func (*Number) Descriptor() ([]byte, []int) {\n\treturn file_drill_exercise_1_filter_protobuf_filter_proto_rawDescGZIP(), []int{0}\n}", "func (*TypedValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{2}\n}", "func (NameUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{56, 0}\n}", "func (*Value_EnumValue) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_resourcesettings_v1_resource_settings_proto_rawDescGZIP(), []int{2, 1}\n}", "func (Schema_PartitionStyle) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{13, 2}\n}", "func (KibanaLog_PhoneType) EnumDescriptor() ([]byte, []int) {\n\treturn file_KibanaLog_proto_rawDescGZIP(), []int{0, 0}\n}", "func (StandardResourceHints_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{63, 0}\n}", "func (Transaction_Limit) EnumDescriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{17, 0}\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (EventTimingCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{51, 0}\n}", "func (*NumericValue) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_admin_v1alpha_access_report_proto_rawDescGZIP(), []int{10}\n}", "func (ConfigMessage_Range) EnumDescriptor() ([]byte, []int) {\n\treturn file_cvnetv2_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*EnumMessage) Descriptor() ([]byte, []int) {\n\treturn file_enum_enum_example_proto_rawDescGZIP(), []int{0}\n}", "func (*SimpleInt) Descriptor() ([]byte, []int) {\n\treturn file_spacemesh_v1_types_proto_rawDescGZIP(), []int{0}\n}", "func (*Number) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{0}\n}", "func (FaultDelay_FaultDelayType) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_config_filter_fault_v2_fault_proto_rawDescGZIP(), []int{0, 0}\n}", "func (Gateway_Listener_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_mesh_v1alpha1_gateway_proto_rawDescGZIP(), []int{0, 1, 0}\n}", "func (Schema_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{13, 0}\n}", "func (Ref_Foo_En) EnumDescriptor() ([]byte, []int) {\n\treturn file_constructs_input_proto_rawDescGZIP(), []int{11, 1, 0}\n}", "func (Person_PhoneType) EnumDescriptor() ([]byte, []int) {\n\treturn file_protomessage_proto_rawDescGZIP(), []int{0, 0}\n}", "func (DaysOfWeekCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{50, 0}\n}", "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (ContactPointSystemCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{48, 0}\n}", "func (StatusCode) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_type_http_status_proto_rawDescGZIP(), []int{0}\n}", "func (SafetySetting_HarmBlockThreshold) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{3, 0}\n}", "func (Permission_Constraint) EnumDescriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{12, 1}\n}", "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{0}\n}", "func (Retry_Conf_Grpc_RetryOn) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 3, 0}\n}", "func (CodecClientType) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_type_v3_http_proto_rawDescGZIP(), []int{0}\n}", "func (IdpType) EnumDescriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{37}\n}", "func (Scope) EnumDescriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{4}\n}", "func (StandardCoders_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{29, 0}\n}", "func (WithEnum_Things) EnumDescriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{5, 0}\n}", "func (Severity) EnumDescriptor() ([]byte, []int) {\n\treturn file_apiextensions_fn_proto_v1beta1_run_function_proto_rawDescGZIP(), []int{0}\n}", "func (Metric_Scale) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{0, 0}\n}", "func (SpanLayer) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_trace_common_proto_rawDescGZIP(), []int{2}\n}", "func (VersionView) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{0}\n}", "func (Connector_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_kafka_v1_connector_proto_rawDescGZIP(), []int{10, 1}\n}", "func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{3, 0}\n}", "func (SequencerOptions_AutoIncrement) EnumDescriptor() ([]byte, []int) {\n\treturn file_runtime_proto_rawDescGZIP(), []int{8, 0}\n}", "func (Resource) EnumDescriptor() ([]byte, []int) {\n\treturn file_teleport_userpreferences_v1_onboard_proto_rawDescGZIP(), []int{0}\n}", "func (DataType) EnumDescriptor() ([]byte, []int) {\n\treturn file_toit_api_data_proto_rawDescGZIP(), []int{0}\n}", "func (*EnumExample) Descriptor() ([]byte, []int) {\n\treturn file_enum_example_enum_example_proto_rawDescGZIP(), []int{0}\n}", "func (SpanType) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_trace_common_proto_rawDescGZIP(), []int{0}\n}", "func (Connector_Health) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_kafka_v1_connector_proto_rawDescGZIP(), []int{10, 0}\n}", "func (*MaximizeConversionValue) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_bidding_proto_rawDescGZIP(), []int{7}\n}", "func (*SampleConstrainedInteger) Descriptor() ([]byte, []int) {\n\treturn file_pkg_asn1_testsm_test_sm_proto_rawDescGZIP(), []int{31}\n}", "func (Span_TimeEvent_MessageEvent_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 1, 1, 0}\n}", "func (Function_Func) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{1, 0}\n}", "func (ESpecialPingValue) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{0}\n}", "func (*Numbers) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{1}\n}", "func (StandardRunnerProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{55, 0}\n}", "func (InterfaceUpdateResponse_StatusCode) EnumDescriptor() ([]byte, []int) {\n\treturn file_jnx_interfaces_service_proto_rawDescGZIP(), []int{13, 0}\n}", "func (Time_Precision) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{13, 0}\n}", "func (MemcacheIncrementRequest_Direction) EnumDescriptor() ([]byte, []int) {\n\treturn file_memcache_service_proto_rawDescGZIP(), []int{9, 0}\n}", "func (ProtocolType) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_config_filter_network_jres_proxy_v2alpha1_jres_proxy_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.70525485", "0.6754184", "0.65298253", "0.6228725", "0.6184354", "0.61641115", "0.61580116", "0.61567146", "0.6086682", "0.5993912", "0.5946612", "0.59417975", "0.593936", "0.5934582", "0.59211963", "0.58922446", "0.5886116", "0.5884352", "0.58841336", "0.586868", "0.58599967", "0.5850004", "0.58493805", "0.58467585", "0.5845221", "0.5842878", "0.58383524", "0.58146036", "0.580975", "0.5806876", "0.58066523", "0.5802123", "0.57987916", "0.57939345", "0.57841206", "0.57814384", "0.5776907", "0.57736254", "0.57730603", "0.57687217", "0.5761838", "0.5759295", "0.57592195", "0.5750712", "0.5748457", "0.57466686", "0.5744665", "0.57354516", "0.5731102", "0.57291937", "0.5715724", "0.5715338", "0.5711324", "0.5710665", "0.5699289", "0.5697576", "0.5695584", "0.5692498", "0.5688741", "0.56873417", "0.56866145", "0.5685306", "0.56849015", "0.5680796", "0.5680142", "0.56797224", "0.56794804", "0.5678899", "0.56782013", "0.56741387", "0.5673947", "0.5672345", "0.5671326", "0.56677294", "0.56671244", "0.56666154", "0.5666014", "0.56623083", "0.56577504", "0.56549215", "0.5654877", "0.5647739", "0.5645534", "0.5641736", "0.564166", "0.56406224", "0.56392", "0.5638883", "0.56369597", "0.5634961", "0.5632596", "0.56314975", "0.5630762", "0.56305104", "0.5630332", "0.56265056", "0.5625791", "0.5623759", "0.56214964", "0.5620856" ]
0.69361603
1
Deprecated: Use StringValue.ProtoReflect.Descriptor instead.
func (*StringValue) Descriptor() ([]byte, []int) { return file_proto_value_value_proto_rawDescGZIP(), []int{2} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*StringValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{7}\n}", "func (*TruncatableString) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{4}\n}", "func (*String) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{12}\n}", "func (*StringAttribute) Descriptor() ([]byte, []int) {\n\treturn file_jnx_interfaces_service_proto_rawDescGZIP(), []int{0}\n}", "func (*StringMessage) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_proto_rawDescGZIP(), []int{0}\n}", "func (*String) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{7}\n}", "func (*ListStringMatcher) Descriptor() ([]byte, []int) {\n\treturn file_envoy_type_matcher_v3_string_proto_rawDescGZIP(), []int{1}\n}", "func (*StringMatcher) Descriptor() ([]byte, []int) {\n\treturn file_envoy_type_matcher_v3_string_proto_rawDescGZIP(), []int{0}\n}", "func (*Str) Descriptor() ([]byte, []int) {\n\treturn file_banyandb_model_v1_common_proto_rawDescGZIP(), []int{0}\n}", "func (*TypedValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{2}\n}", "func (*StringProperty) Descriptor() ([]byte, []int) {\n\treturn file_furo_property_proto_rawDescGZIP(), []int{2}\n}", "func (*StrMessage) Descriptor() ([]byte, []int) {\n\treturn file_demo_proto_rawDescGZIP(), []int{1}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*SimpleString) Descriptor() ([]byte, []int) {\n\treturn file_spacemesh_v1_types_proto_rawDescGZIP(), []int{1}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*StringListValue) Descriptor() ([]byte, []int) {\n\treturn file_github_com_infobloxopen_atlas_app_toolkit_rpc_errfields_error_fields_proto_rawDescGZIP(), []int{1}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*MarkedString) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{113}\n}", "func (*CNETMsg_StringCmd) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{5}\n}", "func (x *fastReflection_AddressStringToBytesRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesRequest\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{13}\n}", "func (x *fastReflection_AddressBytesToStringRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressBytesToStringRequest\n}", "func (*AnnotatedString) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataqna_v1alpha_annotated_string_proto_rawDescGZIP(), []int{0}\n}", "func (*TargetValue) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{7}\n}", "func (x *fastReflection_AddressStringToBytesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesResponse\n}", "func stringProto(s string) *proto3.Value {\n\treturn &proto3.Value{Kind: stringKind(s)}\n}", "func (*CMsgURLChanged) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{42}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*CNETMsg_StringCmd) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{5}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{13}\n}", "func (*Instant) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{7}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*SimpleStringMap) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{6}\n}", "func (*SValues) Descriptor() ([]byte, []int) {\n\treturn file_internals_proto_select_proto_rawDescGZIP(), []int{1}\n}", "func Proto(cmd *cobra.Command, value proto.Message) error {\n\ts, err := ProtoString(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmd.Println(s)\n\n\treturn nil\n}", "func (*CNETMsg_StringCmd) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{9}\n}", "func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\tp := &descriptorpb.FieldDescriptorProto{\n\t\tName: proto.String(string(field.Name())),\n\t\tNumber: proto.Int32(int32(field.Number())),\n\t\tLabel: descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(),\n\t\tOptions: proto.Clone(field.Options()).(*descriptorpb.FieldOptions),\n\t}\n\tif field.IsExtension() {\n\t\tp.Extendee = fullNameOf(field.ContainingMessage())\n\t}\n\tif field.Kind().IsValid() {\n\t\tp.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum()\n\t}\n\tif field.Enum() != nil {\n\t\tp.TypeName = fullNameOf(field.Enum())\n\t}\n\tif field.Message() != nil {\n\t\tp.TypeName = fullNameOf(field.Message())\n\t}\n\tif field.HasJSONName() {\n\t\t// A bug in older versions of protoc would always populate the\n\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t// When it did so, it would always use the camel-cased field name.\n\t\tif field.IsExtension() {\n\t\t\tp.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))\n\t\t} else {\n\t\t\tp.JsonName = proto.String(field.JSONName())\n\t\t}\n\t}\n\tif field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {\n\t\tp.Proto3Optional = proto.Bool(true)\n\t}\n\tif field.HasDefault() {\n\t\tdef, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)\n\t\tif err != nil && field.DefaultEnumValue() != nil {\n\t\t\tdef = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values\n\t\t} else if err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%v: %v\", field.FullName(), err))\n\t\t}\n\t\tp.DefaultValue = proto.String(def)\n\t}\n\tif oneof := field.ContainingOneof(); oneof != nil {\n\t\tp.OneofIndex = proto.Int32(int32(oneof.Index()))\n\t}\n\treturn p\n}", "func (x *fastReflection_AddressBytesToStringResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressBytesToStringResponse\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Extension_ValueX) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{41, 0}\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{5}\n}", "func (*TracingTagLiteral) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{4}\n}", "func (*TracingTagLiteral) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{4}\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_mtpc_proto_rawDescGZIP(), []int{6}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func FromProtoValue(val protoreflect.Value) (rel.Value, error) {\n\tswitch message := val.Interface().(type) {\n\tcase protoreflect.Message:\n\t\tvar attrs []rel.Attr\n\t\tvar err error\n\t\tmessage.Range(func(desc protoreflect.FieldDescriptor, val protoreflect.Value) bool {\n\t\t\tvar item rel.Value\n\t\t\titem, err = FromProtoValue(val)\n\t\t\tif err != nil {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tfieldName := string(desc.Name())\n\t\t\titemNum, isNum := item.(rel.Number)\n\t\t\tif desc.Enum() != nil && isNum {\n\t\t\t\t// item is protoreflect.EnumNumber\n\t\t\t\tif num, success := itemNum.Int(); success {\n\t\t\t\t\ten := protoreflect.EnumNumber(num)\n\t\t\t\t\tname := desc.Enum().Values().ByNumber(en).Name()\n\t\t\t\t\tattrs = append(attrs, rel.NewStringAttr(fieldName, []rune(name)))\n\t\t\t\t} else {\n\t\t\t\t\tattrs = append(attrs, rel.NewAttr(fieldName, item))\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tattrs = append(attrs, rel.NewAttr(fieldName, item))\n\t\t\treturn true\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn rel.NewTuple(attrs...), nil\n\n\tcase protoreflect.Map:\n\t\tentries := make([]rel.DictEntryTuple, 0, val.Map().Len())\n\t\tvar err error\n\t\tval.Map().Range(func(key protoreflect.MapKey, value protoreflect.Value) bool {\n\t\t\tvar val rel.Value\n\t\t\tval, err = FromProtoValue(value)\n\t\t\tif err != nil {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tat := rel.NewString([]rune(key.String()))\n\t\t\tentries = append(entries, rel.NewDictEntryTuple(at, val))\n\t\t\treturn true\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn rel.NewDict(false, entries...)\n\n\tcase protoreflect.List:\n\t\tlist := make([]rel.Value, 0, message.Len())\n\t\tfor i := 0; i < message.Len(); i++ {\n\t\t\titem, err := FromProtoValue(message.Get(i))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tlist = append(list, item)\n\t\t}\n\t\treturn rel.NewArray(list...), nil\n\n\tcase string, bool, int, int32, int64, uint, uint32, uint64, float32, float64:\n\t\treturn rel.NewValue(message)\n\n\tcase protoreflect.EnumNumber:\n\t\t// type EnumNumber int32\n\t\treturn rel.NewValue(int32(message))\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%v (%[1]T) not supported\", message)\n\t}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func (*EnumMessage) Descriptor() ([]byte, []int) {\n\treturn file_enum_enum_example_proto_rawDescGZIP(), []int{0}\n}", "func (*AllowedValues) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{3}\n}", "func (*CSVCMsg_UpdateStringTable) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{31}\n}", "func ProtoFromEnumValueDescriptor(d protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto {\n\ttype canProto interface {\n\t\tEnumValueDescriptorProto() *descriptorpb.EnumValueDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.EnumValueDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif ed, ok := res.AsProto().(*descriptorpb.EnumValueDescriptorProto); ok {\n\t\t\treturn ed\n\t\t}\n\t}\n\treturn protodesc.ToEnumValueDescriptorProto(d)\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (NameUseCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{56, 0}\n}", "func (*CSVCMsg_UpdateStringTable) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{31}\n}", "func (*IValues) Descriptor() ([]byte, []int) {\n\treturn file_internals_proto_insert_proto_rawDescGZIP(), []int{2}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func ProtoFromMessageDescriptor(d protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\ttype canProto interface {\n\t\tMessageDescriptorProto() *descriptorpb.DescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MessageDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.DescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToDescriptorProto(d)\n}", "func (*TestPrintableString) Descriptor() ([]byte, []int) {\n\treturn file_pkg_asn1_testsm_test_sm_proto_rawDescGZIP(), []int{17}\n}", "func (*ExprValue) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_eval_proto_rawDescGZIP(), []int{1}\n}", "func (AnnotatedString_SemanticMarkupType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataqna_v1alpha_annotated_string_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_resourcesettings_v1_resource_settings_proto_rawDescGZIP(), []int{2}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*Values) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{12}\n}", "func (*StatusMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*DoubleValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{0}\n}", "func (*TextEdits) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{14}\n}", "func (*ReqString) Descriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{1}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (*ConstantSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{3}\n}", "func (*NameUseCode) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{56}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (*CredentialsKVProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{1}\n}", "func (*AddressBytesToStringRequest) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_auth_v1beta1_query_proto_rawDescGZIP(), []int{12}\n}", "func (*Simple) Descriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{7}\n}", "func (*Attribute) Descriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{2}\n}", "func (*AnnotatedString_SemanticMarkup) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataqna_v1alpha_annotated_string_proto_rawDescGZIP(), []int{0, 0}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*StrArray) Descriptor() ([]byte, []int) {\n\treturn file_banyandb_model_v1_common_proto_rawDescGZIP(), []int{2}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*AttributeValue) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{1}\n}" ]
[ "0.6931012", "0.65828127", "0.63500345", "0.6220976", "0.6214141", "0.619462", "0.61732066", "0.61639756", "0.61276054", "0.61102676", "0.60967743", "0.60827637", "0.60621834", "0.6050361", "0.6043717", "0.6034313", "0.59939146", "0.59777445", "0.596602", "0.5956804", "0.59490603", "0.59466517", "0.594498", "0.5941654", "0.59251183", "0.5916398", "0.59152853", "0.5908408", "0.5904324", "0.59001124", "0.5897682", "0.588129", "0.58761424", "0.58750284", "0.5874976", "0.5874094", "0.58737916", "0.5872255", "0.586892", "0.586313", "0.5853483", "0.58534724", "0.5847415", "0.58394325", "0.5835573", "0.5832074", "0.58295655", "0.5820172", "0.58193237", "0.5816434", "0.58139426", "0.58080983", "0.5806094", "0.58013964", "0.57952905", "0.57952905", "0.57948756", "0.5790576", "0.5784584", "0.57842195", "0.5781383", "0.5781322", "0.57740134", "0.57724816", "0.5769107", "0.5768747", "0.5763345", "0.5754691", "0.5748583", "0.5748375", "0.5744475", "0.5736329", "0.5734764", "0.57331157", "0.5730235", "0.57275546", "0.5725715", "0.5724625", "0.57236665", "0.57171214", "0.5716482", "0.57162726", "0.57155156", "0.5715476", "0.57120895", "0.57097036", "0.570928", "0.57075", "0.570665", "0.5700946", "0.5700665", "0.5698649", "0.56961775", "0.5693988", "0.56927687", "0.56920284", "0.56917965", "0.56913644", "0.5690598", "0.5688759" ]
0.66620374
1
Deprecated: Use BoolValue.ProtoReflect.Descriptor instead.
func (*BoolValue) Descriptor() ([]byte, []int) { return file_proto_value_value_proto_rawDescGZIP(), []int{3} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*BoolValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_wrappers_proto_rawDescGZIP(), []int{6}\n}", "func (*Boolean) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{1}\n}", "func (*Boolean) Descriptor() ([]byte, []int) {\n\treturn file_ravel_cmd_ravel_node_ravel_node_proto_rawDescGZIP(), []int{2}\n}", "func (*TrueValues) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{1}\n}", "func (*Bool) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{8}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*FieldValuePredicate) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_serverless_triggers_v1_predicate_proto_rawDescGZIP(), []int{2}\n}", "func (*BoolReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_casbin_proto_rawDescGZIP(), []int{5}\n}", "func (x *fastReflection_SendEnabled) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_SendEnabled\n}", "func (*StripeBool) Descriptor() ([]byte, []int) {\n\treturn file_stripe_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.bank.v1beta1.Params.send_enabled\":\n\t\tif len(x.SendEnabled) == 0 {\n\t\t\treturn protoreflect.ValueOfList(&_Params_1_list{})\n\t\t}\n\t\tlistValue := &_Params_1_list{list: &x.SendEnabled}\n\t\treturn protoreflect.ValueOfList(listValue)\n\tcase \"cosmos.bank.v1beta1.Params.default_send_enabled\":\n\t\tvalue := x.DefaultSendEnabled\n\t\treturn protoreflect.ValueOfBool(value)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Params\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.Params does not contain field %s\", descriptor.FullName()))\n\t}\n}", "func (x *fastReflection_SendEnabled) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.bank.v1beta1.SendEnabled.denom\":\n\t\tvalue := x.Denom\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.bank.v1beta1.SendEnabled.enabled\":\n\t\tvalue := x.Enabled\n\t\treturn protoreflect.ValueOfBool(value)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.SendEnabled\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.SendEnabled does not contain field %s\", descriptor.FullName()))\n\t}\n}", "func Bool(name string, val bool) Field {\n\treturn Field(zap.Bool(name, val))\n}", "func (*BoolResponse) Descriptor() ([]byte, []int) {\n\treturn file_session_proto_rawDescGZIP(), []int{2}\n}", "func (*Predicate) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_serverless_triggers_v1_predicate_proto_rawDescGZIP(), []int{0}\n}", "func (*AnalyzerOrgPolicyConstraint_Constraint_BooleanConstraint) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_asset_v1_asset_service_proto_rawDescGZIP(), []int{53, 0, 1}\n}", "func (*ToggleFavoriteTranslationRequest) Descriptor() ([]byte, []int) {\n\treturn file_translation_proto_rawDescGZIP(), []int{5}\n}", "func (*ToggleWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{35}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func Bool(k string, v bool) Field {\n\treturn Field{Key: k, Value: valf.Bool(v)}\n}", "func (*SafetySetting) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{3}\n}", "func Bool(v bool) (p *bool) { return &v }", "func MakeBool(in *bool) *google_protobuf.BoolValue {\n\tif in == nil {\n\t\treturn nil\n\t}\n\n\treturn &google_protobuf.BoolValue{\n\t\tValue: *in,\n\t}\n}", "func (x *fastReflection_FlagOptions) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.autocli.v1.FlagOptions.name\":\n\t\tvalue := x.Name\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.autocli.v1.FlagOptions.shorthand\":\n\t\tvalue := x.Shorthand\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.autocli.v1.FlagOptions.usage\":\n\t\tvalue := x.Usage\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.autocli.v1.FlagOptions.default_value\":\n\t\tvalue := x.DefaultValue\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.autocli.v1.FlagOptions.deprecated\":\n\t\tvalue := x.Deprecated\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.autocli.v1.FlagOptions.shorthand_deprecated\":\n\t\tvalue := x.ShorthandDeprecated\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.autocli.v1.FlagOptions.hidden\":\n\t\tvalue := x.Hidden\n\t\treturn protoreflect.ValueOfBool(value)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.FlagOptions\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.FlagOptions does not contain field %s\", descriptor.FullName()))\n\t}\n}", "func (*CMsgSetTeamFanContentStatus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{383}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (m *SecureScoreControlProfile) GetDeprecated()(*bool) {\n val, err := m.GetBackingStore().Get(\"deprecated\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (*CMsgTeamFanContentStatus_TeamStatus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{382, 0}\n}", "func (x *fastReflection_SendEnabled) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.SendEnabled.denom\":\n\t\tpanic(fmt.Errorf(\"field denom of message cosmos.bank.v1beta1.SendEnabled is not mutable\"))\n\tcase \"cosmos.bank.v1beta1.SendEnabled.enabled\":\n\t\tpanic(fmt.Errorf(\"field enabled of message cosmos.bank.v1beta1.SendEnabled is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.SendEnabled\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.SendEnabled does not contain field %s\", fd.FullName()))\n\t}\n}", "func (*IsOk) Descriptor() ([]byte, []int) {\n\treturn file_t1_healthcheck_proto_rawDescGZIP(), []int{5}\n}", "func (*BuildPredicate) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{8}\n}", "func BoolPtr(v bool) *bool { return &v }", "func Bool(key string, val bool) Field {\n\tvar ival int64\n\tif val {\n\t\tival = 1\n\t}\n\treturn Field{Key: key, Type: core.BoolType, Integer: ival}\n}", "func Bool(v *Value, def bool) bool {\n\tb, err := v.Bool()\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn b\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (s settableBool) Type() string { return \"bool\" }", "func (x *fastReflection_ModuleOptions) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.autocli.v1.ModuleOptions.tx\":\n\t\tif x.Tx == nil {\n\t\t\tx.Tx = new(ServiceCommandDescriptor)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Tx.ProtoReflect())\n\tcase \"cosmos.autocli.v1.ModuleOptions.query\":\n\t\tif x.Query == nil {\n\t\t\tx.Query = new(ServiceCommandDescriptor)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Query.ProtoReflect())\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.ModuleOptions\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.ModuleOptions does not contain field %s\", fd.FullName()))\n\t}\n}", "func (*CMsgTeamFanContentStatus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{382}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (x *fastReflection_RpcCommandOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RpcCommandOptions\n}", "func (*TabletStatusPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tablet_tablet_proto_rawDescGZIP(), []int{0}\n}", "func (*FieldMask) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_types_known_field_mask_proto_rawDescGZIP(), []int{0}\n}", "func (o *FakeObject) Bool() bool { return o.Value.(bool) }", "func (x *fastReflection_RpcCommandOptions) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.alias\":\n\t\tif x.Alias == nil {\n\t\t\tx.Alias = []string{}\n\t\t}\n\t\tvalue := &_RpcCommandOptions_6_list{list: &x.Alias}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.suggest_for\":\n\t\tif x.SuggestFor == nil {\n\t\t\tx.SuggestFor = []string{}\n\t\t}\n\t\tvalue := &_RpcCommandOptions_7_list{list: &x.SuggestFor}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.flag_options\":\n\t\tif x.FlagOptions == nil {\n\t\t\tx.FlagOptions = make(map[string]*FlagOptions)\n\t\t}\n\t\tvalue := &_RpcCommandOptions_10_map{m: &x.FlagOptions}\n\t\treturn protoreflect.ValueOfMap(value)\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.positional_args\":\n\t\tif x.PositionalArgs == nil {\n\t\t\tx.PositionalArgs = []*PositionalArgDescriptor{}\n\t\t}\n\t\tvalue := &_RpcCommandOptions_11_list{list: &x.PositionalArgs}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.rpc_method\":\n\t\tpanic(fmt.Errorf(\"field rpc_method of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.use\":\n\t\tpanic(fmt.Errorf(\"field use of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.long\":\n\t\tpanic(fmt.Errorf(\"field long of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.short\":\n\t\tpanic(fmt.Errorf(\"field short of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.example\":\n\t\tpanic(fmt.Errorf(\"field example of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.deprecated\":\n\t\tpanic(fmt.Errorf(\"field deprecated of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.version\":\n\t\tpanic(fmt.Errorf(\"field version of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.RpcCommandOptions.skip\":\n\t\tpanic(fmt.Errorf(\"field skip of message cosmos.autocli.v1.RpcCommandOptions is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.RpcCommandOptions\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.RpcCommandOptions does not contain field %s\", fd.FullName()))\n\t}\n}", "func Bool(val bool, buf []byte) []byte {\n\tif val {\n\t\treturn append(buf, `true`...)\n\t}\n\treturn append(buf, `false`...)\n}", "func (x *fastReflection_PositionalArgDescriptor) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"cosmos.autocli.v1.PositionalArgDescriptor.proto_field\":\n\t\tvalue := x.ProtoField\n\t\treturn protoreflect.ValueOfString(value)\n\tcase \"cosmos.autocli.v1.PositionalArgDescriptor.varargs\":\n\t\tvalue := x.Varargs\n\t\treturn protoreflect.ValueOfBool(value)\n\tcase \"cosmos.autocli.v1.PositionalArgDescriptor.optional\":\n\t\tvalue := x.Optional\n\t\treturn protoreflect.ValueOfBool(value)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.PositionalArgDescriptor\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.PositionalArgDescriptor does not contain field %s\", descriptor.FullName()))\n\t}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func newBool(value bool) *TypedBool {\n\tbuf := make([]byte, 1)\n\tif value {\n\t\tbuf[0] = 1\n\t}\n\ttypedBool := TypedBool{\n\t\tBytes: buf,\n\t\tType: ValueType_BOOL,\n\t}\n\treturn &typedBool\n}", "func (*ArticleServiceRsBool) Descriptor() ([]byte, []int) {\n\treturn file_proto_articleService_proto_rawDescGZIP(), []int{5}\n}", "func (*GetTabletStatusRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_tserver_proto_rawDescGZIP(), []int{12}\n}", "func (*SetStateSpec) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{16}\n}", "func (*StandardUserStateTypes) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_FlagOptions) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.autocli.v1.FlagOptions.name\":\n\t\tpanic(fmt.Errorf(\"field name of message cosmos.autocli.v1.FlagOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.FlagOptions.shorthand\":\n\t\tpanic(fmt.Errorf(\"field shorthand of message cosmos.autocli.v1.FlagOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.FlagOptions.usage\":\n\t\tpanic(fmt.Errorf(\"field usage of message cosmos.autocli.v1.FlagOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.FlagOptions.default_value\":\n\t\tpanic(fmt.Errorf(\"field default_value of message cosmos.autocli.v1.FlagOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.FlagOptions.deprecated\":\n\t\tpanic(fmt.Errorf(\"field deprecated of message cosmos.autocli.v1.FlagOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.FlagOptions.shorthand_deprecated\":\n\t\tpanic(fmt.Errorf(\"field shorthand_deprecated of message cosmos.autocli.v1.FlagOptions is not mutable\"))\n\tcase \"cosmos.autocli.v1.FlagOptions.hidden\":\n\t\tpanic(fmt.Errorf(\"field hidden of message cosmos.autocli.v1.FlagOptions is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.FlagOptions\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.FlagOptions does not contain field %s\", fd.FullName()))\n\t}\n}", "func (*OnlineStatus) Descriptor() ([]byte, []int) {\n\treturn file_chat_chat_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.rpc_command_options\":\n\t\tif x.RpcCommandOptions == nil {\n\t\t\tx.RpcCommandOptions = []*RpcCommandOptions{}\n\t\t}\n\t\tvalue := &_ServiceCommandDescriptor_2_list{list: &x.RpcCommandOptions}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.sub_commands\":\n\t\tif x.SubCommands == nil {\n\t\t\tx.SubCommands = make(map[string]*ServiceCommandDescriptor)\n\t\t}\n\t\tvalue := &_ServiceCommandDescriptor_3_map{m: &x.SubCommands}\n\t\treturn protoreflect.ValueOfMap(value)\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.service\":\n\t\tpanic(fmt.Errorf(\"field service of message cosmos.autocli.v1.ServiceCommandDescriptor is not mutable\"))\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.enhance_custom_command\":\n\t\tpanic(fmt.Errorf(\"field enhance_custom_command of message cosmos.autocli.v1.ServiceCommandDescriptor is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.ServiceCommandDescriptor\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.ServiceCommandDescriptor does not contain field %s\", fd.FullName()))\n\t}\n}", "func (*CheckedExpr) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{0}\n}", "func Bool(flag string, value bool, description string) *bool {\n\tvar v bool\n\tBoolVar(&v, flag, value, description)\n\treturn &v\n}", "func BoolPtr(v bool) *bool {\n\treturn &v\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func Bool(v bool) *bool { return &v }", "func Bool(v bool) *bool { return &v }", "func Bool(v bool) *bool { return &v }", "func Bool(v bool) *bool { return &v }", "func Bool(v bool) *bool { return &v }", "func Bool(v bool) *bool { return &v }", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*ValidateReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{18}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*HealthCheckStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{2}\n}", "func (*HealthCheckStatus) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{0}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*AndPredicate) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_serverless_triggers_v1_predicate_proto_rawDescGZIP(), []int{1}\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{13}\n}", "func (f BooleanField) Desc() BooleanField {\n\tdesc := true\n\tf.descending = &desc\n\treturn f\n}", "func (*BoolMatch) Descriptor() ([]byte, []int) {\n\treturn file_aggregation_v1_aggregation_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_GenesisState\n}", "func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_GenesisState\n}", "func (*MaximizeConversionValue) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_bidding_proto_rawDescGZIP(), []int{7}\n}", "func (*SetStateRequest) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{3}\n}", "func (*Entity_CompatibilityStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{11, 0}\n}", "func (*ChangeStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v8_resources_change_status_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgWasHidden) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{24}\n}", "func (*UpdateFriendStatusReq) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{2}\n}", "func (*ForwardingRules) Descriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_targets_gce_proto_config_proto_rawDescGZIP(), []int{2}\n}", "func (*CheckLiveRequest) Descriptor() ([]byte, []int) {\n\treturn file_health_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (PackageVersionStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_udpa_annotations_status_proto_rawDescGZIP(), []int{0}\n}", "func (*ListGuildChannelVoiceStatesRequest) Descriptor() ([]byte, []int) {\n\treturn file_discord_v1_cache_proto_rawDescGZIP(), []int{22}\n}", "func (Friend_State) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{37, 0}\n}", "func (Permission_Constraint) EnumDescriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{12, 1}\n}", "func (*TargetRestrictionOperation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_targeting_setting_proto_rawDescGZIP(), []int{2}\n}", "func (*StaleReadRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{24}\n}", "func decodeBool(s *Stream, val reflect.Value) error {\n\tb, err := s.Bool()\n\tif err != nil {\n\t\treturn wrapStreamError(err, val.Type())\n\t}\n\tval.SetBool(b)\n\treturn nil\n}", "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_validators_http_proto_config_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchAnnotationsStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{5}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (IsBounded_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{18, 0}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}" ]
[ "0.71954405", "0.6830013", "0.6324887", "0.6318868", "0.6266849", "0.6174953", "0.60510534", "0.6028189", "0.6014427", "0.59822106", "0.59640604", "0.5955174", "0.58510447", "0.5669405", "0.5663759", "0.56565034", "0.56331444", "0.56010723", "0.5576649", "0.55448", "0.54891485", "0.54815793", "0.5472224", "0.54571265", "0.5427202", "0.5426716", "0.5424548", "0.5415967", "0.5415853", "0.54001653", "0.53994954", "0.53925383", "0.5375706", "0.5373206", "0.5364399", "0.5362107", "0.53561205", "0.5356064", "0.5355056", "0.53549355", "0.5348597", "0.5345164", "0.5344142", "0.53429484", "0.5341817", "0.53296345", "0.531913", "0.5317368", "0.53154576", "0.5312485", "0.5307611", "0.5306896", "0.5306444", "0.52943623", "0.52918404", "0.52866304", "0.52864784", "0.52854884", "0.52821946", "0.5280994", "0.52808577", "0.52783453", "0.52783453", "0.52783453", "0.52783453", "0.52783453", "0.52783453", "0.52783334", "0.52754796", "0.5274489", "0.5269886", "0.52624077", "0.5256679", "0.5250048", "0.52486277", "0.524555", "0.5244108", "0.52366334", "0.52366334", "0.5230623", "0.5229625", "0.5227515", "0.52274054", "0.52201635", "0.5215108", "0.52143073", "0.52108103", "0.5210202", "0.52097934", "0.52065533", "0.52048355", "0.5203888", "0.5203086", "0.5202724", "0.5190946", "0.5185249", "0.51850766", "0.5182508", "0.5180966", "0.51803905" ]
0.7158229
1
Deprecated: Use ListValue.ProtoReflect.Descriptor instead.
func (*ListValue) Descriptor() ([]byte, []int) { return file_proto_value_value_proto_rawDescGZIP(), []int{4} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Type_ListType) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 0}\n}", "func (x *fastReflection_EvidenceList) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_EvidenceList\n}", "func (*ListValue) Descriptor() ([]byte, []int) {\n\treturn file_chameleon_api_http_data_proto_rawDescGZIP(), []int{0}\n}", "func (*List) Descriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{11}\n}", "func (*ListValue) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{14}\n}", "func (*ListDeleted) Descriptor() ([]byte, []int) {\n\treturn file_lists_events_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*EventsListProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{9}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{14}\n}", "func (*FriendList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{38}\n}", "func (*ListOptions) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{11}\n}", "func (x *fastReflection_EvidenceList) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"tendermint.types.EvidenceList.evidence\":\n\t\tif len(x.Evidence) == 0 {\n\t\t\treturn protoreflect.ValueOfList(&_EvidenceList_1_list{})\n\t\t}\n\t\tlistValue := &_EvidenceList_1_list{list: &x.Evidence}\n\t\treturn protoreflect.ValueOfList(listValue)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.types.EvidenceList\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.types.EvidenceList does not contain field %s\", descriptor.FullName()))\n\t}\n}", "func (*VfList) Descriptor() ([]byte, []int) {\n\treturn file_config_devmodel_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*ListOptionValue) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{15}\n}", "func (*FeatureValueList) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_featurestore_online_service_proto_rawDescGZIP(), []int{7}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*FieldList) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_datatransfer_v1_endpoint_common_proto_rawDescGZIP(), []int{7}\n}", "func (*List) Descriptor() ([]byte, []int) {\n\treturn file_google_actions_sdk_v2_conversation_prompt_content_list_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{6}\n}", "func (*GroupListRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{36}\n}", "func (*MessageList) Descriptor() ([]byte, []int) {\n\treturn file_message_proto_rawDescGZIP(), []int{1}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*GroupList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{42}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*ChannelMessageList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{27}\n}", "func (*ListUserFriendRsp_List) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*ListNotification) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_notification_proto_rawDescGZIP(), []int{1}\n}", "func (*MemberListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{4}\n}", "func (*MemberLevelListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{47}\n}", "func (*StringListValue) Descriptor() ([]byte, []int) {\n\treturn file_github_com_infobloxopen_atlas_app_toolkit_rpc_errfields_error_fields_proto_rawDescGZIP(), []int{1}\n}", "func (*List) Descriptor() ([]byte, []int) {\n\treturn file_filebrowser_proto_rawDescGZIP(), []int{0}\n}", "func (*PortList) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (*DecoyList) Descriptor() ([]byte, []int) {\n\treturn file_signalling_proto_rawDescGZIP(), []int{4}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{1}\n}", "func (*TList) Descriptor() ([]byte, []int) {\n\treturn file_s3_proto_s3_proto_rawDescGZIP(), []int{66}\n}", "func (*LeaderboardRecordList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{52}\n}", "func (*LeaderboardList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{50}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{12}\n}", "func (*MemberLevelListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{49}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{4}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*NotificationList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{73}\n}", "func (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{10}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{15}\n}", "func (*UserList) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{16}\n}", "func (*CMsgDOTAMutationList) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{301}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{5}\n}", "func (*RuleBasedUserListInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_user_lists_proto_rawDescGZIP(), []int{10}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{2}\n}", "func (*ListService) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{6}\n}", "func (*PhoneList) Descriptor() ([]byte, []int) {\n\treturn file_contacts_phones_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{0}\n}", "func (*PortList) Descriptor() ([]byte, []int) {\n\treturn file_portdomain_proto_rawDescGZIP(), []int{2}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*GroupListReplyProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{43}\n}", "func (*GroupUserList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{43}\n}", "func (*CMsgLeagueAdminList) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{21}\n}", "func (*ListOption) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{11}\n}", "func (*UserList) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_proto_rawDescGZIP(), []int{1}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*LogicalUserListInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_user_lists_proto_rawDescGZIP(), []int{11}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*UserList) Descriptor() ([]byte, []int) {\n\treturn file_api_interface_v1_user_proto_rawDescGZIP(), []int{2}\n}", "func (*List_ListItem) Descriptor() ([]byte, []int) {\n\treturn file_google_actions_sdk_v2_conversation_prompt_content_list_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*ListTeamsResponse_TeamListItem) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_audience_team_list_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*SubscriptionList) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{12}\n}", "func (*TournamentRecordList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{87}\n}", "func (*ListChannelMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{56}\n}", "func (*ListOption) Descriptor() ([]byte, []int) {\n\treturn file_api_comm_base_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*UserListRuleInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_user_lists_proto_rawDescGZIP(), []int{2}\n}", "func (*MemberRuleSettingListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{94}\n}", "func (*MemberReceiveAddressListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{83}\n}", "func (*ListMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{15}\n}", "func (*UserList) Descriptor() ([]byte, []int) {\n\treturn file_user_copy_proto_rawDescGZIP(), []int{1}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*ListStringMatcher) Descriptor() ([]byte, []int) {\n\treturn file_envoy_type_matcher_v3_string_proto_rawDescGZIP(), []int{1}\n}", "func (*ListChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{27}\n}", "func (*SubscriptionList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{103}\n}", "func (*TopicList) Descriptor() ([]byte, []int) {\n\treturn file_topic_proto_rawDescGZIP(), []int{2}\n}", "func (*MemberRuleSettingListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{92}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*PeopleListRequest) Descriptor() ([]byte, []int) {\n\treturn file_sil_proto_rawDescGZIP(), []int{2}\n}", "func (*ListMyTeams) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{4}\n}", "func (*UserListLogicalRuleInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_user_lists_proto_rawDescGZIP(), []int{12}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_todolist_proto_rawDescGZIP(), []int{4}\n}", "func (*MemberReceiveAddressListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{85}\n}", "func (*EvidenceList) Descriptor() ([]byte, []int) {\n\treturn file_tendermint_types_evidence_proto_rawDescGZIP(), []int{3}\n}", "func (*GetClientListRequest) Descriptor() ([]byte, []int) {\n\treturn file_messaging_proto_rawDescGZIP(), []int{4}\n}", "func (*PluginListRequest) Descriptor() ([]byte, []int) {\n\treturn file_plugin_proto_rawDescGZIP(), []int{7}\n}" ]
[ "0.707069", "0.70365655", "0.70291966", "0.70239806", "0.6918956", "0.6818043", "0.67351645", "0.6724737", "0.6663505", "0.665617", "0.66319114", "0.6621582", "0.66133124", "0.6585078", "0.6584132", "0.6580475", "0.6579676", "0.65657884", "0.6558554", "0.6557646", "0.65424997", "0.65341115", "0.65338784", "0.65134346", "0.6510221", "0.65050554", "0.65004647", "0.65001273", "0.64967394", "0.649368", "0.6473264", "0.6470122", "0.64548326", "0.6450808", "0.644079", "0.6438837", "0.64376724", "0.64257425", "0.641976", "0.6417385", "0.6416005", "0.64078796", "0.6401691", "0.6399163", "0.63971573", "0.63961387", "0.6384466", "0.63817257", "0.6379755", "0.63793635", "0.6377418", "0.6376849", "0.6374149", "0.6370129", "0.6366702", "0.63624394", "0.6356122", "0.63520026", "0.63512194", "0.63505757", "0.634992", "0.6347597", "0.6347504", "0.6342851", "0.63391256", "0.63337", "0.6328048", "0.6327782", "0.63272804", "0.6322344", "0.6321042", "0.6314256", "0.63132596", "0.6312407", "0.6312109", "0.6308716", "0.6301865", "0.6299582", "0.62948334", "0.62943786", "0.62925786", "0.628961", "0.62868035", "0.6285906", "0.6283682", "0.62835085", "0.62776065", "0.6276053", "0.6271469", "0.62712395", "0.6269386", "0.6264464", "0.6258617", "0.6258061", "0.6257294", "0.62542915", "0.6235322", "0.6232915", "0.62304497", "0.6228509" ]
0.71012735
0
Deprecated: Use MapValue.ProtoReflect.Descriptor instead.
func (*MapValue) Descriptor() ([]byte, []int) { return file_proto_value_value_proto_rawDescGZIP(), []int{5} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Type_MapType) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 1}\n}", "func (*Map) Descriptor() ([]byte, []int) {\n\treturn file_userInfo_proto_rawDescGZIP(), []int{0}\n}", "func (*MapValueResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{7}\n}", "func (*Maps) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{4}\n}", "func (*MapMessage) Descriptor() ([]byte, []int) {\n\treturn file_map_proto_rawDescGZIP(), []int{1}\n}", "func (*SimpleMap) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{5}\n}", "func (*MapContainer) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_client_flagpb_unmarshal_test_proto_rawDescGZIP(), []int{3}\n}", "func (*GetConfigMapRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{0}\n}", "func (*ValidAuthorizations_MapElement) Descriptor() ([]byte, []int) {\n\treturn file_sa_proto_rawDescGZIP(), []int{5, 0}\n}", "func (*WatchConfigMapsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{7}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*CMsgGlobalMapStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{91}\n}", "func (*NestedMap) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{7}\n}", "func (*MapLeaf) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{0}\n}", "func (*GetMapValueRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{5}\n}", "func ProtoFromMessageDescriptor(d protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\ttype canProto interface {\n\t\tMessageDescriptorProto() *descriptorpb.DescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MessageDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.DescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToDescriptorProto(d)\n}", "func (*IDMapType) Descriptor() ([]byte, []int) {\n\treturn file_incus_migration_migrate_proto_rawDescGZIP(), []int{0}\n}", "func (*MapMetadata) Descriptor() ([]byte, []int) {\n\treturn file_sequencer_api_proto_rawDescGZIP(), []int{0}\n}", "func (*WatchConfigMapsResponse_PageTokenChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{8, 0}\n}", "func (*InitMapRequest) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{17}\n}", "func (*UpdateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{40}\n}", "func (*Authorizations_MapElement) Descriptor() ([]byte, []int) {\n\treturn file_sa_proto_rawDescGZIP(), []int{30, 0}\n}", "func buildMapDescriptorProto(field *surface_v1.Field) *dpb.DescriptorProto {\n\tisMapEntry := true\n\tn := field.FieldName + \"Entry\"\n\n\tmapDP := &dpb.DescriptorProto{\n\t\tName: &n,\n\t\tField: buildKeyValueFields(field),\n\t\tOptions: &dpb.MessageOptions{MapEntry: &isMapEntry},\n\t}\n\treturn mapDP\n}", "func (*BatchGetConfigMapsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{1}\n}", "func (*WatchConfigMapRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{5}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*Maps) Descriptor() ([]byte, []int) {\n\treturn file_constructs_input_proto_rawDescGZIP(), []int{5}\n}", "func (*Verdict) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_addressvalidation_v1_address_validation_service_proto_rawDescGZIP(), []int{5}\n}", "func (*WatchConfigMapsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{8}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*GetMapLeafRequest) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*CSVCMsg_PaintmapData) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{42}\n}", "func (*BatchGetConfigMapsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{2}\n}", "func (*CSVCMsg_PaintmapData) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{42}\n}", "func (*InitMapResponse) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{18}\n}", "func (*MapStateSpec) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{14}\n}", "func (*ListConfigMapsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{3}\n}", "func (*UnaryMapMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{10}\n}", "func (*GetDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{38}\n}", "func (*CMsgGCToClientCavernCrawlMapUpdated) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{290}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*MapLeaves) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{1}\n}", "func (*MapResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{15}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (*UnaryMapRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{9}\n}", "func (*CMsgMapStatsSnapshot) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{90}\n}", "func (*SimpleMapDocument) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{16}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*GetMapLeafResponse) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{7}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func (*CreateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{39}\n}", "func (*MapFilter) Descriptor() ([]byte, []int) {\n\treturn file_app_proto_rawDescGZIP(), []int{17}\n}", "func (*MapLeafInclusion) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{2}\n}", "func ProtoFromServiceDescriptor(d protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto {\n\ttype canProto interface {\n\t\tServiceDescriptorProto() *descriptorpb.ServiceDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.ServiceDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif sd, ok := res.AsProto().(*descriptorpb.ServiceDescriptorProto); ok {\n\t\t\treturn sd\n\t\t}\n\t}\n\treturn protodesc.ToServiceDescriptorProto(d)\n}", "func (*WatchConfigMapResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{6}\n}", "func (*SimpleStringMap) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{6}\n}", "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "func (*CMsgClientToGCCavernCrawlRequestMapState) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{297}\n}", "func ProtoFromEnumValueDescriptor(d protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto {\n\ttype canProto interface {\n\t\tEnumValueDescriptorProto() *descriptorpb.EnumValueDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.EnumValueDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif ed, ok := res.AsProto().(*descriptorpb.EnumValueDescriptorProto); ok {\n\t\t\treturn ed\n\t\t}\n\t}\n\treturn protodesc.ToEnumValueDescriptorProto(d)\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*ListConfigMapsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{4}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (x *fastReflection_AddressStringToBytesRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesRequest\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (x *fastReflection_AddressStringToBytesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesResponse\n}", "func (*IdMap) Descriptor() ([]byte, []int) {\n\treturn file_nsjail_config_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgClientToGCCavernCrawlRequestMapStateResponse_MapVariant) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{298, 3}\n}", "func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}", "func (x *fastReflection_AddressBytesToStringRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressBytesToStringRequest\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (*UpdateConfigMapRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{10}\n}", "func (*GetSignedMapRootRequest) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{14}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.rpc_command_options\":\n\t\tif x.RpcCommandOptions == nil {\n\t\t\tx.RpcCommandOptions = []*RpcCommandOptions{}\n\t\t}\n\t\tvalue := &_ServiceCommandDescriptor_2_list{list: &x.RpcCommandOptions}\n\t\treturn protoreflect.ValueOfList(value)\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.sub_commands\":\n\t\tif x.SubCommands == nil {\n\t\t\tx.SubCommands = make(map[string]*ServiceCommandDescriptor)\n\t\t}\n\t\tvalue := &_ServiceCommandDescriptor_3_map{m: &x.SubCommands}\n\t\treturn protoreflect.ValueOfMap(value)\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.service\":\n\t\tpanic(fmt.Errorf(\"field service of message cosmos.autocli.v1.ServiceCommandDescriptor is not mutable\"))\n\tcase \"cosmos.autocli.v1.ServiceCommandDescriptor.enhance_custom_command\":\n\t\tpanic(fmt.Errorf(\"field enhance_custom_command of message cosmos.autocli.v1.ServiceCommandDescriptor is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.ServiceCommandDescriptor\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.ServiceCommandDescriptor does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*SetMapLeavesRequest) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{10}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*GetMapLeafByRevisionRequest) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{5}\n}", "func (*Foo) Descriptor() ([]byte, []int) {\n\treturn file_map_proto_rawDescGZIP(), []int{0}\n}", "func (*TargetValue) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{7}\n}", "func (x *fastReflection_AddressBytesToStringResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressBytesToStringResponse\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{13}\n}", "func (*FeatureValue_Metadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_featurestore_online_service_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*MetadataUpdateEventProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{7}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*GrpcJsonTranscoder_DescriptorConfigMap) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_grpc_json_grpc_json_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*MaximizeConversionValue) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_bidding_proto_rawDescGZIP(), []int{7}\n}", "func (*RowOrganizedPackage_MapOfMetadata) Descriptor() ([]byte, []int) {\n\treturn file_fds_protobuf_stach_v2_RowOrganized_proto_rawDescGZIP(), []int{0, 7}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{41}\n}" ]
[ "0.68534106", "0.65867347", "0.65407133", "0.6514981", "0.650354", "0.63864344", "0.6374998", "0.63440746", "0.63249564", "0.6292053", "0.628673", "0.62796533", "0.6271795", "0.62570107", "0.6219716", "0.6176154", "0.6170224", "0.6157537", "0.6154043", "0.61422586", "0.61352056", "0.60982955", "0.60958403", "0.6075831", "0.6075018", "0.60745615", "0.60646266", "0.604408", "0.6043919", "0.6039091", "0.6017752", "0.59933037", "0.5992776", "0.5989717", "0.59893835", "0.5982287", "0.5972971", "0.5962098", "0.5957771", "0.5954614", "0.5953017", "0.5936502", "0.5924706", "0.59130704", "0.5912482", "0.5900911", "0.58903396", "0.58888984", "0.586675", "0.58537203", "0.58534765", "0.5851001", "0.5849608", "0.58443075", "0.583799", "0.5831097", "0.5828622", "0.5828236", "0.5825347", "0.5821835", "0.5816484", "0.58163387", "0.5811161", "0.58059067", "0.5803661", "0.5797974", "0.5792637", "0.57903093", "0.57873195", "0.57859015", "0.5784302", "0.57741475", "0.57681465", "0.57672554", "0.57577205", "0.5753238", "0.57519776", "0.5751028", "0.57509214", "0.5738561", "0.5732831", "0.5723084", "0.57189006", "0.5717066", "0.5709174", "0.5706639", "0.5705231", "0.569736", "0.56936765", "0.56884056", "0.5686332", "0.5685308", "0.5683189", "0.5681382", "0.5673812", "0.56737226", "0.5671959", "0.56715566", "0.56645745", "0.566191" ]
0.6997244
0
Cook up a uniqueish UNIXdomain socket name in /var/tmp, for the master. Can't use the current directory since Athena AFS doesn't support UNIXdomain sockets.
func masterSock() string { s := "/var/tmp/824-mr-" s += strconv.Itoa(os.Getuid()) return s }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func masterSock() string {\r\n\ts := \"/var/tmp/824-mr-\"\r\n\ts += strconv.Itoa(os.Getuid())\r\n\treturn s\r\n}", "func coordinatorSock() string {\n\ts := \"/var/tmp/824-mr-\"\n\ts += strconv.Itoa(os.Getuid())\n\treturn s\n}", "func coordinatorSock() string {\n\ts := \"/var/tmp/824-mr-\"\n\ts += strconv.Itoa(os.Getuid())\n\treturn s\n}", "func coordinatorSock() string {\n\ts := \"/var/tmp/824-mr-\"\n\ts += strconv.Itoa(os.Getuid())\n\treturn s\n}", "func coordinatorSock() string {\n\ts := \"/var/tmp/824-mr-\"\n\ts += strconv.Itoa(os.Getuid())\n\treturn s\n}", "func coordinatorSock() string {\n\ts := \"/var/tmp/824-mr-\"\n\ts += strconv.Itoa(os.Getuid())\n\treturn s\n}", "func coordinatorSock() string {\n\ts := \"/var/tmp/824-mr-\"\n\ts += strconv.Itoa(os.Getuid())\n\treturn s\n}", "func coordinatorSock() string {\n\ts := \"/var/tmp/6.824-mr-\"\n\ts += strconv.Itoa(os.Getuid())\n\treturn s\n}", "func TestEndpoints_LocalCreateUnixSocket(t *testing.T) {\n\tendpoints, config, cleanup := newEndpoints(t)\n\tdefer cleanup()\n\n\trequire.NoError(t, endpoints.Up(config))\n\n\tpath := endpoints.LocalSocketPath()\n\tassert.NoError(t, httpGetOverUnixSocket(path))\n\n\t// The unix socket file gets removed after shutdown.\n\tcleanup()\n\tassert.Equal(t, false, shared.PathExists(path))\n}", "func tarmakSocketPath(clusterConfig string) string {\n\treturn filepath.Join(clusterConfig, \"tarmak.sock\")\n}", "func socketSafeTempDir(t testing.TB) string {\n\ttempDir := t.TempDir()\n\tmaxLen := 103 - len(filepath.Join(\".fly\", \"fly-agent.sock\"))\n\tif len(tempDir) < maxLen {\n\t\treturn tempDir\n\t}\n\thasher := md5.New()\n\thasher.Write([]byte(tempDir))\n\tsum := base32.StdEncoding.EncodeToString(hasher.Sum(nil))\n\tsum = strings.Replace(sum, \"=\", \"\", -1)\n\tshorterTempDir := filepath.Join(os.TempDir(), sum)\n\terr := os.Symlink(tempDir, shorterTempDir)\n\tif err != nil {\n\t\tt.Fatalf(\"default temp dir is too long (len %d), but we failed to create symlink to %s (len %d) because: %v\", len(tempDir), shorterTempDir, len(shorterTempDir), err)\n\t}\n\tt.Cleanup(func() {\n\t\tos.Remove(shorterTempDir)\n\t})\n\treturn shorterTempDir\n}", "func mkTmpSocket(t *testing.T) (path string, cleanup func()) {\n\ttdir, err := ioutil.TempDir(\"\", \"socket-test-\")\n\tif err != nil {\n\t\tt.Fatalf(\"iouti.TempDir(): %v\", err)\n\t}\n\tcleanup = func() {\n\t\tos.RemoveAll(tdir)\n\t}\n\n\tpath = filepath.Join(tdir, \"socket\")\n\terr = osutil.Mksocket(path)\n\tif err != nil {\n\t\tt.Fatalf(\"osutil.Mksocket(): %v\", err)\n\t}\n\n\treturn\n}", "func testUnixAddr() string {\n\tf, err := os.CreateTemp(\"\", \"uwsgi-exporter-test\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\taddr := f.Name()\n\tf.Close()\n\tos.Remove(addr)\n\treturn addr\n}", "func rootlessSocketPathFromRunDir() (string, error) {\n\tuid := os.Getuid()\n\tf := filepath.Join(baseRunDir, \"user\", fmt.Sprintf(\"%d\", uid), \"docker.sock\")\n\tif fileExists(f) {\n\t\treturn f, nil\n\t}\n\treturn \"\", ErrRootlessDockerNotFoundRunDir\n}", "func rootlessSocketPathFromHomeRunDir() (string, error) {\n\thome, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tf := filepath.Join(home, \".docker\", \"run\", \"docker.sock\")\n\tif fileExists(f) {\n\t\treturn f, nil\n\t}\n\treturn \"\", ErrRootlessDockerNotFoundHomeRunDir\n}", "func (t *tmux) socketName() string { return fmt.Sprintf(\"%s@%s\", t.options.Profile, t.options.Story) }", "func rootlessSocketPathFromHomeDesktopDir() (string, error) {\n\thome, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tf := filepath.Join(home, \".docker\", \"desktop\", \"docker.sock\")\n\tif fileExists(f) {\n\t\treturn f, nil\n\t}\n\treturn \"\", ErrRootlessDockerNotFoundHomeDesktopDir\n}", "func rootlessSocketPathFromEnv() (string, error) {\n\txdgRuntimeDir, exists := os.LookupEnv(\"XDG_RUNTIME_DIR\")\n\tif exists {\n\t\tf := filepath.Join(xdgRuntimeDir, \"docker.sock\")\n\t\tif fileExists(f) {\n\t\t\treturn f, nil\n\t\t}\n\n\t\treturn \"\", ErrRootlessDockerNotFoundXDGRuntimeDir\n\t}\n\n\treturn \"\", ErrXDGRuntimeDirNotSet\n}", "func (s *Server) setupSockets(remoteID string) {\n log.Infof(\"server: dialing client socket\")\n out, err := net.DialUnix(\n udsType,\n nil,\n &net.UnixAddr{path.Join(os.TempDir(), remoteID), udsType},\n )\n if err != nil {\n log.Infof(\"problem dialing client's socket: %s\", err)\n return\n }\n\n if err := out.SetWriteBuffer(5 * MiB); err != nil {\n log.Errorf(\"cannot set the Unix Domain Socket buffer to 5 MiB\")\n return\n }\n\n log.Infof(\"server: preparing to listen on new socket\")\n uid := uuid.New()\n p := path.Join(os.TempDir(), uid)\n in, err := net.ListenUnixgram(udsType, &net.UnixAddr{p, udsType})\n if err != nil {\n out.Close()\n log.Infof(\"could not listen on domain socket %q: %s\", p, err)\n return\n }\n\n log.Infof(\"server: sending a uid to the client\")\n if err := SetupEncode(uid, out); err != nil {\n out.Close()\n log.Infof(\"problem encoding UUIDv4 for setup: %s\", err)\n return\n }\n\n go s.serveConn(in, out)\n}", "func unixServer(addr string) (io.ReadCloser, error) {\n\treturn listenServer(\"unix\", addr)\n}", "func SetUnixAddress(addr string) func(*Server) error {\n\treturn func(s *Server) error {\n\t\ts.unixAddr = addr\n\t\treturn nil\n\t}\n}", "func sharedUnixSocketVolumeMount() apiv1.VolumeMount {\n\treturn apiv1.VolumeMount{\n\t\tName: sidecar.UnixDomainSocketVolume,\n\t\tMountPath: pluggableComponentSocketMountPath,\n\t}\n}", "func DefaultCLIAddr() string {\n\treturn filepath.Join(os.TempDir(), \"dmsgpty.sock\")\n}", "func socketPath(bundleDir string) (string, error) {\n\tnum := rand.Intn(10000)\n\tpath := filepath.Join(bundleDir, fmt.Sprintf(\"socket-%4d\", num))\n\tconst maxPathLen = 108\n\tif len(path) <= maxPathLen {\n\t\treturn path, nil\n\t}\n\n\t// Path is too large, try to make it smaller.\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting cwd: %v\", err)\n\t}\n\tpath, err = filepath.Rel(cwd, path)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting relative path for %q from cwd %q: %v\", path, cwd, err)\n\t}\n\tif len(path) > maxPathLen {\n\t\treturn \"\", fmt.Errorf(\"could not get socket path under length limit %d: %s\", maxPathLen, path)\n\t}\n\treturn path, nil\n}", "func GetUnixServerPath(socketName string, paths ...string) string {\n\tserverPath := \"unix://\"\n\tfor _, path := range paths {\n\t\tserverPath = serverPath + path\n\t}\n\tserverPath = serverPath + socketName + \".sock\"\n\treturn serverPath\n}", "func createListenSocket(path string) (*os.File, error) {\n\tos.Remove(path)\n\tconn, err := net.ListenUnix(\"unix\", &net.UnixAddr{Name: path, Net: \"unix\"})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create socket: %v\", err)\n\t}\n\tf, err := conn.File()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f, nil\n}", "func getsockname(fd int, rsa *unix.RawSockaddrAny, addrlen *socklen) (err error)", "func socketUnixgram(name string) (*net.UnixConn, error) {\n\tsyscall.ForkLock.RLock()\n\tfd, err := unix.Socket(unix.AF_UNIX, unix.SOCK_DGRAM, 0)\n\tif err == nil {\n\t\tsyscall.CloseOnExec(fd)\n\t}\n\tsyscall.ForkLock.RUnlock()\n\tif err != nil {\n\t\treturn nil, os.NewSyscallError(\"socket\", err)\n\t}\n\tdefer unix.Close(fd)\n\t// Don't bother calling unix.SetNonblock(), net.FileConn()\n\t// will call syscall.SetNonblock().\n\tconn, err := net.FileConn(os.NewFile(uintptr(fd), name))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tunixConn := conn.(*net.UnixConn)\n\treturn unixConn, nil\n}", "func newUnixListener(t *testing.T) *net.UnixListener {\n\tfile, err := os.CreateTemp(\"\", \"lxd-endpoints-test\")\n\trequire.NoError(t, err)\n\n\tpath := file.Name()\n\trequire.NoError(t, file.Close())\n\terr = os.Remove(path)\n\trequire.NoError(t, err)\n\n\taddr, err := net.ResolveUnixAddr(\"unix\", path)\n\trequire.NoError(t, err)\n\n\tlistener, err := net.ListenUnix(\"unix\", addr)\n\n\trequire.NoError(t, err)\n\treturn listener\n}", "func BaseTempDirName(id string) (string, error) {\n\tuser, err := user.Current()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to get username: %w\", err)\n\t}\n\n\treturn fmt.Sprintf(\"/tmp/determined-%s-%s\", user.Username, id), nil\n}", "func sharedUnixSocketVolume() apiv1.Volume {\n\treturn apiv1.Volume{\n\t\tName: sidecar.UnixDomainSocketVolume,\n\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\tEmptyDir: &apiv1.EmptyDirVolumeSource{},\n\t\t},\n\t}\n}", "func UnixAddrToSockaddr(addr *net.UnixAddr) (Sockaddr, int) {\n\tt := 0\n\tswitch addr.Net {\n\tcase \"unix\":\n\t\tt = SOCK_STREAM\n\tcase \"unixgram\":\n\t\tt = SOCK_DGRAM\n\tcase \"unixpacket\":\n\t\tt = SOCK_SEQPACKET\n\tdefault:\n\t\treturn nil, 0\n\t}\n\treturn &SockaddrUnix{Name: addr.Name}, t\n}", "func SockaddrToUnixAddr(sa Sockaddr) *net.UnixAddr {\n\tif s, ok := sa.(*SockaddrUnix); ok {\n\t\treturn &net.UnixAddr{Name: s.Name, Net: \"unix\"}\n\t}\n\treturn nil\n}", "func tmpNetworkDir(net *btcnet.Params) string {\n\treturn networkDir(net) + \"_tmp\"\n}", "func main() {\n\tfile, err := os.Open(\"./temp\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\tfdnum := file.Fd()\n\tfmt.Printf(\"fd: %b %b %b %b\\n\", byte(fdnum), byte(fdnum>>8), byte(fdnum>>16), byte(fdnum>>24))\n\tfmt.Printf(\"ready to send fd: %d\\n\", fdnum)\n\t// 编码fd编译传送给其他进程\n\tdata := syscall.UnixRights(int(fdnum))\n\traddr, err := net.ResolveUnixAddr(\"unix\", socksPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// 连接UnixSock\n\tconn, err := net.DialUnix(\"unix\", nil, raddr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"has dial, time:%v\\n\", time.Now())\n\ttime.Sleep(10 * time.Second)\n\t// 发送msg\n\tn, oobn, err := conn.WriteMsgUnix(nil, data, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"has write, time:%v\\n\", time.Now())\n\ttime.Sleep(10 * time.Second)\n\tfmt.Printf(\"WriteMsgUnix = n:%d, oobn:%d; want 1, %d\\n\", n, oobn, len(data))\n\tfmt.Printf(\"write %d data success\\n\", n)\n}", "func UnixSocketRequireSameUser() UnixCredentialsFunc {\n\tuid, gid := os.Getuid(), os.Getgid()\n\treturn UnixSocketRequireUidGid(uid, gid)\n}", "func runServerToClientCopyAs(who, ttype string, conn *xsnet.Conn, srcPath string, chaffing bool) (exitStatus uint32, err error) {\n\tu, err := user.Lookup(who)\n\tif err != nil {\n\t\texitStatus = 1\n\t\treturn\n\t}\n\tvar uid, gid uint32\n\t_, _ = fmt.Sscanf(u.Uid, \"%d\", &uid) // nolint: gosec\n\t_, _ = fmt.Sscanf(u.Gid, \"%d\", &gid) // nolint: gosec\n\tlog.Println(\"uid:\", uid, \"gid:\", gid)\n\n\t// Need to clear server's env and set key vars of the\n\t// target user. This isn't perfect (TERM doesn't seem to\n\t// work 100%; ANSI/xterm colour isn't working even\n\t// if we set \"xterm\" or \"ansi\" here; and line count\n\t// reported by 'stty -a' defaults to 24 regardless\n\t// of client shell window used to run client.\n\t// Investigate -- rlm 2018-01-26)\n\tos.Clearenv()\n\t_ = os.Setenv(\"HOME\", u.HomeDir) // nolint: gosec\n\t_ = os.Setenv(\"TERM\", ttype) // nolint: gosec\n\t_ = os.Setenv(\"XS_SESSION\", \"1\") // nolint: gosec\n\n\tvar c *exec.Cmd\n\tcmdName := xs.GetTool(\"tar\")\n\tif !path.IsAbs(srcPath) {\n\t\tsrcPath = fmt.Sprintf(\"%s%c%s\", u.HomeDir, os.PathSeparator, srcPath)\n\t}\n\n\tsrcDir, srcBase := path.Split(srcPath)\n\tcmdArgs := []string{\"-cz\", \"-C\", srcDir, \"-f\", \"-\", srcBase}\n\n\tc = exec.Command(cmdName, cmdArgs...) // nolint: gosec\n\n\t//If os.Clearenv() isn't called by server above these will be seen in the\n\t//client's session env.\n\t//c.Env = []string{\"HOME=\" + u.HomeDir, \"SUDO_GID=\", \"SUDO_UID=\", \"SUDO_USER=\", \"SUDO_COMMAND=\", \"MAIL=\", \"LOGNAME=\"+who}\n\tc.Dir = u.HomeDir\n\tc.SysProcAttr = &syscall.SysProcAttr{}\n\tc.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}\n\tc.Stdout = conn\n\t// Stderr sinkholing (or buffering to something other than stdout)\n\t// is important. Any extraneous output to tarpipe messes up remote\n\t// side as it's expecting pure tar data.\n\t// (For example, if user specifies abs paths, tar outputs\n\t// \"Removing leading '/' from path names\")\n\tstdErrBuffer := new(bytes.Buffer)\n\tc.Stderr = stdErrBuffer\n\t//c.Stderr = nil\n\n\tif chaffing {\n\t\tconn.EnableChaff()\n\t}\n\t//defer conn.Close()\n\tdefer conn.DisableChaff()\n\tdefer conn.ShutdownChaff()\n\n\t// Start the command (no pty)\n\tlog.Printf(\"[%v %v]\\n\", cmdName, cmdArgs)\n\terr = c.Start() // returns immediately\n\tif err != nil {\n\t\tlog.Printf(\"Command finished with error: %v\", err)\n\t\treturn xsnet.CSEExecFail, err // !?\n\t}\n\tif err := c.Wait(); err != nil {\n\t\t//fmt.Println(\"*** c.Wait() done ***\")\n\t\tif exiterr, ok := err.(*exec.ExitError); ok {\n\t\t\t// The program has exited with an exit code != 0\n\n\t\t\t// This works on both Unix and Windows. Although package\n\t\t\t// syscall is generally platform dependent, WaitStatus is\n\t\t\t// defined for both Unix and Windows and in both cases has\n\t\t\t// an ExitStatus() method with the same signature.\n\t\t\tif status, ok := exiterr.Sys().(syscall.WaitStatus); ok {\n\t\t\t\texitStatus = uint32(status.ExitStatus())\n\t\t\t\tif len(stdErrBuffer.Bytes()) > 0 {\n\t\t\t\t\tlog.Print(stdErrBuffer)\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"Exit Status: %d\", exitStatus)\n\t\t\t}\n\t\t}\n\t}\n\t//fmt.Println(\"*** server->client cp finished ***\")\n\treturn\n}", "func listenUnix(addr string) (net.Listener, error) {\n\tif strings.HasPrefix(addr, \"@\") {\n\t\treturn net.Listen(\"unix\", addr)\n\t}\n\n\tos.RemoveAll(addr)\n\treturn net.Listen(\"unix\", addr)\n}", "func main() {\n\tvar connList []uintptr\n\tisUpgrade := os.Getenv(\"fork\") != \"\"\n\tvar err error\n\tvar ln net.Listener\n\tif isUpgrade {\n\t\tln, err = net.FileListener(os.NewFile(3, \"\"))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tln, _ = net.Listen(\"tcp\", \"localhost:9000\")\n\t}\n\n\tif isUpgrade {\n\t\tconn, err := net.FileConn(os.NewFile(4, \"\"))\n\t\tPanic(err)\n\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\tconn.Write([]byte(\"hello\" + os.Getenv(\"fork\")))\n\t\t\t\ttime.Sleep(time.Millisecond * 500)\n\t\t\t\tvar data = make([]byte, 1024)\n\t\t\t\tconn.Read(data)\n\t\t\t\tfmt.Println(string(data))\n\t\t\t}\n\t\t}()\n\t}\n\n\t//defer ln.Close()\n\n\trawConn, ok := ln.(syscall.Conn)\n\tif !ok {\n\t\tpanic(\"not raw\")\n\t}\n\n\traw, err := rawConn.SyscallConn()\n\tPanic(err)\n\n\tvar dupfd uintptr\n\tPanic(raw.Control(func(fd uintptr) {\n\t\tdupfd, err = dupFd(fd)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tPanic(err)\n\t}))\n\n\tconnList = append(connList, dupfd)\n\n\tgo func() {\n\t\tfor i := 0; ; i++ {\n\t\t\tconn, err := ln.Accept()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\trawConn, ok := conn.(syscall.Conn)\n\t\t\tif !ok {\n\t\t\t\tpanic(\"not raw\")\n\t\t\t}\n\n\t\t\traw, err := rawConn.SyscallConn()\n\t\t\tPanic(err)\n\n\t\t\tvar dupfd uintptr\n\t\t\tPanic(raw.Control(func(fd uintptr) {\n\t\t\t\tdupfd, err = dupFd(fd)\n\t\t\t\tPanic(err)\n\t\t\t}))\n\n\t\t\tconnList = append(connList, dupfd)\n\n\t\t\tgo func() {\n\t\t\t\tfor {\n\t\t\t\t\tconn.Write([]byte(\"hello\"))\n\t\t\t\t\ttime.Sleep(time.Millisecond * 500)\n\t\t\t\t\tvar data = make([]byte, 1024)\n\t\t\t\t\tconn.Read(data)\n\t\t\t\t\tfmt.Println(string(data))\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}()\n\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGHUP)\n\t<-ch\n\n\tos.Setenv(\"fork\", \"true\")\n\n\tpid, err := forkExec(os.Args[0], os.Args, connList...)\n\tPanic(err)\n\n\tgo func() {\n\t\t// 防止子进程变成僵尸进程\n\t\tfor {\n\t\t\t_, _ = syscall.Wait4(pid, nil, syscall.WNOWAIT, nil)\n\t\t\ttime.Sleep(time.Second * 5)\n\t\t\treturn\n\t\t}\n\t}()\n\n\ttime.Sleep(time.Second * 5)\n}", "func UnixSocket(socket string) func(*Attacker) {\n\treturn func(a *Attacker) {\n\t\tif tr, ok := a.client.Transport.(*http.Transport); socket != \"\" && ok {\n\t\t\ttr.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) {\n\t\t\t\treturn net.Dial(\"unix\", socket)\n\t\t\t}\n\t\t}\n\t}\n}", "func init() {\n\thostname, err := os.Hostname()\n\tif hostname == \"\" || err != nil {\n\t\thostname = \"localhost\"\n\t}\n\tvar buf [12]byte\n\tvar b64 string\n\tfor len(b64) < 10 {\n\t\t_, _ = rand.Read(buf[:])\n\t\tb64 = base64.StdEncoding.EncodeToString(buf[:])\n\t\tb64 = strings.NewReplacer(\"+\", \"\", \"/\", \"\").Replace(b64)\n\t}\n\n\tprefix = fmt.Sprintf(\"%s/%s\", hostname, b64[0:10])\n}", "func connectUnixSocket() (*sql.DB, error) {\n\tmustGetenv := func(k string) string {\n\t\tv := os.Getenv(k)\n\t\tif v == \"\" {\n\t\t\tlog.Fatalf(\"Fatal Error in connect_unix.go: %s environment variable not set.\\n\", k)\n\t\t}\n\t\treturn v\n\t}\n\t// Note: Saving credentials in environment variables is convenient, but not\n\t// secure - consider a more secure solution such as\n\t// Cloud Secret Manager (https://cloud.google.com/secret-manager) to help\n\t// keep secrets safe.\n\tvar (\n\t\tdbUser = mustGetenv(\"DB_USER\") // e.g. 'my-db-user'\n\t\tdbPwd = mustGetenv(\"DB_PASS\") // e.g. 'my-db-password'\n\t\tunixSocketPath = mustGetenv(\"INSTANCE_UNIX_SOCKET\") // e.g. '/cloudsql/project:region:instance'\n\t\tdbName = mustGetenv(\"DB_NAME\") // e.g. 'my-database'\n\t)\n\n\tdbURI := fmt.Sprintf(\"user=%s password=%s database=%s host=%s\",\n\t\tdbUser, dbPwd, dbName, unixSocketPath)\n\n\t// dbPool is the pool of database connections.\n\tdbPool, err := sql.Open(\"pgx\", dbURI)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"sql.Open: %w\", err)\n\t}\n\n\t// [START_EXCLUDE]\n\tconfigureConnectionPool(dbPool)\n\t// [END_EXCLUDE]\n\n\treturn dbPool, nil\n}", "func daprSocketPathEnvVarFor(socket string) apiv1.EnvVar {\n\treturn apiv1.EnvVar{\n\t\tName: pluggableComponentSocketEnvVar,\n\t\tValue: fmt.Sprintf(\"%s/%s\", pluggableComponentSocketMountPath, socket),\n\t}\n}", "func TmpfsRoot(l *LinuxFactory) error {\n\tmounted, err := mount.Mounted(l.Root)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !mounted {\n\t\tif err := syscall.Mount(\"tmpfs\", l.Root, \"tmpfs\", 0, \"\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func TestEndpoints_LocalUnknownUnixGroup(t *testing.T) {\n\tendpoints, config, cleanup := newEndpoints(t)\n\tdefer cleanup()\n\n\tconfig.LocalUnixSocketGroup = \"xquibaz\"\n\terr := endpoints.Up(config)\n\n\tassert.EqualError(\n\t\tt, err, \"local endpoint: cannot get group ID of 'xquibaz': group: unknown group xquibaz\")\n}", "func (c *cpu) getsockname() {\n\tsp, addrlen := popPtr(c.sp)\n\tsp, addr := popPtr(sp)\n\tfd := readI32(sp)\n\t_, _, err := syscall.Syscall(unix.SYS_GETSOCKNAME, uintptr(fd), addr, addrlen)\n\tif strace {\n\t\tfmt.Fprintf(os.Stderr, \"getsockname(%#x, %#x, %#x) %v\\t; %s\\n\", fd, addr, addrlen, err, c.pos())\n\t}\n\tif err != 0 {\n\t\tc.setErrno(err)\n\t\twriteI32(c.rp, -1)\n\t\treturn\n\t}\n\n\twriteI32(c.rp, 0)\n}", "func StartServer(servers []string, me int) *ShardMaster {\n gob.Register(Op{})\n gob.Register(JoinArgs{})\n gob.Register(LeaveArgs{})\n gob.Register(MoveArgs{})\n gob.Register(QueryArgs{})\n\n sm := new(ShardMaster)\n sm.me = me\n\n sm.configs = make([]Config, 1)\n sm.configs[0].Groups = make(map[int64][]string)\n\n sm.lastAppliedSeq = -1\n\n rpcs := rpc.NewServer()\n rpcs.Register(sm)\n\n sm.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me])\n if e != nil {\n log.Fatal(\"listen error: \", e)\n }\n sm.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for sm.dead == false {\n conn, err := sm.l.Accept()\n if err == nil && sm.dead == false {\n if sm.unreliable && (rand.Int63()%1000) < 100 {\n // discard the request.\n conn.Close()\n } else if sm.unreliable && (rand.Int63()%1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && sm.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n sm.Kill()\n }\n }\n }()\n\n go sm.tick()\n\n return sm\n}", "func runClientToServerCopyAs(who, ttype string, conn *xsnet.Conn, fpath string, chaffing bool) (exitStatus uint32, err error) {\n\tu, _ := user.Lookup(who) // nolint: gosec\n\tvar uid, gid uint32\n\tfmt.Sscanf(u.Uid, \"%d\", &uid) // nolint: gosec,errcheck\n\tfmt.Sscanf(u.Gid, \"%d\", &gid) // nolint: gosec,errcheck\n\tlog.Println(\"uid:\", uid, \"gid:\", gid)\n\n\t// Need to clear server's env and set key vars of the\n\t// target user. This isn't perfect (TERM doesn't seem to\n\t// work 100%; ANSI/xterm colour isn't working even\n\t// if we set \"xterm\" or \"ansi\" here; and line count\n\t// reported by 'stty -a' defaults to 24 regardless\n\t// of client shell window used to run client.\n\t// Investigate -- rlm 2018-01-26)\n\tos.Clearenv()\n\tos.Setenv(\"HOME\", u.HomeDir) // nolint: gosec,errcheck\n\tos.Setenv(\"TERM\", ttype) // nolint: gosec,errcheck\n\tos.Setenv(\"XS_SESSION\", \"1\") // nolint: gosec,errcheck\n\n\tvar c *exec.Cmd\n\tcmdName := xs.GetTool(\"tar\")\n\n\tvar destDir string\n\tif path.IsAbs(fpath) {\n\t\tdestDir = fpath\n\t} else {\n\t\tdestDir = path.Join(u.HomeDir, fpath)\n\t}\n\n\tcmdArgs := []string{\"-xz\", \"-C\", destDir}\n\n\t// NOTE the lack of quotes around --xform option's sed expression.\n\t// When args are passed in exec() format, no quoting is required\n\t// (as this isn't input from a shell) (right? -rlm 20180823)\n\t//cmdArgs := []string{\"-x\", \"-C\", destDir, `--xform=s#.*/\\(.*\\)#\\1#`}\n\tfmt.Println(cmdName, cmdArgs)\n\tc = exec.Command(cmdName, cmdArgs...) // nolint: gosec\n\n\tc.Dir = destDir\n\n\t//If os.Clearenv() isn't called by server above these will be seen in the\n\t//client's session env.\n\t//c.Env = []string{\"HOME=\" + u.HomeDir, \"SUDO_GID=\", \"SUDO_UID=\", \"SUDO_USER=\", \"SUDO_COMMAND=\", \"MAIL=\", \"LOGNAME=\"+who}\n\t//c.Dir = u.HomeDir\n\tc.SysProcAttr = &syscall.SysProcAttr{}\n\tc.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}\n\tc.Stdin = conn\n\tc.Stdout = os.Stdout\n\tc.Stderr = os.Stderr\n\n\tif chaffing {\n\t\tconn.EnableChaff()\n\t}\n\tdefer conn.DisableChaff()\n\tdefer conn.ShutdownChaff()\n\n\t// Start the command (no pty)\n\tlog.Printf(\"[%v %v]\\n\", cmdName, cmdArgs)\n\terr = c.Start() // returns immediately\n\t/////////////\n\t// NOTE: There is, apparently, a bug in Go stdlib here. Start()\n\t// can actually return immediately, on a command which *does*\n\t// start but exits quickly, with c.Wait() error\n\t// \"c.Wait status: exec: not started\".\n\t// As in this example, attempting a client->server copy to\n\t// a nonexistent remote dir (it's tar exiting right away, exitStatus\n\t// 2, stderr\n\t// /bin/tar -xz -C /home/someuser/nosuchdir\n\t// stderr: fork/exec /bin/tar: no such file or directory\n\t//\n\t// In this case, c.Wait() won't give us the real\n\t// exit status (is it lost?).\n\t/////////////\n\tif err != nil {\n\t\tlog.Println(\"cmd exited immediately. Cannot get cmd.Wait().ExitStatus()\")\n\t\terr = errors.New(\"cmd exited prematurely\")\n\t\t//exitStatus = uint32(254)\n\t\texitStatus = xsnet.CSEExecFail\n\t} else {\n\t\tif err := c.Wait(); err != nil {\n\t\t\t//fmt.Println(\"*** c.Wait() done ***\")\n\t\t\tif exiterr, ok := err.(*exec.ExitError); ok {\n\t\t\t\t// The program has exited with an exit code != 0\n\n\t\t\t\t// This works on both Unix and Windows. Although package\n\t\t\t\t// syscall is generally platform dependent, WaitStatus is\n\t\t\t\t// defined for both Unix and Windows and in both cases has\n\t\t\t\t// an ExitStatus() method with the same signature.\n\t\t\t\tif status, ok := exiterr.Sys().(syscall.WaitStatus); ok {\n\t\t\t\t\texitStatus = uint32(status.ExitStatus())\n\t\t\t\t\t//err = errors.New(\"cmd returned nonzero status\")\n\t\t\t\t\tlog.Printf(\"Exit Status: %d\\n\", exitStatus)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog.Println(\"*** client->server cp finished ***\")\n\t}\n\treturn\n}", "func prepareTempDir(rootDir string) (string, error) {\n\tvar tmpDir string\n\tif tmpDir = os.Getenv(\"DOCKER_TMPDIR\"); tmpDir == \"\" {\n\t\ttmpDir = filepath.Join(rootDir, \"tmp\")\n\t\tnewName := tmpDir + \"-old\"\n\t\tif err := os.Rename(tmpDir, newName); err == nil {\n\t\t\tgo func() {\n\t\t\t\tif err := os.RemoveAll(newName); err != nil {\n\t\t\t\t\tlog.G(context.TODO()).Warnf(\"failed to delete old tmp directory: %s\", newName)\n\t\t\t\t}\n\t\t\t}()\n\t\t} else if !os.IsNotExist(err) {\n\t\t\tlog.G(context.TODO()).Warnf(\"failed to rename %s for background deletion: %s. Deleting synchronously\", tmpDir, err)\n\t\t\tif err := os.RemoveAll(tmpDir); err != nil {\n\t\t\t\tlog.G(context.TODO()).Warnf(\"failed to delete old tmp directory: %s\", tmpDir)\n\t\t\t}\n\t\t}\n\t}\n\treturn tmpDir, idtools.MkdirAllAndChown(tmpDir, 0o700, idtools.CurrentIdentity())\n}", "func StartServer(servers []string, me int) *ShardMaster {\n gob.Register(Op{})\n\n sm := new(ShardMaster)\n sm.me = me\n\n sm.configs = make([]Config, 1)\n\n for i := 0; i < NShards; i++ {\n\tsm.configs[0].Shards[i] = EMPTY_NUMBER \n }\n sm.configs[0].Groups = map[int64][]string{}\n\n rpcs := rpc.NewServer()\n rpcs.Register(sm)\n\n sm.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n sm.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for sm.dead == false {\n conn, err := sm.l.Accept()\n if err == nil && sm.dead == false {\n if sm.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if sm.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && sm.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n sm.Kill()\n }\n }\n }()\n\n return sm\n}", "func MakeWSRpcHost(ctx *cli.Context) string {\n\tif !ctx.GlobalBool(WSEnabledFlag.Name) {\n\t\treturn \"\"\n\t}\n\treturn ctx.GlobalString(WSListenAddrFlag.Name)\n}", "func UnixConnect(ctx context.Context, addr string) (net.Conn, error) {\n\tunixAddr, _ := net.ResolveUnixAddr(\"unix\", addr)\n\treturn net.DialUnix(\"unix\", nil, unixAddr)\n}", "func NewServer(setupSocket string) (*Server, error) {\n p := path.Join(os.TempDir(), setupSocket)\n conn, err := net.ListenUnixgram(udsType, &net.UnixAddr{p, udsType})\n if err != nil {\n return nil, fmt.Errorf(\"could not listen on domain socket %q: %s\", setupSocket, err)\n }\n\n s := &Server{setupConn: conn, registry: make(map[string]*register, 1)}\n\n return s, nil\n}", "func defaultHostId(p peer.ID, prefix string) string {\n\tif os.Getenv(\"HOST_ID\") == \"\" {\n\t\treturn fmt.Sprintf(\"%s-%s\", prefix, shortID(p))\n\t}\n\treturn fmt.Sprintf(\"%s-%s-%s\", prefix, os.Getenv(\"HOST_ID\"), shortID(p))\n}", "func NewUnix(c Config, p uint32) (*Asock, error) {\n\tl, err := net.ListenUnix(\"unix\", &net.UnixAddr{Name: c.Sockname, Net: \"unix\"})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = os.Chmod(c.Sockname, os.FileMode(p))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn commonNew(c, l), nil\n}", "func ConnectIncusUnix(path string, args *ConnectionArgs) (InstanceServer, error) {\n\treturn ConnectIncusUnixWithContext(context.Background(), path, args)\n}", "func ConnectIncusUnixWithContext(ctx context.Context, path string, args *ConnectionArgs) (InstanceServer, error) {\n\tlogger.Debug(\"Connecting to a local Incus over a Unix socket\")\n\n\t// Use empty args if not specified\n\tif args == nil {\n\t\targs = &ConnectionArgs{}\n\t}\n\n\thttpBaseURL, err := url.Parse(\"http://unix.socket\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctxConnected, ctxConnectedCancel := context.WithCancel(context.Background())\n\n\t// Initialize the client struct\n\tserver := ProtocolIncus{\n\t\tctx: ctx,\n\t\thttpBaseURL: *httpBaseURL,\n\t\thttpUnixPath: path,\n\t\thttpProtocol: \"unix\",\n\t\thttpUserAgent: args.UserAgent,\n\t\tctxConnected: ctxConnected,\n\t\tctxConnectedCancel: ctxConnectedCancel,\n\t\teventConns: make(map[string]*websocket.Conn),\n\t\teventListeners: make(map[string][]*EventListener),\n\t}\n\n\t// Determine the socket path\n\tif path == \"\" {\n\t\tpath = os.Getenv(\"INCUS_SOCKET\")\n\t\tif path == \"\" {\n\t\t\tincusDir := os.Getenv(\"INCUS_DIR\")\n\t\t\tif incusDir == \"\" {\n\t\t\t\tincusDir = \"/var/lib/incus\"\n\t\t\t}\n\n\t\t\tpath = filepath.Join(incusDir, \"unix.socket\")\n\t\t}\n\t}\n\n\t// Setup the HTTP client\n\thttpClient, err := unixHTTPClient(args, path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserver.http = httpClient\n\n\t// Test the connection and seed the server information\n\tif !args.SkipGetServer {\n\t\tserverStatus, _, err := server.GetServer()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Record the server certificate\n\t\tserver.httpCertificate = serverStatus.Environment.Certificate\n\t}\n\n\treturn &server, nil\n}", "func systemPeers() string {\n\treturn filepath.Join(\"/\", \"etc\", dirname, filename)\n}", "func createUniqueFileName() string {\n\n\t// Get a timestamp\n\ttv := syscall.Timeval{}\n\tsyscall.Gettimeofday(&tv)\n\tleft := fmt.Sprintf(\"%d.%d\", tv.Sec, tv.Usec)\n\n\t// Just generate a random number for now\n\tb := make([]byte, 16)\n\trand.Read(b)\n\tmiddle := fmt.Sprintf(\"%x\", b)\n\n\t// The right dot should be the hostname\n\tright, _ := os.Hostname()\n\n\t// Put the pieces together\n\tcombined := []string{left, middle, right}\n\treturn strings.Join(combined, \".\")\n}", "func StartServer(me string) *ObliviousReplica {\n\n or := new(ObliviousReplica)\n or.me = me\n\n rpcs := rpc.NewServer()\n rpcs.Register(or)\n\n or.UID = GetMD5Hash(me)\n os.Mkdir(\"data\", 0700)\n\n or.dataPath = \"data/replica-\" + or.UID\n os.Mkdir(or.dataPath, 0700)\n\n os.Remove(me)\n l, e := net.Listen(Network, me);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n or.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for or.dead == false {\n conn, err := or.l.Accept()\n if err == nil && or.dead == false {\n if or.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if or.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && or.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n or.Kill()\n }\n }\n }()\n\n return or\n}", "func ReadOrMakeHostUUID(dataDir string) (string, error) {\n\tid, err := ReadHostUUID(dataDir)\n\tif err == nil {\n\t\treturn id, nil\n\t}\n\tif !trace.IsNotFound(err) {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\t// Checking error instead of the usual uuid.New() in case uuid generation\n\t// fails due to not enough randomness. It's been known to happen happen when\n\t// Teleport starts very early in the node initialization cycle and /dev/urandom\n\t// isn't ready yet.\n\trawID, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn \"\", trace.BadParameter(\"\" +\n\t\t\t\"Teleport failed to generate host UUID. \" +\n\t\t\t\"This may happen if randomness source is not fully initialized when the node is starting up. \" +\n\t\t\t\"Please try restarting Teleport again.\")\n\t}\n\tid = rawID.String()\n\tif err = WriteHostUUID(dataDir, id); err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\treturn id, nil\n}", "func (opt KubeAPIServerStartConfig) MakeMasterConfig(dockerClient dockerhelper.Interface, basedir string) (string, error) {\n\tcomponentName := \"create-master-config\"\n\timageRunHelper := run.NewRunHelper(dockerhelper.NewHelper(dockerClient)).New()\n\tglog.Infof(\"Running %q\", componentName)\n\n\tcreateConfigCmd := []string{\n\t\t\"start\", \"master\",\n\t}\n\tcreateConfigCmd = append(createConfigCmd, opt.Args...)\n\n\tcontainerId, rc, err := imageRunHelper.Image(opt.MasterImage).\n\t\tPrivileged().\n\t\tHostNetwork().\n\t\tHostPid().\n\t\tSaveContainerLogs(componentName, path.Join(basedir, \"logs\")).\n\t\tCommand(createConfigCmd...).Run()\n\tdefer func() {\n\t\tif err = dockerClient.ContainerRemove(containerId, types.ContainerRemoveOptions{}); err != nil {\n\t\t\tglog.Errorf(\"error removing %q: %v\", containerId, err)\n\t\t}\n\t}()\n\tif err != nil {\n\t\treturn \"\", errors.NewError(\"could not run %q: %v\", componentName, err).WithCause(err)\n\t}\n\tif rc != 0 {\n\t\treturn \"\", errors.NewError(\"could not run %q: rc==%v\", componentName, rc)\n\t}\n\n\t// TODO eliminate the linkage that other tasks have on this particular structure\n\tmasterDir := path.Join(basedir, KubeAPIServerDirName)\n\tif err := os.MkdirAll(masterDir, 0755); err != nil {\n\t\treturn \"\", err\n\t}\n\tglog.V(1).Infof(\"Copying OpenShift config to local directory %s\", masterDir)\n\tif err = dockerhelper.DownloadDirFromContainer(dockerClient, containerId, \"/var/lib/origin/openshift.local.config\", masterDir); err != nil {\n\t\tif removeErr := os.RemoveAll(masterDir); removeErr != nil {\n\t\t\tglog.V(2).Infof(\"Error removing temporary config dir %s: %v\", masterDir, removeErr)\n\t\t}\n\t\treturn \"\", err\n\t}\n\n\t// update some listen information to include starting the DNS server\n\tmasterconfigFilename := path.Join(masterDir, \"master-config.yaml\")\n\tmasterconfig, err := componentinstall.ReadMasterConfig(masterconfigFilename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\taddImagePolicyAdmission(&masterconfig.AdmissionConfig)\n\n\tif err := componentinstall.WriteMasterConfig(masterconfigFilename, masterconfig); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn masterDir, nil\n}", "func (c *Client) SetupSocket() {\n\tfmt.Printf(\"Socket path: %s\\n\", c.SocketPath)\n\tvar err error\n\tc.Socket, err = net.Dial(\"unixgram\", c.SocketPath)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func TestEndpoints_LocalSocketBasedActivation(t *testing.T) {\n\tlistener := newUnixListener(t)\n\tdefer func() { _ = listener.Close() }() // This will also remove the underlying file\n\n\tfile, err := listener.File()\n\trequire.NoError(t, err)\n\tdefer func() { _ = file.Close() }()\n\n\tendpoints, config, cleanup := newEndpoints(t)\n\tdefer cleanup()\n\n\tsetupSocketBasedActivation(endpoints, file)\n\n\trequire.NoError(t, endpoints.Up(config))\n\n\tassertNoSocketBasedActivation(t)\n\n\tpath := endpoints.LocalSocketPath()\n\tassert.NoError(t, httpGetOverUnixSocket(path))\n\n\t// The unix socket file does not get removed after shutdown (thanks to\n\t// this change in Go 1.6:\n\t//\n\t// https://github.com/golang/go/commit/a4fd325c178ea29f554d69de4f2c3ffa09b53874\n\t//\n\t// which prevents listeners created from file descriptors from removing\n\t// their socket files on close).\n\tcleanup()\n\tassert.Equal(t, true, shared.PathExists(path))\n}", "func pickFreeAddr(t *testing.T) string {\n\tl, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer l.Close()\n\treturn l.Addr().String()\n}", "func TestTmpfsDevShmNoDupMount(t *testing.T) {\n\tskip.If(t, os.Getuid() != 0, \"skipping test that requires root\")\n\tc := &container.Container{\n\t\tShmPath: \"foobar\", // non-empty, for c.IpcMounts() to work\n\t\tHostConfig: &containertypes.HostConfig{\n\t\t\tIpcMode: containertypes.IPCModeShareable, // default mode\n\t\t\t// --tmpfs /dev/shm:rw,exec,size=NNN\n\t\t\tTmpfs: map[string]string{\n\t\t\t\t\"/dev/shm\": \"rw,exec,size=1g\",\n\t\t\t},\n\t\t},\n\t}\n\td := setupFakeDaemon(t, c)\n\n\t_, err := d.createSpec(context.TODO(), &configStore{}, c)\n\tassert.Check(t, err)\n}", "func (h *Handler) ServeUnix(systemGroupId, addr string) error {\n\treturn h.listenAndServe(\"unix\", addr, systemGroupId)\n}", "func main() {\n\ttype SysProcIDMap struct {\n\t\tContainerID int\n\t\tHostID int\n\t\tSize int\n\t}\n\tvar rootfsPath string\n\n\tcmd := reexec.Command(\"nsInitialisation\", rootfsPath)\n\tcmd = exec.Command(\"/bin/bash\")\n\tcmd.Stdout = os.Stdout\n\tcmd.Stdin = os.Stdin\n\tcmd.Stderr = os.Stderr\n\n\tcmd.Env = []string{\"PS1=-[ns-process]- # \"}\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tCloneflags: syscall.CLONE_NEWUTS |\n\t\t\tsyscall.CLONE_NEWNS |\n\t\t\tsyscall.CLONE_NEWIPC |\n\t\t\tsyscall.CLONE_NEWNET |\n\t\t\tsyscall.CLONE_NEWPID |\n\t\t\tsyscall.CLONE_NEWUSER,\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.Getgid(),\n\t\t\t\tSize: 1,\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := cmd.Run(); err != nil {\n\t\tfmt.Printf(\"Error running the /bin/bash command %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n}", "func socketID(ctx context.Context) uuid.UUID {\n\tval := ctx.Value(socketIDKey)\n\tif val == nil {\n\t\treturn uuid.UUID{}\n\t}\n\treturn val.(uuid.UUID)\n}", "func MakeListenAddress(ctx *cli.Context) string {\n\treturn fmt.Sprintf(\":%d\", ctx.GlobalInt(ListenPortFlag.Name))\n}", "func (t *Manager) socketName() string {\n\tif t.story != nil {\n\t\treturn strings.Replace(fmt.Sprintf(\"swm-%s\", t.story.GetName()), \"/\", \"_\", -1)\n\t}\n\n\treturn \"swm\"\n}", "func FindSocketOnHost(vmi *v1.VirtualMachineInstance) (string, error) {\n\tif string(vmi.UID) != \"\" {\n\t\tlegacySockFile := string(vmi.UID) + \"_sock\"\n\t\tlegacySock := filepath.Join(LegacySocketsDirectory(), legacySockFile)\n\t\texists, _ := diskutils.FileExists(legacySock)\n\t\tif exists {\n\t\t\treturn legacySock, nil\n\t\t}\n\t}\n\n\tsocketsFound := 0\n\tfoundSocket := \"\"\n\t// It is possible for multiple pods to be active on a single VMI\n\t// during migrations. This loop will discover the active pod on\n\t// this particular local node if it exists. A active pod not\n\t// running on this node will not have a kubelet pods directory,\n\t// so it will not be found.\n\tfor podUID := range vmi.Status.ActivePods {\n\t\tsocket := SocketFilePathOnHost(string(podUID))\n\t\texists, _ := diskutils.FileExists(socket)\n\t\tif exists {\n\t\t\tfoundSocket = socket\n\t\t\tsocketsFound++\n\t\t}\n\t}\n\n\tif socketsFound == 1 {\n\t\treturn foundSocket, nil\n\t} else if socketsFound > 1 {\n\t\treturn \"\", fmt.Errorf(\"Found multiple sockets for vmi %s/%s. waiting for only one to exist\", vmi.Namespace, vmi.Name)\n\t}\n\n\treturn \"\", fmt.Errorf(\"No command socket found for vmi %s\", vmi.UID)\n}", "func findSocket() (l net.Conn, err error) {\n\tvar fd uintptr\n\tif _, err = fmt.Sscan(os.Getenv(\"RESTART_FD\"), &fd); nil != err {\n\t\treturn\n\t}\n\tl, err = net.FileConn(os.NewFile(fd, os.Getenv(\"RESTART_NAME\")))\n\tif nil != err {\n\t\treturn\n\t}\n\tswitch l.(type) {\n\tcase *net.TCPConn, *net.UnixConn:\n\tdefault:\n\t\terr = fmt.Errorf(\n\t\t\t\"file descriptor is %T not *net.TCPConn or *net.UnixConn\",\n\t\t\tl,\n\t\t)\n\t\treturn\n\t}\n\tif err = syscall.Close(int(fd)); nil != err {\n\t\treturn\n\t}\n\treturn\n}", "func getRandomServerPrefix() string {\n\tprefix := os.Getenv(\"GO_SERVER_PEFIX\")\n\tif prefix == \"\" {\n\t\tprefix = \"0-63\"\n\t}\n\n\tstart, _ := strconv.Atoi(strings.Split(prefix, \"-\")[0])\n\tend, _ := strconv.Atoi(strings.Split(prefix, \"-\")[1])\n\tnum, _ := rand.Int(rand.Reader, big.NewInt(int64(end-start+1)))\n\tprefixString := string(LETTERS[start+int(num.Int64())])\n\treturn prefixString\n}", "func setRootless() error {\n\tinitRootless = true\n\tfile, err := os.Open(uidMapPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tbuf := bufio.NewReader(file)\n\tfor {\n\t\tline, _, err := buf.ReadLine()\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tif line == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tvar parseError = errors.Errorf(\"Failed to parse uid map file %s\", uidMapPath)\n\t\t// if the container id (id[0]) is 0 (root inside the container)\n\t\t// has a mapping to the host id (id[1]) that is not root, then\n\t\t// it can be determined that the host user is running rootless\n\t\tids := strings.Fields(string(line))\n\t\t// do some sanity checks\n\t\tif len(ids) != 3 {\n\t\t\treturn parseError\n\t\t}\n\t\tuserNSUid, err := strconv.ParseUint(ids[0], 10, 0)\n\t\tif err != nil {\n\t\t\treturn parseError\n\t\t}\n\t\thostUID, err := strconv.ParseUint(ids[1], 10, 0)\n\t\tif err != nil {\n\t\t\treturn parseError\n\t\t}\n\t\trangeUID, err := strconv.ParseUint(ids[2], 10, 0)\n\t\tif err != nil || rangeUID == 0 {\n\t\t\treturn parseError\n\t\t}\n\n\t\tif userNSUid == 0 && hostUID != 0 {\n\t\t\trootlessLog.Info(\"Running as rootless\")\n\t\t\tisRootless = true\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func RemoveUnixSocket(socket string) error {\n\tif _, err := os.Stat(socket); err == nil {\n\t\tc, err := net.DialTimeout(\"unix\", socket, 5*time.Second)\n\t\tif err == nil {\n\t\t\tc.Close()\n\t\t\treturn fmt.Errorf(\"Socket %v is in use\", socket)\n\t\t}\n\t\tlog.Infof(\"Removing stale socket %v\", socket)\n\t\treturn os.Remove(socket)\n\t}\n\treturn nil\n}", "func newEndpoint() *testSocket {\n\tp := fmt.Sprintf(\"@%s.sock\", uuid.NewUUID())\n\n\treturn &testSocket{\n\t\tpath: p,\n\t\tendpoint: fmt.Sprintf(\"unix:///%s\", p),\n\t}\n}", "func LocalHostname() (string, error) {\n\tarch, err := Arch()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpath := fmt.Sprintf(\"%s/utilbin/%s/gethostname\", os.Getenv(\"SGE_ROOT\"), arch)\n\thostname, errExec := exec.Command(path, \"-name\").Output()\n\treturn strings.TrimSpace(string(hostname)), errExec\n}", "func DialUnixFn(addr string) Dialer {\n\treturn func() (net.Conn, error) {\n\t\tunixAddr := &net.UnixAddr{addr, \"unix\"}\n\t\treturn net.DialUnix(\"unix\", nil, unixAddr)\n\t}\n}", "func createListeningAddress(network, address string) string {\n\treturn strings.Join([]string{network, address}, \"/\")\n}", "func (m *Master) server() {\n\trpc.Register(m)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := masterSock()\n\t//remove file whose name is sockname\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "func generateRemoteServersConfigReplicaHostname(\n\tchi *chiv1.ClickHouseInstallation,\n\treplica *chiv1.ChiClusterLayoutShardReplica,\n) string {\n\tif chi.Spec.Defaults.ReplicasUseFQDN == 1 {\n\t\t// In case .Spec.Defaults.ReplicasUseFQDN is set replicas would use FQDN pod hostname,\n\t\t// otherwise hostname+service name (unique within namespace) would be used\n\t\t// .my-dev-namespace.svc.cluster.local\n\t\treturn CreatePodHostname(replica) + \".\" + CreateNamespaceDomainName(replica.Address.Namespace)\n\t} else {\n\t\treturn CreatePodHostname(replica)\n\t}\n}", "func makeTempDir() (name string, err error) {\n\t// A multiple of 3 for the length prevents padding.\n\tbuf := make([]byte, 15)\n\n\tfor retry := 0; retry < 5; retry++ {\n\t\tvar n int\n\t\tn, err = io.ReadFull(rand.Reader, buf)\n\t\tif n != len(buf) || err != nil {\n\t\t\tif err == nil {\n\t\t\t\terr = errors.New(\"Error generating random number\")\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tname = fmt.Sprintf(\"%s/test-%s\", os.TempDir(),\n\t\t\tbase64.URLEncoding.EncodeToString(buf))\n\n\t\terr = os.Mkdir(name, 0755)\n\t\tif err == nil {\n\t\t\t// If no error, return success.\n\t\t\treturn\n\t\t}\n\t}\n\t// Too many retries, go ahead and leave the EEXIST.\n\treturn\n}", "func serverName(addr string) string {\n\treturn \"\"\n}", "func ensureTempDir(rootfsPath string) {\n\tpth := filepath.Join(rootfsPath, \"/tmp\")\n\tstickyMode := os.FileMode(0777) | os.ModeSticky\n\t// try to chmod first\n\terr := os.Chmod(pth, stickyMode)\n\tif err == nil {\n\t\treturn\n\t}\n\t// for unexpected complaints, bail\n\tif !os.IsNotExist(err) {\n\t\tpanic(executor.SetupError.New(\"cradle: could not ensure reasonable /tmp: %s\", err))\n\t}\n\t// mkdir if not exist\n\tif err := os.Mkdir(pth, stickyMode); err != nil {\n\t\tpanic(executor.SetupError.New(\"cradle: could not ensure reasonable /tmp: %s\", err))\n\t}\n\t// chmod it *again* because unit tests reveal that `os.Mkdir` is subject to umask\n\tif err := os.Chmod(pth, stickyMode); err != nil {\n\t\tpanic(executor.SetupError.New(\"cradle: could not ensure reasonable /tmp: %s\", err))\n\t}\n}", "func createConsoleSocket(t *testing.T, path string) (*unet.ServerSocket, func()) {\n\tt.Helper()\n\tsrv, err := unet.BindAndListen(path, false)\n\tif err != nil {\n\t\tt.Fatalf(\"error binding and listening to socket %q: %v\", path, err)\n\t}\n\n\tcleanup := func() {\n\t\t// Log errors; nothing can be done.\n\t\tif err := srv.Close(); err != nil {\n\t\t\tt.Logf(\"error closing socket %q: %v\", path, err)\n\t\t}\n\t\tif err := os.Remove(path); err != nil {\n\t\t\tt.Logf(\"error removing socket %q: %v\", path, err)\n\t\t}\n\t}\n\n\treturn srv, cleanup\n}", "func SetupMaster(ctx context.Context, force bool, imageCacheDir string, clusterConf *ClusterConfiguration) (errOut error) {\n\tauthCaCertPath, authCertPath, err := CreateAdminCert(ctx, force)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error creating authentication certs\")\n\t}\n\tdefer func() {\n\t\tif errOut != nil {\n\t\t\t_ = SudoRemoveFile(context.Background(), authCaCertPath)\n\t\t\t_ = SudoRemoveFile(context.Background(), authCertPath)\n\t\t}\n\t}()\n\n\tclusterConf.AuthCACertPath = authCaCertPath\n\tclusterConf.AuthAdminCertPath = authCertPath\n\n\tciaoConfigPath, err := createConfigurationFile(ctx, clusterConf)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error creating cluster configuration file\")\n\t}\n\tdefer func() {\n\t\tif errOut != nil {\n\t\t\t_ = SudoRemoveFile(context.Background(), ciaoConfigPath)\n\t\t\t_ = SudoRemoveDirectory(context.Background(), ciaoConfigDir)\n\t\t}\n\t}()\n\n\tsetupEnvironment(clusterConf)\n\n\tanchorCertPath, caCertPath, err := createSchedulerCerts(ctx, force, clusterConf.ServerIP)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error creating scheduler certificates\")\n\t}\n\tdefer func() {\n\t\tif errOut != nil {\n\t\t\t_ = SudoRemoveFile(context.Background(), anchorCertPath)\n\t\t\t_ = SudoRemoveFile(context.Background(), caCertPath)\n\t\t}\n\t}()\n\n\terr = installScheduler(ctx, anchorCertPath, caCertPath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error installing scheduler\")\n\t}\n\tdefer func() {\n\t\tif errOut != nil {\n\t\t\tuninstallTool(context.Background(), \"ciao-scheduler\")\n\t\t}\n\t}()\n\n\tcontrollerCertPath, err := createControllerCert(ctx, anchorCertPath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error installing controller certs\")\n\t}\n\tdefer func() {\n\t\tif errOut != nil {\n\t\t\t_ = SudoRemoveFile(context.Background(), controllerCertPath)\n\t\t}\n\t}()\n\n\terr = installController(ctx, controllerCertPath, caCertPath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error installing controller\")\n\t}\n\tdefer func() {\n\t\tif errOut != nil {\n\t\t\tuninstallTool(context.Background(), \"ciao-controller\")\n\t\t}\n\t}()\n\n\terr = CreateCNCIImage(ctx, anchorCertPath, caCertPath, imageCacheDir)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error creating CNCI image\")\n\t}\n\n\treturn nil\n}", "func TestCtlSockCrash(t *testing.T) {\n\tif plaintextnames {\n\t\tt.Skip(\"this only tests encrypted names\")\n\t}\n\tmnt, err := ioutil.TempDir(test_helpers.TmpDir, \"reverse_mnt_\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tsock := mnt + \".sock\"\n\ttest_helpers.MountOrFatal(t, \"ctlsock_reverse_test_fs\", mnt, \"-reverse\", \"-extpass\", \"echo test\", \"-ctlsock=\"+sock,\n\t\t\"-wpanic=0\", \"-nosyslog=0\")\n\tdefer test_helpers.UnmountPanic(mnt)\n\t// Try to crash it\n\treq := ctlsock.RequestStruct{DecryptPath: \"gocryptfs.longname.XXX_TestCtlSockCrash_XXX.name\"}\n\ttest_helpers.QueryCtlSock(t, sock, req)\n}", "func removeIfStaleUnixSocket(socketPath string) error {\n\t// Ensure it's a socket; if not return without an error\n\tst, err := os.Stat(socketPath)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tif st.Mode()&os.ModeType != os.ModeSocket {\n\t\treturn nil\n\t}\n\n\t// Try to connect\n\tconn, err := net.DialTimeout(\"unix\", socketPath, staleSocketTimeout)\n\tswitch {\n\t// The connection was refused so this socket is stale; remove it\n\tcase isSyscallError(err, syscall.ECONNREFUSED):\n\t\treturn os.Remove(socketPath)\n\n\t// The socket is alive so close this connection and leave the socket alone\n\tcase err == nil:\n\t\treturn conn.Close()\n\n\tdefault:\n\t\treturn nil\n\t}\n}", "func createLogTempDir(podSandboxName string) (string, string) {\n\thostPath, err := ioutil.TempDir(\"\", \"/podLogTest\")\n\tframework.ExpectNoError(err, \"failed to create TempDir %q: %v\", hostPath, err)\n\tpodLogPath := filepath.Join(hostPath, podSandboxName)\n\terr = os.MkdirAll(podLogPath, 0777)\n\tframework.ExpectNoError(err, \"failed to create host path %s: %v\", podLogPath, err)\n\n\treturn hostPath, podLogPath\n}", "func generateClusterName() string {\n\treturn string(uuid.NewUUID())\n}" ]
[ "0.70321614", "0.6337058", "0.6337058", "0.6337058", "0.6337058", "0.6337058", "0.6337058", "0.6250822", "0.6171099", "0.6073385", "0.60616237", "0.60538125", "0.5845415", "0.58431125", "0.5684725", "0.5635544", "0.56164056", "0.5570891", "0.54773664", "0.52518755", "0.5238843", "0.51579267", "0.5152167", "0.5136592", "0.5127903", "0.50787127", "0.5060117", "0.50448763", "0.49948674", "0.49948433", "0.49791884", "0.49300206", "0.48680112", "0.48664996", "0.48423994", "0.483199", "0.47782326", "0.4774682", "0.4746136", "0.47423258", "0.47376633", "0.47311562", "0.4729118", "0.47242442", "0.47202313", "0.4718571", "0.46922812", "0.46795806", "0.4673473", "0.46503899", "0.4639772", "0.4636662", "0.4631511", "0.46248406", "0.4620128", "0.4615359", "0.46100667", "0.46033594", "0.45995006", "0.45950156", "0.4591965", "0.45864755", "0.45750922", "0.45631123", "0.4561113", "0.45571515", "0.45483252", "0.4546081", "0.4545655", "0.45364547", "0.45320284", "0.45275623", "0.4526923", "0.45190108", "0.45116985", "0.450978", "0.45071068", "0.45020065", "0.45019627", "0.44905642", "0.44904572", "0.44892108", "0.44862428", "0.4480002", "0.4477583", "0.4474699", "0.44713682", "0.44711256", "0.44698623", "0.4468395", "0.44621748" ]
0.7014852
10
Functions from the win.go file of lxn/win
func GET_X_LPARAM(lp uintptr) int32 { return int32(int16(win.LOWORD(uint32(lp)))) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsWin() bool { return false }", "func IsWindows() bool { return false }", "func WindowMessageName(msg UINT) string {\n\tvar messages = map[UINT]string{\n\t\tWM_ACTIVATE: \"WM_ACTIVATE\",\n\t\tWM_CHAR: \"WM_CHAR\",\n\t\tWM_COMMAND: \"WM_COMMAND\",\n\t\tWM_COPYDATA: \"WM_COPYDATA\",\n\t\tWM_CREATE: \"WM_CREATE\",\n\t\tWM_DESTROY: \"WM_DESTROY\",\n\t\tWM_DROPFILES: \"WM_DROPFILES\",\n\t\tWM_INITDIALOG: \"WM_INITDIALOG\",\n\t\tWM_KEYDOWN: \"WM_KEYDOWN\",\n\t\tWM_KILLFOCUS: \"WM_KILLFOCUS\",\n\t\tWM_LBUTTONDOWN: \"WM_LBUTTONDOWN\",\n\t\tWM_LBUTTONUP: \"WM_LBUTTONUP\",\n\t\tWM_MOUSEMOVE: \"WM_MOUSEMOVE\",\n\t\tWM_MOUSEWHEEL: \"WM_MOUSEWHEEL\",\n\t\tWM_MOVE: \"WM_MOVE\",\n\t\tWM_NULL: \"WM_NULL\",\n\t\tWM_PAINT: \"WM_PAINT\",\n\t\tWM_SETFOCUS: \"WM_SETFOCUS\",\n\t\tWM_SETFONT: \"WM_SETFONT\",\n\t\tWM_SIZE: \"WM_SIZE\",\n\t\t// other messages:\n\t\tWM_ENABLE: \"WM_ENABLE\",\n\t\tWM_SETREDRAW: \"WM_SETREDRAW\",\n\t\tWM_SETTEXT: \"WM_SETTEXT\",\n\t\tWM_GETTEXT: \"WM_GETTEXT\",\n\t\tWM_GETTEXTLENGTH: \"WM_GETTEXTLENGTH\",\n\t\tWM_CLOSE: \"WM_CLOSE\",\n\t\tWM_QUERYENDSESSION: \"WM_QUERYENDSESSION\",\n\t\tWM_QUIT: \"WM_QUIT\",\n\t\tWM_QUERYOPEN: \"WM_QUERYOPEN\",\n\t\tWM_ERASEBKGND: \"WM_ERASEBKGND\",\n\t\tWM_SYSCOLORCHANGE: \"WM_SYSCOLORCHANGE\",\n\t\tWM_ENDSESSION: \"WM_ENDSESSION\",\n\t\tWM_SHOWWINDOW: \"WM_SHOWWINDOW\",\n\t\tWM_WININICHANGE: \"WM_WININICHANGE\",\n\t\tWM_DEVMODECHANGE: \"WM_DEVMODECHANGE\",\n\t\tWM_ACTIVATEAPP: \"WM_ACTIVATEAPP\",\n\t\tWM_FONTCHANGE: \"WM_FONTCHANGE\",\n\t\tWM_TIMECHANGE: \"WM_TIMECHANGE\",\n\t\tWM_CANCELMODE: \"WM_CANCELMODE\",\n\t\tWM_SETCURSOR: \"WM_SETCURSOR\",\n\t\tWM_MOUSEACTIVATE: \"WM_MOUSEACTIVATE\",\n\t\tWM_CHILDACTIVATE: \"WM_CHILDACTIVATE\",\n\t\tWM_QUEUESYNC: \"WM_QUEUESYNC\",\n\t\tWM_GETMINMAXINFO: \"WM_GETMINMAXINFO\",\n\t\tWM_PAINTICON: \"WM_PAINTICON\",\n\t\tWM_ICONERASEBKGND: \"WM_ICONERASEBKGND\",\n\t\tWM_NEXTDLGCTL: \"WM_NEXTDLGCTL\",\n\t\tWM_SPOOLERSTATUS: \"WM_SPOOLERSTATUS\",\n\t\tWM_DRAWITEM: \"WM_DRAWITEM\",\n\t\tWM_MEASUREITEM: \"WM_MEASUREITEM\",\n\t\tWM_DELETEITEM: \"WM_DELETEITEM\",\n\t\tWM_VKEYTOITEM: \"WM_VKEYTOITEM\",\n\t\tWM_CHARTOITEM: \"WM_CHARTOITEM\",\n\t\tWM_GETFONT: \"WM_GETFONT\",\n\t\tWM_SETHOTKEY: \"WM_SETHOTKEY\",\n\t\tWM_GETHOTKEY: \"WM_GETHOTKEY\",\n\t\tWM_QUERYDRAGICON: \"WM_QUERYDRAGICON\",\n\t\tWM_COMPAREITEM: \"WM_COMPAREITEM\",\n\t\tWM_GETOBJECT: \"WM_GETOBJECT\",\n\t\tWM_COMPACTING: \"WM_COMPACTING\",\n\t\tWM_COMMNOTIFY: \"WM_COMMNOTIFY\",\n\t\tWM_WINDOWPOSCHANGING: \"WM_WINDOWPOSCHANGING\",\n\t\tWM_WINDOWPOSCHANGED: \"WM_WINDOWPOSCHANGED\",\n\t\tWM_POWER: \"WM_POWER\",\n\t\tWM_CANCELJOURNAL: \"WM_CANCELJOURNAL\",\n\t\tWM_NOTIFY: \"WM_NOTIFY\",\n\t\tWM_INPUTLANGCHANGEREQUEST: \"WM_INPUTLANGCHANGEREQUEST\",\n\t\tWM_INPUTLANGCHANGE: \"WM_INPUTLANGCHANGE\",\n\t\tWM_TCARD: \"WM_TCARD\",\n\t\tWM_HELP: \"WM_HELP\",\n\t\tWM_USERCHANGED: \"WM_USERCHANGED\",\n\t\tWM_NOTIFYFORMAT: \"WM_NOTIFYFORMAT\",\n\t\tWM_CONTEXTMENU: \"WM_CONTEXTMENU\",\n\t\tWM_STYLECHANGING: \"WM_STYLECHANGING\",\n\t\tWM_STYLECHANGED: \"WM_STYLECHANGED\",\n\t\tWM_DISPLAYCHANGE: \"WM_DISPLAYCHANGE\",\n\t\tWM_GETICON: \"WM_GETICON\",\n\t\tWM_SETICON: \"WM_SETICON\",\n\t\tWM_NCCREATE: \"WM_NCCREATE\",\n\t\tWM_NCDESTROY: \"WM_NCDESTROY\",\n\t\tWM_NCCALCSIZE: \"WM_NCCALCSIZE\",\n\t\tWM_NCHITTEST: \"WM_NCHITTEST\",\n\t\tWM_NCPAINT: \"WM_NCPAINT\",\n\t\tWM_NCACTIVATE: \"WM_NCACTIVATE\",\n\t\tWM_GETDLGCODE: \"WM_GETDLGCODE\",\n\t\tWM_SYNCPAINT: \"WM_SYNCPAINT\",\n\t\tWM_NCMOUSEMOVE: \"WM_NCMOUSEMOVE\",\n\t\tWM_NCLBUTTONDOWN: \"WM_NCLBUTTONDOWN\",\n\t\tWM_NCLBUTTONUP: \"WM_NCLBUTTONUP\",\n\t\tWM_NCLBUTTONDBLCLK: \"WM_NCLBUTTONDBLCLK\",\n\t\tWM_NCRBUTTONDOWN: \"WM_NCRBUTTONDOWN\",\n\t\tWM_NCRBUTTONUP: \"WM_NCRBUTTONUP\",\n\t\tWM_NCRBUTTONDBLCLK: \"WM_NCRBUTTONDBLCLK\",\n\t\tWM_NCMBUTTONDOWN: \"WM_NCMBUTTONDOWN\",\n\t\tWM_NCMBUTTONUP: \"WM_NCMBUTTONUP\",\n\t\tWM_NCMBUTTONDBLCLK: \"WM_NCMBUTTONDBLCLK\",\n\t\tWM_NCXBUTTONDOWN: \"WM_NCXBUTTONDOWN\",\n\t\tWM_NCXBUTTONUP: \"WM_NCXBUTTONUP\",\n\t\tWM_NCXBUTTONDBLCLK: \"WM_NCXBUTTONDBLCLK\",\n\t\tWM_INPUT_DEVICE_CHANGE: \"WM_INPUT_DEVICE_CHANGE\",\n\t\tWM_INPUT: \"WM_INPUT\",\n\t\tWM_KEYUP: \"WM_KEYUP\",\n\t\tWM_DEADCHAR: \"WM_DEADCHAR\",\n\t\tWM_SYSKEYDOWN: \"WM_SYSKEYDOWN\",\n\t\tWM_SYSKEYUP: \"WM_SYSKEYUP\",\n\t\tWM_SYSCHAR: \"WM_SYSCHAR\",\n\t\tWM_SYSDEADCHAR: \"WM_SYSDEADCHAR\",\n\t\tWM_UNICHAR: \"WM_UNICHAR\",\n\t\tWM_IME_STARTCOMPOSITION: \"WM_IME_STARTCOMPOSITION\",\n\t\tWM_IME_ENDCOMPOSITION: \"WM_IME_ENDCOMPOSITION\",\n\t\tWM_IME_COMPOSITION: \"WM_IME_COMPOSITION\",\n\t\tWM_SYSCOMMAND: \"WM_SYSCOMMAND\",\n\t\tWM_TIMER: \"WM_TIMER\",\n\t\tWM_HSCROLL: \"WM_HSCROLL\",\n\t\tWM_VSCROLL: \"WM_VSCROLL\",\n\t\tWM_INITMENU: \"WM_INITMENU\",\n\t\tWM_INITMENUPOPUP: \"WM_INITMENUPOPUP\",\n\t\tWM_GESTURE: \"WM_GESTURE\",\n\t\tWM_GESTURENOTIFY: \"WM_GESTURENOTIFY\",\n\t\tWM_MENUSELECT: \"WM_MENUSELECT\",\n\t\tWM_MENUCHAR: \"WM_MENUCHAR\",\n\t\tWM_ENTERIDLE: \"WM_ENTERIDLE\",\n\t\tWM_MENURBUTTONUP: \"WM_MENURBUTTONUP\",\n\t\tWM_MENUDRAG: \"WM_MENUDRAG\",\n\t\tWM_MENUGETOBJECT: \"WM_MENUGETOBJECT\",\n\t\tWM_UNINITMENUPOPUP: \"WM_UNINITMENUPOPUP\",\n\t\tWM_MENUCOMMAND: \"WM_MENUCOMMAND\",\n\t\tWM_CHANGEUISTATE: \"WM_CHANGEUISTATE\",\n\t\tWM_UPDATEUISTATE: \"WM_UPDATEUISTATE\",\n\t\tWM_QUERYUISTATE: \"WM_QUERYUISTATE\",\n\t\tWM_CTLCOLORMSGBOX: \"WM_CTLCOLORMSGBOX\",\n\t\tWM_CTLCOLOREDIT: \"WM_CTLCOLOREDIT\",\n\t\tWM_CTLCOLORLISTBOX: \"WM_CTLCOLORLISTBOX\",\n\t\tWM_CTLCOLORBTN: \"WM_CTLCOLORBTN\",\n\t\tWM_CTLCOLORDLG: \"WM_CTLCOLORDLG\",\n\t\tWM_CTLCOLORSCROLLBAR: \"WM_CTLCOLORSCROLLBAR\",\n\t\tWM_CTLCOLORSTATIC: \"WM_CTLCOLORSTATIC\",\n\t\tWM_LBUTTONDBLCLK: \"WM_LBUTTONDBLCLK\",\n\t\tWM_RBUTTONDOWN: \"WM_RBUTTONDOWN\",\n\t\tWM_RBUTTONUP: \"WM_RBUTTONUP\",\n\t\tWM_RBUTTONDBLCLK: \"WM_RBUTTONDBLCLK\",\n\t\tWM_MBUTTONDOWN: \"WM_MBUTTONDOWN\",\n\t\tWM_MBUTTONUP: \"WM_MBUTTONUP\",\n\t\tWM_MBUTTONDBLCLK: \"WM_MBUTTONDBLCLK\",\n\t\tWM_XBUTTONDOWN: \"WM_XBUTTONDOWN\",\n\t\tWM_XBUTTONUP: \"WM_XBUTTONUP\",\n\t\tWM_XBUTTONDBLCLK: \"WM_XBUTTONDBLCLK\",\n\t\tWM_MOUSEHWHEEL: \"WM_MOUSEHWHEEL\",\n\t\tWM_PARENTNOTIFY: \"WM_PARENTNOTIFY\",\n\t\tWM_ENTERMENULOOP: \"WM_ENTERMENULOOP\",\n\t\tWM_EXITMENULOOP: \"WM_EXITMENULOOP\",\n\t\tWM_NEXTMENU: \"WM_NEXTMENU\",\n\t\tWM_SIZING: \"WM_SIZING\",\n\t\tWM_CAPTURECHANGED: \"WM_CAPTURECHANGED\",\n\t\tWM_MOVING: \"WM_MOVING\",\n\t\tWM_POWERBROADCAST: \"WM_POWERBROADCAST\",\n\t\tWM_DEVICECHANGE: \"WM_DEVICECHANGE\",\n\t\tWM_MDICREATE: \"WM_MDICREATE\",\n\t\tWM_MDIDESTROY: \"WM_MDIDESTROY\",\n\t\tWM_MDIACTIVATE: \"WM_MDIACTIVATE\",\n\t\tWM_MDIRESTORE: \"WM_MDIRESTORE\",\n\t\tWM_MDINEXT: \"WM_MDINEXT\",\n\t\tWM_MDIMAXIMIZE: \"WM_MDIMAXIMIZE\",\n\t\tWM_MDITILE: \"WM_MDITILE\",\n\t\tWM_MDICASCADE: \"WM_MDICASCADE\",\n\t\tWM_MDIICONARRANGE: \"WM_MDIICONARRANGE\",\n\t\tWM_MDIGETACTIVE: \"WM_MDIGETACTIVE\",\n\t\tWM_MDISETMENU: \"WM_MDISETMENU\",\n\t\tWM_ENTERSIZEMOVE: \"WM_ENTERSIZEMOVE\",\n\t\tWM_EXITSIZEMOVE: \"WM_EXITSIZEMOVE\",\n\t\tWM_MDIREFRESHMENU: \"WM_MDIREFRESHMENU\",\n\t\tWM_TOUCH: \"WM_TOUCH\",\n\t\tWM_IME_SETCONTEXT: \"WM_IME_SETCONTEXT\",\n\t\tWM_IME_NOTIFY: \"WM_IME_NOTIFY\",\n\t\tWM_IME_CONTROL: \"WM_IME_CONTROL\",\n\t\tWM_IME_COMPOSITIONFULL: \"WM_IME_COMPOSITIONFULL\",\n\t\tWM_IME_SELECT: \"WM_IME_SELECT\",\n\t\tWM_IME_CHAR: \"WM_IME_CHAR\",\n\t\tWM_IME_REQUEST: \"WM_IME_REQUEST\",\n\t\tWM_IME_KEYDOWN: \"WM_IME_KEYDOWN\",\n\t\tWM_IME_KEYUP: \"WM_IME_KEYUP\",\n\t\tWM_NCMOUSEHOVER: \"WM_NCMOUSEHOVER\",\n\t\tWM_MOUSEHOVER: \"WM_MOUSEHOVER\",\n\t\tWM_NCMOUSELEAVE: \"WM_NCMOUSELEAVE\",\n\t\tWM_MOUSELEAVE: \"WM_MOUSELEAVE\",\n\t\tWM_WTSSESSION_CHANGE: \"WM_WTSSESSION_CHANGE\",\n\t\tWM_TABLET_FIRST: \"WM_TABLET_FIRST\",\n\t\tWM_TABLET_LAST: \"WM_TABLET_LAST\",\n\t\tWM_CUT: \"WM_CUT\",\n\t\tWM_COPY: \"WM_COPY\",\n\t\tWM_PASTE: \"WM_PASTE\",\n\t\tWM_CLEAR: \"WM_CLEAR\",\n\t\tWM_UNDO: \"WM_UNDO\",\n\t\tWM_RENDERFORMAT: \"WM_RENDERFORMAT\",\n\t\tWM_RENDERALLFORMATS: \"WM_RENDERALLFORMATS\",\n\t\tWM_DESTROYCLIPBOARD: \"WM_DESTROYCLIPBOARD\",\n\t\tWM_DRAWCLIPBOARD: \"WM_DRAWCLIPBOARD\",\n\t\tWM_PAINTCLIPBOARD: \"WM_PAINTCLIPBOARD\",\n\t\tWM_VSCROLLCLIPBOARD: \"WM_VSCROLLCLIPBOARD\",\n\t\tWM_SIZECLIPBOARD: \"WM_SIZECLIPBOARD\",\n\t\tWM_ASKCBFORMATNAME: \"WM_ASKCBFORMATNAME\",\n\t\tWM_CHANGECBCHAIN: \"WM_CHANGECBCHAIN\",\n\t\tWM_HSCROLLCLIPBOARD: \"WM_HSCROLLCLIPBOARD\",\n\t\tWM_QUERYNEWPALETTE: \"WM_QUERYNEWPALETTE\",\n\t\tWM_PALETTEISCHANGING: \"WM_PALETTEISCHANGING\",\n\t\tWM_PALETTECHANGED: \"WM_PALETTECHANGED\",\n\t\tWM_HOTKEY: \"WM_HOTKEY\",\n\t\tWM_PRINT: \"WM_PRINT\",\n\t\tWM_PRINTCLIENT: \"WM_PRINTCLIENT\",\n\t\tWM_APPCOMMAND: \"WM_APPCOMMAND\",\n\t\tWM_THEMECHANGED: \"WM_THEMECHANGED\",\n\t\tWM_CLIPBOARDUPDATE: \"WM_CLIPBOARDUPDATE\",\n\t\tWM_DWMCOMPOSITIONCHANGED: \"WM_DWMCOMPOSITIONCHANGED\",\n\t\tWM_DWMNCRENDERINGCHANGED: \"WM_DWMNCRENDERINGCHANGED\",\n\t\tWM_DWMCOLORIZATIONCOLORCHANGED: \"WM_DWMCOLORIZATIONCOLORCHANGED\",\n\t\tWM_DWMWINDOWMAXIMIZEDCHANGE: \"WM_DWMWINDOWMAXIMIZEDCHANGE\",\n\t\tWM_DWMSENDICONICTHUMBNAIL: \"WM_DWMSENDICONICTHUMBNAIL\",\n\t\tWM_DWMSENDICONICLIVEPREVIEWBITMAP: \"WM_DWMSENDICONICLIVEPREVIEWBITMAP\",\n\t\tWM_GETTITLEBARINFOEX: \"WM_GETTITLEBARINFOEX\",\n\t\tWM_HANDHELDFIRST: \"WM_HANDHELDFIRST\",\n\t\tWM_HANDHELDLAST: \"WM_HANDHELDLAST\",\n\t\tWM_AFXFIRST: \"WM_AFXFIRST\",\n\t\tWM_AFXLAST: \"WM_AFXLAST\",\n\t\tWM_PENWINFIRST: \"WM_PENWINFIRST\",\n\t\tWM_PENWINLAST: \"WM_PENWINLAST\",\n\t\tWM_USER: \"WM_USER\",\n\t\tWM_APP: \"WM_APP\",\n\t}\n\t// messages that equal to existing messages:\n\t// WM_IME_KEYLAST\n\t// WM_SETTINGCHANGE\n\t// WM_MOUSEFIRST\n\t// WM_MOUSELAST\n\tif s, ok := messages[msg]; ok {\n\t\treturn s\n\t}\n\treturn \"WM_...UNKNOWN\"\n}", "func winEvent(id w32.HWND, event uint32, wParam, lParam uintptr) uintptr {\n\tw, ok := widgetTable[id]\n\tif !ok {\n\t\treturn w32.DefWindowProc(id, event, wParam, lParam)\n\t}\n\tswitch event {\n\tcase w32.WM_CHAR:\n\t\tr := utf16.Decode([]uint16{uint16(loWord(uint32(wParam)))})\n\t\tif len(r) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tkey := r[0]\n\t\tif key == 0 {\n\t\t\tbreak\n\t\t}\n\t\tif (key == '\\b') || (key == '\\t') || (key == '\\n') || (key == '\\r') {\n\t\t\tbreak\n\t\t}\n\t\tev := sparta.KeyEvent{\n\t\t\tKey: sparta.Key(key),\n\t\t\tState: getState(),\n\t\t}\n\t\tx, y, _ := w32.GetCursorPos()\n\t\tev.Loc.X, ev.Loc.Y, _ = w32.ScreenToClient(id, x, y)\n\t\tw.OnEvent(ev)\n\tcase w32.WM_CLOSE:\n\t\tif w.Property(sparta.Parent) != nil {\n\t\t\tbreak\n\t\t}\n\t\tw.OnEvent(sparta.CloseEvent{})\n\tcase w32.WM_KEYDOWN:\n\t\tkey := getKeyValue(wParam)\n\t\tif key == 0 {\n\t\t\tbreak\n\t\t}\n\t\tif (key & sparta.KeyNoChar) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tev := sparta.KeyEvent{\n\t\t\tKey: key,\n\t\t\tState: getState(),\n\t\t}\n\t\tx, y, _ := w32.GetCursorPos()\n\t\tev.Loc.X, ev.Loc.Y, _ = w32.ScreenToClient(id, x, y)\n\t\tw.OnEvent(ev)\n\tcase w32.WM_KEYUP:\n\t\tkey := getKeyValue(wParam)\n\t\tif key == 0 {\n\t\t\tbreak\n\t\t}\n\t\tev := sparta.KeyEvent{\n\t\t\tKey: -key,\n\t\t\tState: getState(),\n\t\t}\n\t\tx, y, _ := w32.GetCursorPos()\n\t\tev.Loc.X, ev.Loc.Y, _ = w32.ScreenToClient(id, x, y)\n\t\tw.OnEvent(ev)\n\tcase w32.WM_LBUTTONDOWN, w32.WM_RBUTTONDOWN, w32.WM_MBUTTONDOWN:\n\t\tev := sparta.MouseEvent{\n\t\t\tButton: getButton(event),\n\t\t\tState: getState(),\n\t\t\tLoc: image.Pt(getXLParam(lParam), getYLParam(lParam)),\n\t\t}\n\t\tw.OnEvent(ev)\n\t\tw.Focus()\n\tcase w32.WM_LBUTTONUP, w32.WM_RBUTTONUP, w32.WM_MBUTTONUP:\n\t\tev := sparta.MouseEvent{\n\t\t\tButton: -getButton(event),\n\t\t\tState: getState(),\n\t\t\tLoc: image.Pt(getXLParam(lParam), getYLParam(lParam)),\n\t\t}\n\t\tw.OnEvent(ev)\n\tcase w32.WM_MOUSEMOVE:\n\t\tev := sparta.MouseEvent{\n\t\t\tLoc: image.Pt(getXLParam(lParam), getYLParam(lParam)),\n\t\t}\n\t\tw.OnEvent(ev)\n\tcase w32.WM_MOUSEWHEEL:\n\t\tev := sparta.MouseEvent{\n\t\t\tButton: sparta.MouseWheel,\n\t\t}\n\t\tif getWheelDeltaWParam(wParam) < 0 {\n\t\t\tev.Button = -sparta.MouseWheel\n\t\t}\n\t\tev.Loc.X, ev.Loc.Y, _ = w32.ScreenToClient(id, getXLParam(lParam), getYLParam(lParam))\n\t\tw = propagateWheel(w, ev.Loc)\n\t\tw.OnEvent(ev)\n\tcase w32.WM_MOVE:\n\t\twin := w.Window().(*window)\n\t\twin.pos.X, win.pos.Y = int(loWord(uint32(lParam))), int(hiWord(uint32(lParam)))\n\tcase w32.WM_PAINT:\n\t\twin := w.Window().(*window)\n\t\tps := &w32.PAINTSTRUCT{}\n\t\twin.dc = w32.BeginPaint(id, ps)\n\t\twin.isPaint = true\n\n\t\tw32.SetBkMode(win.dc, w32.TRANSPARENT)\n\t\tw32.SetBkColor(win.dc, win.back.color)\n\n\t\t// \"clear\" the area\n\t\tw32.SelectObject(win.dc, w32.HGDIOBJ(win.back.brush))\n\t\tw32.SelectObject(win.dc, w32.HGDIOBJ(win.back.pen))\n\t\tw32.Rectangle(win.dc, int(ps.RcPaint.Left), int(ps.RcPaint.Top), int(ps.RcPaint.Right), int(ps.RcPaint.Bottom))\n\n\t\tw32.SelectObject(win.dc, w32.HGDIOBJ(win.fore.brush))\n\t\tw32.SelectObject(win.dc, w32.HGDIOBJ(win.fore.pen))\n\t\tw32.SelectObject(win.dc, w32.HGDIOBJ(winFont))\n\t\tw32.SetTextColor(win.dc, win.fore.color)\n\t\twin.curr = win.fore\n\n\t\tev := sparta.ExposeEvent{image.Rect(int(ps.RcPaint.Left), int(ps.RcPaint.Top), int(ps.RcPaint.Right), int(ps.RcPaint.Bottom))}\n\t\tw.OnEvent(ev)\n\t\tw32.EndPaint(id, ps)\n\t\twin.isPaint = false\n\t\twin.dc = 0\n\tcase w32.WM_SIZE:\n\t\twin := w.Window().(*window)\n\t\tev := sparta.ConfigureEvent{image.Rect(win.pos.X, win.pos.Y, win.pos.X+int(loWord(uint32(lParam))), win.pos.Y+int(hiWord(uint32(lParam))))}\n\t\tw.OnEvent(ev)\n\tcase w32.WM_USER:\n\t\tsrc, ok := widgetTable[w32.HWND(wParam)]\n\t\tif !ok {\n\t\t\tsrc = nil\n\t\t}\n\t\tev := sparta.CommandEvent{\n\t\t\tSource: src,\n\t\t\tValue: int(int32(lParam)),\n\t\t}\n\t\tw.OnEvent(ev)\n\tdefault:\n\t\treturn w32.DefWindowProc(id, event, wParam, lParam)\n\t}\n\treturn 0\n}", "func win() {\n\tfmt.Println(\"win\", i, j)\n\tos.Exit(1)\n}", "func makeWindow(wmctrl_out_line string) []Window {\n\tparts := strings.Split(wmctrl_out_line, \" \")\n\tcomponents := make([]string, 9)\n\tcurrent_component := 0\n\tfor _, text := range parts {\n\t\tif current_component == 8 {\n\t\t\tif text == \"\" {\n\t\t\t\tcomponents[8] += \" \"\n\t\t\t} else {\n\t\t\t\tcomponents[8] += text\n\t\t\t}\n\t\t} else if text != \"\" {\n\t\t\tcomponents[current_component] = text\n\t\t\tcurrent_component += 1\n\t\t}\n\t}\n\n\twid, err0 := strconv.ParseInt(strings.TrimLeft(components[0], \"x0\"), 16, 64)\n\txmin, err1 := strconv.Atoi(components[3])\n\tymin, err2 := strconv.Atoi(components[4])\n\twidth, err3 := strconv.Atoi(components[5])\n\theight, err4 := strconv.Atoi(components[6])\n\tgravity, err5 := strconv.Atoi(components[1])\n\t\n\tproblem := err0 != nil || err1 != nil || err2 != nil || err3 != nil || err4 != nil || err5 != nil\n\t\n\tif gravity == -1 {\n\t\t// Most people have a Desktop, which *is* a window, but we don't want to switch to it\n\t\treturn []Window{}\n\t} else if problem {\n\t\tfmt.Println(\"Something did not parse correctly in this line of output from `wmctrl`. This window will be ignored: \")\n\t\tfmt.Println(wmctrl_out_line)\n\t\treturn []Window{}\n\t} else {\n\t\tw := Window{int(wid), xmin, width, xmin + width, xmin + width/2, ymin, height, ymin + height, ymin + height/2}\n\t\treturn []Window{w}\n\t}\n\n}", "func (app *appImpl) setSysWindow(opts *oswin.NewWindowOptions, winPtr uintptr) error {\n\tapp.mu.Lock()\n\tdefer app.mu.Unlock()\n\n\tvar sf vk.Surface\n\t// we have to remake the surface, system, and drawer every time someone reopens the window\n\t// because the operating system changes the underlying window\n\tlog.Println(\"in NewWindow\", app.gpu.Instance, winPtr, &sf)\n\tret := vk.CreateWindowSurface(app.gpu.Instance, winPtr, nil, &sf)\n\tif err := vk.Error(ret); err != nil {\n\t\tlog.Println(\"oswin/driver/mobile new window: vulkan error:\", err)\n\t\treturn err\n\t}\n\tapp.Surface = vgpu.NewSurface(app.gpu, sf)\n\n\tlog.Printf(\"format: %s\\n\", app.Surface.Format.String())\n\n\tapp.System = app.gpu.NewGraphicsSystem(app.name, &app.Surface.Device)\n\tapp.System.ConfigRender(&app.Surface.Format, vgpu.UndefType)\n\tapp.Surface.SetRender(&app.System.Render)\n\t// app.window.System.Mem.Vars.NDescs = vgpu.MaxTexturesPerSet\n\tapp.System.Config()\n\n\tapp.Draw = vdraw.Drawer{\n\t\tSys: *app.System,\n\t\tYIsDown: true,\n\t}\n\t// app.window.Draw.ConfigSys()\n\tapp.Draw.ConfigSurface(app.Surface, vgpu.MaxTexturesPerSet)\n\n\tapp.winptr = winPtr\n\tlog.Println(\"set window pointer to\", app.winptr)\n\tlog.Println(\"total number of windows:\", len(app.windows))\n\n\treturn nil\n}", "func ListWindowNames() error {\n\tcb := syscall.NewCallback(func(h syscall.Handle, p uintptr) uintptr {\n\t\tb := make([]uint16, 200)\n\t\tGetWindowText(h, &b[0], int32(len(b)))\n\t\tfmt.Println(syscall.UTF16ToString(b))\n\t\treturn 1 // continue enumeration\n\t})\n\tEnumWindows(cb, 0)\n\treturn nil\n}", "func windowsShowSettingsUI(_ *cagent.Cagent, _ bool) {\n\n}", "func getWinsize() (int, int) {\n\twidth, height, err := term.GetSize(int(os.Stdout.Fd()))\n\n\tif err != nil {\n\t\treturn 120, 60\n\t}\n\n\treturn width, height\n}", "func NewWindow(width, height int) (w *Window, err error) {\n\n\tw = new(Window)\n\tw.width, w.height = width, height\n\tw.showed = false\n\n\tw.xu, err = xgbutil.NewConn()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tw.conn = w.xu.Conn()\n\t// screen := w.xu.Screen()\n\n\tw.win, err = xwindow.Generate(w.xu)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: %#+v\\n\", err)\n\t\treturn\n\t}\n\n\tkeybind.Initialize(w.xu)\n\n\terr = w.win.CreateChecked(w.xu.RootWin(), 0, 0, width, height, xproto.CwBackPixel, 0x606060ff)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tw.win.Listen(AllEventsMask)\n\n\terr = icccm.WmProtocolsSet(w.xu, w.win.Id, []string{\"WM_DELETE_WINDOW\"})\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\terr = nil\n\t}\n\n\tw.bufferLck = &sync.Mutex{}\n\tw.buffer = xgraphics.New(w.xu, image.Rect(0, 0, width, height))\n\tw.buffer.XSurfaceSet(w.win.Id)\n\n\t// I /think/ XDraw actually sends data to server?\n\tw.buffer.XDraw()\n\t// I /think/ XPaint tells the server to paint image to window\n\tw.buffer.XPaint(w.win.Id)\n\n\tkeyMap, modMap := keybind.MapsGet(w.xu)\n\tkeybind.KeyMapSet(w.xu, keyMap)\n\tkeybind.ModMapSet(w.xu, modMap)\n\n\tw.events = make(chan interface{})\n\n\tw.SetIcon(Gordon)\n\tw.SetIconName(\"Go\")\n\n\tgo w.handleEvents()\n\n\treturn\n}", "func findWindow(title string, callback uintptr, handle *syscall.Handle) (syscall.Handle, error) {\n\tenumWindows(callback, 0)\n\tif *handle == 0 {\n\t\treturn 0, fmt.Errorf(\"No window with title '%s' found\", title)\n\t}\n\treturn *handle, nil\n}", "func Open(id int)(*Window,error){\n\n\n/*8:*/\n\n\n//line goacme.w:147\n\n{\nvar err error\nonce.Do(func(){fsys,err= client.MountService(\"acme\")})\nif err!=nil{\nreturn nil,err\n}\n}\n\n\n\n/*:8*/\n\n\n//line goacme.w:177\n\nif err:=fsys.Access(fmt.Sprintf(\"%d\",id),plan9.OREAD);err!=nil{\nreturn nil,err\n}\nthis:=&Window{id:id}\n\n\n/*22:*/\n\n\n//line goacme.w:308\n\nthis.files= make(map[string]*client.Fid)\n\n\n\n/*:22*/\n\n\n\n/*30:*/\n\n\n//line goacme.w:384\n\nthis.prev= lwin\nthis.next= nil\nif fwin==nil{\nfwin= this\n}\nif lwin!=nil{\nlwin.next= this\n}\nlwin= this\n\n\n\n/*:30*/\n\n\n\n/*64:*/\n\n\n//line goacme.w:868\n\nif _,err:=this.File(\"addr\");err!=nil{\nreturn nil,err\n}\n\n\n\n\n/*:64*/\n\n\n//line goacme.w:182\n\nreturn this,nil\n}", "func appConsolatoryWin(win *gtk.Window) {\n\tlbl, err := gtk.LabelNew(\"There were no tags to be displayed, sorry!\")\n\tif err != nil {\n\t\tlog(ERR, fmt.Sprintf(\" creating consolatory label: %s\", err.Error()))\n\t\treturn\n\t}\n\n\tbtn, err := gtk.ButtonNewWithLabel(\"Try again\")\n\tif err != nil {\n\t\tlog(ERR, fmt.Sprintf(\" creating file reload button: %s\\n\", err.Error()))\n\t\treturn\n\t}\n\tbtn.Connect(\"clicked\", handleFiles, win)\n\n\tvbox, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 10)\n\tif err != nil {\n\t\tlog(ERR, fmt.Sprintf(\" creating vbox: %s\\n\", err.Error()))\n\t\treturn\n\t}\n\n\tvbox.Add(lbl)\n\tvbox.Add(btn)\n\twin.Add(vbox)\n\twin.ShowAll()\n}", "func TestAddDifferentWindows(t *testing.T) {\n\tp, err := NewProgram()\n\tif err != nil {\n\t\tt.Error(\"Unable to start termbox\")\n\t}\n\n\tdefer p.Close()\n\n\twinNumberBefore := len(p.windows)\n\tshowNumberBefore := len(p.showed)\n\n\tw := NewWindow()\n\terr2 := p.AddWindow(w)\n\n\tif err2 != nil {\n\t\tt.Errorf(\"An error occured (1st win) %s\", fmt.Sprint(err2))\n\t}\n\n\tw2 := NewWindow()\n\terr3 := p.AddWindow(w2)\n\tif err3 != nil {\n\t\tt.Errorf(\"An error occured (2nd win) %s\", fmt.Sprint(err2))\n\t}\n\n\tif winNumberBefore+2 != len(p.windows) {\n\t\tt.Error(\"Window not successfully added to windows's map\")\n\t}\n\n\tif showNumberBefore+2 != len(p.showed) {\n\t\tt.Error(\"Window not successfully added to showed windows map\")\n\t}\n}", "func winLoop(cfg pixelgl.WindowConfig) {\n\twin, err := pixelgl.NewWindow(cfg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor !win.Closed() {\n\t\t// For the test, just set the background to black\n\t\twin.Clear(colornames.Black)\n\n\t\t// check if the esc key has been pressed\n\t\tif win.JustPressed(pixelgl.KeyEscape) {\n\t\t\t// exit out of the win.Closed() loop\n\t\t\tbreak\n\t\t}\n\t\twin.Update()\n\t}\n\n\t// When the win.Closed() loop exists, close the `quit` channel\n\tclose(quit)\n}", "func keyHelp(myWin fyne.Window) {\n\tstep1 := \"1.chrome F12\"\n\tstep2 := \"2.source\"\n\tstep3 := \"3.theoplayer.d.js\"\n\tstep4 := \"4.break: \" + services.JSConsole[0]\n\tstep5 := \"5.copy code to console\"\n\tstep6 := \"6.copy to key\"\n\tuiKeyTip := fmt.Sprintf(\"%-28s\\n%-33s\\n%-28s\\n%-25s\\n%-6s\\n%-30s\", step1, step2, step3, step4, step5, step6)\n\tuiKeyDialog := dialog.NewConfirm(\"Get Key\", uiKeyTip, func(res bool) {\n\t\tif res {\n\t\t\tmyWin.Clipboard().SetContent(services.JSConsole[1])\n\t\t}\n\t}, myWin)\n\n\tuiKeyDialog.SetDismissText(\"Cancel\")\n\tuiKeyDialog.SetConfirmText(\"Copy\")\n\tuiKeyDialog.Show()\n}", "func openXDisplay(dispName string) error {\n\tfor i := 0; i < 50; i++ {\n\t\tif fileExists(\"/tmp/.X11-unix/X\" + dispName[1:]) {\n\t\t\tbreak\n\t\t} else {\n\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t}\n\t}\n\treturn nil\n}", "func (w *windowImpl) winLoop() {\nouter:\n\tfor {\n\t\tselect {\n\t\tcase <-w.winClose:\n\t\t\tbreak outer\n\t\tcase f := <-w.runQueue:\n\t\t\tif w.glw == nil {\n\t\t\t\tbreak outer\n\t\t\t}\n\t\t\tf.f()\n\t\t\tif f.done != nil {\n\t\t\t\tf.done <- true\n\t\t\t}\n\t\tcase <-w.publish:\n\t\t\tif w.glw == nil {\n\t\t\t\tbreak outer\n\t\t\t}\n\t\t\tif !theApp.noScreens {\n\t\t\t\ttheApp.RunOnMain(func() {\n\t\t\t\t\tif !w.Activate() {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tw.glw.SwapBuffers() // note: implicitly does a flush\n\t\t\t\t\t// note: generally don't need this:\n\t\t\t\t\t// gpu.Draw.Clear(true, true)\n\t\t\t\t})\n\t\t\t\tw.publishDone <- struct{}{}\n\t\t\t}\n\t\t}\n\t}\n}", "func IsWin() bool {\n\treturn runtime.GOOS == \"windows\"\n}", "func initWndClassInfo() (err error) {\n\tr1, _, err := user32.NewProc(\"LoadIconW\").Call(\n\t\tuintptr(_NULL),\n\t\tuintptr(_IDI_APPLICATION))\n\tif r1 == 0 { // failure\n\t\treturn fmt.Errorf(\"error getting window icon: %v\", err)\n\t}\n\ticon = _HANDLE(r1)\n\n\tr1, _, err = user32.NewProc(\"LoadCursorW\").Call(\n\t\tuintptr(_NULL),\n\t\tuintptr(_IDC_ARROW))\n\tif r1 == 0 { // failure\n\t\treturn fmt.Errorf(\"error getting window cursor: %v\", err)\n\t}\n\tcursor = _HANDLE(r1)\n\n\treturn nil\n}", "func (w *Window) readEvents(nativeWinIn <-chan interface{}) {\n\tfor evt := range nativeWinIn {\n\t\tswitch evt := evt.(type) {\n\t\tcase event.ExposeEvt:\n\t\t\tw.DefaultContainer.SetArea(image.Rect(0, 0, evt.Dx, evt.Dy))\n\t\t\tw.Draw()\n\t\tcase event.CloseEvt:\n\t\t\tw.Close()\n\t\tdefault:\n\t\t\tw.DefaultContainer.ReceiveEvent(evt)\n\t\t}\n\t}\n}", "func (ap *App) WinDefaults(wparams *WinParams) {\n\twparams.WinMs = 25.0\n\twparams.StepMs = 10.0\n\twparams.Channel = 0\n\twparams.BorderSteps = 0\n\twparams.Resize = true\n}", "func EnumWindows(enumFunc uintptr, lparam uintptr) (err error) {\n\tr1, _, e1 := syscall.Syscall(enumWindows.Addr(), 2, uintptr(enumFunc), uintptr(lparam), 0)\n\tif r1 == 0 {\n\t\tif e1 != 0 {\n\t\t\terr = error(e1)\n\t\t} else {\n\t\t\terr = syscall.EINVAL\n\t\t}\n\t}\n\treturn\n}", "func(this*Window)Close()error{\n\n\n/*23:*/\n\n\n//line goacme.w:312\n\nfor _,v:=range this.files{\nv.Close()\n}\n\n\n\n/*:23*/\n\n\n\n/*31:*/\n\n\n//line goacme.w:396\n\nif this.next!=nil{\nthis.next.prev= this.prev\n}\nif this.prev!=nil{\nthis.prev.next= this.next\n}\nif fwin==this{\nfwin= this.next\n}\nif lwin==this{\nlwin= this.prev\n}\n\n\n\n/*:31*/\n\n\n//line goacme.w:190\n\nreturn nil\n}", "func winGUI() {\n\tinst := w32.GetModuleHandle(\"\")\n\t// Parse arguments from command line.\n\tvar s int64\n\tflag.Int64Var(&s, \"r\", 0, \"initial signed 32-bit seed for dungeon generation\")\n\tflag.Parse()\n\tswitch {\n\tcase s >= -2147483648 && s <= 2147483647:\n\t\t*diablo.FlagRSeed = int32(s)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"invalid seed; expected >= -2147483648 and <= 2147483647; got %d\", s))\n\t}\n\targs := strings.Join(flag.Args(), \" \")\n\tfmt.Println(\"args:\", args)\n\tshow := w32.SW_SHOWDEFAULT\n\tdiablo.WinMain(inst, 0, args, show)\n}", "func List() (ret []*Window) {\n\tfor _, v := range winMap {\n\t\tret = append(ret, v)\n\t}\n\treturn\n}", "func Start(hwnd W.HWND) uintptr {\n\tvar message W.MSG\n//\tW.ShowWindow(hwnd,W.SW_SHOW)\n\tfor{\n\t\tif W.GetMessage(&message, 0, 0, 0) == 0 {break}\n\t\tW.TranslateMessage(&message)\n\t\tW.DispatchMessage(&message)\n\t}\n\treturn 0\n}", "func wndProc(hwnd syscall.Handle, msg uint32, wparam, lparam uintptr) (rc uintptr) {\n\treturn uit.M.DefWindowProc(hwnd, msg, wparam, lparam)\n}", "func debugPrintWinSize() {\n\twindow := getWinSize()\n\tfmt.Printf(\"col: %v\\nrow: %v\\nx: %v\\ny: %v\\n\", window.col, window.row, window.unusedX, window.unusedY)\n}", "func (win *Window) WindowPresent() {\n\twin.Candy().Guify(\"gtk_window_present\", win)\n}", "func registerWindow(callbacks MsgHandlerMap, windowName string) {\n\n\twproc := syscall.NewCallback(func(hwnd, msg uint32, wparam uintptr, lparam uintptr) uintptr {\n\t\tif result, handled := ProcNoDefault(hwnd, msg, wparam, lparam); handled {\n\t\t\treturn result\n\t\t}\n\n\t\tvar rc interface{} = nil\n\t\tif cb := callbacks[msg]; cb != nil {\n\t\t\trc = cb(hwnd)\n\t\t}\n\n\t\t// Handler provided a return code\n\t\tif rc != nil {\n\t\t\tif code, ok := rc.(int); !ok {\n\t\t\t\tpanic(\"window msg response should be int\")\n\t\t\t} else {\n\t\t\t\treturn uintptr(code)\n\t\t\t}\n\t\t}\n\n\t\t// Handler did not provide a return code, use the default window procedure\n\t\tcode := DefWindowProc(hwnd, msg, wparam, lparam)\n\t\treturn uintptr(code)\n\t})\n\n\tvar wc Wndclassex\n\twc.Size = uint32(unsafe.Sizeof(wc))\n\twc.WndProc = wproc\n\twc.Instance = 0\n\twc.Icon = 0\n\twc.Cursor = 0\n\twc.Background = 0\n\twc.MenuName = nil\n\twc.ClassName = stringToUtf16Ptr(windowName)\n\twc.IconSm = 0\n\n\tif _, errno := RegisterClassEx(&wc); errno != ERROR_SUCCESS {\n\t\tlog.Panic(errno)\n\t}\n}", "func(this*Window)ReadCtl()(id int,tlen int,blen int,isdir bool,isdirty bool,wwidth int,font string,twidth int,err error){\nf,err:=this.File(\"ctl\")\nif err!=nil{\nreturn\n}\nif _,err= f.Seek(0,0);err!=nil{\nreturn\n}\nvar dir,dirty int\n_,err= fmt.Fscanf(f,\"%d %d %d %d %d %d %s %d\",&id,&tlen,&blen,&dir,&dirty,&wwidth,&font,&twidth)\nisdir= dir==1\nisdirty= dirty==1\nreturn\n}", "func (sh *Shell) runCommandWindows(line string, timeout time.Duration) (out string, err error) {\n\treturn\n}", "func WindowsWorkstationChecks() {\n\n}", "func listBox(title, text, className string, items []string, multi bool) (string, bool, error) {\n\tvar out string\n\tnotCancledOrClosed := true\n\tvar hwndList syscall.Handle\n\n\tinstance, err := getModuleHandle()\n\tif err != nil {\n\t\treturn out, false, err\n\t}\n\n\tfn := func(hwnd syscall.Handle, msg uint32, wparam, lparam uintptr) uintptr {\n\t\tswitch msg {\n\t\tcase wmClose:\n\t\t\tnotCancledOrClosed = false\n\t\t\tdestroyWindow(hwnd)\n\t\tcase wmDestroy:\n\t\t\tpostQuitMessage(0)\n\t\tcase wmKeydown:\n\t\t\tif wparam == vkEscape {\n\t\t\t\tnotCancledOrClosed = false\n\t\t\t\tdestroyWindow(hwnd)\n\t\t\t}\n\t\tcase wmCommand:\n\t\t\tif wparam == 100 {\n\t\t\t\tif multi {\n\t\t\t\t\tselCount := int(sendMessage(hwndList, lbGetSelCount, 0, 0))\n\t\t\t\t\tselItems := make([]int32, selCount)\n\t\t\t\t\tsendMessage(hwndList, lbGetSelItems, uintptr(selCount), uintptr(unsafe.Pointer(&selItems[0])))\n\t\t\t\t\tfor i, idx := range selItems {\n\t\t\t\t\t\tout += items[idx]\n\t\t\t\t\t\tif i != len(selItems)-1 {\n\t\t\t\t\t\t\tout += lbSeparator\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ti := int(sendMessage(hwndList, lbGetCurSel, 0, 0))\n\t\t\t\t\tif i >= 0 {\n\t\t\t\t\t\tout = items[i]\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tdestroyWindow(hwnd)\n\t\t\t} else if wparam == 110 {\n\t\t\t\tnotCancledOrClosed = false\n\t\t\t\tdestroyWindow(hwnd)\n\t\t\t}\n\t\tdefault:\n\t\t\tret := defWindowProc(hwnd, msg, wparam, lparam)\n\t\t\treturn ret\n\t\t}\n\n\t\treturn 0\n\t}\n\n\terr = registerClass(className, instance, fn)\n\tif err != nil {\n\t\treturn out, false, err\n\t}\n\tdefer unregisterClass(className, instance)\n\n\thwnd, _ := createWindow(0, className, title, wsOverlappedWindow, swUseDefault, swUseDefault, 235, 300, 0, 0, instance)\n\thwndText, _ := createWindow(0, \"STATIC\", text, wsChild|wsVisible, 10, 10, 200, 16, hwnd, 0, instance)\n\n\tflags := wsBorder | wsChild | wsVisible | wsGroup | wsTabStop | esAutoVScroll\n\tif multi {\n\t\tflags |= lbsExtendedsel\n\t}\n\thwndList, _ = createWindow(wsExClientEdge, \"LISTBOX\", title, uint64(flags), 10, 30, 200, 200, hwnd, 0, instance)\n\n\thwndOK, _ := createWindow(wsExClientEdge, \"BUTTON\", \"OK\", wsChild|wsVisible|bsPushButton|wsGroup|wsTabStop, 10, 230, 90, 24, hwnd, 100, instance)\n\thwndCancel, _ := createWindow(wsExClientEdge, \"BUTTON\", \"Cancel\", wsChild|wsVisible|bsPushButton|wsGroup|wsTabStop, 120, 230, 90, 24, hwnd, 110, instance)\n\n\tsetWindowLong(hwnd, gwlStyle, getWindowLong(hwnd, gwlStyle)^wsMinimizeBox)\n\tsetWindowLong(hwnd, gwlStyle, getWindowLong(hwnd, gwlStyle)^wsMaximizeBox)\n\n\tfont := getMessageFont()\n\tsendMessage(hwndText, wmSetFont, font, 0)\n\tsendMessage(hwndList, wmSetFont, font, 0)\n\tsendMessage(hwndOK, wmSetFont, font, 0)\n\tsendMessage(hwndCancel, wmSetFont, font, 0)\n\n\tcenterWindow(hwnd)\n\n\tfor _, item := range items {\n\t\ti, _ := syscall.UTF16PtrFromString(item)\n\t\tsendMessage(hwndList, lbAddString, 0, uintptr(unsafe.Pointer(i)))\n\t}\n\n\tshowWindow(hwnd, swShowNormal)\n\tupdateWindow(hwnd)\n\n\terr = messageLoop(hwnd)\n\tif err != nil {\n\t\treturn out, false, err\n\t}\n\n\treturn out, notCancledOrClosed, nil\n}", "func newWindow(X *xgbutil.XUtil, color uint32) *xwindow.Window {\n\twin, err := xwindow.Generate(X)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = win.CreateChecked(X.RootWin(), 0, 0, 400, 400,\n\t\txproto.CwBackPixel|xproto.CwEventMask,\n\t\tcolor, xproto.EventMaskPointerMotion)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\twin.Map()\n\treturn win\n}", "func GetNextWindow(hWnd win.HWND, wCmd uintptr) win.HWND {\n\tret, _, _ := getNextWindow.Call(uintptr(hWnd), wCmd)\n\treturn win.HWND(ret)\n}", "func (c *Client) upgradeWindows(update *update.Update) {\n\tyes, _ := ui.Question(Title, \"An Update is available! Upgrade Now?\\n\\n\"+\n\t\t\"Your Version: \"+update.Version+\"\\n\"+\n\t\t\"New Version: \"+update.Current+\"\\n\"+\n\t\t\"Date: \"+update.RelDate.Format(\"Jan 2, 2006\")+\" (\"+\n\t\tdurafmt.Parse(time.Since(update.RelDate).Round(time.Hour)).String()+\" ago)\", false)\n\tif yes {\n\t\tif err := c.updateNow(update, \"user requested\"); err != nil {\n\t\t\tc.Errorf(\"Update Failed: %v\", err)\n\t\t\t_, _ = ui.Error(Title+\" ERROR\", \"Updating Notifiarr:\\n\"+err.Error()+\"\\n\")\n\t\t}\n\t}\n}", "func (w *windowImpl) winLoop() {\n\twinShow := time.NewTimer(time.Second)\nouter:\n\tfor {\n\t\tlog.Println(\"mobile window loop iteration\")\n\t\tselect {\n\t\tcase <-w.winClose:\n\t\t\tbreak outer\n\t\tcase f := <-w.runQueue:\n\t\t\tif w.app.gpu == nil {\n\t\t\t\tbreak outer\n\t\t\t}\n\t\t\tf.f()\n\t\t\tif f.done != nil {\n\t\t\t\tf.done <- true\n\t\t\t}\n\t\tcase <-winShow.C:\n\t\t\tif w.app.gpu == nil {\n\t\t\t\tbreak outer\n\t\t\t}\n\t\t\tw.sendWindowEvent(window.Show)\n\t\t}\n\t}\n}", "func (m *display) ClrWindow(id int) (int) {\n\tn := m.Send([]byte{0xFE, 0x2C, byte(id)})\n\treturn n\n}", "func (a *AbstractSessionChannelHandler) OnWindow(\n\t_ uint64,\n\t_ uint32,\n\t_ uint32,\n\t_ uint32,\n\t_ uint32,\n) error {\n\treturn fmt.Errorf(\"not supported\")\n}", "func getWindowLongPtr(hwnd _HWND, what uintptr) uintptr {\n\tr1, _, _ := _getWindowLongPtr.Call(\n\t\tuintptr(hwnd),\n\t\twhat)\n\treturn r1\n}", "func IsWindows() bool {\n\treturn CapWindows.IsWindows()\n}", "func CreateMainWindow() {\n\n\tvBox := tui.NewVBox()\n\tvBox.SetSizePolicy(tui.Minimum, tui.Minimum)\n\tSidebar := tui.NewVBox()\n\tSidebar.SetSizePolicy(tui.Minimum, tui.Minimum)\n\n\tfor _, cmd := range strings.Split(libs.Cmds, \",\") {\n\t\tSidebar.Append(tui.NewLabel(wordwrap.WrapString(cmd, 50)))\n\t}\n\n\tSidebar.SetBorder(true)\n\tSidebar.Prepend(tui.NewLabel(\"***COMMANDS***\"))\n\n\tInput.SetFocused(true)\n\tInput.SetSizePolicy(tui.Expanding, tui.Maximum)\n\n\tinputBox := tui.NewHBox(Input)\n\tinputBox.SetBorder(true)\n\tinputBox.SetSizePolicy(tui.Expanding, tui.Maximum)\n\n\thistoryScroll := tui.NewScrollArea(History)\n\thistoryScroll.SetAutoscrollToBottom(true)\n\thistoryBox := tui.NewVBox(historyScroll)\n\thistoryBox.SetBorder(true)\n\n\tchat := tui.NewVBox(historyBox, inputBox)\n\tchat.SetSizePolicy(tui.Expanding, tui.Expanding)\n\n\t// create root window and add all windows\n\troot := tui.NewHBox(Sidebar, chat)\n\tui, err := tui.New(root)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tui.SetKeybinding(\"Esc\", func() { ui.Quit() })\n\n\tInput.OnSubmit(func(e *tui.Entry) {\n\t\t// this is just to see what command given\n\t\tuserCommand := e.Text()\n\t\tif userCommand == \"\" {\n\t\t\tHistory.Append(tui.NewLabel(\"that is not acceptable command\"))\n\t\t\tHistory.Append(tui.NewLabel(libs.PrintHelp()))\n\t\t} else {\n\t\t\tHistory.Append(tui.NewHBox(\n\t\t\t\ttui.NewLabel(\"Your Command: \" + userCommand),\n\t\t\t))\n\t\t\tHistory.Append(tui.NewHBox(tui.NewLabel(\"\")))\n\n\t\t\tif strings.HasPrefix(userCommand, \"\\\\\") {\n\t\t\t\t// then this is command ..\n\t\t\t\tswitch userCommand {\n\t\t\t\tcase \"\\\\help\":\n\t\t\t\t\tHistory.Append(tui.NewLabel(libs.PrintHelp()))\n\t\t\t\tcase \"\\\\monitor\":\n\t\t\t\t\tHistory.Append(tui.NewLabel(\"Switching to MONITOR mode for device \" + DeviceName))\n\t\t\t\t\tChangeToMonitorMode()\n\t\t\t\tcase \"\\\\managed\":\n\t\t\t\t\tHistory.Append(tui.NewLabel(\"Switching to MANAGED mode for device \" + DeviceName))\n\t\t\t\t\tChangeToManagedMode()\n\t\t\t\tcase \"\\\\exit\":\n\t\t\t\t\tHistory.Append(tui.NewHBox(tui.NewLabel(\"quitting...\")))\n\t\t\t\t\ttime.Sleep(1000 * time.Millisecond)\n\t\t\t\t\t// os.Exit(0)\n\n\t\t\t\t}\n\t\t\t} else if strings.Contains(userCommand, \":\") {\n\t\t\t\t// then this is declaration\n\t\t\t\tcmdSplit := strings.Split(userCommand, \":\")\n\t\t\t\tif cmdSplit[1] == \"\" {\n\t\t\t\t\tHistory.Append(tui.NewLabel(\"that is not acceptable command\"))\n\t\t\t\t\tHistory.Append(tui.NewLabel(libs.PrintHelp()))\n\t\t\t\t} else {\n\t\t\t\t\tswitch cmdSplit[0] {\n\t\t\t\t\tcase \"device\":\n\t\t\t\t\t\tSetDeviceName(cmdSplit[1])\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tHistory.Append(tui.NewLabel(\"there is no such declaration or command\"))\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tHistory.Append(tui.NewHBox(tui.NewLabel(userCommand + \" is not command or a declaration\")))\n\t\t\t}\n\t\t}\n\t\tInput.SetText(\"\")\n\t})\n\n\tif err := ui.Run(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (s *BaseTdatListener) EnterWindowsWithLowAndHighIndex(ctx *WindowsWithLowAndHighIndexContext) {}", "func WndProc(hwnd syscall.Handle, msg uint32, wparam, lparam uintptr) (rc uintptr) {\n\t_ = make([]int, 100000)\n\tswitch msg {\n\tcase wingui.WM_CREATE:\n\t\thdc := wingui.GetDC(hwnd)\n\t\thdcWndBuffer = wingui.CreateCompatibleDC(hdc)\n\t\twndBufferHeader = wingui.CreateCompatibleBitmap(hdc, 600, 800)\n\t\twingui.GetObject(wndBufferHeader, unsafe.Sizeof(wndBuffer), uintptr(unsafe.Pointer(&wndBuffer)))\n\t\twingui.SelectObject(hdcWndBuffer, wndBufferHeader)\n\n\t\tvar bmp_header wingui.BITMAPINFOHEADER\n\t\tbmp_header.Size = uint32(unsafe.Sizeof(bmp_header))\n\t\tbmp_header.Width = 600\n\t\tbmp_header.Height = 800\n\t\tbmp_header.SizeImage = 0 // the api says this must be 0 for BI_RGB images\n\t\tbmp_header.Compression = wingui.BI_RGB\n\t\tbmp_header.BitCount = 32\n\t\tbmp_header.Planes = 1\n\t\tbmp_header.XPelsPerMeter = 0\n\t\tbmp_header.YPelsPerMeter = 0\n\t\tbmp_header.ClrUsed = 0\n\t\tbmp_header.ClrImportant = 0\n\t\t//bitmap info\n\t\tvar bmpinfo wingui.BITMAPINFO\n\t\tbmpinfo.Colors[0].Blue = 0\n\t\tbmpinfo.Colors[0].Green = 0\n\t\tbmpinfo.Colors[0].Red = 0\n\t\tbmpinfo.Colors[0].Reserved = 0\n\t\tbmpinfo.Header = bmp_header\n\t\twndBufferHeader = wingui.CreateDIBSection(hdc, &bmpinfo, wingui.DIB_RGB_COLORS, uintptr(unsafe.Pointer(&ppvBits)), 0, 0)\n\t\twingui.GetObject(wndBufferHeader, unsafe.Sizeof(wndBufferHeader), uintptr(unsafe.Pointer(&wndBuffer)))\n\t\thdcWndBuffer = wingui.CreateCompatibleDC(hdc)\n\t\twingui.SelectObject(hdcWndBuffer, wndBufferHeader)\n\n\t\tpixel := (*[600 * 800 * 4]uint8)(unsafe.Pointer(ppvBits))\n\t\tpixelSlice := pixel[:]\n\t\tbackBuffer = &image.RGBA{pixelSlice, 4*600, image.Rect(0, 0, 600, 800)}\n\t\tfmt.Println(\"Create windows\")\n\t\trc = wingui.DefWindowProc(hwnd, msg, wparam, lparam)\n\tcase wingui.WM_COMMAND:\n\t\tswitch syscall.Handle(lparam) {\n\t\tdefault:\n\t\t\trc = wingui.DefWindowProc(hwnd, msg, wparam, lparam)\n\t\t}\n\tcase wingui.WM_PAINT:\n\t\tvar ps wingui.PAINTSTRUCT\n\t\thdc := wingui.BeginPaint(hwnd, &ps)\n\t\tt := time.Now()\n\t\tgc := draw2d.NewGraphicContext(backBuffer)\n\t\t/*gc.SetFillColor(color.RGBA{0xFF, 0xFF, 0xFF, 0xFF})\n\t\tgc.Clear()*/\n\t\tfor i := 0; i < len(backBuffer.Pix); i+=1 {\n\t\t\tbackBuffer.Pix[i] = 0xff\n\t\t}\n\t\tgc.Save()\n\t\t//gc.Translate(0, -380)\n\t\tDrawTiger(gc)\n\t\tgc.Restore()\n\t\t// back buf in\n\t\tvar tmp uint8\n\t\tfor i := 0; i < len(backBuffer.Pix); i+=4 {\n\t\t\ttmp = backBuffer.Pix[i]\n\t\t\tbackBuffer.Pix[i] = backBuffer.Pix[i+2]\n\t\t\tbackBuffer.Pix[i+2] = tmp\n\t\t}\n\t\twingui.BitBlt(hdc, 0, 0, int(wndBuffer.Width), int(wndBuffer.Height), hdcWndBuffer, 0, 0, wingui.SRCCOPY)\n\t\twingui.EndPaint(hwnd, &ps)\n\t\trc = wingui.DefWindowProc(hwnd, msg, wparam, lparam)\n\t\tdt := time.Now().Sub(t)\n\t\tfmt.Printf(\"Redraw in : %f ms\\n\", float64(dt)*1e-6)\n\tcase wingui.WM_CLOSE:\n\t\twingui.DestroyWindow(hwnd)\n\tcase wingui.WM_DESTROY:\n\t\twingui.PostQuitMessage(0)\n\tdefault:\n\t\trc = wingui.DefWindowProc(hwnd, msg, wparam, lparam)\n\t}\n\treturn\n}", "func wmDefaultLaunchClamshell24(ctx context.Context, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device) error {\n\t// There are some differences in default launch behavior between P and R.\n\tresizableLandscapeCheckFunc := wm.CheckRestoreResizable\n\tresizableUnspecifiedCheckFunc := wm.CheckRestoreResizable\n\tunresizablePortraitCheckFunc := wm.CheckRestoreNonResizable\n\tunresizableLandscapeCheckFunc := wm.CheckMaximizeNonResizable\n\tif sdkVer, err := arc.SDKVersion(); err != nil {\n\t\treturn err\n\t} else if sdkVer < arc.SDKR {\n\t\tresizableLandscapeCheckFunc = wm.CheckMaximizeResizable\n\t\tresizableUnspecifiedCheckFunc = wm.CheckMaximizeResizable\n\t\tunresizablePortraitCheckFunc = wm.CheckPillarboxNonResizable\n\t} else {\n\t\tdisplayInfo, err := display.GetPrimaryInfo(ctx, tconn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif displayInfo.Bounds.Height > displayInfo.Bounds.Width {\n\t\t\tunresizableLandscapeCheckFunc = wm.CheckRestoreNonResizable\n\t\t}\n\t}\n\tfor _, test := range []struct {\n\t\tname string\n\t\tact string\n\t\twantedState wm.CheckFunc\n\t}{\n\t\t// The are four possible default states (windows #A to #D) from six possible different activities.\n\t\t// Window #A.\n\t\t{\"Landscape + Resize enabled\", wm.ResizableLandscapeActivity, resizableLandscapeCheckFunc},\n\t\t// Window #B.\n\t\t{\"Landscape + Resize disabled\", wm.NonResizableLandscapeActivity, unresizableLandscapeCheckFunc},\n\t\t// Window #A.\n\t\t{\"Unspecified + Resize enabled\", wm.ResizableUnspecifiedActivity, resizableUnspecifiedCheckFunc},\n\t\t// Window #B.\n\t\t{\"Unspecified + Resize disabled\", wm.NonResizableUnspecifiedActivity, wm.CheckMaximizeNonResizable},\n\t\t// Window #C.\n\t\t{\"Portrait + Resized enabled\", wm.ResizablePortraitActivity, wm.CheckRestoreResizable},\n\t\t// Window #D.\n\t\t{\"Portrait + Resize disabled\", wm.NonResizablePortraitActivity, unresizablePortraitCheckFunc},\n\t} {\n\t\tif err := func() error {\n\t\t\ttesting.ContextLogf(ctx, \"Running subtest %q\", test.name)\n\t\t\tact, err := arc.NewActivity(a, wm.Pkg24, test.act)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer act.Close()\n\n\t\t\tif err := act.StartWithDefaultOptions(ctx, tconn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Stop activity at exit time so that the next WM test can launch a different activity from the same package.\n\t\t\tdefer act.Stop(ctx, tconn)\n\t\t\tif err := wm.WaitUntilActivityIsReady(ctx, tconn, act, d); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn test.wantedState(ctx, tconn, act, d)\n\t\t}(); err != nil {\n\t\t\treturn errors.Wrapf(err, \"%q subtest failed\", test.name)\n\t\t}\n\t}\n\treturn nil\n}", "func init() {\n\ttermcols = 80\n\tupdateWinSize()\n\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGWINCH)\n\n\tgo func() {\n\t\tfor {\n\t\t\t// Wait for signal\n\t\t\t<-ch\n\t\t\tupdateWinSize()\n\t\t}\n\t}()\n}", "func NewTelWindow(c int, r int) *TelWindow {\n t := TelWindow {\n c, // cols\n r, // rows\n 0, // point col\n 0, // point row\n nil,\n AnsiProperty{},\n make([]TelWord, c * r),\n TelWord{},\n }\n return &t\n}", "func TestAddWindow(t *testing.T) {\n\tp, err := NewProgram()\n\tif err != nil {\n\t\tt.Error(\"Unable to start termbox\")\n\t}\n\n\tdefer p.Close()\n\n\twinNumberBefore := len(p.windows)\n\tshowNumberBefore := len(p.showed)\n\n\tw := NewWindow()\n\terr2 := p.AddWindow(w)\n\n\tif err2 != nil {\n\t\tt.Errorf(\"An error occured %s\", fmt.Sprint(err2))\n\t}\n\n\tif winNumberBefore+1 != len(p.windows) {\n\t\tt.Error(\"Window not successfully added to windows's map\")\n\t}\n\n\tif showNumberBefore+1 != len(p.showed) {\n\t\tt.Error(\"Window not successfully added to showed windows map\")\n\t}\n\n\tif w.parent == nil {\n\t\tt.Error(\"The window must have a parent when added to a program\")\n\t}\n}", "func getWinSize() winSize {\n\tws := winSize{}\n\tsyscall.Syscall(syscall.SYS_IOCTL, uintptr(0), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&ws)))\n\treturn ws\n}", "func SetCosoleWinsize(pid, w, h int) {\n\twhandle, err := GetWindowHandleByPID(pid, true)\n\tif err != nil {\n\t\tlog.Printf(\"SetWinsize: %v\", err)\n\t\treturn\n\t}\n\t// read default font size from registry\n\tconsole_reg_key, err := registry.OpenKey(registry.CURRENT_USER, \"Console\", registry.QUERY_VALUE)\n\tif err != nil {\n\t\tlog.Printf(\"SetCosoleWinsize: %v\", err)\n\t\treturn\n\t}\n\tdefer console_reg_key.Close()\n\tfont_size_val, _, err := console_reg_key.GetIntegerValue(\"FontSize\")\n\tif err != nil {\n\t\tlog.Printf(\"SetConsoleWinSize: query fontsize: %v\", err)\n\t\treturn\n\t}\n\tfont_size := int(font_size_val >> 16) // font height in pixels, width = h/2\n\tlog.Printf(\"Default font size of console host is %d (0x%x), parsed from 0x%x\",\n\t\tfont_size, font_size, font_size_val)\n\t// what size in pixels we need\n\tw_px := w * font_size / 2\n\th_px := h * font_size\n\n\tif ConsoleExtraHeight == 0 && ConsoleExtraWidth == 0 {\n\t\t// Get default window size\n\t\tnow_size, _, err := console_reg_key.GetIntegerValue(\"WindowSize\")\n\t\tif err != nil {\n\t\t\tlog.Printf(\"window size: %v\", err)\n\t\t\treturn\n\t\t}\n\t\t// in chars\n\t\tdefault_width := int(now_size & 0xffff)\n\t\tdefault_height := int(now_size >> 16)\n\t\t// in pixels\n\t\tdefault_w_px := default_width * font_size / 2\n\t\tdefault_h_px := default_height * font_size\n\t\tlog.Printf(\"Default window (client rectangle, excluding frames) is %dx%d (chars) or %dx%d (pixels)\",\n\t\t\tdefault_width, default_height,\n\t\t\tdefault_w_px, default_h_px)\n\t\t// window size in pixels, including title bar and frame\n\t\tnow_rect := w32.GetWindowRect(whandle)\n\t\tnow_w_px := int(now_rect.Width())\n\t\tnow_h_px := int(now_rect.Height())\n\t\tif now_h_px <= 0 || now_w_px <= 0 {\n\t\t\tlog.Printf(\"Now window (normal rectangle) size is %dx%d, aborting\", now_w_px, now_h_px)\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"Current window (normal rectangle, including frames) is %dx%d (pixels)\",\n\t\t\tnow_w_px, now_h_px)\n\t\t// calculate extra width and height\n\t\tConsoleExtraHeight = now_h_px - default_h_px\n\t\tConsoleExtraWidth = now_w_px - default_w_px\n\t\tif ConsoleExtraWidth <= 0 || ConsoleExtraHeight <= 0 {\n\t\t\tlog.Printf(\"Extra width %d pixels, extra height %d pixels, aborting\", ConsoleExtraWidth, ConsoleExtraHeight)\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"Frame (excluding window content) is %d(w), %d(h) (pixels)\",\n\t\t\tConsoleExtraWidth, ConsoleExtraHeight)\n\n\t}\n\tw_px = w_px + ConsoleExtraWidth\n\th_px = h_px + ConsoleExtraHeight\n\n\t// set window size in pixels\n\tif w32.SetWindowPos(whandle, whandle, 0, 0, w_px, h_px, w32.SWP_NOMOVE|w32.SWP_NOZORDER) {\n\t\tlog.Printf(\"Window (0x%x) of %d is being resized to %dx%d (chars) or %dx%d (pixels)\",\n\t\t\twhandle, pid, w, h, w_px, h_px)\n\t}\n\n\t// check window size\n\tnow_rect := w32.GetWindowRect(whandle)\n\tnow_w_px := int(now_rect.Width())\n\tnow_h_px := int(now_rect.Height())\n\tif now_w_px != w_px || now_h_px != h_px {\n\t\tlog.Printf(\"Resizing failed, actual window size is now %dx%d pixels\", now_w_px, now_h_px)\n\t}\n}", "func (o *Omok) Win(x, y int, stone Stone) bool {\n\treturn false\n}", "func makeCallback(handle *syscall.Handle) uintptr {\n\tcb := syscall.NewCallback(func(h syscall.Handle, p uintptr) uintptr {\n\t\tb := make([]uint16, 200)\n\t\t_, err := getWindowText(h, &b[0], int32(len(b)))\n\t\tif err != nil {\n\t\t\t// ignore the error\n\t\t\treturn 1 // continue enumeration\n\t\t}\n\t\twindowTitle := syscall.UTF16ToString(b)\n\t\tif strings.HasPrefix(windowTitle, \"Spotify\") {\n\t\t\t// note the window\n\t\t\t*handle = h\n\t\t\treturn 0 // stop enumeration\n\t\t}\n\t\treturn 1 // continue enumeration\n\t})\n\treturn cb\n}", "func getWinSize() *winSize {\n\twin := &winSize{}\n\tret, _, err := syscall.Syscall(uintptr(syscall.SYS_IOCTL), uintptr(syscall.Stdin), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(win)))\n\tif int(ret) == -1 {\n\t\tpanic(err)\n\t}\n\treturn win\n}", "func(this*Window)WriteCtl(format string,args...interface{})error{\nf,err:=this.File(\"ctl\")\nif err!=nil{\nreturn err\n}\nif len(args)> 0{\nformat= fmt.Sprintf(format,args...)\n}\nif len(format)>=0&&format[len(format)-1]!='\\n'{\nformat+= \"\\n\"\n}\nif _,err= f.Seek(0,0);err!=nil{\nreturn err\n}\n_,err= f.Write([]byte(format))\nreturn err\n}", "func (p *Window) Class() string {\n\treturn (`winl.Window`)\n}", "func minWindow(s string, t string) string {\n \n}", "func (l LCDControl) WindowDisplay() bool {\n\treturn binary.Bit(5, byte(l)) != 0\n}", "func GuiWindowBox(bounds Rectangle, title string) bool {\n\tcbounds, _ := *(*C.Rectangle)(unsafe.Pointer(&bounds)), cgoAllocsUnknown\n\ttitle = safeString(title)\n\tctitle, _ := unpackPCharString(title)\n\t__ret := C.GuiWindowBox(cbounds, ctitle)\n\truntime.KeepAlive(title)\n\t__v := (bool)(__ret)\n\treturn __v\n}", "func (*WindowActiveWindowRequest) Descriptor() ([]byte, []int) {\n\treturn file_window_proto_rawDescGZIP(), []int{5}\n}", "func (w *windowImpl) GoRunOnWin(f func()) {\n\tif w.IsClosed() {\n\t\treturn\n\t}\n\tgo func() {\n\t\tw.runQueue <- funcRun{f: f, done: nil}\n\t}()\n}", "func (w *windowImpl) GoRunOnWin(f func()) {\n\tif w.IsClosed() {\n\t\treturn\n\t}\n\tgo func() {\n\t\tw.runQueue <- funcRun{f: f, done: nil}\n\t}()\n}", "func FindWindow(win string) (ret uintptr, err error) {\n\tlpszWindow := syscall.StringToUTF16Ptr(win)\n\n\tr0, _, e1 := syscall.Syscall(findWindowW.Addr(), 2, uintptr(unsafe.Pointer(nil)), uintptr(unsafe.Pointer(lpszWindow)), 0)\n\tret = uintptr(r0)\n\tif ret == 0 {\n\t\tif e1 != 0 {\n\t\t\terr = error(e1)\n\t\t} else {\n\t\t\terr = syscall.EINVAL\n\t\t}\n\t}\n\treturn\n}", "func mainWinOnExit() {\n\tvar err error\n\topt.UpdateOptions()\n\tif err = opt.Write(); err != nil {\n\t\tlog.Fatalf(\"Error writing option file: %s\\n\", err.Error())\n\t}\n}", "func textWinBtnDoneClicked() {\n\tobj.textWinChkShowModifications.SetActive(false)\n\n\topt.SourceWinWidth, opt.SourceWinHeight = obj.textWin.GetSize()\n\topt.SourceWinPosX, opt.SourceWinPosY = obj.textWin.GetPosition()\n\topt.PanedWidth = opt.SourceWinWidth - obj.Paned.GetPosition()\n\n\tgenericHideWindow(obj.textWin)\n\n\tcurrentText = \"\"\n\tcurrentLine = -1\n}", "func (lw *listWin) refresh() {\n\tvar inds []int\n\tfor i, task := range file.Tasks {\n\t\tok := true\n\t\tfor _, filter := range lw.filters {\n\t\t\tif !task.HasTag(filter) {\n\t\t\t\tok = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif ok {\n\t\t\tinds = append(inds, i)\n\t\t}\n\t}\n\n\tsort.Sort(sorter{inds, file.Tasks, lw.less})\n\n\tprojs := make(map[string]bool)\n\tctxs := make(map[string]bool)\n\n\tif err := lw.Addr(\",\"); err != nil {\n\t\tdie(1, \"Failed to set address for %s: %s\", lw.title, err)\n\t}\n\n\tfor _, i := range inds {\n\t\ttask := file.Tasks[i]\n\t\tif _, err := fmt.Fprintf(lw.Data, \"%5d. %s\\n\", i+1, task.String()); err != nil {\n\t\t\tdie(1, \"Failed to refresh window %s: %s\", lw.title, err)\n\t\t}\n\t\tfor _, t := range task.Tags(todotxt.ProjectTag) {\n\t\t\tprojs[t] = true\n\t\t}\n\t\tfor _, t := range task.Tags(todotxt.ContextTag) {\n\t\t\tctxs[t] = true\n\t\t}\n\t}\n\n\tif err := lw.Addr(\"#0\"); err != nil {\n\t\tdie(1, \"Failed to write address to %s: %s\", lw.title, err)\n\t}\n\tif err := lw.Ctl(\"dot=addr\"); err != nil {\n\t\tdie(1, \"Failed to write dot=addr to %s ctl: %s\", lw.title, err)\n\t}\n\tif err := lw.Ctl(\"show\"); err != nil {\n\t\tdie(1, \"Failed to write show to %s ctl: %s\", lw.title, err)\n\t}\n\tif err := lw.Ctl(\"clean\"); err != nil {\n\t\tdie(1, \"Failed to write clean to %s ctl: %s\", lw.title, err)\n\t}\n}", "func (*ClientCapabilities_Window) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{51, 1}\n}", "func wmMaximizeRestoreClamshell24(ctx context.Context, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device) error {\n\ttype testCase struct {\n\t\tname string\n\t\tact string\n\t\tstateA ash.WMEventType\n\t\twantedStateA wm.CheckFunc\n\t\tstateB ash.WMEventType\n\t\twantedStateB wm.CheckFunc\n\t}\n\t// There are some differences in default launch behavior between P and R.\n\ttestCases := []testCase{\n\t\t{\"Unspecified\", wm.ResizableUnspecifiedActivity,\n\t\t\tash.WMEventNormal, wm.CheckRestoreResizable, ash.WMEventMaximize, wm.CheckMaximizeResizable},\n\t\t{\"Portrait\", wm.ResizablePortraitActivity,\n\t\t\tash.WMEventNormal, wm.CheckRestoreResizable, ash.WMEventMaximize, wm.CheckPillarboxResizable},\n\t\t{\"Landscape\", wm.ResizableLandscapeActivity,\n\t\t\tash.WMEventNormal, wm.CheckRestoreResizable, ash.WMEventMaximize, wm.CheckMaximizeResizable},\n\t}\n\tif sdkVer, err := arc.SDKVersion(); err != nil {\n\t\treturn err\n\t} else if sdkVer < arc.SDKR {\n\t\ttestCases = []testCase{\n\t\t\t{\"Unspecified\", wm.ResizableUnspecifiedActivity,\n\t\t\t\tash.WMEventMaximize, wm.CheckMaximizeResizable, ash.WMEventNormal, wm.CheckRestoreResizable},\n\t\t\t{\"Portrait\", wm.ResizablePortraitActivity,\n\t\t\t\tash.WMEventNormal, wm.CheckRestoreResizable, ash.WMEventMaximize, wm.CheckPillarboxResizable},\n\t\t\t{\"Landscape\", wm.ResizableLandscapeActivity,\n\t\t\t\tash.WMEventMaximize, wm.CheckMaximizeResizable, ash.WMEventNormal, wm.CheckRestoreResizable},\n\t\t}\n\t}\n\tfor _, test := range testCases {\n\t\tif err := func() error {\n\t\t\ttesting.ContextLogf(ctx, \"Running subtest %q\", test.name)\n\t\t\tact, err := arc.NewActivity(a, wm.Pkg24, test.act)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer act.Close()\n\n\t\t\tif err := act.StartWithDefaultOptions(ctx, tconn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Stop activity at exit time so that the next WM test can launch a different activity from the same package.\n\t\t\tdefer act.Stop(ctx, tconn)\n\n\t\t\tif err := test.wantedStateA(ctx, tconn, act, d); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif _, err := ash.SetARCAppWindowState(ctx, tconn, act.PackageName(), test.stateB); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := test.wantedStateB(ctx, tconn, act, d); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif _, err := ash.SetARCAppWindowState(ctx, tconn, act.PackageName(), test.stateA); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn test.wantedStateA(ctx, tconn, act, d)\n\t\t}(); err != nil {\n\t\t\treturn errors.Wrapf(err, \"%q subtest failed\", test.name)\n\t\t}\n\t}\n\treturn nil\n}", "func (d *Device) setWindow(x, y, w, h int16) {\n\tx += d.columnOffset\n\ty += d.rowOffset\n\tcopy(d.buf[:4], []uint8{uint8(x >> 8), uint8(x), uint8((x + w - 1) >> 8), uint8(x + w - 1)})\n\td.sendCommand(CASET, d.buf[:4])\n\tcopy(d.buf[:4], []uint8{uint8(y >> 8), uint8(y), uint8((y + h - 1) >> 8), uint8(y + h - 1)})\n\td.sendCommand(RASET, d.buf[:4])\n\td.sendCommand(RAMWR, nil)\n}", "func (*WindowActiveWindowResponse) Descriptor() ([]byte, []int) {\n\treturn file_window_proto_rawDescGZIP(), []int{1}\n}", "func CreateWindow(title string, width, height uint32, r Framer) (*Window, error) {\n\tconst className = \"goui.wingui.window\"\n\n\tres := &Window{\n\t\tHandle: tHWND(0),\n\t\tRunning: true,\n\t\tRoot: r,\n\t}\n\n\tinstance, err := getModuleHandle()\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tcursor, err := loadCursor(cIDC_ARROW)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tcallback := func(hwnd tHWND, msg uint32, wparam, lparam uintptr) uintptr {\n\t\treturn mainLoop(res, hwnd, msg, wparam, lparam)\n\t}\n\n\twndclass := tWNDCLASSEXW{\n\t\twndProc: syscall.NewCallback(callback),\n\t\tinstance: instance,\n\t\tcursor: cursor,\n\t\tbackground: cCOLOR_WINDOW,\n\t\tclassName: syscall.StringToUTF16Ptr(className),\n\t}\n\twndclass.size = uint32(unsafe.Sizeof(wndclass))\n\n\tif _, err = registerClassEx(&wndclass); err != nil {\n\t\treturn res, err\n\t}\n\n\tres.Handle, err = createWindow(\n\t\tclassName,\n\t\ttitle,\n\t\tcWS_VISIBLE|cWS_OVERLAPPEDWINDOW,\n\t\tcSW_USE_DEFAULT,\n\t\tcSW_USE_DEFAULT,\n\t\tint32(width),\n\t\tint32(height),\n\t\t0,\n\t\t0,\n\t\tinstance,\n\t)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\treturn res, nil\n}", "func loadWindows() ([]*safari.Window, error) {\n\n\tvar wins []*safari.Window\n\n\tgetWins := func() (interface{}, error) {\n\t\treturn safari.Windows()\n\t}\n\n\tif err := wf.Session.LoadOrStoreJSON(\"windows\", getWins, &wins); err != nil {\n\t\treturn nil, err\n\t}\n\treturn wins, nil\n}", "func (ref *UIElement) Windows() []*UIElement {\n\treturn ref.SliceOfUIElementAttr(WindowsAttribute)\n}", "func (m *display) InitTextWindow(id, x1, y1, x2, y2, font, charSpace, lineSpace, scroll int) int {\n\tdata := []byte{0xFE, 0x2B, byte(id), byte(x1), byte(y1), byte(x2), byte(y2)}\n\tfontb := make([]byte,2)\n\tbinary.LittleEndian.PutUint16(fontb, uint16(font))\n\tdata = append(data, fontb...)\n\tdata = append(data, byte(charSpace))\n\tdata = append(data, byte(lineSpace))\n\tdata = append(data, byte(scroll))\n\n\tn1 := m.Send(data)\n\treturn n1\n}", "func updateWindow(ctx context.Context, a api.FullNode, w CidWindow, t int, ch chan CidWindow) (CidWindow, error) {\n\thead, err := a.ChainHead(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twindow := appendCIDsToWindow(w, head.Cids(), t)\n\tch <- window\n\treturn window, nil\n}", "func (s *Service) onWindowResize(channel chan os.Signal) {\n\t//stdScr, _ := gc.Init()\n\t//stdScr.ScrollOk(true)\n\t//gc.NewLines(true)\n\tfor {\n\t\t<-channel\n\t\t//gc.StdScr().Clear()\n\t\t//rows, cols := gc.StdScr().MaxYX()\n\t\tcols, rows := GetScreenSize()\n\t\ts.screenRows = rows\n\t\ts.screenCols = cols\n\t\ts.resizeWindows()\n\t\t//gc.End()\n\t\t//gc.Update()\n\t\t//gc.StdScr().Refresh()\n\t}\n}", "func (w *windowImpl) Handle() any {\n\treturn w.app.winptr\n}", "func wmSnapping(ctx context.Context, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device) error {\n\tact, err := arc.NewActivity(a, wm.Pkg24, wm.ResizableLandscapeActivity)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer act.Close()\n\tif err := act.StartWithDefaultOptions(ctx, tconn); err != nil {\n\t\treturn err\n\t}\n\tdefer act.Stop(ctx, tconn)\n\n\tif err := wm.WaitUntilActivityIsReady(ctx, tconn, act, d); err != nil {\n\t\treturn err\n\t}\n\n\t// Snap the activity to the left.\n\tif _, err := ash.SetARCAppWindowState(ctx, tconn, wm.Pkg24, ash.WMEventSnapLeft); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to left snap %s\", wm.Pkg24)\n\t}\n\n\treturn testing.Poll(ctx, func(ctx context.Context) error {\n\t\tdispInfo, err := display.GetPrimaryInfo(ctx, tconn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\twindow, err := ash.GetARCAppWindowInfo(ctx, tconn, wm.Pkg24)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// 1-DP margin error in case of using an odd screen width.\n\t\tconst errorMargin = 1\n\t\tif math.Abs(float64(dispInfo.WorkArea.Width/2-window.BoundsInRoot.Width)) > errorMargin {\n\t\t\treturn errors.Errorf(\"invalid window width: got %d, want Abs(%d - %d) <= 1\", window.BoundsInRoot.Width, window.BoundsInRoot.Width, dispInfo.WorkArea.Width/2)\n\t\t}\n\t\tif window.BoundsInRoot.Left != 0 {\n\t\t\treturn errors.Errorf(\"invalid window origin: got %d, want 0\", window.BoundsInRoot.Left)\n\t\t}\n\t\tif window.State != ash.WindowStateLeftSnapped {\n\t\t\treturn errors.Errorf(\"invalid window state: got %s, want WindowStateLeftSnapped\", window.State)\n\t\t}\n\t\treturn nil\n\t}, &testing.PollOptions{Timeout: 10 * time.Second})\n}", "func doShowMeshWindow(compMesh *component.Mesh) {\n\tmeshWindow := uiman.GetWindow(fmt.Sprintf(\"%s%s\", compMeshWindowID, compMesh.Name))\n\tif meshWindow == nil {\n\t\tcreateMeshWindow(compMesh, meshWndX, meshWndY)\n\t}\n}", "func (n *mockAgent) winsizeProcess(c *Container, processID string, height, width uint32) error {\n\treturn nil\n}", "func pollSpotifyWindow(handle syscall.Handle, sleepDurationSec int, npPath string) error {\n\tvar prevTitle string\n\tvar b = make([]uint16, 200) // Holds window title byte array (or w/e it's called in Go)\n\n\tfor true {\n\t\twindowTitle, err := windowTextToString(handle, &b[0], int32(len(b)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Only write artist & song to file if new window title is different\n\t\tif len(prevTitle) == 0 || prevTitle != windowTitle {\n\t\t\tlogSpotifyWindow(windowTitle, npPath)\n\t\t\tprevTitle = windowTitle\n\t\t}\n\t\ttime.Sleep(time.Duration(sleepDurationSec) * time.Second)\n\t}\n\treturn nil\n}", "func (p *ControlPanel) RunWindow(opts *widget.RunWindowOptions) error {\n\tvar (\n\t\tnwo *screen.NewWindowOptions\n\t\tt *theme.Theme\n\t)\n\tif opts != nil {\n\t\tnwo = &opts.NewWindowOptions\n\t\tt = &opts.Theme\n\t}\n\tvar err error\n\tp.w, err = p.s.NewWindow(nwo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer p.w.Release()\n\n\tpaintPending := false\n\n\tgef := gesture.EventFilter{EventDeque: p.w}\n\tfor {\n\t\te := p.w.NextEvent()\n\n\t\tif e = gef.Filter(e); e == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch e := e.(type) {\n\t\tcase lifecycle.Event:\n\t\t\tp.root.OnLifecycleEvent(e)\n\t\t\tif e.To == lifecycle.StageDead {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\tcase gesture.Event, mouse.Event:\n\t\t\tp.root.OnInputEvent(e, image.Point{})\n\n\t\tcase paint.Event:\n\t\t\tctx := &node.PaintContext{\n\t\t\t\tTheme: t,\n\t\t\t\tScreen: p.s,\n\t\t\t\tDrawer: p.w,\n\t\t\t\tSrc2Dst: f64.Aff3{\n\t\t\t\t\t1, 0, 0,\n\t\t\t\t\t0, 1, 0,\n\t\t\t\t},\n\t\t\t}\n\t\t\tif err := p.root.Paint(ctx, image.Point{}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tp.w.Publish()\n\t\t\tpaintPending = false\n\n\t\tcase size.Event:\n\t\t\tif dpi := float64(e.PixelsPerPt) * unit.PointsPerInch; dpi != t.GetDPI() {\n\t\t\t\tnewT := new(theme.Theme)\n\t\t\t\tif t != nil {\n\t\t\t\t\t*newT = *t\n\t\t\t\t}\n\t\t\t\tnewT.DPI = dpi\n\t\t\t\tt = newT\n\t\t\t}\n\n\t\t\twindowSize := e.Size()\n\t\t\tp.root.Measure(t, windowSize.X, windowSize.Y)\n\t\t\tp.root.Wrappee().Rect = e.Bounds()\n\t\t\tp.root.Layout(t)\n\t\t\t// TODO: call Mark(node.MarkNeedsPaint)?\n\n\t\tcase panelUpdate:\n\n\t\tcase error:\n\t\t\treturn e\n\t\t}\n\n\t\tif !paintPending && p.root.Wrappee().Marks.NeedsPaint() {\n\t\t\tpaintPending = true\n\t\t\tp.w.Send(paint.Event{})\n\t\t}\n\t}\n}", "func (win *Window) Display() {\n\tC.sfRenderWindow_display(win.win)\n}", "func (*WindowInfo) Descriptor() ([]byte, []int) {\n\treturn file_window_proto_rawDescGZIP(), []int{0}\n}", "func (w *Window) Expose(x, y, width, height float32) {\n\tC.winl_expose(w.native, C.float(x), C.float(y), C.float(width), C.float(height))\n}", "func (v *WindowGroup) ListWindows() *glib.List {\n\tclist := C.gtk_window_group_list_windows(v.native())\n\tif clist == nil {\n\t\treturn nil\n\t}\n\tglist := glib.WrapList(uintptr(unsafe.Pointer(clist)))\n\tglist.DataWrapper(func(ptr unsafe.Pointer) interface{} {\n\t\treturn wrapWindow(glib.Take(ptr))\n\t})\n\truntime.SetFinalizer(glist, func(l *glib.List) { glib.FinalizerStrategy(l.Free) })\n\treturn glist\n}", "func (w *Window) Present() {\n\tC.winl_swap_buffers(w.native)\n}", "func WindowList(URL *url.URL) ([]Window, error) {\n\tvar list []Window\n\tif err := request(URL, http.MethodGet, nil, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn list, nil\n}", "func newWindow(width, height int) (wdeWindow wde.Window, err error) {\n\tw := &sdlWindow{}\n\twdeWindow = w\n\tsdlWrap.Size <- &geom.Coord{float64(width), float64(height)}\n\tw.Surface = <-sdlWrap.Surface\n\tw.events = make(chan interface{}, 16)\n\tgo w.poolSdl()\n\n\tif w.Surface == nil {\n\t\terr = sdlError(sdl.GetError())\n\t\treturn\n\t}\n\n\treturn\n}", "func (w *windowImpl) RunOnWin(f func()) {\n\tif w.IsClosed() {\n\t\treturn\n\t}\n\tdone := make(chan bool)\n\tw.runQueue <- funcRun{f: f, done: done}\n\t<-done\n}", "func (w *windowImpl) RunOnWin(f func()) {\n\tif w.IsClosed() {\n\t\treturn\n\t}\n\tdone := make(chan bool)\n\tw.runQueue <- funcRun{f: f, done: done}\n\t<-done\n}", "func (s *BaseTdatListener) ExitWindowsWithLowAndHighIndex(ctx *WindowsWithLowAndHighIndexContext) {}", "func newListWin(filters []string) *listWin {\n\tsort.Strings(filters)\n\n\ttitle := fmt.Sprintf(\"%s/%s\", path, strings.Join(filters, \"\"))\n\twin, err := acme.New(title)\n\tif err != nil {\n\t\tdie(1, \"Failed to create a new window %s: %s\", title, err)\n\t}\n\tif err := win.Fprintf(\"tag\", \"Sort \"); err != nil {\n\t\tdie(1, \"Failed to write the tag of %s: %s\", title, err)\n\t}\n\tlw := &listWin{\n\t\tWin: win,\n\t\ttitle: title,\n\t\tfilters: filters,\n\t\tless: lessFuncs[\"prio\"],\n\t}\n\twg.Add(1)\n\tgo lw.events()\n\tlw.refresh()\n\treturn lw\n}", "func (app *appImpl) waitWindowInFocus() oswin.Window {\n\tfor {\n\t\twin := app.WindowInFocus()\n\t\tif win != nil {\n\t\t\treturn win\n\t\t}\n\t}\n}", "func (win *Window) Getch() int {\n\treturn int(C.wgetch((*C.WINDOW)(win)))\n}", "func TestAddSameWindow(t *testing.T) {\n\tp, err := NewProgram()\n\tif err != nil {\n\t\tt.Error(\"Unable to start termbox\")\n\t}\n\n\tdefer p.Close()\n\n\tw := NewWindow()\n\terr2 := p.AddWindow(w)\n\tif err2 != nil {\n\t\tt.Errorf(\"An error occured %s\", fmt.Sprint(err2))\n\t}\n\n\terr3 := p.AddWindow(w)\n\tif err3 == nil {\n\t\tt.Error(\"An error was expected\")\n\t}\n}", "func newGLWindow(opts *oswin.NewWindowOptions, sc *oswin.Screen) (*glfw.Window, error) {\n\t_, _, tool, fullscreen := oswin.WindowFlagsToBool(opts.Flags)\n\tglfw.DefaultWindowHints()\n\tglfw.WindowHint(glfw.Resizable, glfw.True)\n\tglfw.WindowHint(glfw.Visible, glfw.False) // needed to position\n\tglfw.WindowHint(glfw.Focused, glfw.True)\n\t// glfw.WindowHint(glfw.ScaleToMonitor, glfw.True)\n\tglfw.WindowHint(glfw.ContextVersionMajor, glosGlMajor)\n\tglfw.WindowHint(glfw.ContextVersionMinor, glosGlMinor)\n\tglfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)\n\tglfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)\n\tglfw.WindowHint(glfw.Samples, 0) // don't do multisampling for main window -- only in sub-render\n\tif glosDebug {\n\t\tglfw.WindowHint(glfw.OpenGLDebugContext, glfw.True)\n\t}\n\n\t// todo: glfw.Samples -- multisampling\n\tif fullscreen {\n\t\tglfw.WindowHint(glfw.Maximized, glfw.True)\n\t}\n\tif tool {\n\t\tglfw.WindowHint(glfw.Decorated, glfw.False)\n\t} else {\n\t\tglfw.WindowHint(glfw.Decorated, glfw.True)\n\t}\n\t// todo: glfw.Floating for always-on-top -- could set for modal\n\tsz := opts.Size // note: this is already in standard window size units!\n\twin, err := glfw.CreateWindow(sz.X, sz.Y, opts.GetTitle(), nil, theApp.shareWin)\n\tif err != nil {\n\t\treturn win, err\n\t}\n\twin.SetPos(opts.Pos.X, opts.Pos.Y)\n\treturn win, err\n}", "func (winMap tWinMap) createMap (hwnd W.HWND) {\n\t_, ok := winMap[hwnd]\n\tif !ok {\n\t\twinMap[hwnd] = make(map[uint32]TWinProc)\n\t}\n}", "func (o *NewWindowOptions) Fixup() {\n\tsc := TheApp.Screen(0)\n\tscsz := sc.Geometry.Size() // window coords size\n\n\tif o.Size.X <= 0 {\n\t\to.StdPixels = false\n\t\to.Size.X = int(0.8 * float32(scsz.X) * sc.DevicePixelRatio)\n\t}\n\tif o.Size.Y <= 0 {\n\t\to.StdPixels = false\n\t\to.Size.Y = int(0.8 * float32(scsz.Y) * sc.DevicePixelRatio)\n\t}\n\n\to.Size, o.Pos = sc.ConstrainWinGeom(o.Size, o.Pos)\n\tif o.Pos.X == 0 && o.Pos.Y == 0 {\n\t\twsz := sc.WinSizeFmPix(o.Size)\n\t\tdialog, modal, _, _ := WindowFlagsToBool(o.Flags)\n\t\tnw := TheApp.NWindows()\n\t\tif nw > 0 {\n\t\t\tlastw := TheApp.Window(nw - 1)\n\t\t\tlsz := lastw.WinSize()\n\t\t\tlp := lastw.Position()\n\n\t\t\tnwbig := wsz.X > lsz.X || wsz.Y > lsz.Y\n\n\t\t\tif modal || dialog || !nwbig { // place centered on top of current\n\t\t\t\tctrx := lp.X + (lsz.X / 2)\n\t\t\t\tctry := lp.Y + (lsz.Y / 2)\n\t\t\t\to.Pos.X = ctrx - wsz.X/2\n\t\t\t\to.Pos.Y = ctry - wsz.Y/2\n\t\t\t} else { // cascade to right\n\t\t\t\to.Pos.X = lp.X + lsz.X // tile to right -- could depend on orientation\n\t\t\t\to.Pos.Y = lp.Y + 72 // and move down a bit\n\t\t\t}\n\t\t} else { // center in screen\n\t\t\to.Pos.X = scsz.X/2 - wsz.X/2\n\t\t\to.Pos.Y = scsz.Y/2 - wsz.Y/2\n\t\t}\n\t\to.Size, o.Pos = sc.ConstrainWinGeom(o.Size, o.Pos) // make sure ok\n\t}\n}" ]
[ "0.64971346", "0.649706", "0.64064795", "0.63375676", "0.6229853", "0.60432464", "0.5920922", "0.5882753", "0.585449", "0.57806545", "0.5673989", "0.56614226", "0.565672", "0.5639505", "0.563183", "0.56152505", "0.5606165", "0.55970424", "0.5593446", "0.55857486", "0.55596143", "0.55346394", "0.5527282", "0.5514173", "0.5505973", "0.54906225", "0.5479623", "0.5472103", "0.5466744", "0.54117626", "0.54093164", "0.5403094", "0.54002804", "0.5392424", "0.5377937", "0.5376158", "0.5367499", "0.5361059", "0.5358954", "0.53518426", "0.5333624", "0.53178144", "0.5315142", "0.5309604", "0.5309115", "0.52975994", "0.52938306", "0.5289134", "0.5261794", "0.52553236", "0.5251743", "0.5247065", "0.5227457", "0.52245396", "0.5221904", "0.5210348", "0.52102953", "0.5207586", "0.52061725", "0.52055496", "0.5197944", "0.5191272", "0.51865906", "0.51865906", "0.5184084", "0.5178409", "0.5175422", "0.51663375", "0.5146658", "0.5138728", "0.51279294", "0.5123021", "0.51211846", "0.5110313", "0.5110005", "0.5107224", "0.51049346", "0.51045257", "0.5103403", "0.5102914", "0.5101861", "0.5069002", "0.5067499", "0.50659925", "0.50610167", "0.5058063", "0.50561404", "0.5055078", "0.5039451", "0.503825", "0.50378746", "0.5036328", "0.5036328", "0.50350165", "0.5032584", "0.5030028", "0.50179553", "0.50149465", "0.50071484", "0.5004697", "0.5003191" ]
0.0
-1
Plays a waveform sound. uType is the sound to be played. The sounds are set by the user through the Sound control panel application. The following values can be used as a sound: MB_ICONASTERISK (see MB_ICONINFORMATION) MB_ICONEXCLAMATION (see MB_ICONWARNING) MB_ICONERROR (The sound specified as the Windows Critical Stop sound) MB_ICONHAND (See MB_ICONERROR) MB_ICONINFORMATION (The sounds specified as the Windows Asterisk sound) MB_ICONQUESTION (The sound specified as the Windows Question sound) MB_ICONSTOP (See MB_ICONERROR) MB_ICONWARNING (The sounds specified as the Windows Exclamation sound) MB_OK (The sound specified as the Windows Default Beep sound) The function will return true if the function succeeds, false if otherwise.
func MessageBeep(uType uint32) bool { ret, _, _ := syscall.Syscall(messageBeep.Addr(), 2, uintptr(uType), 0, 0) return ret != 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (me TxsdMimeTypeSequenceType) IsAudio() bool { return me.String() == \"audio\" }", "func (c *Sound) Play(times int) {\n\t// if err := c.resource.GetResource().Play(times); err != nil {\n\tif sound, format := c.resource.GetResource(); sound != nil {\n\t\tif format == engosdl.SoundMP3 {\n\t\t\tif err := sound.(*mix.Music).FadeIn(times, 2500); err != nil {\n\t\t\t\tengosdl.Logger.Error().Err(err).Msg(\"play mix MP3 resource error\")\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t} else if format == engosdl.SoundWAV {\n\t\t\tif _, err := sound.(*mix.Chunk).Play(1, 1); err != nil {\n\t\t\t\tengosdl.Logger.Error().Err(err).Msg(\"play mix WAV resource error\")\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func StartSound() error {\n\treturn globalSoundBuffer.Play(0, ds.BPLAY_LOOPING)\n}", "func RunSound(path string) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\t// Create a new beep.Decoder\n\tstreamer, format, err := mp3.Decode(f)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer streamer.Close()\n\t// Create a new beep.Player\n\tspeaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))\n\n\tdone := make(chan bool)\n\t// Play the stream\n\tspeaker.Play(beep.Seq(streamer, beep.Callback(func() {\n\t\tdone <- true\n\t})))\n\n\t<-done\n}", "func (b *Beeper) PlaySound(ctx context.Context, e pipanel.SoundEvent) error {\n\tif err := validateAudioFilename(e.Sound); err != nil {\n\t\treturn errors.Wrap(err, \"bad filename\")\n\t}\n\n\tpathToFile := b.cfg.LibraryPath + e.Sound + \".wav\"\n\n\tf, err := os.Open(pathToFile)\n\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"file not found: %s\", pathToFile)\n\t}\n\n\tstreamer, format, err := wav.Decode(f)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not decode WAV audio\")\n\t}\n\n\tvar streamToPlay beep.Streamer = streamer\n\n\tif format.SampleRate != SampleRate {\n\t\tstreamToPlay = beep.Resample(4, format.SampleRate, SampleRate, streamer)\n\t}\n\n\tspeaker.Play(streamToPlay)\n\tb.log.WithContext(ctx).Printf(\"Playing sound: %s\", pathToFile)\n\n\treturn nil\n}", "func (tr *trooper) play(sound uint32) { tr.part.PlaySound(sound) }", "func (t *AudioPlayer) Start(a *app.App) {\n\n\tvar err error\n\tt.pc1, err = NewPlayerControl(a, \"bomb1.wav\")\n\tt.pc1.player.SetLooping(false)\n\tif err != nil {\n\t\ta.Log().Fatal(\"%s\", err)\n\t}\n\tt.pc1.SetPosition(40, 10)\n\ta.DemoPanel().Add(t.pc1)\n\n\tt.pc2, err = NewPlayerControl(a, \"Vivaldi1.wav\")\n\tif err != nil {\n\t\ta.Log().Fatal(\"%s\", err)\n\t}\n\tt.pc2.SetPosition(40, t.pc1.Position().Y+t.pc1.Height()+20)\n\ta.DemoPanel().Add(t.pc2)\n\n\tt.pc3, err = NewPlayerControl(a, \"bomb2.ogg\")\n\tt.pc3.player.SetLooping(false)\n\tif err != nil {\n\t\ta.Log().Fatal(\"%s\", err)\n\t}\n\tt.pc3.SetPosition(40, t.pc2.Position().Y+t.pc2.Height()+40)\n\ta.DemoPanel().Add(t.pc3)\n\n\tt.pc4, err = NewPlayerControl(a, \"Bach1.ogg\")\n\tif err != nil {\n\t\ta.Log().Fatal(\"%s\", err)\n\t}\n\tt.pc4.SetPosition(40, t.pc3.Position().Y+t.pc3.Height()+20)\n\ta.DemoPanel().Add(t.pc4)\n}", "func (cow Cow) Speak() {\n\tfmt.Println(cow.sound)\n}", "func (e *Engine) PlayWAV(chunk *mix.Chunk) {\n\tchunk.Play(-1, 0)\n}", "func (c *Client) PlaySound(path string) error {\n\tfh, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fh.Close()\n\n\tbytes, err := ioutil.ReadAll(fh)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo c.playRaw(bytes)\n\treturn nil\n}", "func playSound(s *discordgo.Session, guildID, channelID string) (err error) {\n\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sleep for a specified amount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking.\n\tvc.Speaking(true)\n\t\n\t// Send the buffer data.\n\tfor _, buff := range buffer {\n\t\tvc.OpusSend <- buff\n\t}\n\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specificed amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided voice channel.\n\tvc.Disconnect()\n\n\treturn nil\n}", "func (a *AudioLog) PlaySound(e pipanel.SoundEvent) error {\n\ta.log.Printf(\n\t\t\"## SOUND EVENT ##\\n\"+\n\t\t\t\"Sound: %s\\n\",\n\t\te.Sound)\n\n\treturn nil\n}", "func PlayFoodSound() {\n\tplay(freqA, 250*time.Millisecond)\n}", "func (self Sound) Play() { \n C.sfSound_play(self.Cref);\n}", "func (s *SoundGroup) Sound(index int) (*Sound, error) {\n\tvar sound Sound\n\tres := C.FMOD_SoundGroup_GetSound(s.cptr, C.int(index), &sound.cptr)\n\treturn &sound, errs[res]\n}", "func playSound(s *discordgo.Session, guildID, channelID string) (err error) {\n\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sleep for a specified amount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking.\n\tvc.Speaking(true)\n\tkey := guildID + \":\" + channelID\n\tstopCh := make(chan int)\n\tstopMutex.Lock()\n\tstop[key] = &stopCh\n\tstopMutex.Unlock()\n\t// Send the buffer data.\n\tfunc() {\n\t\tfor _, buff := range buffer {\n\t\t\tselect {\n\t\t\tcase <-stopCh:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tvc.OpusSend <- buff\n\t\t\t}\n\t\t}\n\t}()\n\tclose(stopCh)\n\tdelete(stop, key)\n\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specificed amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided voice channel.\n\tvc.Disconnect()\n\n\treturn nil\n}", "func TestNewWAV(t *testing.T) {\n\twav := audio.NewWAV()\n\trequire.Equal(t, audio.DefaultNumChannels, wav.NumChannels)\n\trequire.Equal(t, audio.DefaultSampleRate, wav.SampleRate)\n\trequire.Equal(t, audio.DefaultAudioFormat, wav.AudioFormat)\n\trequire.Equal(t, audio.DefaultBitsPerSample, wav.BitsPerSample)\n\n\taudioData := wav.AudioData()\n\trequire.Equal(t, 0, len(audioData))\n}", "func CreateSound(params ...interface{}) engosdl.IComponent {\n\tif len(params) == 3 {\n\t\treturn NewSound(params[0].(string), params[1].(string), params[2].(int))\n\t}\n\treturn NewSound(\"\", \"\", engosdl.SoundMP3)\n}", "func (bird Bird) Speak() {\n\tfmt.Println(bird.sound)\n}", "func (self *GameObjectCreator) Audio3O(key string, volume int, loop bool, connect bool) *Sound{\n return &Sound{self.Object.Call(\"audio\", key, volume, loop, connect)}\n}", "func (*InputInlineQueryResultAudio) TypeName() string {\n\treturn \"inputInlineQueryResultAudio\"\n}", "func GenSound(note util.KeyNote) []byte {\n\thz := math.Pow(FrequencyConstant, float64(note)-49.0) * 440.0\n\tL := int(SampleRate * SampleDuration)\n\tf := (2.0 * math.Pi * hz) / SampleRate\n\tdata := make([]byte, L, L)\n\tfor sample := 0; sample < L; sample++ {\n\t\tdata[sample] = byte(128.0 * (math.Sin(f*float64(sample)) + 1.0))\n\t}\n\treturn data\n}", "func TestInstructionSetSoundTimer(t *testing.T) {\n\tchipCfg := GetDefaultConfig()\n\tchip, _, _ := NewCHIP8(chipCfg)\n\n\tchip.Reg[0x1] = 0xba\n\n\tchip.WriteShort(0x200, 0xf118)\n\n\tchip.StepEmulation()\n\n\tif chip.RegSound != 0xba {\n\t\tt.Errorf(\"chip.RegSound = 0x%x; want 0xba\", chip.RegSound)\n\t}\n}", "func ripSound(ripCmd ripCommand) error {\n\tvideoBuf, err := fetchVideoData(ripCmd.url)\n\tif err != nil {\n\t\treturn err\n\t}\n\topusFrames, err := convertToOpusFrames(videoBuf, ripCmd.start, ripCmd.duration)\n\tif err != nil {\n\t\treturn err\n\t}\n\tencodedFrames, err := gobEncodeOpusFrames(opusFrames)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif s3Persistence == \"true\" {\n\t\terr = putSoundS3(encodedFrames, ripCmd.name)\n\t} else {\n\t\terr = putSoundLocal(encodedFrames, ripCmd.name)\n\t}\n\treturn err\n}", "func (self *GameObjectCreator) Sound3O(key string, volume int, loop bool, connect bool) *Sound{\n return &Sound{self.Object.Call(\"sound\", key, volume, loop, connect)}\n}", "func (self *GameObjectCreator) Audio1O(key string, volume int) *Sound{\n return &Sound{self.Object.Call(\"audio\", key, volume)}\n}", "func (t *Track) IsAudio() bool {\n\treturn t.isAudio\n}", "func (self *GameObjectCreator) Sound1O(key string, volume int) *Sound{\n return &Sound{self.Object.Call(\"sound\", key, volume)}\n}", "func TestNewWAVFromData(t *testing.T) {\n\temptyWAVFile := testutils.CreateEmptyWAVFile()\n\n\twav, err := audio.NewWAVFromData(emptyWAVFile)\n\trequire.Nil(t, err)\n\trequire.Equal(t, uint16(1), wav.NumChannels)\n\trequire.Equal(t, uint32(44100), wav.SampleRate)\n\trequire.Equal(t, uint16(16), wav.BitsPerSample)\n\trequire.Equal(t, 0, len(wav.AudioData()))\n}", "func (snake Snake) Speak() {\n\tfmt.Println(snake.sound)\n}", "func isAudio(n *html.Node) bool {\n\treturn n.Type == html.ElementNode && n.Data == \"audio\"\n}", "func (self *GameObjectCreator) AudioI(args ...interface{}) *Sound{\n return &Sound{self.Object.Call(\"audio\", args)}\n}", "func TestNewWAVFromParamsCustom(t *testing.T) {\n\temptyAudio := make([]byte, 0)\n\twav := audio.NewWAVFromParams(&audio.WAVParams{1, 10000, 8, emptyAudio})\n\trequire.Equal(t, uint16(1), wav.NumChannels)\n\trequire.Equal(t, uint32(10000), wav.SampleRate)\n\trequire.Equal(t, uint16(8), wav.BitsPerSample)\n\trequire.Equal(t, 0, len(wav.AudioData()))\n}", "func StopSound() error {\n\treturn globalSoundBuffer.Stop()\n}", "func playSound(s *discordgo.Session, guildID, channelID string) (err_r error) {\n\n\tif playing {\n\t\treturn nil\n\t}\n\n\trand_num := rand.Int()%len(sliceData)\n\tmsg_string := sliceData[rand_num]\n\tfile_name := strconv.Itoa(rand_num)+\".mp3\"\n\tvar err error\n\tos.Setenv(\"GOOGLE_APPLICATION_CREDENTIALS\",\"INSERT YOUR GOOGLE CLOUD CREDENTIALS HERE\")\n\tif Exists(file_name) {\n\t\tlog.Println(\"file found: \", file_name)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error opening mp3 file :\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Println(\"file not found: \", file_name)\n\t\tctx := context.Background()\n\n\t\tclient, err := texttospeech.NewClient(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer client.Close()\n\n\t\t// Perform the text-to-speech request on the text input with the selected\n\t\t// voice parameters and audio file type.\n\t\treq := texttospeechpb.SynthesizeSpeechRequest{\n\t\t\t// Set the text input to be synthesized.\n\t\t\tInput: &texttospeechpb.SynthesisInput{\n\t\t\t\tInputSource: &texttospeechpb.SynthesisInput_Text{Text: msg_string},\n\t\t\t},\n\t\t\t// Build the voice request, select the language code and the SSML\n\t\t\t// voice gender.\n\t\t\tVoice: &texttospeechpb.VoiceSelectionParams{\n\t\t\t\tLanguageCode: \"ru-RU\",\n\t\t\t\tSsmlGender: texttospeechpb.SsmlVoiceGender_MALE,\n\t\t\t\tName: \"ru-RU-Wavenet-D\",\n\t\t\t},\n\t\t\t// Select the type of audio file you want returned.\n\t\t\tAudioConfig: &texttospeechpb.AudioConfig{\n\t\t\t\tAudioEncoding: texttospeechpb.AudioEncoding_MP3,\n\t\t\t},\n\t\t}\n\n\t\tresp, err := client.SynthesizeSpeech(ctx, &req)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// The resp's AudioContent is binary.\n\t\tfile_name = strconv.Itoa(rand_num) + \".mp3\"\n\t\terr = ioutil.WriteFile(file_name, resp.AudioContent, 0644)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Printf(\"Audio content written to file: %v\\n\", file_name)\n\n\t\tlog.Println(file_name)\n\n\t}\n\n\t//encode mp3 to dca\n\toptions := dca.StdEncodeOptions\n\toptions.RawOutput = true\n\toptions.Bitrate = 128\n\toptions.Application = \"lowdelay\"\n\n\tencodeSession, err := dca.EncodeFile(file_name, options)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer encodeSession.Cleanup()\n\n\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tplaying = true\n\n\t// Sleep for a specified amount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking.\n\tvc.Speaking(true)\n\n\tdone := make(chan error)\n\tdca.NewStream(encodeSession, vc, done)\n\terr = <-done\n\tif err != nil && err != io.EOF {\n\t\treturn\n\t}\n\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specified amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided voice channel.\n\tvc.Disconnect()\n\n\tplaying = false\n\n\treturn nil\n\n}", "func (self *GameObjectCreator) Audio(key string) *Sound{\n return &Sound{self.Object.Call(\"audio\", key)}\n}", "func (n *Notifier) Play(ctx context.Context, url string) error {\n\tmedia, err := n.client.Media(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem := controllers.MediaItem{\n\t\tContentId: url,\n\t\tStreamType: \"BUFFERED\",\n\t\tContentType: \"audio/mpeg\",\n\t}\n\t_, err = media.LoadMedia(ctx, item, 0, true, map[string]interface{}{})\n\treturn err\n}", "func (f *FilePlayer) Play(fileName string, fileType string, device string) (err error) {\n\toptions, err := producePlayOptions(fileName, fileType, device)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo playAudio(options, f.doneCh)\n\treturn\n}", "func TestNewWAVFromDataWithNoise(t *testing.T) {\n\tbuff := []byte{0x12, 0x34, 0x56, 0x78}\n\temptyWAVFile := testutils.CreateEmptyWAVFile()\n\n\twav, err := audio.NewWAVFromData(append(buff, emptyWAVFile...))\n\trequire.Nil(t, err)\n\trequire.Equal(t, uint16(1), wav.NumChannels)\n\trequire.Equal(t, uint32(44100), wav.SampleRate)\n\trequire.Equal(t, uint16(16), wav.BitsPerSample)\n\trequire.Equal(t, 0, len(wav.AudioData()))\n}", "func (b *Bot) SendAudio(request axon.O) (result axon.O, err error) {\n\tvar response interface{}\n\tif response, err = b.doPostMultipart(\"sendAudio\", request); err == nil {\n\t\tresult = response.(map[string]interface{})\n\t}\n\treturn\n}", "func TestAddAudioData(t *testing.T) {\n\temptyWAVFile := testutils.CreateEmptyWAVFile()\n\n\taudioData := []byte{0xff, 0xfd, 0x00, 0x00}\n\n\twav, err := audio.NewWAVFromData(emptyWAVFile)\n\twav.AddAudioData(audioData)\n\n\trequire.Nil(t, err)\n\trequire.Equal(t, 4, len(wav.AudioData()))\n}", "func Mono(in Sound) Sound { return newmono(in) }", "func (c *Client) Play(url string) (e error) {\n\tclient := cast.NewClient(c.ip, c.port)\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\te = fmt.Errorf(\"Panic occurs on Play [%w]\", err)\n\t\t}\n\t}()\n\n\terr := client.Connect(c.ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer client.Close()\n\tclient.Receiver().QuitApp(c.ctx)\n\n\tmedia, err := client.Media(c.ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem := controllers.MediaItem{\n\t\tContentId: url,\n\t\tStreamType: \"BUFFERED\",\n\t\tContentType: \"audio/mpeg\",\n\t}\n\t_, err = media.LoadMedia(c.ctx, item, 0, true, map[string]interface{}{})\n\treturn err\n}", "func (*InputInlineQueryResultAudio) TypeID() uint32 {\n\treturn InputInlineQueryResultAudioTypeID\n}", "func (b *Bot) SendAudio() (*Message, error) {\n\treturn nil, nil\n}", "func (self *GameObjectCreator) Audio2O(key string, volume int, loop bool) *Sound{\n return &Sound{self.Object.Call(\"audio\", key, volume, loop)}\n}", "func (s *Sound) Pause() {\n\ts.snd.Call(\"pause\")\n}", "func NewAudio() *Audio {\n\ta := new(Audio)\n\n\t// Helper function to create player and handle errors\n\tcreatePlayer := func(fileName string) *audio.Player {\n\t\tlog.Debug(\"Creating sound player for: \" + fileName)\n\t\tp, err := audio.NewPlayer(fileName)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Failed to create sound player: %v\", err)\n\t\t}\n\t\treturn p\n\t}\n\n\t// Music\n\ta.musicGame = createPlayer(\"./audio/music/Lost-Jungle_Looping.ogg\")\n\ta.musicGame.SetLooping(true)\n\ta.musicMenu = createPlayer(\"./audio/music/Spooky-Island.ogg\")\n\ta.musicMenu.SetLooping(true)\n\n\t// Gameplay sound effects\n\ta.levelDone = createPlayer(\"./audio/sfx/level_done.ogg\")\n\ta.levelDone.SetRolloffFactor(0)\n\ta.levelRestart = createPlayer(\"./audio/sfx/level_restart.ogg\")\n\ta.levelRestart.SetRolloffFactor(0)\n\ta.levelFail = createPlayer(\"./audio/sfx/level_fail.ogg\")\n\ta.levelFail.SetRolloffFactor(0)\n\ta.gameComplete = createPlayer(\"./audio/sfx/game_complete.ogg\")\n\ta.gameComplete.SetRolloffFactor(0)\n\n\t// User interface sound effects\n\ta.click = createPlayer(\"./audio/sfx/button_click.ogg\")\n\ta.click.SetRolloffFactor(0)\n\ta.hover = createPlayer(\"./audio/sfx/button_hover.ogg\")\n\ta.hover.SetRolloffFactor(0)\n\n\t// Gopher sound effects\n\ta.gopherWalk = createPlayer(\"./audio/sfx/gopher_walk.ogg\")\n\ta.gopherWalk.SetRolloffFactor(0)\n\ta.gopherBump = createPlayer(\"./audio/sfx/gopher_bump.ogg\")\n\ta.gopherBump.SetRolloffFactor(0)\n\ta.gopherHurt = createPlayer(\"./audio/sfx/gopher_hurt.ogg\")\n\ta.gopherHurt.SetRolloffFactor(0)\n\ta.gopherFallStart = createPlayer(\"./audio/sfx/gopher_fall_start.ogg\")\n\ta.gopherFallStart.SetRolloffFactor(0)\n\ta.gopherFallEnd = createPlayer(\"./audio/sfx/gopher_fall_end.ogg\")\n\ta.gopherFallEnd.SetRolloffFactor(0)\n\n\t// Box sound effects\n\ta.boxPush = createPlayer(\"./audio/sfx/box_push.ogg\")\n\ta.boxPush.SetRolloffFactor(0)\n\ta.boxOnPad = createPlayer(\"./audio/sfx/box_on.ogg\")\n\ta.boxOnPad.SetRolloffFactor(0)\n\ta.boxOffPad = createPlayer(\"./audio/sfx/box_off.ogg\")\n\ta.boxOffPad.SetRolloffFactor(0)\n\ta.boxFallStart = createPlayer(\"./audio/sfx/box_fall_start.ogg\")\n\ta.boxFallStart.SetRolloffFactor(0)\n\ta.boxFallEnd = createPlayer(\"./audio/sfx/box_fall_end.ogg\")\n\ta.boxFallEnd.SetRolloffFactor(0)\n\n\t// Elevator sound effects\n\ta.elevatorUp = createPlayer(\"./audio/sfx/elevator_up.ogg\")\n\ta.elevatorUp.SetLooping(true)\n\ta.elevatorUp.SetRolloffFactor(0)\n\ta.elevatorDown = createPlayer(\"./audio/sfx/elevator_down.ogg\")\n\ta.elevatorDown.SetLooping(true)\n\ta.elevatorDown.SetRolloffFactor(0)\n\n\treturn a\n}", "func (self Sound) Pause() {\n\tC.sfSound_pause(self.Cref)\n}", "func (phone *Ph0n3) play(freq float64, duration time.Duration, wg *sync.WaitGroup) {\n\tdefer func() {\n\t\tif wg != nil {\n\t\t\twg.Done()\n\t\t}\n\t}()\n\tp := phone.ctx.NewPlayer()\n\ts := newSineWave(freq, duration, phone.opt.Channel)\n\tif _, err := io.Copy(p, s); err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn\n\t}\n\tif err := p.Close(); err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (s *AllowedInputTypes) SetAllowAudioInput(v bool) *AllowedInputTypes {\n\ts.AllowAudioInput = &v\n\treturn s\n}", "func (s *Sound) Loop() bool {\n\treturn s.snd.Get(\"loop\").Bool()\n}", "func (self *GameObjectCreator) SoundI(args ...interface{}) *Sound{\n return &Sound{self.Object.Call(\"sound\", args)}\n}", "func InitSound() {\n\t// Init sounds\n\tc, ready, err := oto.NewContext(*sampleRate, *channelNum, *bitDepthInBytes)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t<-ready\n\tcontext = c\n}", "func Cat_sound_Factory(o map[string]interface{}) (interface{}, error) {\n\tfm := map[string]func() interface{}{\n\t\t\"PURR\": NewPurr,\n\t\t\"LOUD\": NewMeow,\n\t\t\"WARN\": NewGrowl,\n\t}\n\treturn factory(fm, \"Cat.sound\", \"type\", o)\n}", "func playSound(s *discord.Session, guildID, channelID, videoURL string) (err error) {\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twithSpeaking := func() error { return stream(vc, videoURL) }\n\twithSleepFn := func() error { return wrapWithSpeaking(withSpeaking, vc) }\n\tf := func() error { return wrapWithSleep(withSleepFn, 250*time.Millisecond, 250*time.Millisecond, false) }\n\n\t// Call the payload.\n\terr1 := f()\n\n\t// Disconnect from the provided voice channel.\n\tif err := vc.Disconnect(); err != nil && err1 == nil {\n\t\treturn err\n\t}\n\treturn err1\n}", "func (a *AudioData) SampleType() SampleType {\n\treturn a.format.SampleType\n}", "func (m *Manager) GetSound(name string) (s *Sound, err error) {\n\ts, ok := m.sounds[name]\n\tif !ok {\n\t\ts, err = newSound(name + \".wav\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm.sounds[name] = s\n\t}\n\treturn s, nil\n}", "func (sfs *SoundFileInfoService) IsValidSoundFileFormat(fileName string) bool {\n\tisValidFileFormat := false\n\tfname := strings.ToLower(fileName)\n\n\tif strings.HasSuffix(fname, \".mp3\") || strings.HasSuffix(fname, \".wav\") {\n\t\tisValidFileFormat = true\n\t}\n\n\treturn isValidFileFormat\n}", "func PlayMusic(input chan []byte, guildID string, vc Channel, main bool) {\n\tgo DefaultMusicPlayer.PlayMusic(input, guildID, vc, main)\n}", "func TestNewWAVFromParamsWithZero(t *testing.T) {\n\temptyAudio := make([]byte, 0)\n\twav := audio.NewWAVFromParams(&audio.WAVParams{0, 0, 0, emptyAudio})\n\trequire.Equal(t, audio.DefaultNumChannels, wav.NumChannels)\n\trequire.Equal(t, audio.DefaultSampleRate, wav.SampleRate)\n\trequire.Equal(t, audio.DefaultBitsPerSample, wav.BitsPerSample)\n\trequire.Equal(t, 0, len(wav.AudioData()))\n}", "func (a *Animal) Speak() string {\n\treturn \"Sound: \" + a.noise\n}", "func AudioCheck(src string) (string, error) {\n\n\tfile, err := os.Open(src)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdefer file.Close()\n\n\theader := make([]byte, 261)\n\tif _, err := file.Read(header); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcheck := make([]byte, 261)\n\tcopy(check, header)\n\n\tif !filetype.IsAudio(header) {\n\t\treturn \"\", errors.New(\"not a audio file\")\n\t}\n\n\tkind, err := filetype.Match(check)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmime := kind.MIME.Value\n\n\tif mime == \"audio/midi\" || mime == \"audio/m4a\" || mime == \"audio/amr\" {\n\t\treturn \"\", errors.New(\"unplayable audio file\")\n\t}\n\n\treturn mime, nil\n\n}", "func QueueWAV(filepath string) (*mix.Chunk, error) {\n\t// Load in BG wav\n\tdata, err := ioutil.ReadFile(\"sfx/streets.wav\")\n\tif err != nil {\n\t\treturn &mix.Chunk{}, err\n\t}\n\n\tchunk, err := mix.QuickLoadWAV(data)\n\tif err != nil {\n\t\treturn &mix.Chunk{}, err\n\t}\n\t// defer chunk.Free()\n\treturn chunk, nil\n}", "func (c *Chrome) AudioStream(a int) error {\n\tmsg := wsMessage{\n\t\tComponent: \"player\",\n\t\tMethod: \"audioStream\",\n\t\tArguments: map[string]string{\n\t\t\t\"rate\": strconv.Itoa(a),\n\t\t},\n\t}\n\n\tsend := c.ConnViewer.getChanSend()\n\tsend <- msg\n\tres := <-c.ConnViewer.getChanReceive()\n\treturn handleRes(res)\n}", "func Encode(w io.Writer, audio *WaveAudio) error {\n\t// Write RIFF header\n\t_, err := w.Write(RiffHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\triffSize := 4 + 8 + 16 + 8 + audio.DataSize()\n\terr = binary.Write(w, binary.LittleEndian, uint32(riffSize))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write file type\n\t_, err = w.Write(WaveHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write format\n\t_, err = w.Write(FmtHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Write format length\n\terr = binary.Write(w, binary.LittleEndian, uint32(16))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(w, binary.LittleEndian, audio.Format)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(w, binary.LittleEndian, audio.Channels)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(w, binary.LittleEndian, audio.SampleRate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(w, binary.LittleEndian, audio.SampleFreq())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(w, binary.LittleEndian, audio.Sound())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(w, binary.LittleEndian, audio.BitsPerSample)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write data\n\t_, err = w.Write(DataHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(w, binary.LittleEndian, audio.DataSize())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write raw data directly\n\t_, err = w.Write(audio.RawData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (self *GameObjectCreator) Sound(key string) *Sound{\n return &Sound{self.Object.Call(\"sound\", key)}\n}", "func NewUSAudio(word string) Audio {\n\treturn &USAudio{\n\t\tword: word,\n\t\tdone: make(chan struct{}),\n\t}\n}", "func NewSound(name string, filename string, format int) *Sound {\n\tengosdl.Logger.Trace().Str(\"component\", \"sound\").Str(\"sound\", name).Msg(\"new sound\")\n\treturn &Sound{\n\t\tComponent: engosdl.NewComponent(name),\n\t\tFilename: filename,\n\t\tFormat: format,\n\t\tresource: nil,\n\t}\n}", "func (o *OscSync) Start(sampleRate int, connectedMask int) {\n\tif sampleRate > maxSamples {\n\t\tpanic(\"sample rate is out of range\")\n\t}\n\n\to.sampleRate = float32(sampleRate)\n\n\tfor i := 0; i < sampleRate; i++ {\n\t\to.waveTable[Sin][i] = float32(math.Sin(float64(2*math.Pi*float64(i)) / float64(sampleRate)))\n\t\to.waveTable[Saw][i] = (float32(i) / (float32(sampleRate) / 2)) - 1\n\t\to.waveTable[Square][i] = -1\n\t\tif i < sampleRate/2 {\n\t\t\to.waveTable[Square][i] = 1\n\t\t}\n\n\t\tif i < sampleRate/2 {\n\t\t\to.waveTable[Triangle][i] = (float32(i) / (float32(sampleRate) / 4)) - 1\n\t\t}\n\t}\n}", "func (p *Pump) WavAudioFormat() int {\n\treturn p.wavAudioFormat\n}", "func (self Sound) Stop() {\n\tC.sfSound_stop(self.Cref)\n}", "func (self *GameObjectCreator) Sound2O(key string, volume int, loop bool) *Sound{\n return &Sound{self.Object.Call(\"sound\", key, volume, loop)}\n}", "func (u *LDSUnit) CanAcceptWave() bool {\n\treturn u.toRead == nil\n}", "func (n *Name) Polish () {\n\tnewSound := []Sound {}\n\tascendSound := n.name [0]\n\tlastAscendType := byte (0) // default value\n\n\tfor x := 2; x <= len (n.name); x ++ {\n\t\tif len (newSound) > 0 && lastAscendType == ascendSound.Type () &&\n\t\t\tascendSound.Type () == n.name [x - 1].Type () {\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif (ascendSound.Type () == Sound_TypeCons &&\n\t\t\tn.name [x - 1].Type () == Sound_TypeCons) ||\n\t\t\t(ascendSound.Type () == Sound_TypeVowl &&\n\t\t\tn.name [x - 1].Type () == Sound_TypeVowl) {\n\n\t\t\tif ! strings.Contains (name_polish_goodCombo, ascendSound.String () +\n\t\t\t\tn.name [x - 1].String ()) {\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tnewSound = append (newSound, ascendSound)\n\t\tlastAscendType = ascendSound.Type ()\n\t\tascendSound = n.name [x - 1]\n\t}\n\tnewSound = append (newSound, ascendSound)\n\n\tn.name = newSound\n\n\treturn\n}", "func (vr *VoiceRecorder) RecordAudioFor(cr *chrome.Chrome, fileDuration time.Duration) uiauto.Action {\n\treturn func(ctx context.Context) error {\n\t\t// Button for starting recording and button for stoping recording are identical object.\n\t\t// The share the same id. And there is no text or description to identify them.\n\t\tstartOrStopRecordBtn := vr.app.Device.Object(ui.ID(startOrStopRecordBtnID))\n\t\ttesting.ContextLog(ctx, \"Start to record sound\")\n\t\tif err := uiauto.Combine(\"record sound\",\n\t\t\tapputil.FindAndClick(startOrStopRecordBtn, defaultUITimeout), // First click is for starting recording sound.\n\t\t\tuiauto.Sleep(fileDuration), // For recording sound, sleep for some time after clicking recording button.\n\t\t\tapputil.FindAndClick(startOrStopRecordBtn, defaultUITimeout), // Second click is for stopping recording sound.\n\t\t)(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\teditFileNameDialog := vr.app.Device.Object(ui.ID(editFileNameDialogID))\n\t\tif err := editFileNameDialog.WaitForExists(ctx, defaultUITimeout); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to find edit file name\")\n\t\t}\n\t\tname, err := editFileNameDialog.GetText(ctx)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to get the recorded audio file name in app %q\", vr.app.AppName)\n\t\t}\n\t\tname = name + \".mp3\"\n\n\t\ttesting.ContextLogf(ctx, \"Save the file: %s\", name)\n\t\tokBtn := vr.app.Device.Object(ui.Text(\"OK\"))\n\t\tif err := apputil.FindAndClick(okBtn, defaultUITimeout)(ctx); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to save the audio file\")\n\t\t}\n\n\t\ttesting.ContextLog(ctx, \"Check whether recorded file is in file system\")\n\t\tdownloadsPath, err := cryptohome.DownloadsPath(ctx, cr.NormalizedUser())\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to retrieve users Downloads path\")\n\t\t}\n\n\t\tpath := filepath.Join(downloadsPath, \"Recorders\", name)\n\t\tif _, err := os.Stat(path); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn errors.Wrap(err, \"file is not in file system\")\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tvr.latestRecordDuration = fileDuration\n\t\tvr.latestRecordName = name\n\n\t\treturn nil\n\t}\n}", "func playSound(playCmd playCommand) ([][]byte, error) {\n\tval, ok := checkCache(playCmd.name)\n\tif ok {\n\t\treturn val, nil\n\t}\n\n\tvar opusData []byte\n\tif s3Persistence == \"true\" {\n\t\topusData = getSoundS3(playCmd.name)\n\t} else {\n\t\topusData = getSoundLocal(playCmd.name)\n\t}\n\n\tdecodedFrames := gobDecodeOpusFrames(opusData)\n\tputCache(playCmd.name, decodedFrames)\n\treturn decodedFrames, nil\n}", "func (a *AnimatedEmoji) GetSound() (value File) {\n\tif a == nil {\n\t\treturn\n\t}\n\treturn a.Sound\n}", "func (apu *APU) Start() {\n\tspeaker.Play(apu.pulse1)\n}", "func (d *defaultMusicPlayer) PlayMusic(input chan []byte, guildID string, vc Channel, mainPlaylist bool) {\n\tif !vc.ExistsNext() && mainPlaylist {\n\t\tpanic(\"Song does not exist in playlist but PlayMusic was called.\")\n\t} else if !vc.ExistsBackupNext() && !mainPlaylist {\n\t\tpanic(\"Song does not exist in backup playlist but PlayMusic was called.\")\n\t}\n\n\tvar song *playlist.Song\n\tvar aborted bool\n\n\tif mainPlaylist {\n\t\tsong = vc.GetNext()\n\t} else {\n\t\tsong = vc.GetBackupNext()\n\t}\n\n\tdefer func() {\n\t\tif aborted {\n\t\t\treturn\n\t\t}\n\n\t\tvc.RemoveNowPlaying()\n\n\t\tif vc.ExistsNext() {\n\t\t\tgo d.PlayMusic(input, guildID, vc, true)\n\t\t} else if vc.ExistsBackupNext() {\n\t\t\tgo d.PlayMusic(input, guildID, vc, false)\n\t\t}\n\t}()\n\n\tencodeSession, err := dca.EncodeFile(ytmp3.PathToAudio(song.YoutubeID), dca.StdEncodeOptions)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\tdefer encodeSession.Cleanup()\n\n\tdecoder := dca.NewDecoder(encodeSession)\n\tabortChannel := ActiveVoiceChannels[guildID].GetAbortChannel()\n\n\tfor {\n\t\tframe, err := decoder.OpusFrame()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Print(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\t// Do something with the frame, in this example were sending it to discord\n\t\tselect {\n\t\tcase input <- frame:\n\t\tcase <-abortChannel:\n\t\t\taborted = true\n\t\t\treturn\n\t\tcase <-time.After(time.Second):\n\t\t\t// We haven't been able to send a frame in a second, assume the connection is borked\n\t\t\tlog.Println(\"TIMEOUT: Unable to send audio..\")\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (p *Pattern) Play(playingTime time.Duration) error {\n\t// Initialize portaudio\n\tportaudio.Initialize()\n\tdefer portaudio.Terminate()\n\n\tstream, err := portaudio.OpenDefaultStream(0, 1, sampleRate, 0, processAudio)\n\tif err != nil {\n\t\treturn errors.New(\"could not open default stream\")\n\t}\n\tdefer stream.Close()\n\n\t// Create random tone map\n\ttoneMap = make(map[byte]*tone)\n\trand.Seed(time.Now().Unix())\n\tfor i := range p.instruments {\n\t\tvar err error\n\t\ttoneMap[i], err = newTone(rand.Float64()*600+300, sampleRate)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not create tone for instrument %v\", i)\n\t\t}\n\t}\n\n\tstream.Start()\n\tdefer stream.Stop()\n\n\t// Signal for stopping\n\ttimeOut := time.After(playingTime)\n\n\ttimePerStep := time.Duration(60/p.header.BPM*1000) * time.Millisecond\n\tticker := time.NewTicker(timePerStep)\n\tcurrentStep := 0\n\n\t// Play!\n\tfor _ = range ticker.C {\n\t\tfor i, instrument := range p.instruments {\n\t\t\tif instrument.Pattern[currentStep] == 0 {\n\t\t\t\ttoneMap[i].playing = false\n\t\t\t} else {\n\t\t\t\ttoneMap[i].playing = true\n\t\t\t}\n\t\t}\n\n\t\tcurrentStep++\n\t\tif currentStep > 15 {\n\t\t\tcurrentStep = 0\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeOut:\n\t\t\tticker.Stop()\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\t}\n\n\treturn nil\n}", "func TestAlarmSounds(t *testing.T) {\n\tdelta := 10 * time.Millisecond\n\tnow := time.Now()\n\ta := NewAlarm(delta, TimeFromStandardTime(now), TimeFromStandardTime(now.Add(time.Second)))\n\tcount := 0\n\tgo func() {\n\t\tfor _ = range a.C {\n\t\t\tcount++\n\t\t}\n\t}()\n\ttime.Sleep(5 * delta)\n\ta.Stop()\n\tif count == 0 {\n\t\tt.Fatal(\"Alarm did not sound\")\n\t}\n}", "func Input(c *cli.Context) error {\n\tvar file string\n\tfmt.Println(\"Enter the output file name\")\n\tfmt.Scan(&file)\n\tif file == \"\" {\n\t\tfile = inputFileName\n\t}\n\n\tvar str string\n\tfmt.Println(\"Enter the music you want to play\")\n\tfmt.Scan(&str)\n\n\tvar score []uint8\n\tfor _, t := range str {\n\t\tscore = append(score, values.Scale(fmt.Sprintf(\"%c\", t)))\n\t}\n\n\tdivision, err := smf.NewDivision(ticks, smf.NOSMTPE)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmidi, err := smf.NewSMF(smf.Format0, *division)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttrack := &smf.Track{}\n\terr = midi.AddTrack(track)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar list []*smf.MIDIEvent\n\tfor i, t := range score {\n\t\tvar d uint32\n\t\tif i != 0 {\n\t\t\td = onDeltaTime\n\t\t}\n\t\ttoneOn, err := smf.NewMIDIEvent(d, smf.NoteOnStatus, 0x00, t, 0x64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, toneOn)\n\t\ttoneOff, err := smf.NewMIDIEvent(offDeltaTime, smf.NoteOffStatus, 0x00, t, 0x64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, toneOff)\n\t}\n\n\tfor _, l := range list {\n\t\tif err := track.AddEvent(l); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tmetaEvent, err := smf.NewMetaEvent(21, smf.MetaEndOfTrack, []byte{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := track.AddEvent(metaEvent); err != nil {\n\t\treturn err\n\t}\n\n\toutputMidi, err := os.Create(fmt.Sprintf(\"./%s.mid\", file))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer outputMidi.Close()\n\n\twriter := bufio.NewWriter(outputMidi)\n\tsmfio.Write(writer, midi)\n\treturn writer.Flush()\n}", "func (s *UtteranceInputSpecification) SetAudioInput(v *UtteranceAudioInputSpecification) *UtteranceInputSpecification {\n\ts.AudioInput = v\n\treturn s\n}", "func BeatWave(cxn MQTT.Client) {\r\n\tfor i := 0.0; ; i = i + 0.01 {\r\n\t\tcxn.Publish(\"rocket_view/data/beat\", 0, false, fmt.Sprintf(\"%.3f\", math.Sin(i) + math.Sin(5 * i)))\r\n\t\ttime.Sleep(25 * time.Millisecond)\r\n\t}\r\n}", "func click_sound() {\n\tvar errA error\n\tmpv_cmd := fmt.Sprintf(\"mpv --really-quiet audio/click.wav\")\n\tcmd_run, errA = exec.Command(\"bash\", \"-c\", mpv_cmd).Output()\n\tif errA != nil {\n\t\tfmt.Printf(\"Error playing sound\\n\")\n\t}\n}", "func TestNewWAVFromReader(t *testing.T) {\n\temptyWAVFile := testutils.CreateEmptyWAVFile()\n\tr := bytes.NewReader(emptyWAVFile)\n\n\twav, err := audio.NewWAVFromReader(r)\n\trequire.Nil(t, err)\n\trequire.Equal(t, uint16(1), wav.NumChannels)\n\trequire.Equal(t, uint32(44100), wav.SampleRate)\n\trequire.Equal(t, uint16(16), wav.BitsPerSample)\n\trequire.Equal(t, 0, len(wav.AudioData()))\n}", "func (k *Mumble) Command_Audio_List(user string) {\n\tk.Client.Users.Find(user).Send(common.Command_Audio_List(k))\n}", "func TestAddAudioDataEmpty(t *testing.T) {\n\temptyWAVFile := testutils.CreateEmptyWAVFile()\n\n\taudioData := make([]byte, 0)\n\n\twav, err := audio.NewWAVFromData(emptyWAVFile)\n\twav.AddAudioData(audioData)\n\n\trequire.Nil(t, err)\n\trequire.Equal(t, 0, len(wav.AudioData()))\n}", "func Audio(props *AudioProps, children ...Element) *AudioElem {\n\trProps := &_AudioProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &AudioElem{\n\t\tElement: createElement(\"audio\", rProps, children...),\n\t}\n}", "func (s *Sound) PlayFromStart() {\n\ts.snd.Set(\"currentTime\", 0)\n\ts.snd.Call(\"play\")\n}", "func (self Sound) Getstatus() SoundStatus { \n switch C.sfSound_getStatus(self.Cref) {\n\tcase 0: return Stopped\n\tcase 1: return Paused\n\tcase 2: return Playing\n\t}\n\treturn UnknownSoundStatus\n}", "func (a *attachUp) AddAudio(p, n string) AttachmentUploader {\n\ta.a = append(a.a, p)\n\tif n == \"\" {\n\t\tn = filepath.Base(p)\n\t}\n\ta.an = append(a.an, n)\n\treturn a\n}", "func (w *Wav) GetData() (interface{}, error) {\n\tbytePerSample := int(w.BitsPerSample / 8)\n\tsampleParser, err := GetSampleParser(w.BitsPerSample, w.WaveFormat)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif w.NumChannels == 1 {\n\t\tsample := parseMonoSample(w.Data, bytePerSample, sampleParser)\n\t\tbound, err := GetBound(w.BitsPerSample, w.WaveFormat)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsample.Bound = bound\n\t\treturn sample, nil\n\t}\n\n\tif w.NumChannels == 2 {\n\t\tsample := parseStereoSample(w.Data, bytePerSample, sampleParser)\n\t\tbound, err := GetBound(w.BitsPerSample, w.WaveFormat)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsample.Bound = bound\n\t\treturn sample, nil\n\t}\n\n\treturn nil, errors.New(\"failed to sampled data from wav file\")\n}", "func (ap *App) Process(wparams *WinParams, pparams *ProcessParams, gparams *GaborParams) (err error) {\n\tap.LoadSound(wparams)\n\n\tif ap.Sound.Buf == nil {\n\t\tgi.PromptDialog(nil, gi.DlgOpts{Title: \"Sound buffer is empty\", Prompt: \"Open a sound file before processing\"}, gi.AddOk, gi.NoCancel, nil, nil)\n\t\treturn errors.New(\"Load a sound file and try again\")\n\t}\n\n\tif wparams.SegmentEnd <= wparams.SegmentStart {\n\t\tgi.PromptDialog(nil, gi.DlgOpts{Title: \"End <= Start\", Prompt: \"SegmentEnd must be greater than SegmentStart.\"}, gi.AddOk, gi.NoCancel, nil, nil)\n\t\treturn errors.New(\"SegmentEnd <= SegmentStart\")\n\t}\n\n\tif wparams.Resize {\n\t\tduration := wparams.SegmentEnd - wparams.SegmentStart\n\t\tstepMs := wparams.StepMs\n\t\tsizeXMs := float64(gparams.GaborSet.SizeX) * stepMs\n\t\tstrideXMs := float64(gparams.GaborSet.StrideX) * stepMs\n\t\tadd := 0.0\n\t\tif duration < sizeXMs {\n\t\t\tadd = sizeXMs - duration\n\t\t} else { // duration is longer than one filter so find the next stride end\n\t\t\td := duration\n\t\t\td -= sizeXMs\n\t\t\trem := float64(int(d) % int(strideXMs))\n\t\t\tif rem > 0 {\n\t\t\t\tadd = strideXMs - rem\n\t\t\t}\n\t\t}\n\t\tif wparams.SegmentStart-add < 0 {\n\t\t\twparams.SegmentEnd += add\n\t\t} else {\n\t\t\twparams.SegmentStart -= add / 2\n\t\t\twparams.SegmentEnd += add / 2\n\t\t}\n\t\tap.GUI.UpdateWindow()\n\t}\n\n\tsr := ap.Sound.SampleRate()\n\tif sr <= 0 {\n\t\tfmt.Println(\"sample rate <= 0\")\n\t\treturn errors.New(\"sample rate <= 0\")\n\n\t}\n\twparams.WinSamples = sound.MSecToSamples(wparams.WinMs, sr)\n\twparams.StepSamples = sound.MSecToSamples(wparams.StepMs, sr)\n\n\t// round up to nearest step interval\n\tsegmentMs := wparams.SegmentEnd - wparams.SegmentStart\n\tsegmentMs = segmentMs + wparams.StepMs*float64(int(segmentMs)%int(wparams.StepMs))\n\tsteps := int(segmentMs / wparams.StepMs)\n\twparams.StepsTotal = steps + 2*wparams.BorderSteps\n\n\twinSamplesHalf := wparams.WinSamples/2 + 1\n\tpparams.Mel.FBank.NFilters = 32\n\tpparams.Mel.InitFilters(wparams.WinSamples, ap.Sound.SampleRate(), &pparams.MelFilters) // call after non-default values are set!\n\tap.Window.SetShape([]int{wparams.WinSamples}, nil, nil)\n\tpparams.Power.SetShape([]int{winSamplesHalf}, nil, nil)\n\tpparams.LogPower.CopyShapeFrom(&pparams.Power)\n\tpparams.PowerSegment.SetShape([]int{winSamplesHalf, wparams.StepsTotal}, nil, nil)\n\tif pparams.Dft.CompLogPow {\n\t\tpparams.LogPowerSegment.CopyShapeFrom(&pparams.PowerSegment)\n\t}\n\tgparams.FftCoefs = make([]complex128, wparams.WinSamples)\n\tgparams.Fft = fourier.NewCmplxFFT(len(gparams.FftCoefs))\n\n\tpparams.Mel.FBank.LoHz = 0\n\n\t// 2 reasons for this code\n\t// 1 - the amount of signal handed to the fft has a \"border\" (some extra signal) to avoid edge effects.\n\t// On the first step there is no signal to act as the \"border\" so we pad the data handed on the front.\n\t// 2 - signals needs to be aligned when the number when multiple signals are input (e.g. 100 and 300 ms)\n\t// so that the leading edge (right edge) is the same time point.\n\t// This code does this by generating negative offsets for the start of the processing.\n\t// Also see SndToWindow for the use of the step values\n\tstepsBack := wparams.BorderSteps\n\twparams.Steps = make([]int, wparams.StepsTotal)\n\tfor i := 0; i < wparams.StepsTotal; i++ {\n\t\twparams.Steps[i] = wparams.StepSamples * (i - stepsBack)\n\t}\n\n\tpparams.MelFBank.SetShape([]int{pparams.Mel.FBank.NFilters}, nil, nil)\n\tpparams.MelFBankSegment.SetShape([]int{pparams.Mel.FBank.NFilters, wparams.StepsTotal}, nil, nil)\n\tpparams.Energy.SetShape([]int{wparams.StepsTotal}, nil, nil)\n\tif pparams.Mel.MFCC {\n\t\tpparams.MFCCDct.SetShape([]int{pparams.Mel.FBank.NFilters}, nil, nil)\n\t\tpparams.MFCCSegment.SetShape([]int{pparams.Mel.NCoefs, wparams.StepsTotal}, nil, nil)\n\t\tpparams.MFCCDeltas.SetShape([]int{pparams.Mel.NCoefs, wparams.StepsTotal}, nil, nil)\n\t\tpparams.MFCCDeltaDeltas.SetShape([]int{pparams.Mel.NCoefs, wparams.StepsTotal}, nil, nil)\n\t}\n\tsamples := sound.MSecToSamples(wparams.SegmentEnd-wparams.SegmentStart, ap.Sound.SampleRate())\n\tsiglen := len(ap.Signal.Values) - samples*ap.Sound.Channels()\n\tsiglen = siglen / ap.Sound.Channels()\n\n\tpparams.Power.SetZeros()\n\tpparams.LogPower.SetZeros()\n\tpparams.PowerSegment.SetZeros()\n\tpparams.LogPowerSegment.SetZeros()\n\tpparams.MelFBankSegment.SetZeros()\n\tpparams.MFCCSegment.SetZeros()\n\tpparams.Energy.SetZeros()\n\n\tfor s := 0; s < int(wparams.StepsTotal); s++ {\n\t\terr := ap.ProcessStep(s, wparams, pparams, gparams)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor s := 0; s < wparams.StepsTotal; s++ {\n\t\te := 0.0\n\t\tfor f := 0; f < pparams.LogPowerSegment.Shape.Dim(1); f++ {\n\t\t\te += pparams.LogPowerSegment.FloatValRowCell(f, s)\n\t\t}\n\t\tpparams.Energy.SetFloat1D(s, e)\n\t}\n\n\tfor s := 0; s < wparams.StepsTotal; s++ {\n\t\tpparams.MFCCSegment.SetFloatRowCell(0, s, pparams.Energy.FloatVal1D(s))\n\t}\n\n\t// calculate the MFCC deltas (change in MFCC coeficient over time - basically first derivative)\n\t// One source of the equation - https://priv\tacycanada.net/mel-frequency-cepstral-coefficient/#Mel-filterbank-Computation\n\n\t//denominator = 2 * sum([i**2 for i in range(1, N+1)])\n\t// N: For each frame, calculate delta features based on preceding and following N frames\n\tN := 2\n\tif pparams.Mel.MFCC && pparams.Mel.Deltas {\n\t\tfor s := 0; s < int(wparams.StepsTotal); s++ {\n\t\t\tprv := 0.0\n\t\t\tnxt := 0.0\n\t\t\tfor i := 0; i < pparams.Mel.NCoefs; i++ {\n\t\t\t\tnume := 0.0\n\t\t\t\tfor n := 1; n <= N; n++ {\n\t\t\t\t\tsprv := s - n\n\t\t\t\t\tsnxt := s + n\n\t\t\t\t\tif sprv < 0 {\n\t\t\t\t\t\tsprv = 0\n\t\t\t\t\t}\n\t\t\t\t\tif snxt > wparams.StepsTotal-1 {\n\t\t\t\t\t\tsnxt = wparams.StepsTotal - 1\n\t\t\t\t\t}\n\t\t\t\t\tprv += pparams.MFCCSegment.FloatValRowCell(i, sprv)\n\t\t\t\t\tnxt += pparams.MFCCSegment.FloatValRowCell(i, snxt)\n\t\t\t\t\tnume += float64(n) * (nxt - prv)\n\n\t\t\t\t\tdenom := n * n\n\t\t\t\t\td := nume / 2.0 * float64(denom)\n\t\t\t\t\tpparams.MFCCDeltas.SetFloatRowCell(i, s, d)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor s := 0; s < int(wparams.StepsTotal); s++ {\n\t\t\tprv := 0.0\n\t\t\tnxt := 0.0\n\t\t\tfor i := 0; i < pparams.Mel.NCoefs; i++ {\n\t\t\t\tnume := 0.0\n\t\t\t\tfor n := 1; n <= N; n++ {\n\t\t\t\t\tsprv := s - n\n\t\t\t\t\tsnxt := s + n\n\t\t\t\t\tif sprv < 0 {\n\t\t\t\t\t\tsprv = 0\n\t\t\t\t\t}\n\t\t\t\t\tif snxt > wparams.StepsTotal-1 {\n\t\t\t\t\t\tsnxt = wparams.StepsTotal - 1\n\t\t\t\t\t}\n\t\t\t\t\tprv += pparams.MFCCDeltas.FloatValRowCell(i, sprv)\n\t\t\t\t\tnxt += pparams.MFCCDeltas.FloatValRowCell(i, snxt)\n\t\t\t\t\tnume += float64(n) * (nxt - prv)\n\n\t\t\t\t\tdenom := n * n\n\t\t\t\t\td := nume / 2.0 * float64(denom)\n\t\t\t\t\tpparams.MFCCDeltaDeltas.SetFloatRowCell(i, s, d)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (a *Ability) storeSamplesWav(id string, samples []int32, sampleRate, significantBits int) (err error) {\n\t// Create wav path\n\twavPath := filepath.Join(samplesToBeValidatedDirectory(a.c.SamplesDirectory), id+\".wav\")\n\n\t// Create dir\n\tif err = os.MkdirAll(filepath.Dir(wavPath), 0755); err != nil {\n\t\terr = errors.Wrapf(err, \"astiunderstanding: mkdirall %s failed\", filepath.Dir(wavPath))\n\t\treturn\n\t}\n\n\t// Create wav file\n\tvar f *os.File\n\tif f, err = os.Create(wavPath); err != nil {\n\t\terr = errors.Wrapf(err, \"astiunderstanding: creating %s failed\", wavPath)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\t// Create wav writer\n\twf := wav.File{\n\t\tChannels: 1,\n\t\tSampleRate: uint32(sampleRate),\n\t\tSignificantBits: uint16(significantBits),\n\t}\n\tvar r *wav.Writer\n\tif r, err = wf.NewWriter(f); err != nil {\n\t\terr = errors.Wrap(err, \"astiunderstanding: creating wav writer failed\")\n\t\treturn\n\t}\n\tdefer r.Close()\n\n\t// Write wav samples\n\tfor _, sample := range samples {\n\t\tif err = r.WriteInt32(sample); err != nil {\n\t\t\terr = errors.Wrap(err, \"astiunderstanding: writing wav sample failed\")\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (f *File) Play() error {\n\t// initialize the underlying APIs for audio transmission\n\tportaudio.Initialize()\n\tdefer portaudio.Terminate()\n\n\t// create a buffer for audio to be put into\n\t// hardcode 16-bit sample until i figure out a better way to do this\n\tbufLen := int(BufSize * f.AudioData.NumChannels)\n\tbuf := make([]int16, bufLen)\n\n\t// create the audio stream to write to\n\tstream, err := portaudio.OpenDefaultStream(0, int(f.AudioData.NumChannels), float64(f.AudioData.SampleRate), BufSize, buf)\n\tif err != nil {\n\t\treturn errors.NewFromErrorCodeInfo(errors.AudioFileOutputStreamNotOpened, err.Error())\n\t}\n\tdefer stream.Close()\n\tdefer stream.Stop()\n\tstream.Start()\n\n\t// get audio data (without WAV header)\n\tdata := f.AudioData.AudioData()\n\tstep := bufLen * 2 // *2 since we need twice as many bytes to fill up `bufLen` in16s\n\n\tf.playing = true\n\tdefer func() { f.playing = false }()\n\n\tfor i := 0; i < len(data); i += step {\n\t\t// check if we should stop (user called f.Stop())\n\t\tif f.shouldStop {\n\t\t\tf.shouldStop = false\n\t\t\tbreak\n\t\t}\n\t\t// need to convert each 2-bytes in [i, i+step] to 1 little endian int16\n\t\tfor j := 0; j < bufLen; j++ {\n\t\t\tk := j * 2\n\t\t\tbuf[j] = int16(binary.LittleEndian.Uint16(data[i+k : i+k+2]))\n\t\t}\n\t\t// write the converted data into the stream\n\t\terr := stream.Write()\n\t\tif err != nil {\n\t\t\treturn errors.NewFromErrorCodeInfo(errors.AudioFileNotWritableStream, err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *CarInspectionMutation) SoundLevel() (r float64, exists bool) {\n\tv := m.sound_level\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func CreateSoundEntry(soundLine string) SoundEntry {\n\tprops := strings.Split(soundLine, \"\\t\")\n\tresult := SoundEntry{\n\t\tHandle: props[0],\n\t\tIndex: StringToInt(props[1]),\n\t\tFileName: props[2],\n\t\tVolume: StringToUint8(props[3]),\n\t\tGroupSize: StringToUint8(props[4]),\n\t\tLoop: StringToUint8(props[5]) == 1,\n\t\tFadeIn: StringToUint8(props[6]),\n\t\tFadeOut: StringToUint8(props[7]),\n\t\tDeferInst: StringToUint8(props[8]),\n\t\tStopInst: StringToUint8(props[9]),\n\t\tDuration: StringToUint8(props[10]),\n\t\tCompound: StringToInt8(props[11]),\n\t\tReverb: StringToUint8(props[12]) == 1,\n\t\tFalloff: StringToUint8(props[13]),\n\t\tCache: StringToUint8(props[14]),\n\t\tAsyncOnly: StringToUint8(props[15]) == 1,\n\t\tPriority: StringToUint8(props[16]),\n\t\tStream: StringToUint8(props[17]),\n\t\tStereo: StringToUint8(props[18]),\n\t\tTracking: StringToUint8(props[19]),\n\t\tSolo: StringToUint8(props[20]),\n\t\tMusicVol: StringToUint8(props[21]),\n\t\tBlock1: StringToInt(props[22]),\n\t\tBlock2: StringToInt(props[23]),\n\t\tBlock3: StringToInt(props[24]),\n\t}\n\treturn result\n}", "func Convert(num int) string {\n\tsound := \"\"\n\n\t// If num has 3 as a factor, add \"Pling\" sound.\n\tif num%3 == 0 {\n\t\tsound += \"Pling\"\n\t}\n\n\t// If num has 5 as a factor, add \"Plang\" sound.\n\tif num%5 == 0 {\n\t\tsound += \"Plang\"\n\t}\n\n\t// If num has 7 as a factor, add \"Plong\" sound.\n\tif num%7 == 0 {\n\t\tsound += \"Plong\"\n\t}\n\n\t// If num does not have any 3, 5, 7 as a factor the sound will be the num\n\t// itself.\n\tif sound == \"\" {\n\t\tsound = strconv.Itoa(num)\n\t}\n\n\treturn sound\n}" ]
[ "0.56773376", "0.55151767", "0.5490583", "0.54481584", "0.5429382", "0.54216766", "0.53923196", "0.5336851", "0.5258713", "0.5232368", "0.52229524", "0.5222621", "0.5219998", "0.51924276", "0.51697564", "0.51531744", "0.5129222", "0.51270676", "0.50789714", "0.50149304", "0.5008915", "0.49895993", "0.49712226", "0.49489543", "0.49411592", "0.49154225", "0.4899525", "0.48505026", "0.4832861", "0.48202217", "0.47894952", "0.47728798", "0.47671902", "0.4718024", "0.47135094", "0.47003603", "0.4699426", "0.46959332", "0.46892285", "0.468587", "0.46781158", "0.4651761", "0.46500942", "0.4649731", "0.46374184", "0.46331415", "0.46264955", "0.46162787", "0.46149746", "0.46088696", "0.459913", "0.45793754", "0.45695186", "0.45620692", "0.45552298", "0.45327452", "0.4531201", "0.45236284", "0.45053262", "0.44944632", "0.44890505", "0.44705334", "0.445466", "0.4451359", "0.4441369", "0.44396782", "0.44337943", "0.44253176", "0.44225988", "0.44218057", "0.44204548", "0.44200686", "0.4411199", "0.4399556", "0.4392485", "0.4392033", "0.43783277", "0.43740317", "0.43643185", "0.43634772", "0.43544304", "0.43488282", "0.43428117", "0.43345842", "0.43189776", "0.4304772", "0.42978853", "0.42901328", "0.42879632", "0.42786047", "0.42712727", "0.4269138", "0.42679358", "0.4239719", "0.42381862", "0.42374715", "0.42355672", "0.4235459", "0.42330214", "0.4228212" ]
0.54538226
3
pInputs expects a unsafe.Pointer to a slice of MOUSE_INPUT or KEYBD_INPUT or HARDWARE_INPUT structs.
func SendInput(nInputs uint32, pInputs unsafe.Pointer, cbSize int32) uint32 { ret, _, _ := syscall.Syscall(sendInput.Addr(), 3, uintptr(nInputs), uintptr(pInputs), uintptr(cbSize)) return uint32(ret) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func UpdateInputs() {\n\tfor _, key := range keyBindings {\n\t\tif key.wasPressed() {\n\t\t\tkey.isPressed = true\n\t\t\tinterrupts.WriteJoypadInterrupt()\n\t\t\tinputMask &= ^key.binding\n\t\t}\n\t\tif !ebiten.IsKeyPressed(key.key) {\n\t\t\tkey.isPressed = false\n\t\t\tinputMask |= key.binding\n\t\t}\n\t}\n}", "func (c *Client) Inputs() (map[int]Input, error) {\n\treq, err := http.NewRequest(http.MethodGet, \"/menu_native/dynamic/tv_settings/devices/name_input\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp respInputs\n\tif err = c.do(req, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tinputs := make(map[int]Input, len(resp.Items))\n\tfor _, i := range resp.Items {\n\t\tinputs[i.Hash] = Input{\n\t\t\tDisplayName: i.Value.Name,\n\t\t\tHash: i.Hash,\n\t\t\tName: i.Name,\n\t\t}\n\t}\n\n\treturn inputs, nil\n}", "func (o *Transaction) AddInputsP(exec boil.Executor, insert bool, related ...*Input) {\n\tif err := o.AddInputs(exec, insert, related...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (pub *Publisher) GetInputs() []*types.InputDiscoveryMessage {\n\treturn pub.registeredInputs.GetAllInputs()\n}", "func (lgtv *Client) GetInputs() ([]Input, error) {\n\tresp := struct {\n\t\tInputs []Input `json:\"devices\"`\n\t}{}\n\tif err := lgtv.c.Request(lgtv.nextID(), uriInputList, nil, &resp); err != nil {\n\t\treturn resp.Inputs, err\n\t}\n\n\treturn resp.Inputs, nil\n}", "func (linux *linuxSystemObject) GetInputEvents() ([]gin.OsEvent, int64) {\n\tvar first_event *C.GlopKeyEvent\n\tcp := (*unsafe.Pointer)(unsafe.Pointer(&first_event))\n\tvar length C.int\n\tvar horizon C.longlong\n\tC.GlopGetInputEvents(cp, unsafe.Pointer(&length), unsafe.Pointer(&horizon))\n\tlinux.horizon = int64(horizon)\n\tc_events := (*[1000]C.GlopKeyEvent)(unsafe.Pointer(first_event))[:length]\n\tevents := make([]gin.OsEvent, length)\n\tfor i := range c_events {\n\t\twx, wy := linux.rawCursorToWindowCoords(int(c_events[i].cursor_x), int(c_events[i].cursor_y))\n\t\tevents[i] = gin.OsEvent{\n\t\t\tKeyId: gin.KeyId(c_events[i].index),\n\t\t\tPress_amt: float64(c_events[i].press_amt),\n\t\t\tTimestamp: int64(c_events[i].timestamp),\n\t\t\tX: wx,\n\t\t\tY: wy,\n\t\t}\n\t}\n\treturn events, linux.horizon\n}", "func (r *ProcessorResolver) Inputs(ctx context.Context, processor *model.Processor) ([]*model.ProcessorInput, error) {\n\tresult, err := r.DataLoaders.ProcessorLoader(ctx).InputsByProcessor(processor.ID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get inputs from loader\")\n\t}\n\treturn result, nil\n}", "func (o *ImportActionAllOf) SetInputs(v []Relation) {\n\to.Inputs = v\n}", "func updateInputs(msg tea.Msg, m model) (model, tea.Cmd) {\n\tvar (\n\t\tcmd tea.Cmd\n\t\tcmds []tea.Cmd\n\t)\n\n\tfor i := 0; i < len(m.settingsInputsScreen.input); i++ {\n\t\tm.settingsInputsScreen.input[i], cmd = m.settingsInputsScreen.input[i].Update(msg)\n\t\tcmds = append(cmds, cmd)\n\t}\n\n\treturn m, tea.Batch(cmds...)\n}", "func (o AzureMachineLearningStudioFunctionBindingOutput) Inputs() AzureMachineLearningStudioInputsPtrOutput {\n\treturn o.ApplyT(func(v AzureMachineLearningStudioFunctionBinding) *AzureMachineLearningStudioInputs { return v.Inputs }).(AzureMachineLearningStudioInputsPtrOutput)\n}", "func (o AzureMachineLearningServiceFunctionBindingOutput) Inputs() AzureMachineLearningServiceInputColumnArrayOutput {\n\treturn o.ApplyT(func(v AzureMachineLearningServiceFunctionBinding) []AzureMachineLearningServiceInputColumn {\n\t\treturn v.Inputs\n\t}).(AzureMachineLearningServiceInputColumnArrayOutput)\n}", "func (i *Individual) SetInputs(inputs []float64) {\n\ti.inputs = inputs\n}", "func (o AzureMachineLearningStudioFunctionBindingResponseOutput) Inputs() AzureMachineLearningStudioInputsResponsePtrOutput {\n\treturn o.ApplyT(func(v AzureMachineLearningStudioFunctionBindingResponse) *AzureMachineLearningStudioInputsResponse {\n\t\treturn v.Inputs\n\t}).(AzureMachineLearningStudioInputsResponsePtrOutput)\n}", "func (d *Descriptor) CreateInputs(filterCreator func(string, map[string]interface{}) (iface.Filter, error)) ([]interface{}, map[string]interface{}, error) {\n\tmodule := mod.NewModule(d.VerbLocation)\n\tif !module.Exists() {\n\t\treturn nil, nil, fmt.Errorf(\"Module named %v does not exist.\", d.VerbLocation)\n\t}\n\tins := module.Instance()\n\tverb := ins.Method(d.Sentence.Verb)\n\tan := verbinfo.NewAnalyzer(verb)\n\tac := an.ArgCount()\n\tif len(d.Route.Queries) < ac {\n\t\treturn nil, nil, fmt.Errorf(\"Not enough input to supply.\")\n\t}\n\tif ac == 0 {\n\t\treturn nil, nil, nil\n\t}\n\tfc := an.FilterCount()\n\tif fc > 0 && filterCreator == nil {\n\t\treturn nil, nil, fmt.Errorf(\"filterCreator is needed but it is nil.\")\n\t}\n\tvar inp []interface{}\n\tvar data map[string]interface{}\n\tsource := []map[string]interface{}{}\n\tfor _, v := range d.Route.Queries {\n\t\tsource = append(source, v)\n\t}\n\tif an.NeedsData() {\n\t\tdata = source[len(source)-1]\n\t\tif data == nil {\n\t\t\tdata = map[string]interface{}{} // !Important.\n\t\t}\n\t}\n\tif fc > 0 {\n\t\tif fc != 1 && len(source) != fc {\n\t\t\treturn nil, nil, fmt.Errorf(\"Got %v inputs, but method %v needs only %v filters. Currently filters can only be reduced to 1.\", len(source), d.Sentence.Verb, fc)\n\t\t}\n\t\tfilters := []iface.Filter{}\n\t\tfor i, v := range source {\n\t\t\tif d.Sentence.Verb != \"Get\" && d.Sentence.Verb != \"GetSingle\" && i == len(source)-1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfilt, err := filterCreator(d.Route.Words[i], v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tfilters = append(filters, filt)\n\t\t}\n\t\tif len(filters) > 1 {\n\t\t\tfilter := filters[0]\n\t\t\tred, err := filter.Reduce(filters[1:]...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tfilters = []iface.Filter{red}\n\t\t}\n\t\tfor _, v := range filters {\n\t\t\tinp = append(inp, v)\n\t\t}\n\t}\n\treturn inp, data, nil\n}", "func inputs(fns []InputSetter) Inputs {\n\tresult := make(Inputs)\n\tfor _, fn := range fns {\n\t\tfn(result)\n\t}\n\treturn result\n}", "func (d *DSP) NumInputs() (int, error) {\n\tvar numinputs C.int\n\tres := C.FMOD_DSP_GetNumInputs(d.cptr, &numinputs)\n\treturn int(numinputs), errs[res]\n}", "func PublishRegisteredInputs(\n\tinputs []*types.InputDiscoveryMessage,\n\tmessageSigner *messaging.MessageSigner) {\n\n\t// publish updated registered inputs\n\tfor _, input := range inputs {\n\t\tlogrus.Infof(\"PublishRegisteredInputs: publish input discovery: %s\", input.Address)\n\t\t// no encryption as this is for everyone to see\n\t\tmessageSigner.PublishObject(input.Address, true, input, nil)\n\t}\n\t// todo move save input configuration\n\t// if len(updatedInputs) > 0 && publisher.cacheFolder != \"\" {\n\t// \tallInputs := inpub.registeredInputs.GetAllInputs()\n\t// \tpersist.SaveInputs(publisher.cacheFolder, publisher.PublisherID(), allInputs)\n\t// }\n}", "func (i *Individual) Inputs() []float64 {\n\treturn i.inputs\n}", "func (jn *SemiJoin) Inputs() ([]Primitive, []map[string]any) {\n\treturn []Primitive{jn.Left, jn.Right}, []map[string]any{{\n\t\tinputName: \"Outer\",\n\t}, {\n\t\tinputName: \"SubQuery\",\n\t}}\n}", "func ValidInputs() []string {\n\treturn []string{\n\t\t\"toml\",\n\t\t\"tf|hcl\",\n\t\t\"cue\",\n\t\t\"ini\",\n\t\t\"yaml\",\n\t}\n}", "func GetInputs(callback InputCallback) {\n\tinput := input.ReferenceInput{\n\t\tContent: map[string]interface{}{\n\t\t\t\"date\": \"2019-01-01\",\n\t\t},\n\t\tSentManually: false,\n\t\tPriority: 1,\n\t}\n\n\tcallback(input)\n}", "func (a *Auditor) InspectInputs(inputs []*AuditableToken) error {\n\tfor i, input := range inputs {\n\t\tif input == nil || input.Token == nil {\n\t\t\treturn errors.Errorf(\"invalid input at index [%d]\", i)\n\t\t}\n\n\t\tif !input.Token.IsRedeem() {\n\t\t\tif err := a.InspectTokenOwnerFunc(a.Des, input, i); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"failed inspecting input at index [%d]\", i)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func updateInputs(msg tea.Msg, m model) (model, tea.Cmd) {\n\tvar (\n\t\tcmd tea.Cmd\n\t\tcmds []tea.Cmd\n\t)\n\n\tm.nameInput, cmd = m.nameInput.Update(msg)\n\tcmds = append(cmds, cmd)\n\n\tm.emailInput, cmd = m.emailInput.Update(msg)\n\tcmds = append(cmds, cmd)\n\n\tm.passwordInput, cmd = m.passwordInput.Update(msg)\n\tcmds = append(cmds, cmd)\n\n\treturn m, tea.Batch(cmds...)\n}", "func (m *ItemTranslateExchangeIdsPostRequestBody) GetInputIds()([]string) {\n val, err := m.GetBackingStore().Get(\"inputIds\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "func (o AzureMachineLearningServiceFunctionBindingResponseOutput) Inputs() AzureMachineLearningServiceInputColumnResponseArrayOutput {\n\treturn o.ApplyT(func(v AzureMachineLearningServiceFunctionBindingResponse) []AzureMachineLearningServiceInputColumnResponse {\n\t\treturn v.Inputs\n\t}).(AzureMachineLearningServiceInputColumnResponseArrayOutput)\n}", "func NewInputs(inputsCfg config.Inputs) *Inputs {\n\tinputs := Inputs{\n\t\tRW: *new(sync.RWMutex),\n\t\tMap: make(map[string]Input),\n\t}\n\n\tinputs.RW.Lock()\n\tdefer inputs.RW.Unlock()\n\n\tfor _, in := range inputsCfg {\n\t\tinputs.Map[in.Name] = NewInput(in.IO.Name, in.IO.Type, msgs.Representation(in.IO.Representation), in.IO.Channel, NewDefaultMessage(in.Type, in.Default))\n\t}\n\treturn &inputs\n}", "func UnpackPinInputs(data []byte) (pi PinInputs, err error) {\n\tdata = bytes.TrimPrefix(data, pinMethod.Id())\n\terr = pinMethod.Inputs.Unpack(&pi, data)\n\treturn\n}", "func (o *ImportActionAllOf) GetInputs() []Relation {\n\tif o == nil {\n\t\tvar ret []Relation\n\t\treturn ret\n\t}\n\treturn o.Inputs\n}", "func (inputs *input) validateInputs() error {\n\n\tif _, ok := howMap[inputs.how]; !ok {\n\t\treturn fmt.Errorf(\"how option is invalid\")\n\t}\n\n\tlog.Printf(\"Got Inputs : %+v\", inputs)\n\n\treturn nil\n}", "func GetNumberOfConsoleInputEvents(hConsoleInput HANDLE, lpNumberOfEvents *uint32) bool {\n\tret1 := syscall3(getNumberOfConsoleInputEvents, 2,\n\t\tuintptr(hConsoleInput),\n\t\tuintptr(unsafe.Pointer(lpNumberOfEvents)),\n\t\t0)\n\treturn ret1 != 0\n}", "func (m *ItemTranslateExchangeIdsPostRequestBody) SetInputIds(value []string)() {\n err := m.GetBackingStore().Set(\"inputIds\", value)\n if err != nil {\n panic(err)\n }\n}", "func (a *Action) InputNames() (names []string) {\n\tnames = []string{}\n\n\tfor k := range a.Input {\n\t\tnames = append(names, k)\n\t}\n\n\tsort.Strings(names)\n\n\treturn names\n}", "func (s *Job) SetInputs(v []*JobInput) *Job {\n\ts.Inputs = v\n\treturn s\n}", "func GetOperationInputs(ctx context.Context, deploymentID, nodeTemplateImpl, typeNameImpl, operationName string) ([]string, error) {\n\tinputs := make([]string, 0)\n\toperationDef, interfaceDef, err := getOperationAndInterfaceDefinitions(ctx, deploymentID, nodeTemplateImpl, typeNameImpl, operationName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// First Get operation inputs\n\tif operationDef != nil {\n\t\tfor k := range operationDef.Inputs {\n\t\t\tinputs = append(inputs, k)\n\t\t}\n\t}\n\n\tif interfaceDef != nil {\n\t\t// Then Get global interface inputs\n\t\tfor k := range interfaceDef.Inputs {\n\t\t\tif !collections.ContainsString(inputs, k) {\n\t\t\t\tinputs = append(inputs, k)\n\t\t\t}\n\t\t}\n\t}\n\treturn inputs, nil\n}", "func (cmd *CommandDelete) Inputs() cli.InputResolver {\n\treturn &cmd.inputs\n}", "func (options *UpdateActionOptions) SetInputs(inputs []VariableData) *UpdateActionOptions {\n\toptions.Inputs = inputs\n\treturn options\n}", "func IntPtrSlice(src []int) []*int {\n\tdst := make([]*int, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func (r *Resolver) qlcUnMarshalInputs(vm *exec.VirtualMachine) int64 {\n\treturn 0\n}", "func HandleInputs(moveDirs uint8, width, height int) (bool, uint8, float64, float64) {\n\trunning := true\t// We assume this to be true.\n\tyaw, pitch := 0.0, 0.0\t// These are measured in units of (fov / 2) radians.\n\t\n\t// Pull every event out of the queue and evaluate/apply it.\n\tfor event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {\n\t\tswitch event.(type) {\n\t\tcase *sdl.KeyboardEvent:\n\t\t\tkeyEvent := event.(*sdl.KeyboardEvent)\n\t\t\tif keyEvent.Type == sdl.KEYDOWN {\n\t\t\t\tswitch keyEvent.Keysym.Sym {\n\t\t\t\tcase sdl.K_ESCAPE:\n\t\t\t\t\trunning = false\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_w:\n\t\t\t\t\tif moveDirs & MoveBackward != 0 {\n\t\t\t\t\t\tmoveDirs &^= MoveForward | MoveBackward\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmoveDirs |= MoveForward\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_a:\n\t\t\t\t\tif moveDirs & MoveRightward != 0 {\n\t\t\t\t\t\tmoveDirs &^= MoveLeftward | MoveRightward\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmoveDirs |= MoveLeftward\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_s:\n\t\t\t\t\tif moveDirs & MoveForward != 0 {\n\t\t\t\t\t\tmoveDirs &^= MoveBackward | MoveForward\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmoveDirs |= MoveBackward\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_d:\n\t\t\t\t\tif moveDirs & MoveLeftward != 0 {\n\t\t\t\t\t\tmoveDirs &^= MoveRightward | MoveLeftward\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmoveDirs |= MoveRightward\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_SPACE:\n\t\t\t\t\tif moveDirs & MoveDownward != 0 {\n\t\t\t\t\t\tmoveDirs &^= MoveUpward | MoveDownward\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmoveDirs |= MoveUpward\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_LSHIFT:\n\t\t\t\t\tif moveDirs & MoveUpward != 0 {\n\t\t\t\t\t\tmoveDirs &^= MoveDownward | MoveUpward\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmoveDirs |= MoveDownward\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}else if keyEvent.Type == sdl.KEYUP {\n\t\t\t\tswitch keyEvent.Keysym.Sym {\n\t\t\t\tcase sdl.K_w:\n\t\t\t\t\tmoveDirs &^= MoveForward\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_a:\n\t\t\t\t\tmoveDirs &^= MoveLeftward\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_s:\n\t\t\t\t\tmoveDirs &^= MoveBackward\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_d:\n\t\t\t\t\tmoveDirs &^= MoveRightward\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_SPACE:\n\t\t\t\t\tmoveDirs &^= MoveUpward\n\t\t\t\t\tbreak\n\t\t\t\tcase sdl.K_LSHIFT:\n\t\t\t\t\tmoveDirs &^= MoveDownward\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\tcase *sdl.MouseMotionEvent:\n\t\t\tmouseEvent := event.(*sdl.MouseMotionEvent)\n\t\t\tyaw += float64(mouseEvent.XRel) / float64(width / 2)\n\t\t\tpitch -= float64(mouseEvent.YRel) / float64(height / 2)\n\t\t\tbreak\n\t\t}\n\t}\n\treturn running, moveDirs, yaw, pitch\n}", "func (p Problem) GenerateInputs() []int {\n\tinput := make([]int, 10)\n\n\tinput[0] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[1] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[2] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[3] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[4] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[5] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[6] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[7] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[8] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\tinput[9] = rng.Intn(PROBLEM_INPUT_RANGE * 2) - PROBLEM_INPUT_RANGE\n\n\treturn input\n}", "func (biuo *BlockInstanceUpdateOne) SetInputs(fv []*flowschema.VariableValue) *BlockInstanceUpdateOne {\n\tbiuo.mutation.SetInputs(fv)\n\treturn biuo\n}", "func (cmd *CommandCreate) Inputs() cli.InputResolver {\n\treturn &cmd.inputs\n}", "func ListInput(list []Input) Input {\n\treturn Input{val: list}\n}", "func FieldPtrs(model Model, fields uint64, args ...interface{}) []interface{} {\n\tc, l := NumFields(fields), len(args)\n\tptrs := make([]interface{}, c+l)\n\tmodel.Ptrs(fields, ptrs)\n\n\tfor l = l - 1; l >= 0; l-- {\n\t\tptrs[c+l] = args[l]\n\t}\n\n\treturn ptrs\n}", "func (mock *InputterMock) InputCalls() []struct {\n\tReqMsg entity.Message\n} {\n\tvar calls []struct {\n\t\tReqMsg entity.Message\n\t}\n\tlockInputterMockInput.RLock()\n\tcalls = mock.calls.Input\n\tlockInputterMockInput.RUnlock()\n\treturn calls\n}", "func (pub *Publisher) GetDomainInputs() []*types.InputDiscoveryMessage {\n\treturn pub.domainInputs.GetAllInputs()\n}", "func (t *Task) ValidateInputs(taskInputs map[string]interface{}) []*ParameterWarning {\n\treturn validateParametersSchema(t.Inputs, taskInputs)\n}", "func (s *Statement) InputBindings() []string {\n\tvar res []string\n\tfor _, p := range s.projection {\n\t\tif p.Binding != \"\" {\n\t\t\tres = append(res, p.Binding)\n\t\t}\n\t}\n\treturn res\n}", "func stopServiceInputs(inputs []*models.RunningInput) {\n\tfor _, input := range inputs {\n\t\tif si, ok := input.Input.(telegraf.ServiceInput); ok {\n\t\t\tsi.Stop()\n\t\t}\n\t}\n}", "func (o *Transaction) Inputs(exec boil.Executor, mods ...qm.QueryMod) inputQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"`input`.`transaction_id`=?\", o.ID),\n\t)\n\n\tquery := Inputs(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`input`\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"`input`.*\"})\n\t}\n\n\treturn query\n}", "func (g *Game) inputs() {\n\t/*\n\t KeySpace = 32\n KeyRight = 262\n KeyLeft = 263\n KeyDown = 264\n KeyUp = 265 */\n\n\n\tif rl.IsKeyPressed(32){\n\t\tg.restart()\n\t}\n}", "func (biu *BlockInstanceUpdate) SetInputs(fv []*flowschema.VariableValue) *BlockInstanceUpdate {\n\tbiu.mutation.SetInputs(fv)\n\treturn biu\n}", "func (options *CreateActionOptions) SetInputs(inputs []VariableData) *CreateActionOptions {\n\toptions.Inputs = inputs\n\treturn options\n}", "func (s *CreateJobInput) SetInputs(v []*JobInput) *CreateJobInput {\n\ts.Inputs = v\n\treturn s\n}", "func InputInts(input string, parser func(string) []string) [][]int {\n\tlines := InputFloats(input, parser)\n\n\tr := make([][]int, len(lines))\n\tfor lineNo, fields := range lines {\n\t\tnums := make([]int, len(fields))\n\t\tfor i, f := range fields {\n\t\t\tif math.IsNaN(f) || math.IsInf(f, 0) {\n\t\t\t\tnums[i] = 0\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnums[i] = int(f)\n\t\t}\n\t\tr[lineNo] = nums\n\t}\n\n\treturn r\n}", "func (transactionL) LoadInputs(e boil.Executor, singular bool, maybeTransaction interface{}) error {\n\tvar slice []*Transaction\n\tvar object *Transaction\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeTransaction.(*Transaction)\n\t} else {\n\t\tslice = *maybeTransaction.(*[]*Transaction)\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 = &transactionR{}\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 = &transactionR{}\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 `input` where `transaction_id` 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 input\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*Input\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice input\")\n\t}\n\n\tif singular {\n\t\tobject.R.Inputs = 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.TransactionID {\n\t\t\t\tlocal.R.Inputs = append(local.R.Inputs, foreign)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *Controller) HandleInputs() {\n\tif ebiten.IsKeyPressed(ebiten.KeyW) {\n\t\tc.Up()\n\t}\n\tif ebiten.IsKeyPressed(ebiten.KeyS) {\n\t\tc.Down()\n\t}\n\tif ebiten.IsKeyPressed(ebiten.KeyA) {\n\t\tc.Left()\n\t}\n\tif ebiten.IsKeyPressed(ebiten.KeyD) {\n\t\tc.Right()\n\t}\n}", "func (m *MockUnsignedTx) InputIDs() set.Set[ids.ID] {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InputIDs\")\n\tret0, _ := ret[0].(set.Set[ids.ID])\n\treturn ret0\n}", "func (s *Server) ListInputBindings(ctx context.Context, in *empty.Empty) (*pb.ListInputBindingsResponse, error) {\n\tlist := make([]string, 0)\n\tfor k := range s.bindingHandlers {\n\t\tlist = append(list, k)\n\t}\n\n\treturn &pb.ListInputBindingsResponse{\n\t\tBindings: list,\n\t}, nil\n}", "func (a *Agent) runInputs(\n\tctx context.Context,\n\tstartTime time.Time,\n\tunit *inputUnit,\n) error {\n\n\tfor _, input := range unit.inputs {\n\t\terr := a.RunSingleInput(input, ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Printf(\"D! [agent] Stopping service inputs\")\n\t\t\tstopServiceInputs(a.Config.Inputs)\n\n\t\t\tclose(unit.dst)\n\t\t\tlog.Printf(\"D! [agent] Input channel closed\")\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (sess *Session) CheckInputsSigned() bool {\n\tfor _, p := range sess.Participants {\n\t\tif p.SignedTx == nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (options *ReplaceJobOptions) SetInputs(inputs []VariableData) *ReplaceJobOptions {\n\toptions.Inputs = inputs\n\treturn options\n}", "func (o *ImportActionAllOf) HasInputs() bool {\n\tif o != nil && o.Inputs != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d PulseDevice) InputArgs() []string {\n\treturn []string{\"-f\", \"pulse\", \"-i\", string(d)}\n}", "func (e *Environment) InputDocs() []docs.ComponentSpec {\n\treturn e.inputs.Docs()\n}", "func GetUserInputs() (*types.UserInput, error) {\n\tvar (\n\t\tuserInputs = new(types.UserInput)\n\t\ttopics string\n\t)\n\n\tuserInputs.QueueGroup = \"log\"\n\ttopics = topics + \"CONFIG,\"\n\ttopics = topics + \"EVENT,\"\n\ttopics = topics + \"LOG,\"\n\n\t//if cdr outtopic is enabled\n\tif types.OutTopic != \"\" {\n\t\ttopics = topics + types.OutTopic + \",\"\n\t}\n\n\t//add a test topic\n\ttopics = topics + \"TEST\"\n\n\tuserInputs.Subject = strings.Split(topics, \",\")\n\n\tuserInputs.MaxFileSizeMB = types.CimConfigObj.CimConfig.Lmaas.MaxFileSizeInMB\n\tuserInputs.MaxBackupFiles = types.CimConfigObj.CimConfig.Lmaas.MaxBackupFiles\n\tuserInputs.MaxAge = types.CimConfigObj.CimConfig.Lmaas.MaxAge\n\tuserInputs.BufSize = types.CimConfigObj.CimConfig.Lmaas.BufferSize\n\tuserInputs.FlushTimeout = time.Duration(types.CimConfigObj.CimConfig.Lmaas.FlushTimeout)\n\tuserInputs.PodID = types.PodID\n\tuserInputs.Namespace = types.Namespace\n\n\treturn userInputs, nil\n}", "func constructInputsCopyTo(ctx *Context, inputs map[string]interface{}, args interface{}) error {\n\tif args == nil {\n\t\treturn errors.New(\"args must not be nil\")\n\t}\n\targsV := reflect.ValueOf(args)\n\ttyp := argsV.Type()\n\tif typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct {\n\t\treturn errors.New(\"args must be a pointer to a struct\")\n\t}\n\targsV, typ = argsV.Elem(), typ.Elem()\n\n\tfor k, v := range inputs {\n\t\tci := v.(*constructInput)\n\t\tfor i := 0; i < typ.NumField(); i++ {\n\t\t\tfieldV := argsV.Field(i)\n\t\t\tif !fieldV.CanSet() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfield := typ.Field(i)\n\t\t\ttag, has := field.Tag.Lookup(\"pulumi\")\n\t\t\tif !has || tag != k {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\thandleField := func(typ reflect.Type, value resource.PropertyValue, deps []Resource) (reflect.Value, error) {\n\t\t\t\tresultType := anyOutputType\n\t\t\t\tif typ.Implements(outputType) {\n\t\t\t\t\tresultType = typ\n\t\t\t\t} else if typ.Implements(inputType) {\n\t\t\t\t\ttoOutputMethodName := \"To\" + strings.TrimSuffix(typ.Name(), \"Input\") + \"Output\"\n\t\t\t\t\tif toOutputMethod, found := typ.MethodByName(toOutputMethodName); found {\n\t\t\t\t\t\tmt := toOutputMethod.Type\n\t\t\t\t\t\tif mt.NumIn() == 0 && mt.NumOut() == 1 && mt.Out(0).Implements(outputType) {\n\t\t\t\t\t\t\tresultType = mt.Out(0)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toutput := ctx.newOutput(resultType, deps...)\n\t\t\t\tdest := reflect.New(output.ElementType()).Elem()\n\t\t\t\tknown := !ci.value.ContainsUnknowns()\n\t\t\t\tsecret, err := unmarshalOutput(ctx, value, dest)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn reflect.Value{}, err\n\t\t\t\t}\n\t\t\t\toutput.getState().resolve(dest.Interface(), known, secret, nil)\n\t\t\t\treturn reflect.ValueOf(output), nil\n\t\t\t}\n\n\t\t\tisInputType := func(typ reflect.Type) bool {\n\t\t\t\treturn typ.Implements(outputType) || typ.Implements(inputType)\n\t\t\t}\n\n\t\t\tif isInputType(field.Type) {\n\t\t\t\tval, err := handleField(field.Type, ci.value, ci.deps)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfieldV.Set(val)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif field.Type.Kind() == reflect.Slice && isInputType(field.Type.Elem()) {\n\t\t\t\telemType := field.Type.Elem()\n\t\t\t\tlength := len(ci.value.ArrayValue())\n\t\t\t\tdest := reflect.MakeSlice(field.Type, length, length)\n\t\t\t\tfor i := 0; i < length; i++ {\n\t\t\t\t\tval, err := handleField(elemType, ci.value.ArrayValue()[i], ci.deps)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tdest.Index(i).Set(val)\n\t\t\t\t}\n\t\t\t\tfieldV.Set(dest)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif field.Type.Kind() == reflect.Map && isInputType(field.Type.Elem()) {\n\t\t\t\telemType := field.Type.Elem()\n\t\t\t\tlength := len(ci.value.ObjectValue())\n\t\t\t\tdest := reflect.MakeMapWithSize(field.Type, length)\n\t\t\t\tfor k, v := range ci.value.ObjectValue() {\n\t\t\t\t\tkey := reflect.ValueOf(string(k))\n\t\t\t\t\tval, err := handleField(elemType, v, ci.deps)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tdest.SetMapIndex(key, val)\n\t\t\t\t}\n\t\t\t\tfieldV.Set(dest)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif len(ci.deps) > 0 {\n\t\t\t\treturn errors.Errorf(\n\t\t\t\t\t\"%s.%s is typed as %v but must be typed as Input or Output for input %q with dependencies\",\n\t\t\t\t\ttyp, field.Name, field.Type, k)\n\t\t\t}\n\t\t\tdest := reflect.New(field.Type).Elem()\n\t\t\tsecret, err := unmarshalOutput(ctx, ci.value, dest)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"unmarshaling input %s\", k)\n\t\t\t}\n\t\t\tif secret {\n\t\t\t\treturn errors.Errorf(\n\t\t\t\t\t\"%s.%s is typed as %v but must be typed as Input or Output for secret input %q\",\n\t\t\t\t\ttyp, field.Name, field.Type, k)\n\t\t\t}\n\t\t\tfieldV.Set(reflect.ValueOf(dest.Interface()))\n\t\t}\n\t}\n\n\treturn nil\n}", "func (ts TaskSpec) SnapshotInputs() []TaskInputSpec {\n\tsnapshotInputs := make([]TaskInputSpec, 0, len(ts.Inputs))\n\tfor _, i := range ts.Inputs {\n\t\tif !i.HasMergeInto() {\n\t\t\tsnapshotInputs = append(snapshotInputs, i)\n\t\t}\n\t}\n\treturn snapshotInputs\n}", "func (nn *NeuralNetwork) Set_inputs (inputs []float64) {\n for i := range inputs {\n nn.input_layer.values[i] = inputs[i]\n }\n}", "func Input(ctx context.Context, s *testing.State) {\n\ttconn := s.FixtValue().(*utils.FixtureData).Tconn\n\n\t// Since virtual keyboard with BUS_USB (0x03) doesn't work yet, use BUS_I2C (0x18).\n\t// See https://crrev.com/c/1407138 for more discussion.\n\tvkb, err := input.VirtualKeyboardWithBusType(ctx, 0x18)\n\tif err != nil {\n\t\ts.Fatal(\"Failed to create a virtual keyboard: \", err)\n\t}\n\tdefer vkb.Close()\n\n\t// Find the Input navigation item and the keyboard list heading.\n\tconst timeout = 10 * time.Second\n\tpollOpts := testing.PollOptions{Interval: time.Second, Timeout: timeout}\n\tui := uiauto.New(tconn)\n\tinputTab := da.DxInput.Ancestor(da.DxRootNode)\n\tkeyboardListHeading := da.DxKeyboardHeading.Ancestor(da.DxRootNode)\n\tif err := uiauto.Combine(\"find the keyboard list heading\",\n\t\tui.WithTimeout(timeout).WaitUntilExists(inputTab),\n\t\tui.WithPollOpts(pollOpts).LeftClick(inputTab),\n\t\tui.WithTimeout(timeout).WaitUntilExists(keyboardListHeading),\n\t)(ctx); err != nil {\n\t\ts.Fatal(\"Failed to find the keyboard list heading: \", err)\n\t}\n}", "func InputType_Values() []string {\n\treturn []string{\n\t\tInputTypeRealTime,\n\t\tInputTypePostCall,\n\t}\n}", "func (options *CreateJobOptions) SetInputs(inputs []VariableData) *CreateJobOptions {\n\toptions.Inputs = inputs\n\treturn options\n}", "func (o *ImportActionAllOf) GetInputsOk() (*[]Relation, bool) {\n\tif o == nil || o.Inputs == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Inputs, true\n}", "func (o *SdwanRouterNode) SetTemplateInputs(v []SdwanTemplateInputsType) {\n\to.TemplateInputs = v\n}", "func (s *State) KeyPresses() []Key {\n\tif s.HasKeyboardFocus() {\n\t\tk := s.keyPresses\n\t\ts.keyPresses = nil\n\t\treturn k\n\t}\n\treturn nil\n}", "func (in Inputs) Len() int { return len(in) }", "func (w *Window) UpdateInput() {\n\n\tmainthread.Call(func() {\n\t\tglfw.PollEvents()\n\t})\n\n\tw.prevInp = w.currInp\n\tw.currInp = w.tempInp\n\tw.tempInp.scro = ScrollEvent(pixel.ZV)\n\tw.tempInp.re = false\n\n\t//we only want to put changed states in the channel, and only one per tick.\n\t//for typing, that's not OK - so I've dumped it direct. If somebody writes about 100 letters\n\t//in 1/60th of a second, then it's gonna crash, but whatever, right?\n\tif w.prevInp.curs != w.currInp.curs {\n\t\tw.EventChannel <- &w.currInp.curs\n\t}\n\tif w.prevInp.scro != ScrollEvent(pixel.ZV) {\n\t\tw.EventChannel <- &w.currInp.scro\n\t}\n\tif w.prevInp.key != w.currInp.key || w.currInp.key.Act == REPEAT {\n\t\tw.EventChannel <- &w.currInp.key\n\t}\n\tif w.prevInp.re != false {\n\t\tw.size()\n\t\tw.EventChannel <- &w.currInp.re\n\t}\n\tif w.window.ShouldClose() {\n\t\tw.EventChannel <- nil\n\t}\n\n}", "func (s *server) ListInputBindings(ctx context.Context, in *empty.Empty) (*pb.ListInputBindingsResponse, error) {\n\treturn &pb.ListInputBindingsResponse{\n\t\tBindings: []string{\"storage\"},\n\t}, nil\n}", "func (fieldMask *ListServicesResponse_FieldMask) FilterInputFields() *ListServicesResponse_FieldMask {\n\tresult := &ListServicesResponse_FieldMask{}\n\tfor _, path := range fieldMask.Paths {\n\t\tswitch path.Selector() {\n\t\tcase ListServicesResponse_FieldPathSelectorServices:\n\t\t\tif _, ok := path.(*ListServicesResponse_FieldTerminalPath); ok {\n\t\t\t\tfor _, subpath := range service.FullService_FieldMask().FilterInputFields().Paths {\n\t\t\t\t\tresult.Paths = append(result.Paths, &ListServicesResponse_FieldSubPath{selector: path.Selector(), subPath: subpath})\n\t\t\t\t}\n\t\t\t} else if sub, ok := path.(*ListServicesResponse_FieldSubPath); ok {\n\t\t\t\tselectedMask := &service.Service_FieldMask{\n\t\t\t\t\tPaths: []service.Service_FieldPath{sub.subPath.(service.Service_FieldPath)},\n\t\t\t\t}\n\t\t\t\tfor _, allowedPath := range selectedMask.FilterInputFields().Paths {\n\t\t\t\t\tresult.Paths = append(result.Paths, &ListServicesResponse_FieldSubPath{selector: ListServicesResponse_FieldPathSelectorServices, subPath: allowedPath})\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tresult.Paths = append(result.Paths, path)\n\t\t}\n\t}\n\treturn result\n}", "func IPListWriteFrom(\n\tinputs []string,\n\tstdin bool,\n\tip bool,\n\tiprange bool,\n\tcidr bool,\n\tfile bool,\n) error {\n\t// prevent edge cases with all flags turned off.\n\tif !stdin && !ip && !iprange && !cidr && !file {\n\t\treturn nil\n\t}\n\n\t// start with stdin.\n\tif stdin {\n\t\tstat, _ := os.Stdin.Stat()\n\n\t\tisPiped := (stat.Mode() & os.ModeNamedPipe) != 0\n\t\tisTyping := (stat.Mode()&os.ModeCharDevice) != 0 && len(inputs) == 0\n\n\t\tif isTyping {\n\t\t\tfmt.Println(\"** manual input mode **\")\n\t\t\tfmt.Println(\"Enter all IPs, one per line:\")\n\t\t}\n\n\t\tif isPiped || isTyping || stat.Size() > 0 {\n\t\t\tIPListWriteFromStdin()\n\t\t}\n\t}\n\n\t// parse `inputs`.\n\tfor _, input := range inputs {\n\t\tif iprange {\n\t\t\tif err := IPListWriteFromIPRangeStr(input); err == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif ip && StrIsIPStr(input) {\n\t\t\tfmt.Println(input)\n\t\t\tcontinue\n\t\t}\n\n\t\tif cidr && StrIsCIDRStr(input) {\n\t\t\tif err := IPListWriteFromCIDR(input); err == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif file && FileExists(input) {\n\t\t\tif err := IPListWriteFromFile(input); err == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\treturn ErrInvalidInput\n\t}\n\n\treturn nil\n}", "func (a *Action) InputMappings() []string {\n\treturn a.inputMappings\n}", "func (o *os) GetConnectedMidiInputs() gdnative.PoolStringArray {\n\to.ensureSingleton()\n\t//log.Println(\"Calling _OS.GetConnectedMidiInputs()\")\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(\"_OS\", \"get_connected_midi_inputs\")\n\n\t// Call the parent method.\n\t// PoolStringArray\n\tretPtr := gdnative.NewEmptyPoolStringArray()\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.NewPoolStringArrayFromPointer(retPtr)\n\treturn ret\n}", "func (b *Builder) InputFields(source reflect.Value, parent reflect.Value) graphql.InputObjectConfigFieldMap {\n\tresult := make(graphql.InputObjectConfigFieldMap, 0)\n\tnodes := b.buildObject(source, parent)\n\tfor _, node := range nodes {\n\t\tif node.skip {\n\t\t\tcontinue\n\t\t}\n\t\tif !node.source.CanSet() {\n\t\t\tcontinue\n\t\t}\n\t\tif node.readOnly {\n\t\t\tcontinue\n\t\t}\n\n\t\tname := node.alias\n\t\tif name == \"\" {\n\t\t\tname = strcase.ToLowerCamel(node.name)\n\t\t}\n\t\tgType := b.mapInput(node.source, parent)\n\t\tif node.required {\n\t\t\tgType = graphql.NewNonNull(gType)\n\t\t}\n\n\t\tfield := &graphql.InputObjectFieldConfig{\n\t\t\tType: gType,\n\t\t}\n\t\tresult[name] = field\n\t}\n\treturn result\n}", "func (o *Transaction) AddInputsGP(insert bool, related ...*Input) {\n\tif err := o.AddInputs(boil.GetDB(), insert, related...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func getInputValues(i []js.Value) (v1, v2 float64) {\n\tvalue1 := getStringValueById(i[0].String())\n\tvalue2 := getStringValueById(i[1].String())\n\tv1, _ = strconv.ParseFloat(value1, 64)\n\tv2, _ = strconv.ParseFloat(value2, 64)\n\treturn\n}", "func Float32PtrSlice(src []float32) []*float32 {\n\tdst := make([]*float32, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func MouseInput(ctx context.Context, s *testing.State) {\n\tp := s.FixtValue().(*arc.PreData)\n\tcr := p.Chrome\n\ta := p.ARC\n\td := p.UIDevice\n\ttestParams := s.Param().(mouseInputParams)\n\n\ttconn, err := cr.TestAPIConn(ctx)\n\tif err != nil {\n\t\ts.Fatal(\"Failed to create test API connection: \", err)\n\t}\n\n\tif err := a.Install(ctx, arc.APKPath(motioninput.APK)); err != nil {\n\t\ts.Fatal(\"Failed installing \", motioninput.APK, \": \", err)\n\t}\n\n\tfor _, params := range testParams.tests {\n\t\ts.Run(ctx, params.Name+\": Verify Mouse\", func(ctx context.Context, s *testing.State) {\n\t\t\tmotioninput.RunTestWithWMParams(ctx, s, tconn, d, a, &params, verifyMouse)\n\t\t})\n\t}\n}", "func SetInputHandlers(uiman *gui.Manager, window *glfw.Window) {\n\tlastMouseX := -1.0\n\tlastMouseY := -1.0\n\tlastDeltaX := -1.0\n\tlastDeltaY := -1.0\n\n\tneedsMousePosCheck := true\n\n\t// at the start of a new frame, reset some flags\n\tuiman.AddConstructionStartCallback(func(startTime time.Time) {\n\t\tneedsMousePosCheck = true\n\t})\n\n\tuiman.GetMousePosition = func() (float32, float32) {\n\t\t// if we've already checked the position this frame, then just return\n\t\t// the old coordinates using math\n\t\tif needsMousePosCheck == false {\n\t\t\treturn float32(lastMouseX), float32(lastMouseY)\n\t\t}\n\n\t\tx, y := window.GetCursorPos()\n\n\t\t// in this package, we reverse the Y location so that the origin\n\t\t// is in the lower left corner and not the top left corner.\n\t\t_, resY := uiman.GetResolution()\n\t\ty = float64(resY) - y\n\n\t\tlastDeltaX = x - lastMouseX\n\t\tlastDeltaY = y - lastMouseY\n\t\tlastMouseX = x\n\t\tlastMouseY = y\n\t\tneedsMousePosCheck = false\n\t\treturn float32(x), float32(y)\n\t}\n\n\tuiman.GetMousePositionDelta = func() (float32, float32) {\n\t\t// test to see if we polled the delta this frame\n\t\tif needsMousePosCheck {\n\t\t\t// if not, then update the location data\n\t\t\tuiman.GetMousePosition()\n\t\t}\n\t\treturn float32(lastDeltaX), float32(lastDeltaY)\n\t}\n\n\tconst doubleClickThreshold = 0.5 // seconds\n\tmouseButtonTracker := make(map[int]mouseButtonData)\n\n\tuiman.GetMouseButtonAction = func(button int) int {\n\t\tvar action int\n\t\tvar mbData mouseButtonData\n\t\tvar tracked bool\n\n\t\t// get the mouse button data and return the stale result if we're\n\t\t// in the same frame.\n\t\tmbData, tracked = mouseButtonTracker[button]\n\t\tif tracked == true && mbData.lastCheckedAt == uiman.FrameStart {\n\t\t\treturn mbData.lastAction\n\t\t}\n\n\t\t// poll the button action\n\t\tglfwAction := window.GetMouseButton(glfw.MouseButton(int(glfw.MouseButton1) + button))\n\t\tif glfwAction == glfw.Release {\n\t\t\taction = gui.MouseUp\n\t\t} else if glfwAction == glfw.Press {\n\t\t\taction = gui.MouseDown\n\t\t} else if glfwAction == glfw.Repeat {\n\t\t\taction = gui.MouseDown\n\t\t}\n\n\t\t// see if we're tracking this button yet\n\t\tif tracked == false {\n\t\t\t// create a new mouse button tracker data object\n\t\t\tif action == gui.MouseDown {\n\t\t\t\tmx, my := uiman.GetMousePosition()\n\t\t\t\tmbData.lastPressLocation = mgl.Vec2{mx, my}\n\t\t\t\tmbData.lastPress = uiman.FrameStart\n\t\t\t} else {\n\t\t\t\tmbData.lastPress = time.Unix(0, 0)\n\t\t\t}\n\t\t} else {\n\t\t\tif action == gui.MouseDown {\n\t\t\t\t// check to see if there was a transition from UP to DOWN\n\t\t\t\tif mbData.lastAction == gui.MouseUp {\n\t\t\t\t\t// check to see the time between the last UP->DOWN transition\n\t\t\t\t\t// and this one. If it's less than the double click threshold\n\t\t\t\t\t// then change the doubleClickDetected member so that the\n\t\t\t\t\t// next DOWN->UP will return a double click instead.\n\t\t\t\t\tif uiman.FrameStart.Sub(mbData.lastPress).Seconds() < doubleClickThreshold {\n\t\t\t\t\t\tmbData.doubleClickDetected = true\n\t\t\t\t\t}\n\n\t\t\t\t\t// count this as a press and log the time\n\t\t\t\t\tmx, my := uiman.GetMousePosition()\n\t\t\t\t\tmbData.lastPressLocation = mgl.Vec2{mx, my}\n\t\t\t\t\tmbData.lastPress = uiman.FrameStart\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// check to see if there was a transition from DOWN to UP\n\t\t\t\tif mbData.lastAction == gui.MouseDown {\n\t\t\t\t\tif mbData.doubleClickDetected {\n\t\t\t\t\t\t// return the double click\n\t\t\t\t\t\taction = gui.MouseDoubleClick\n\n\t\t\t\t\t\t// reset the tracker\n\t\t\t\t\t\tmbData.doubleClickDetected = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// return the single click\n\t\t\t\t\t\taction = gui.MouseClick\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// put the updated data back into the map and return the action\n\t\tmbData.lastAction = action\n\t\tmbData.lastCheckedAt = uiman.FrameStart\n\t\tmouseButtonTracker[button] = mbData\n\t\treturn action\n\t}\n\n\tuiman.ClearMouseButtonAction = func(buttonNumber int) {\n\t\t// get the mouse button data and return the stale result if we're\n\t\t// in the same frame.\n\t\tmbData, tracked := mouseButtonTracker[buttonNumber]\n\t\tif tracked == true {\n\t\t\tmbData.lastAction = gui.MouseUp\n\t\t\tmbData.doubleClickDetected = false\n\t\t\tmouseButtonTracker[buttonNumber] = mbData\n\t\t}\n\t}\n\n\tuiman.GetMouseDownPosition = func(button int) (float32, float32) {\n\t\t// test to see if we polled the delta this frame\n\t\tif needsMousePosCheck {\n\t\t\t// if not, then update the location data\n\t\t\tuiman.GetMousePosition()\n\t\t}\n\n\t\t// is the mouse button down?\n\t\tif uiman.GetMouseButtonAction(button) != gui.MouseUp {\n\t\t\tvar tracked bool\n\t\t\tvar mbData mouseButtonData\n\n\t\t\t// get the mouse button data and return the stale result if we're\n\t\t\t// in the same frame.\n\t\t\tmbData, tracked = mouseButtonTracker[button]\n\t\t\tif tracked == true {\n\t\t\t\treturn mbData.lastPressLocation[0], mbData.lastPressLocation[1]\n\t\t\t}\n\t\t}\n\n\t\t// mouse not down or not tracked.\n\t\treturn -1.0, -1.0\n\t}\n\n\tscrollWheelDelta := float32(0.0)\n\tscrollWheelCache := float32(0.0)\n\tuiman.GetScrollWheelDelta = func(useCached bool) float32 {\n\t\tif useCached {\n\t\t\treturn scrollWheelCache\n\t\t}\n\t\tscrollWheelCache = scrollWheelDelta\n\t\tscrollWheelDelta = 0.0\n\t\treturn scrollWheelCache\n\t}\n\n\t// create our own handler for the scroll wheel which then passes the\n\t// correct data to our own scroll wheel handler function\n\twindow.SetScrollCallback(func(w *glfw.Window, xoff float64, yoff float64) {\n\t\tscrollWheelDelta += float32(yoff) * uiman.ScrollSpeed\n\t})\n\n\t// stores all of the key press events\n\tkeyBuffer := []gui.KeyPressEvent{}\n\n\t// make a translation table from GLFW->EweyGewey key codes\n\tkeyTranslation := make(map[glfw.Key]int)\n\tkeyTranslation[glfw.KeyWorld1] = gui.EweyKeyWorld1\n\tkeyTranslation[glfw.KeyWorld2] = gui.EweyKeyWorld2\n\tkeyTranslation[glfw.KeyEscape] = gui.EweyKeyEscape\n\tkeyTranslation[glfw.KeyEnter] = gui.EweyKeyEnter\n\tkeyTranslation[glfw.KeyTab] = gui.EweyKeyTab\n\tkeyTranslation[glfw.KeyBackspace] = gui.EweyKeyBackspace\n\tkeyTranslation[glfw.KeyInsert] = gui.EweyKeyInsert\n\tkeyTranslation[glfw.KeyDelete] = gui.EweyKeyDelete\n\tkeyTranslation[glfw.KeyRight] = gui.EweyKeyRight\n\tkeyTranslation[glfw.KeyLeft] = gui.EweyKeyLeft\n\tkeyTranslation[glfw.KeyDown] = gui.EweyKeyDown\n\tkeyTranslation[glfw.KeyUp] = gui.EweyKeyUp\n\tkeyTranslation[glfw.KeyPageUp] = gui.EweyKeyPageUp\n\tkeyTranslation[glfw.KeyPageDown] = gui.EweyKeyPageDown\n\tkeyTranslation[glfw.KeyHome] = gui.EweyKeyHome\n\tkeyTranslation[glfw.KeyEnd] = gui.EweyKeyEnd\n\tkeyTranslation[glfw.KeyCapsLock] = gui.EweyKeyCapsLock\n\tkeyTranslation[glfw.KeyNumLock] = gui.EweyKeyNumLock\n\tkeyTranslation[glfw.KeyPrintScreen] = gui.EweyKeyPrintScreen\n\tkeyTranslation[glfw.KeyPause] = gui.EweyKeyPause\n\tkeyTranslation[glfw.KeyF1] = gui.EweyKeyF1\n\tkeyTranslation[glfw.KeyF2] = gui.EweyKeyF2\n\tkeyTranslation[glfw.KeyF3] = gui.EweyKeyF3\n\tkeyTranslation[glfw.KeyF4] = gui.EweyKeyF4\n\tkeyTranslation[glfw.KeyF5] = gui.EweyKeyF5\n\tkeyTranslation[glfw.KeyF6] = gui.EweyKeyF6\n\tkeyTranslation[glfw.KeyF7] = gui.EweyKeyF7\n\tkeyTranslation[glfw.KeyF8] = gui.EweyKeyF8\n\tkeyTranslation[glfw.KeyF9] = gui.EweyKeyF9\n\tkeyTranslation[glfw.KeyF10] = gui.EweyKeyF10\n\tkeyTranslation[glfw.KeyF11] = gui.EweyKeyF11\n\tkeyTranslation[glfw.KeyF12] = gui.EweyKeyF12\n\tkeyTranslation[glfw.KeyF13] = gui.EweyKeyF13\n\tkeyTranslation[glfw.KeyF14] = gui.EweyKeyF14\n\tkeyTranslation[glfw.KeyF15] = gui.EweyKeyF15\n\tkeyTranslation[glfw.KeyF16] = gui.EweyKeyF16\n\tkeyTranslation[glfw.KeyF17] = gui.EweyKeyF17\n\tkeyTranslation[glfw.KeyF18] = gui.EweyKeyF18\n\tkeyTranslation[glfw.KeyF19] = gui.EweyKeyF19\n\tkeyTranslation[glfw.KeyF20] = gui.EweyKeyF20\n\tkeyTranslation[glfw.KeyF21] = gui.EweyKeyF21\n\tkeyTranslation[glfw.KeyF22] = gui.EweyKeyF22\n\tkeyTranslation[glfw.KeyF23] = gui.EweyKeyF23\n\tkeyTranslation[glfw.KeyF24] = gui.EweyKeyF24\n\tkeyTranslation[glfw.KeyF25] = gui.EweyKeyF25\n\tkeyTranslation[glfw.KeyLeftShift] = gui.EweyKeyLeftShift\n\tkeyTranslation[glfw.KeyLeftAlt] = gui.EweyKeyLeftAlt\n\tkeyTranslation[glfw.KeyLeftControl] = gui.EweyKeyLeftControl\n\tkeyTranslation[glfw.KeyLeftSuper] = gui.EweyKeyLeftSuper\n\tkeyTranslation[glfw.KeyRightShift] = gui.EweyKeyRightShift\n\tkeyTranslation[glfw.KeyRightAlt] = gui.EweyKeyRightAlt\n\tkeyTranslation[glfw.KeyRightControl] = gui.EweyKeyRightControl\n\tkeyTranslation[glfw.KeyRightSuper] = gui.EweyKeyRightSuper\n\n\t//keyTranslation[glfw.Key] = gui.EweyKey\n\n\t// create our own handler for key input so that it can buffer the keys\n\t// and then consume them in an edit box or whatever widget has focus.\n\tvar prevKeyCallback glfw.KeyCallback\n\tvar prevCharModsCallback glfw.CharModsCallback\n\tprevKeyCallback = window.SetKeyCallback(func(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey) {\n\t\tif action != glfw.Press && action != glfw.Repeat {\n\t\t\treturn\n\t\t}\n\n\t\t// we have a new event, so init the structure\n\t\tvar kpe gui.KeyPressEvent\n\n\t\t// try to look it up in the translation table; if it exists, then we log\n\t\t// the event; if it doesn't exist, then we assume it will be caught by\n\t\t// the CharMods callback.\n\t\tcode, okay := keyTranslation[key]\n\t\tif okay == false {\n\t\t\t// there are some exceptions to this that will get implemented here.\n\t\t\t// when ctrl is held down, it doesn't appear that runes get sent\n\t\t\t// through the CharModsCallback function, so we must handle the\n\t\t\t// ones we want here.\n\t\t\tif (key == glfw.KeyV) && (mods&glfw.ModControl == glfw.ModControl) {\n\t\t\t\tkpe.Rune = 'V'\n\t\t\t\tkpe.IsRune = true\n\t\t\t\tkpe.CtrlDown = true\n\t\t\t} else {\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tkpe.KeyCode = code\n\n\t\t\t// set the modifier flags\n\t\t\tif mods&glfw.ModShift == glfw.ModShift {\n\t\t\t\tkpe.ShiftDown = true\n\t\t\t}\n\t\t\tif mods&glfw.ModAlt == glfw.ModAlt {\n\t\t\t\tkpe.AltDown = true\n\t\t\t}\n\t\t\tif mods&glfw.ModControl == glfw.ModControl {\n\t\t\t\tkpe.CtrlDown = true\n\t\t\t}\n\t\t\tif mods&glfw.ModSuper == glfw.ModSuper {\n\t\t\t\tkpe.SuperDown = true\n\t\t\t}\n\t\t}\n\n\t\t// add it to the keys that have been buffered\n\t\tkeyBuffer = append(keyBuffer, kpe)\n\n\t\t// if there was a pre-existing callback, we'll chain it here\n\t\tif prevKeyCallback != nil {\n\t\t\tprevKeyCallback(w, key, scancode, action, mods)\n\t\t}\n\t})\n\n\twindow.SetCharModsCallback(func(w *glfw.Window, char rune, mods glfw.ModifierKey) {\n\t\tvar kpe gui.KeyPressEvent\n\t\t//fmt.Printf(\"SetCharModsCallback Rune: %v | mods:%v | ctrl: %v\\n\", char, mods, mods&glfw.ModControl)\n\n\t\t// set the character\n\t\tkpe.Rune = char\n\t\tkpe.IsRune = true\n\n\t\t// set the modifier flags\n\t\tif mods&glfw.ModShift == glfw.ModShift {\n\t\t\tkpe.ShiftDown = true\n\t\t}\n\t\tif mods&glfw.ModAlt == glfw.ModAlt {\n\t\t\tkpe.AltDown = true\n\t\t}\n\t\tif mods&glfw.ModControl == glfw.ModControl {\n\t\t\tkpe.CtrlDown = true\n\t\t}\n\t\tif mods&glfw.ModSuper == glfw.ModSuper {\n\t\t\tkpe.SuperDown = true\n\t\t}\n\n\t\t// add it to the keys that have been buffered\n\t\tkeyBuffer = append(keyBuffer, kpe)\n\n\t\t// if there was a pre-existing callback, we'll chain it here\n\t\tif prevCharModsCallback != nil {\n\t\t\tprevCharModsCallback(w, char, mods)\n\t\t}\n\t})\n\n\tuiman.GetKeyEvents = func() []gui.KeyPressEvent {\n\t\treturnVal := keyBuffer\n\t\tkeyBuffer = keyBuffer[:0]\n\t\treturn returnVal\n\t}\n\n\tuiman.ClearKeyEvents = func() {\n\t\tkeyBuffer = keyBuffer[:0]\n\t}\n\n\tuiman.GetClipboardString = func() (string, error) {\n\t\treturn window.GetClipboardString()\n\t}\n\n\tuiman.SetClipboardString = func(clippy string) {\n\t\twindow.SetClipboardString(clippy)\n\t}\n}", "func (mr *MockUnsignedTxMockRecorder) InputIDs() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"InputIDs\", reflect.TypeOf((*MockUnsignedTx)(nil).InputIDs))\n}", "func (s *State) PeekKeyPresses() []Key {\n\treturn s.keyPresses\n}", "func (fieldMask *Ping_FieldMask) FilterInputFields() *Ping_FieldMask {\n\tresult := &Ping_FieldMask{}\n\tresult.Paths = append(result.Paths, fieldMask.Paths...)\n\treturn result\n}", "func (o *SdwanRouterNode) GetTemplateInputs() []SdwanTemplateInputsType {\n\tif o == nil {\n\t\tvar ret []SdwanTemplateInputsType\n\t\treturn ret\n\t}\n\treturn o.TemplateInputs\n}", "func (fieldMask *ListServicesRequest_FieldMask) FilterInputFields() *ListServicesRequest_FieldMask {\n\tresult := &ListServicesRequest_FieldMask{}\n\tresult.Paths = append(result.Paths, fieldMask.Paths...)\n\treturn result\n}", "func parseInputs() inputs {\n\txdrPtr := flag.String(\"xdr\", \"\", \"base-64 encoded XDR to be signed\")\n\tflag.Parse()\n\n\tif *xdrPtr == \"\" {\n\t\tfmt.Println(\"Params:\")\n\t\tflag.PrintDefaults()\n\t\tos.Exit(1)\n\t}\n\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Printf(\"Enter secret key: \")\n\tsecret, e := terminal.ReadPassword(0)\n\tif e != nil {\n\t\tlog.Fatal(e)\n\t}\n\tfmt.Println()\n\tfmt.Printf(\"Which network (t/p)? [t]: \")\n\tnetworkChoice, _ := reader.ReadString('\\n')\n\tnetworkChoice = strings.Replace(networkChoice, \"\\n\", \"\", -1)\n\tnetwork := b.TestNetwork\n\tif networkChoice == \"p\" {\n\t\tnetwork = b.PublicNetwork\n\t}\n\n\treturn inputs{\n\t\txdr: *xdrPtr,\n\t\tsecretKey: string(secret),\n\t\tnetwork: network,\n\t}\n}", "func (fieldMask *BatchGetServicesResponse_FieldMask) FilterInputFields() *BatchGetServicesResponse_FieldMask {\n\tresult := &BatchGetServicesResponse_FieldMask{}\n\tfor _, path := range fieldMask.Paths {\n\t\tswitch path.Selector() {\n\t\tcase BatchGetServicesResponse_FieldPathSelectorServices:\n\t\t\tif _, ok := path.(*BatchGetServicesResponse_FieldTerminalPath); ok {\n\t\t\t\tfor _, subpath := range service.FullService_FieldMask().FilterInputFields().Paths {\n\t\t\t\t\tresult.Paths = append(result.Paths, &BatchGetServicesResponse_FieldSubPath{selector: path.Selector(), subPath: subpath})\n\t\t\t\t}\n\t\t\t} else if sub, ok := path.(*BatchGetServicesResponse_FieldSubPath); ok {\n\t\t\t\tselectedMask := &service.Service_FieldMask{\n\t\t\t\t\tPaths: []service.Service_FieldPath{sub.subPath.(service.Service_FieldPath)},\n\t\t\t\t}\n\t\t\t\tfor _, allowedPath := range selectedMask.FilterInputFields().Paths {\n\t\t\t\t\tresult.Paths = append(result.Paths, &BatchGetServicesResponse_FieldSubPath{selector: BatchGetServicesResponse_FieldPathSelectorServices, subPath: allowedPath})\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tresult.Paths = append(result.Paths, path)\n\t\t}\n\t}\n\treturn result\n}", "func (dev *InputDevice) Read() ([]InputEvent, error) {\n\tevents := make([]InputEvent, 16)\n\tbuffer := make([]byte, eventsize*16)\n\n\t_, err := dev.File.Read(buffer)\n\tif err != nil {\n\t\treturn events, err\n\t}\n\n\tb := bytes.NewBuffer(buffer)\n\terr = binary.Read(b, binary.LittleEndian, &events)\n\tif err != nil {\n\t\treturn events, err\n\t}\n\n\t// remove trailing structures\n\tfor i := range events {\n\t\tif events[i].Time.Sec == 0 {\n\t\t\tevents = append(events[:i])\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn events, err\n}", "func (*ListInputsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{56}\n}", "func (o LookupPipelineResultOutput) InputParameters() PipelineParameterResponseArrayOutput {\n\treturn o.ApplyT(func(v LookupPipelineResult) []PipelineParameterResponse { return v.InputParameters }).(PipelineParameterResponseArrayOutput)\n}", "func (g *GPIOControllerPCF8574T) IsInput(index int) bool {\n\tif index < 0 || index > pinCount {\n\t\tfmt.Printf(\"Input out of range for gpio: %d\", index)\n\t\treturn false\n\t}\n\n\treturn false\n}", "func (u *Utils) ResolveInputs(inputs []utxo.Input) (outputIDs utxo.OutputIDs) {\n\treturn utxo.NewOutputIDs(lo.Map(inputs, u.ledger.optsVM.ResolveInput)...)\n}" ]
[ "0.578537", "0.56019944", "0.5526558", "0.5326901", "0.5323163", "0.526997", "0.52457935", "0.5199477", "0.51006323", "0.4995746", "0.49824342", "0.49802265", "0.4964477", "0.49603242", "0.49432772", "0.49405253", "0.49357888", "0.49195454", "0.49129304", "0.489958", "0.48833075", "0.48802903", "0.48707232", "0.48377573", "0.48290625", "0.48169184", "0.48140022", "0.47967717", "0.47748274", "0.47426754", "0.47268632", "0.471605", "0.4710817", "0.4687131", "0.46746475", "0.46611437", "0.46570846", "0.46481058", "0.46447814", "0.46366122", "0.4610017", "0.46063492", "0.45973453", "0.45921093", "0.4568064", "0.45659137", "0.4561015", "0.45511487", "0.4537284", "0.45218125", "0.45140657", "0.4497764", "0.44941473", "0.44762808", "0.44694075", "0.44638485", "0.44235173", "0.44126064", "0.4402424", "0.4398342", "0.439386", "0.4388033", "0.4381132", "0.4379895", "0.43797073", "0.43672752", "0.43526524", "0.43482843", "0.43444166", "0.43441147", "0.43387625", "0.43280602", "0.43216094", "0.43182573", "0.4308963", "0.4303767", "0.4299016", "0.42972144", "0.42968124", "0.42965528", "0.4277125", "0.42768678", "0.427573", "0.42553112", "0.42539856", "0.42499983", "0.42431822", "0.42425388", "0.4240983", "0.42404643", "0.42364827", "0.42278537", "0.42270166", "0.42226857", "0.4220856", "0.42170435", "0.4210983", "0.42107445", "0.42099693", "0.4208292" ]
0.5541753
2
New provides module instacne
func New() bot.Module { return &module{ servers: make(map[string]*server), m: &sync.Mutex{}, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func init() {\n\tmodules.Register(\"k6/x/mllp\", new(MLLP))\n}", "func New(cfg Config) Module { return Module{Factory: cfg} }", "func newModule(name string, methods map[string]RubyMethod, outerEnv Environment) *Module {\n\tif methods == nil {\n\t\tmethods = make(map[string]RubyMethod)\n\t}\n\treturn &Module{\n\t\tname: name,\n\t\tclass: newEigenclass(moduleClass, methods),\n\t\tEnvironment: NewEnclosedEnvironment(outerEnv),\n\t}\n}", "func newModule(base mb.BaseModule) (mb.Module, error) {\n\t// Validate that at least one host has been specified.\n\tconfig := struct {\n\t\tHosts []string `config:\"hosts\" validate:\"nonzero,required\"`\n\t}{}\n\tif err := base.UnpackConfig(&config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &base, nil\n}", "func init() {\n\tmodules.Register(\"k6/x/tlstcp\", New())\n}", "func init() {\n\tmodules.Register(\"k6/x/faker\", New())\n}", "func createModule(mi *internal.ModuleInfo, licmetas []*licenses.Metadata, latestRequested bool) *Module {\n\turlVersion := linkVersion(mi.Version, mi.ModulePath)\n\tif latestRequested {\n\t\turlVersion = internal.LatestVersion\n\t}\n\treturn &Module{\n\t\tDisplayVersion: displayVersion(mi.Version, mi.ModulePath),\n\t\tLinkVersion: linkVersion(mi.Version, mi.ModulePath),\n\t\tModulePath: mi.ModulePath,\n\t\tCommitTime: absoluteTime(mi.CommitTime),\n\t\tIsRedistributable: mi.IsRedistributable,\n\t\tLicenses: transformLicenseMetadata(licmetas),\n\t\tURL: constructModuleURL(mi.ModulePath, urlVersion),\n\t\tLatestURL: constructModuleURL(mi.ModulePath, middleware.LatestMinorVersionPlaceholder),\n\t}\n}", "func init() {\n\tmodules.Register(\"k6/x/memcached\", new(Memcached))\n}", "func newModule(moduleName, name string, vrf *VrfInfo) Module {\n\tfactory, found := moduleFactories[moduleName]\n\tif !found {\n\t\tLogger.Printf(\"Module '%s' doesn't exist.\\n\", moduleName)\n\t\treturn nil\n\t}\n\n\trp, ok := ringParams[name]\n\tif !ok {\n\t\trp = defaultRingParam\n\t}\n\trp.Flags = dpdk.RING_F_SC_DEQ\n\n\t// Create a parameter for the module\n\tmodType := moduleTypes[moduleName]\n\tparam := &ModuleParam{\n\t\tt: modType,\n\t\tname: name,\n\t\tvrf: vrf,\n\t\trp: rp,\n\t\tvrp: rp,\n\t\trules: newRules(),\n\t}\n\n\tswitch modType {\n\tcase TypeVif:\n\t\tparam.vif = newVif()\n\tcase TypeBridge:\n\t\tparam.bridge = newBridge()\n\tdefault:\n\t\t// nop\n\t}\n\n\tmodule, err := factory(param)\n\tif err != nil {\n\t\tLogger.Printf(\"Creating module '%s' with name '%s' failed.\\n\", moduleName, name)\n\t\treturn nil\n\t}\n\n\tswitch modType {\n\tcase TypeVif:\n\t\top, ok := module.(VifOp)\n\t\tif !ok {\n\t\t\tLogger.Fatalf(\"'%s' doesn't conform to VifModule interface!\\n\", moduleName)\n\t\t\tbreak\n\t\t}\n\t\tms, _ := module.(ModuleService)\n\t\tparam.vif.config(op, ms)\n\n\tdefault:\n\t\t// nop\n\t}\n\n\tmodules = append(modules, module)\n\n\treturn module\n}", "func init() {\n\tpolochon.RegisterModule(&Guessit{})\n}", "func newInstance(moduleName, name string, priv interface{}) (*BaseInstance, error) {\n\tm, found := modules[moduleName]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"No such module: %s\", moduleName)\n\t}\n\n\tif _, exists := m.instance[name]; exists {\n\t\treturn nil, fmt.Errorf(\"%s already exists in %s\", name, moduleName)\n\t}\n\n\tbi := &BaseInstance{name: name, module: m, subinstance: false}\n\n\tringName := fmt.Sprintf(\"input-%s\", name)\n\tbi.input = dpdk.RingCreate(ringName, m.ringParam.Count, m.ringParam.SocketId, dpdk.RING_F_SC_DEQ)\n\tif bi.input == nil {\n\t\treturn nil, fmt.Errorf(\"Input ring creation faild for %s.\\n\", name)\n\t}\n\n\tif m.ringParam.SecondaryInput {\n\t\tringName := fmt.Sprintf(\"input2-%s\", name)\n\t\tbi.input2 = dpdk.RingCreate(ringName, m.ringParam.Count, m.ringParam.SocketId, dpdk.RING_F_SC_DEQ)\n\t\tif bi.input2 == nil {\n\t\t\treturn nil, fmt.Errorf(\"Second input ring creation failed for %s\", name)\n\t\t}\n\t}\n\n\tbi.rules = newRules()\n\n\tif m.moduleType == TypeInterface || m.moduleType == TypeRIF {\n\t\tbi.counter = NewCounter()\n\t}\n\n\tinstance, err := m.factory(bi, priv)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Creating module '%s' with name '%s' failed: %v\\n\", moduleName, name, err)\n\t}\n\tbi.instance = instance\n\n\t// Set rule observer, if the module complies to RulesNotify.\n\tif rn, ok := instance.(RulesNotify); ok {\n\t\tbi.rules.setRulesNotify(rn)\n\t}\n\n\tm.instance[name] = bi\n\n\treturn bi, nil\n}", "func newDotnetModule(srcPath string, containingBuild *Build) (module *DotnetModule, err error) {\n\tif srcPath == \"\" {\n\t\tsrcPath, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &DotnetModule{solutionPath: srcPath, containingBuild: containingBuild, argAndFlags: []string{\"restore\"}}, nil\n}", "func registerModules(){\n\tweb.Register()\t\t//http server.\n\tdevicetwin.Register()\t\n\teventhub.Register()\t\n}", "func init() {\n\tregistry.Add(\"tapo\", NewTapoFromConfig)\n}", "func init() {\n\tsysImpl = &nacl.MojoNaClSystem{}\n}", "func init() {\n\tp, err := New()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tproviders.Register(p)\n}", "func init() {\n\tRegistry.Add(eksinfo.New())\n\tRegistry.Add(vpcinfo.New())\n\tRegistry.Add(iamresourceusage.New())\n}", "func init() {\n\t// Create the gym.wrappers.time_limit Python module\n\twrappersModule := python.PyImport_ImportModule(\"gym.wrappers.\" +\n\t\t\"time_limit\")\n\tdefer wrappersModule.DecRef()\n\tif wrappersModule == nil {\n\t\tif python.PyErr_Occurred() != nil {\n\t\t\tfmt.Println()\n\t\t\tfmt.Println(\"========== Python Error ==========\")\n\t\t\tpython.PyErr_Print()\n\t\t\tfmt.Println(\"==================================\")\n\t\t\tfmt.Println()\n\t\t}\n\t\tpanic(\"init: could not import gym.wrappers.time_limit\")\n\t}\n\ttimeLimitModule = python.PyImport_AddModule(\"gym.wrappers.\" +\n\t\t\"time_limit\")\n\twrappersModule.IncRef()\n}", "func (*TestingKnobs) ModuleTestingKnobs() {}", "func pyInit(datasetName string, dataFile string, epsilon float64) int {\n\n\tsysPath := python.PySys_GetObject(\"path\")\n\tpython.PyList_Insert(sysPath, 0, python.PyString_FromString(\"./\"))\n\t\n\toutLog.Printf(strconv.Itoa(client.id)+\"Importing modules...\")\n\n\t// We currently support creditcard for logreg, and mnist/lfw for pytorch\n\tif useTorch {\n\t\n\t\t// Get all PyTorch related\n\t\tpython.PyList_Insert(sysPath, 0, python.PyString_FromString(torchPath))\n\t \n\t pyTorchModule = python.PyImport_ImportModule(\"client_obj\")\n\n\t\tpyInitFunc = pyTorchModule.GetAttrString(\"init\")\n\t\tpyPrivFunc = pyTorchModule.GetAttrString(\"privateFun\")\n\t\tpyTrainFunc = pyTorchModule.GetAttrString(\"getTestErr\")\n\t\tpyTestFunc = pyTorchModule.GetAttrString(\"getTestErr\")\n\t\tpyRoniFunc = pyTorchModule.GetAttrString(\"roni\")\n\t\tpyNoiseFunc = pyTorchModule.GetAttrString(\"getNoise\")\n\t\tpyAttackFunc = pyTorchModule.GetAttrString(\"get17AttackRate\")\n\n\n\t} else {\n\t\t\n\t\t// Get all others\n\t\tpython.PyList_Insert(sysPath, 0, python.PyString_FromString(codePath))\n\n\t\tpyLogModule = python.PyImport_ImportModule(\"logistic_model\")\n\t\tpyTestModule = python.PyImport_ImportModule(\"logistic_model_test\")\n\t\tpyRoniModule = python.PyImport_ImportModule(\"logistic_validator\")\n\n\t\tpyInitFunc = pyLogModule.GetAttrString(\"init\")\n\t\tpyPrivFunc = pyLogModule.GetAttrString(\"privateFun\")\n\t\tpyNoiseFunc = pyLogModule.GetAttrString(\"getNoise\")\n\t\tpyTrainFunc = pyTestModule.GetAttrString(\"train_error\")\n\t\tpyTestFunc = pyTestModule.GetAttrString(\"test_error\")\n\t\tpyRoniFunc = pyRoniModule.GetAttrString(\"roni\")\n\n\t}\n\t\n\t// If epsilon is 0, this tells python not to pre-sample noise, \n\t// which saves a lot of time and memory\n\tpyNumFeatures = pyInitFunc.CallFunction(python.PyString_FromString(datasetName), \n\t\t\tpython.PyString_FromString(dataFile), python.PyFloat_FromDouble(epsilon),\n\t\t\tpython.PyInt_FromLong(batch_size))\n\n\tnumFeatures := python.PyInt_AsLong(pyNumFeatures)\n\n\toutLog.Printf(strconv.Itoa(client.id)+\"Sucessfully pulled dataset. Features: %d\\n\", numFeatures)\n\n\treturn numFeatures\n\n}", "func init() {\n\t// Create the gym.wrappers.filter_observation Python module\n\twrappersModule := python.PyImport_ImportModule(\"gym.wrappers.\" +\n\t\t\"filter_observation\")\n\tdefer wrappersModule.DecRef()\n\tif wrappersModule == nil {\n\t\tif python.PyErr_Occurred() != nil {\n\t\t\tfmt.Println()\n\t\t\tfmt.Println(\"========== Python Error ==========\")\n\t\t\tpython.PyErr_Print()\n\t\t\tfmt.Println(\"==================================\")\n\t\t\tfmt.Println()\n\t\t}\n\t\tpanic(\"init: could not import gym.wrappers.filter_observation\")\n\t}\n\tfilterObservationModule = python.PyImport_AddModule(\"gym.wrappers.\" +\n\t\t\"filter_observation\")\n\twrappersModule.IncRef()\n}", "func init() {\n\tonet.RegisterNewService(ServiceName, newService)\n\tserviceID = onet.ServiceFactory.ServiceID(ServiceName)\n}", "func init() {\n\t// TODO: set logger\n\t// TODO: register storage plugin to plugin manager\n}", "func init() {\n\tExample_invoke()\n}", "func New(config contract.ConfigAccessor) Module {\n\treturn Module{config: config}\n}", "func init() {\n\tparser.SharedParser().RegisterFabric(UpdateFabric{})\n}", "func New() *module {\n\tif os.Getenv(\"FAIL_MODE\") == \"1\" {\n\t\treturn new(module)\n\t}\n\n\treturn nil\n}", "func init() {\n\t//todo...\n}", "func init() {\n\tAddCommand(\"mds\", \"Check metadata service process\", cmdMds, nil)\n}", "func init() {\n\tmodules := []string{\n\t\t\"https://cdn.jsdelivr.net/npm/geodesy@1/vector3d.js\",\n\t\t\"https://cdn.jsdelivr.net/npm/geodesy@1/dms.js\",\n\t\t\"https://cdn.jsdelivr.net/npm/geodesy@1/latlon-ellipsoidal.js\",\n\t\t\"https://cdn.jsdelivr.net/npm/geodesy@1/osgridref.js\",\n\t}\n\n\tfor _, mod := range modules {\n\t\tresp, err := http.Get(mod)\n\t\tmust(err)\n\t\t_, err = vm.Run(resp.Body)\n\t\tresp.Body.Close()\n\t\tmust(err)\n\t}\n}", "func (this *Motto) AddModule(id string, loader ModuleLoader) {\n this.modules[id] = loader\n}", "func main() {\n\tpgs.Init().RegisterModule(&cMod{&pgs.ModuleBase{}}).Render()\n}", "func init() {\n\taddBuiltinFns(map[string]interface{}{\n\t\t\"nop\": nop,\n\t\t\"kind-of\": kindOf,\n\t\t\"constantly\": constantly,\n\n\t\t// Introspection\n\t\t\"call\": call,\n\t\t\"resolve\": resolve,\n\t\t\"eval\": eval,\n\t\t\"use-mod\": useMod,\n\n\t\t\"deprecate\": deprecate,\n\n\t\t// Time\n\t\t\"sleep\": sleep,\n\t\t\"time\": timeCmd,\n\n\t\t\"-ifaddrs\": _ifaddrs,\n\t})\n\n\t// For rand and randint.\n\trand.Seed(time.Now().UTC().UnixNano())\n}", "func newInstance(moduleName, name string, priv interface{}) (*BaseInstance, error) {\n\tfactory, found := instanceFactories[moduleName]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"Module '%s' doesn't exist.\\n\", moduleName)\n\t}\n\n\trp, ok := ringParams[moduleName]\n\tif !ok {\n\t\trp = defaultRingParam\n\t}\n\n\tbi := &BaseInstance{name: name}\n\n\tringName := fmt.Sprintf(\"input-%s\", name)\n\tbi.input = dpdk.RingCreate(ringName, rp.Count, rp.SocketId, dpdk.RING_F_SC_DEQ)\n\tif bi.input == nil {\n\t\treturn nil, fmt.Errorf(\"Input ring creation faild for %s.\\n\", name)\n\t}\n\n\tif rp.SecondaryInput {\n\t\tringName := fmt.Sprintf(\"input2-%s\", name)\n\t\tbi.input2 = dpdk.RingCreate(ringName, rp.Count, rp.SocketId, dpdk.RING_F_SC_DEQ)\n\t\tif bi.input2 == nil {\n\t\t\treturn nil, fmt.Errorf(\"Second input ring creation failed for %s\", name)\n\t\t}\n\t}\n\n\tbi.rules = newRules()\n\n\tinstance, err := factory(bi, priv)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Creating module '%s' with name '%s' failed: %v\\n\", moduleName, name, err)\n\t}\n\tbi.instance = instance\n\n\treturn bi, nil\n}", "func New(client zbus.Client, root string, containerd string) *Module {\n\tif len(containerd) == 0 {\n\t\tcontainerd = containerdSock\n\t}\n\n\tmodule := &Module{\n\t\tcontainerd: containerd,\n\t\troot: root,\n\t\tclient: client,\n\t\t// values are cached only for 1 minute. purge cache every 20 second\n\t\tfailures: cache.New(time.Minute, 20*time.Second),\n\t}\n\n\tif err := module.startup(); err != nil {\n\t\tlog.Error().Err(err).Msg(\"failed to update containers configurations\")\n\t}\n\n\treturn module\n}", "func Init() (m *Module, err error) {\n\n\t// Instantiate module with parent types and functions.\n\tm = &Module{exploit.New( // Do not touch this line.\n\n\t\t// Module Information\n\t\t&pb.Info{\n\t\t\t// Base information\n\t\t\tName: \"[Vendor][Software][Subject][Vulnerability]\",\n\t\t\tPath: \"test/path/should/not/be/here\",\n\t\t\tAuthors: []string{\"Author 1\", \"Author 2\"},\n\t\t\tCredits: []string{\"Contributor 1\", \"Contributor 2\"},\n\t\t\tDescription: \"This module is an example post module. Fill the details before implementing it.\",\n\t\t\tPriviledged: false,\n\t\t\t// OS/Platform/language\n\t\t\tLanguage: \"Go\",\n\t\t\t// Other\n\t\t\tNotes: \"You can add some notes to this module, whether it be additional references to check or details to care for.\",\n\t\t},\n\t)}\n\n\t// Commands\n\tm.AddCommand(\"exploit\", \"This command triggers the exploit functionality of this module.\", true)\n\tm.AddCommand(\"check\", \"This command checks for one or more vulnerabilities targeted by this module\", false)\n\n\t// Options\n\tm.AddOption(\n\t\t\"RHost\", // The option name (cannot be empty)\n\t\t\"Base\", // The option category name (can be empty), used for pretty printing on consoles.\n\t\t\"192.168.1.1/24\", // If non-empty, this will serve a default value. This field is used for the option value.\n\t\t\"The remote host address to dial\", // Option description\n\t\ttrue, //Is this option required ? If true, the Value field cannot be empty.\n\t)\n\n\treturn\n}", "func registerModules(appState *state.State) error {\n\tappState.Logger.\n\t\tWithField(\"action\", \"startup\").\n\t\tDebug(\"start registering modules\")\n\n\tappState.Modules = modules.NewProvider()\n\n\tenabledModules := map[string]bool{}\n\tif len(appState.ServerConfig.Config.EnableModules) > 0 {\n\t\tmodules := strings.Split(appState.ServerConfig.Config.EnableModules, \",\")\n\t\tfor _, module := range modules {\n\t\t\tenabledModules[strings.TrimSpace(module)] = true\n\t\t}\n\t}\n\n\tif _, ok := enabledModules[\"text2vec-contextionary\"]; ok {\n\t\tappState.Modules.Register(modcontextionary.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"text2vec-contextionary\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"text2vec-transformers\"]; ok {\n\t\tappState.Modules.Register(modtransformers.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"text2vec-transformers\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modgpt4all.Name]; ok {\n\t\tappState.Modules.Register(modgpt4all.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modgpt4all.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modrerankertransformers.Name]; ok {\n\t\tappState.Modules.Register(modrerankertransformers.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modrerankertransformers.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modrerankercohere.Name]; ok {\n\t\tappState.Modules.Register(modrerankercohere.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modrerankercohere.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"qna-transformers\"]; ok {\n\t\tappState.Modules.Register(modqna.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"qna-transformers\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"sum-transformers\"]; ok {\n\t\tappState.Modules.Register(modsum.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"sum-transformers\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"img2vec-neural\"]; ok {\n\t\tappState.Modules.Register(modimage.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"img2vec-neural\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"ner-transformers\"]; ok {\n\t\tappState.Modules.Register(modner.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"ner-transformers\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"text-spellcheck\"]; ok {\n\t\tappState.Modules.Register(modspellcheck.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"text-spellcheck\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"multi2vec-clip\"]; ok {\n\t\tappState.Modules.Register(modclip.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"multi2vec-clip\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"text2vec-openai\"]; ok {\n\t\tappState.Modules.Register(modopenai.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"text2vec-openai\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[\"qna-openai\"]; ok {\n\t\tappState.Modules.Register(modqnaopenai.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", \"qna-openai\").\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modgenerativecohere.Name]; ok {\n\t\tappState.Modules.Register(modgenerativecohere.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modgenerativecohere.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modgenerativeopenai.Name]; ok {\n\t\tappState.Modules.Register(modgenerativeopenai.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modgenerativeopenai.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modhuggingface.Name]; ok {\n\t\tappState.Modules.Register(modhuggingface.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modhuggingface.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modgenerativepalm.Name]; ok {\n\t\tappState.Modules.Register(modgenerativepalm.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modgenerativepalm.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modtext2vecpalm.Name]; ok {\n\t\tappState.Modules.Register(modtext2vecpalm.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modtext2vecpalm.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modstgfs.Name]; ok {\n\t\tappState.Modules.Register(modstgfs.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modstgfs.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modstgs3.Name]; ok {\n\t\tappState.Modules.Register(modstgs3.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modstgs3.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modstggcs.Name]; ok {\n\t\tappState.Modules.Register(modstggcs.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modstggcs.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modstgazure.Name]; ok {\n\t\tappState.Modules.Register(modstgazure.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modstgazure.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modcentroid.Name]; ok {\n\t\tappState.Modules.Register(modcentroid.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modcentroid.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modcohere.Name]; ok {\n\t\tappState.Modules.Register(modcohere.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modcohere.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tif _, ok := enabledModules[modbind.Name]; ok {\n\t\tappState.Modules.Register(modbind.New())\n\t\tappState.Logger.\n\t\t\tWithField(\"action\", \"startup\").\n\t\t\tWithField(\"module\", modbind.Name).\n\t\t\tDebug(\"enabled module\")\n\t}\n\n\tappState.Logger.\n\t\tWithField(\"action\", \"startup\").\n\t\tDebug(\"completed registering modules\")\n\n\treturn nil\n}", "func instanceFromConfig(cfg core.Config, ch1 chan *core.Event, ch2 chan *core.Event, reg core.Registry) (core.Component, error) {\n\n\tmoduleName, ok := cfg[\"module\"].(string)\n\tif !ok {\n\t\tlog.Error(\"Missing 'module' (module name) from configuration\")\n\t\treturn nil, cli.NewExitError(\"Missing 'module' (module name) from configuration\", -3)\n\t}\n\n\tlog.Info(\"Loading \", moduleName)\n\n\tmodConstructor, ok := reg[moduleName]\n\tif !ok {\n\t\tlog.Error(\"Unknown module '\", moduleName, \"'\")\n\t\treturn nil, cli.NewExitError(\"Unknown module '\"+moduleName+\"'\", -4)\n\t}\n\n\tlog.Info(\"Loaded!\")\n\n\treturn modConstructor(ch1, ch2, cfg), nil\n}", "func Init() {\n\t// default ..\n\t// micro health go.micro.api.gin call this function..\n\tModules.Router.POST(\"/\", NoModules)\n\tModules.Router.GET(\"/gin\", NoModules)\n\t// Modules.Router.GET(\"/gin\", NoModules)\n\t// Modules.Router.GET(\"/dbservice\", NoModules)\n\n\t// Examples Begin:micro api --handler=http as proxy, default is rpc .\n\t// Base module router for rest full, Preferences is name of table or tables while Module equals database.\n\t// Call url:curl \"http://localhost:8004/Preferences/GetPreference?user=1\"\n\te := new(examples)\n\t// Init Preferences Server Client\n\te.cl = go_micro_srv_dbservice.NewPreferencesService(conf2.AppConf.SrvName, client.DefaultClient)\n\tModules.Router.GET(\"/Preferences/*action\", e.Preferences)\n\t// Examples End\n\n\t// register other handlers here, each request run in goroutine.\n\n\t// To register others...\n\n\tfmt.Println(\"Modules init finished.\")\n}", "func new() exampleInterface {\n\treturn config{}\n}", "func init() {\n\tPlugin = IntelPlugin{\n\t\tPluginName: \"intel_plugin\",\n\t\tSpecVersion: \"1.0\",\n\t}\n}", "func init() {\n\t// register iac provider\n\tRegisterIacProvider(helm, helmV3, helmDefaultIacVersion, reflect.TypeOf(helmv3.HelmV3{}))\n}", "func init() {\n\tinstance = GetInstance()\n}", "func New(options map[string]string) model.Module {\n\tlog.WithFields(log.Fields{\n\t\t\"id\": ModuleID,\n\t\t\"options\": options,\n\t}).Debug(\"Creating new Module\")\n\tif os.Getenv(\"DOCKER_HOST\") != \"\" && dockerEndpoint != \"unix:///var/run/docker.sock\" { //If default value of tag + env set\n\t\tdockerEndpoint = os.Getenv(\"DOCKER_HOST\")\n\t}\n\tclient, err := docker.NewClient(dockerEndpoint)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"client\": client,\n\t\t\t\"err\": err,\n\t\t}).Warn(\"Failed to create docker client\")\n\t\t//return nil\n\t}\n\treturn &Module{Endpoint: dockerEndpoint, Client: client, event: setListener(client)}\n}", "func NewNEUTRINOAPI() NEUTRINOAPI {\r\n neutrinoAPIClient := new(NEUTRINOAPI_IMPL)\r\n neutrinoAPIClient.config = configuration_pkg.NewCONFIGURATION()\r\n\r\n return neutrinoAPIClient\r\n}", "func NewModule(moduleType string) *app.Command {\n\tdesc := fmt.Sprintf(\"Create a %s module.\", moduleType)\n\tcmd := app.NewCommand(moduleType, desc, func(ctx *app.Context) error {\n\t\targs := &struct {\n\t\t\tGroup string `option:\"group\"`\n\t\t\tArtifact string `option:\"artifact\"`\n\t\t\tPackage string `option:\"package\"`\n\t\t}{}\n\t\tif err := config.Unmarshal(args); err != nil {\n\t\t\treturn app.Fatal(1, err)\n\t\t}\n\n\t\twd, err := os.Getwd()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"acquire work directory failed: %v\", err)\n\t\t}\n\n\t\t// load parent pom\n\t\tp, err := pom.NewPom(filepath.Join(wd, \"pom.xml\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// check args\n\t\tvar name string\n\t\tif len(ctx.Args()) == 0 {\n\t\t\tif p == nil {\n\t\t\t\treturn fmt.Errorf(\"module name is missing\")\n\t\t\t}\n\t\t\tname = fmt.Sprintf(\"%v-%v\", p.GetArtifactID(), moduleType)\n\t\t} else {\n\t\t\tname = ctx.Args()[0]\n\t\t}\n\n\t\t// build template data\n\t\tif args.Group == \"\" && p != nil {\n\t\t\targs.Group = p.GetGroupID()\n\t\t}\n\t\tif args.Group == \"\" {\n\t\t\treturn fmt.Errorf(\"group arg is missing\")\n\t\t}\n\t\tif args.Artifact == \"\" {\n\t\t\targs.Artifact = name\n\t\t}\n\t\tif args.Package == \"\" {\n\t\t\targs.Package = args.Group + \".\" + strings.Replace(args.Artifact, \"-\", \".\", -1)\n\t\t}\n\t\tdata := map[string]string{\n\t\t\t\"Type\": moduleType,\n\t\t\t\"GroupID\": args.Group,\n\t\t\t\"ArtifactID\": args.Artifact,\n\t\t\t\"Package\": args.Package,\n\t\t}\n\n\t\t// check dir exist\n\t\tmoduleDir := filepath.Join(wd, name)\n\t\t_, err = os.Stat(moduleDir)\n\t\tif err == nil {\n\t\t\treturn fmt.Errorf(\"directory already exist: %v\", moduleDir)\n\t\t}\n\n\t\t// create empty dirs\n\t\tvar dirs []string\n\t\tif moduleType == \"web\" {\n\t\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"main\", \"resources\", \"view\"))\n\t\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"main\", \"resources\", \"static\", \"js\"))\n\t\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"main\", \"resources\", \"static\", \"css\"))\n\t\t}\n\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"test\", \"java\"))\n\t\tfile.CreateDir(dirs...)\n\n\t\tfp := func(name string) string {\n\t\t\treturn fmt.Sprintf(\"modules/%s/%s\", moduleType, name)\n\t\t}\n\n\t\t// create files\n\t\tfiles := make(map[string]string)\n\t\tfiles[filepath.Join(moduleDir, \"pom.xml\")] = fp(\"pom.xml\")\n\t\tfiles[filepath.Join(moduleDir, \"src\", \"main\", \"resources\", \"application.yml\")] = fp(\"application.yml\")\n\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"Bootstrap.java\").String()] = fp(\"Bootstrap.java\")\n\t\tswitch moduleType {\n\t\tcase \"service\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"dao\", \"TestDao.java\").String()] = fp(\"TestDao.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"biz\", \"TestBiz.java\").String()] = fp(\"TestBiz.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"entity\", \"TestObject.java\").String()] = fp(\"TestObject.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"impl\", \"TestServiceImpl.java\").String()] = fp(\"TestServiceImpl.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"TestServiceTests.java\").String()] = fp(\"TestServiceTests.java\")\n\t\tcase \"msg\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"handler\", \"TestHandler.java\").String()] = fp(\"TestHandler.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"handler\", \"TestHandlerTests.java\").String()] = fp(\"TestHandlerTests.java\")\n\t\tcase \"task\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"executor\", \"TestExecutor.java\").String()] = fp(\"TestExecutor.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"executor\", \"TestExecutorTests.java\").String()] = fp(\"TestExecutorTests.java\")\n\t\tcase \"web\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"controller\", \"TestController.java\").String()] = fp(\"TestController.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"executor\", \"TestControllerTests.java\").String()] = fp(\"TestControllerTests.java\")\n\t\t}\n\t\tif err = tpl.Execute(files, data); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// modify files\n\t\tif p != nil {\n\t\t\tp.AddModule(args.Artifact)\n\t\t}\n\n\t\tfmt.Println(\"finished.\")\n\t\treturn nil\n\t})\n\tcmd.Flags.Register(flag.Help)\n\tcmd.Flags.String(\"group\", \"g\", \"\", \"group id\")\n\tcmd.Flags.String(\"artifact\", \"a\", \"\", \"artifact id\")\n\tcmd.Flags.String(\"package\", \"p\", \"\", \"package\")\n\treturn cmd\n}", "func createModuleTypeInstance(module string) (interface{}, error) {\n\tmoduleType, ex := modules[module]\n\tif !ex {\n\t\treturn nil, errors.Errorf(\"module %s's moduleType is not found.\", module)\n\t}\n\tcallback, ex := getModuleTypeCallback(moduleType)\n\tif !ex {\n\t\treturn nil, errors.Errorf(\"module %s moduleType %s callback is not exist!\", module, moduleType)\n\t}\n\n\treturn callback.creator(), nil\n}", "func init() {\n\ttypes.AllowUserExec = append(types.AllowUserExec, []byte(Zksync))\n\t//注册合约启用高度\n\ttypes.RegFork(Zksync, InitFork)\n\ttypes.RegExec(Zksync, InitExecutor)\n}", "func Inst() *Torpedo {\n\treturn instance\n}", "func newImporter() importer {\n\tvar imp importer\n\n\timp.Standard = imports{\n\t\tstandard: importList{\n\t\t\t`\"bytes\"`,\n\t\t\t`\"database/sql\"`,\n\t\t\t`\"fmt\"`,\n\t\t\t`\"reflect\"`,\n\t\t\t`\"strings\"`,\n\t\t\t`\"sync\"`,\n\t\t\t`\"time\"`,\n\t\t},\n\t\tthirdParty: importList{\n\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/errors\"`,\n\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/null\"`,\n\t\t\t`\"github.com/lbryio/sqlboiler/boil\"`,\n\t\t\t`\"github.com/lbryio/sqlboiler/queries\"`,\n\t\t\t`\"github.com/lbryio/sqlboiler/queries/qm\"`,\n\t\t\t`\"github.com/lbryio/sqlboiler/strmangle\"`,\n\t\t},\n\t}\n\n\timp.Singleton = mapImports{\n\t\t\"boil_queries\": imports{\n\t\t\tstandard: importList{\n\t\t\t\t`\"fmt\"`,\n\t\t\t\t`\"strings\"`,\n\t\t\t},\n\t\t\tthirdParty: importList{\n\t\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/errors\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/boil\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/queries\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/queries/qm\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/strmangle\"`,\n\t\t\t},\n\t\t},\n\t\t\"boil_types\": {\n\t\t\tthirdParty: importList{\n\t\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/errors\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/strmangle\"`,\n\t\t\t},\n\t\t},\n\t}\n\n\timp.TestStandard = imports{\n\t\tstandard: importList{\n\t\t\t`\"bytes\"`,\n\t\t\t`\"reflect\"`,\n\t\t\t`\"testing\"`,\n\t\t},\n\t\tthirdParty: importList{\n\t\t\t`\"github.com/lbryio/sqlboiler/boil\"`,\n\t\t\t`\"github.com/lbryio/sqlboiler/randomize\"`,\n\t\t\t`\"github.com/lbryio/sqlboiler/strmangle\"`,\n\t\t},\n\t}\n\n\timp.TestSingleton = mapImports{\n\t\t\"boil_main_test\": {\n\t\t\tstandard: importList{\n\t\t\t\t`\"database/sql\"`,\n\t\t\t\t`\"flag\"`,\n\t\t\t\t`\"fmt\"`,\n\t\t\t\t`\"math/rand\"`,\n\t\t\t\t`\"os\"`,\n\t\t\t\t`\"path/filepath\"`,\n\t\t\t\t`\"testing\"`,\n\t\t\t\t`\"time\"`,\n\t\t\t},\n\t\t\tthirdParty: importList{\n\t\t\t\t`\"github.com/kat-co/vala\"`,\n\t\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/errors\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/boil\"`,\n\t\t\t\t`\"github.com/spf13/viper\"`,\n\t\t\t},\n\t\t},\n\t\t\"boil_queries_test\": {\n\t\t\tstandard: importList{\n\t\t\t\t`\"bytes\"`,\n\t\t\t\t`\"fmt\"`,\n\t\t\t\t`\"io\"`,\n\t\t\t\t`\"io/ioutil\"`,\n\t\t\t\t`\"math/rand\"`,\n\t\t\t\t`\"regexp\"`,\n\t\t\t},\n\t\t\tthirdParty: importList{\n\t\t\t\t`\"github.com/lbryio/sqlboiler/boil\"`,\n\t\t\t},\n\t\t},\n\t\t\"boil_suites_test\": {\n\t\t\tstandard: importList{\n\t\t\t\t`\"testing\"`,\n\t\t\t},\n\t\t},\n\t}\n\n\timp.TestMain = mapImports{\n\t\t\"postgres\": {\n\t\t\tstandard: importList{\n\t\t\t\t`\"bytes\"`,\n\t\t\t\t`\"database/sql\"`,\n\t\t\t\t`\"fmt\"`,\n\t\t\t\t`\"io\"`,\n\t\t\t\t`\"io/ioutil\"`,\n\t\t\t\t`\"os\"`,\n\t\t\t\t`\"os/exec\"`,\n\t\t\t\t`\"strings\"`,\n\t\t\t},\n\t\t\tthirdParty: importList{\n\t\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/errors\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/bdb/drivers\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/randomize\"`,\n\t\t\t\t`_ \"github.com/lib/pq\"`,\n\t\t\t\t`\"github.com/spf13/viper\"`,\n\t\t\t},\n\t\t},\n\t\t\"mysql\": {\n\t\t\tstandard: importList{\n\t\t\t\t`\"bytes\"`,\n\t\t\t\t`\"database/sql\"`,\n\t\t\t\t`\"fmt\"`,\n\t\t\t\t`\"io\"`,\n\t\t\t\t`\"io/ioutil\"`,\n\t\t\t\t`\"os\"`,\n\t\t\t\t`\"os/exec\"`,\n\t\t\t\t`\"strings\"`,\n\t\t\t},\n\t\t\tthirdParty: importList{\n\t\t\t\t`_ \"github.com/go-sql-driver/mysql\"`,\n\t\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/errors\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/bdb/drivers\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/randomize\"`,\n\t\t\t\t`\"github.com/spf13/viper\"`,\n\t\t\t},\n\t\t},\n\t\t\"mssql\": {\n\t\t\tstandard: importList{\n\t\t\t\t`\"bytes\"`,\n\t\t\t\t`\"database/sql\"`,\n\t\t\t\t`\"fmt\"`,\n\t\t\t\t`\"os\"`,\n\t\t\t\t`\"os/exec\"`,\n\t\t\t\t`\"strings\"`,\n\t\t\t},\n\t\t\tthirdParty: importList{\n\t\t\t\t`_ \"github.com/denisenkom/go-mssqldb\"`,\n\t\t\t\t`\"github.com/lbryio/lbry.go/v2/extras/errors\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/bdb/drivers\"`,\n\t\t\t\t`\"github.com/lbryio/sqlboiler/randomize\"`,\n\t\t\t\t`\"github.com/spf13/viper\"`,\n\t\t\t},\n\t\t},\n\t}\n\n\t// basedOnType imports are only included in the template output if the\n\t// database requires one of the following special types. Check\n\t// TranslateColumnType to see the type assignments.\n\timp.BasedOnType = mapImports{\n\t\t\"null.Float32\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Float64\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Int\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Int8\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Int16\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Int32\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Int64\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Uint\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Uint8\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Uint16\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Uint32\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Uint64\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.String\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Bool\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Time\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.JSON\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"null.Bytes\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/lbry.go/v2/extras/null\"`},\n\t\t},\n\t\t\"time.Time\": {\n\t\t\tstandard: importList{`\"time\"`},\n\t\t},\n\t\t\"types.JSON\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/sqlboiler/types\"`},\n\t\t},\n\t\t\"types.BytesArray\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/sqlboiler/types\"`},\n\t\t},\n\t\t\"types.Int64Array\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/sqlboiler/types\"`},\n\t\t},\n\t\t\"types.Float64Array\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/sqlboiler/types\"`},\n\t\t},\n\t\t\"types.BoolArray\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/sqlboiler/types\"`},\n\t\t},\n\t\t\"types.StringArray\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/sqlboiler/types\"`},\n\t\t},\n\t\t\"types.Hstore\": {\n\t\t\tthirdParty: importList{`\"github.com/lbryio/sqlboiler/types\"`},\n\t\t},\n\t}\n\n\treturn imp\n}", "func newNomadUtil() (*nomadUtil, error) {\n\treturn &nomadUtil{}, nil\n}", "func (t Test) Module() error {\n\tmg.Deps(t.FixtureContainerImages, t.GenerateExampleModules)\n\treturn sh.RunWithV(ENV, \"go\", \"test\", \"-v\", \"-tags=module_integration\", \"./integration/...\")\n}", "func New(\n\tarmDeployer arm.Deployer,\n\taciClient aciSDK.ContainerGroupsClient,\n) service.Module {\n\treturn &module{\n\t\tserviceManager: &serviceManager{\n\t\t\tarmDeployer: armDeployer,\n\t\t\taciClient: aciClient,\n\t\t},\n\t}\n}", "func New() *Motto {\n return &Motto{otto.New(), make(map[string]ModuleLoader), nil, make(map[string]otto.Value)}\n}", "func init() {\n\tworkflow.Register(Workflow)\n\tactivity.Register(helloworldActivity)\n}", "func NewModule(NameSpace string, service *data.ServiceData) *Module {\n\to := &Module{NameSpace, service}\n\treturn o\n}", "func init() {\n\ti = New()\n}", "func (s *Suite) initModules() error {\n\tfor _, name := range s.config.Modules {\n\t\ts.logger.WithField(\"module\", name).Debug(\"initiating module\")\n\n\t\tcreator, err := modules.GetModule(name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ts.modules[name], err = creator(types.ModuleOpts{\n\t\t\tConfig: s.config.Config,\n\t\t\tLogger: s.logger,\n\t\t\tRand: s.rand,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func NewModule(ptr ModuleT) *Module {\n\treturn &Module{\n\t\tptr: ptr,\n\t\tnumFunctions: -1,\n\t\tnumImports: -1,\n\t}\n}", "func init() {\n\tingestion.Register(config.CONSTRUCTOR_NANO, newPerfProcessor)\n}", "func init() {\n\tcadence.RegisterWorkflow(SampleParallelWorkflow)\n}", "func Init() {\n\t// default :\n\t// micro health go.micro.api.gin call this function.\n\tModules.Router.POST(\"/\", NoModules)\n\tModules.Router.GET(\"/\", NoModules)\n\n\t// Examples Begin:micro api --handler=http as proxy, default is rpc .\n\t// Base module router for rest full, Preferences is name of table or tables while Module equals database.\n\t// Call url:curl \"http://localhost:8004/Preferences/GetPreference?user=1\"\n\te := new( examples )\n\tclient.DefaultClient = client.NewClient( client.Registry(etcdv3.DefaultEtcdRegistry) )\n\te.cl = example.NewPreferencesService(conf.ApiConf.SrvName, client.DefaultClient)\n\tModules.Router.GET(\"/Preferences/*action\", e.Preferences)\n\t// Examples End\n\n\t// register other handlers here, each request run in goroutine.\n\t// To register others...\n\n\tlog.Info(\"Modules init finished.\")\n}", "func New(storage *storage.Storage, execmode bool) ModuleManager {\n\tmm := ModuleManager{}\n\tmm.modules = make(map[string]*shared.Module)\n\n\tmm.storage = storage\n\n\t// set settings\n\tmm.settings.execMode = execmode\n\tlog.Println(mm)\n\treturn mm\n}", "func main() {\n\tConfigurationFilesImplPtr = new(ConfigurationFilesImpl);\n\tArgsInit();\n\tStorageBackendImplPtr = new(ElasticsearchStorageBackendImp);\n\tStorageBackendImplPtr.init(ConfigurationFilesImplPtr);\n\tRestApiImplPtr = new(CyberBullyingEntryPointRestApiImpl);\n\tRestApiImplPtr.init(ConfigurationFilesImplPtr, StorageBackendImplPtr);\n\tRestServerImplPtr = new(RestServer);\n\tRestServerImplPtr.init(ConfigurationFilesImplPtr, RestApiImplPtr.GetApi());\n Run(); \n}", "func newInstance(x *runtime.Runtime, p *build.Instance, v *adt.Vertex) *Instance {\n\t// TODO: associate root source with structLit.\n\tinst := &Instance{\n\t\troot: v,\n\t\tinst: p,\n\t}\n\tif p != nil {\n\t\tinst.ImportPath = p.ImportPath\n\t\tinst.Dir = p.Dir\n\t\tinst.PkgName = p.PkgName\n\t\tinst.DisplayName = p.ImportPath\n\t\tif p.Err != nil {\n\t\t\tinst.setListOrError(p.Err)\n\t\t}\n\t}\n\n\tx.AddInst(p.ImportPath, v, p)\n\tx.SetBuildData(p, inst)\n\tinst.index = x\n\treturn inst\n}", "func init() {\n\tcallbacks = make(map[ModuleType]*ConfigCallback, 8)\n\tmodules = make(map[string]ModuleType, 32)\n}", "func NewModule(mid uint8, acts ...IAction) IModule {\n\tmodActions := make(map[uint8]IAction, len(acts))\n\tfor _, v := range acts {\n\t\tmodActions[v.GetAID()] = v\n\t}\n\treturn &baseModule{mid: mid, actions: modActions}\n}", "func init() {\n\tRegisterTSDSDBEngine(\"namespace\", new(Namespace))\n}", "func (p *postProcessor) InitializeNewModules(manifest map[string]ManifestEntry) error {\n\tlog.Println(\"checking for new modules and clients\")\n\tfor _, moduleName := range p.config.Modules {\n\t\tmodulePath := filepath.Join(p.googleCloudDir, moduleName)\n\t\timportPath := filepath.Join(\"cloud.google.com/go\", moduleName)\n\n\t\tpathToModVersionFile := filepath.Join(modulePath, \"internal/version.go\")\n\t\t// Check if <module>/internal/version.go file exists\n\t\tif _, err := os.Stat(pathToModVersionFile); errors.Is(err, fs.ErrNotExist) {\n\t\t\tlog.Println(\"detected missing file: \", pathToModVersionFile)\n\t\t\tvar serviceImportPath string\n\t\t\tfor _, v := range p.config.GapicImportPaths() {\n\t\t\t\tif strings.Contains(v, importPath) {\n\t\t\t\t\tserviceImportPath = v\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif serviceImportPath == \"\" {\n\t\t\t\treturn fmt.Errorf(\"no config found for module %s. Cannot generate min required files\", importPath)\n\t\t\t}\n\t\t\t// serviceImportPath here should be a valid ImportPath from a MicrogenGapicConfigs\n\t\t\tapiName := manifest[serviceImportPath].Description\n\t\t\tif err := p.generateMinReqFilesNewMod(moduleName, modulePath, importPath, apiName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := p.modEditReplaceInSnippets(modulePath, importPath); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// Check if version.go files exist for each client\n\t\terr := filepath.WalkDir(modulePath, func(path string, d fs.DirEntry, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !d.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tsplitPath := strings.Split(path, \"/\")\n\t\t\tlastElement := splitPath[len(splitPath)-1]\n\t\t\tif !strings.Contains(lastElement, \"apiv\") {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\t// Skip unless the presence of doc.go indicates that this is a client.\n\t\t\t// Some modules contain only type protos, and don't need version.go.\n\t\t\tpathToClientDocFile := filepath.Join(path, \"doc.go\")\n\t\t\tif _, err = os.Stat(pathToClientDocFile); errors.Is(err, fs.ErrNotExist) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tpathToClientVersionFile := filepath.Join(path, \"version.go\")\n\t\t\tif _, err = os.Stat(pathToClientVersionFile); errors.Is(err, fs.ErrNotExist) {\n\t\t\t\tif err := p.generateVersionFile(moduleName, path); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func NewModule(ptr ModuleT) *Module {\n\treturn &Module{\n\t\tptr: ptr,\n\t\tnumFunctions: -1,\n\t}\n}", "func init() {\n\ttypes.AllowUserExec = append(types.AllowUserExec, []byte(ExchangeX))\n\t//注册合约启用高度\n\ttypes.RegFork(ExchangeX, InitFork)\n\ttypes.RegExec(ExchangeX, InitExecutor)\n}", "func (m *Meta) moduleInstaller() *initwd.ModuleInstaller {\n\treg := m.registryClient()\n\treturn initwd.NewModuleInstaller(m.modulesDir(), reg)\n}", "func New() *dpms.Module {\n\treturn dpms.New(&provider{})\n}", "func New() *Module {\n\tconstruct()\n\tm := new(Module)\n\tl.Register(m, \"outputFunc\")\n\tm.Output(defaultOutput)\n\treturn m\n}", "func init() {\n\ttypes.AllowUserExec = append(types.AllowUserExec, []byte(AccountmanagerX))\n\t//注册合约启用高度\n\ttypes.RegFork(AccountmanagerX, InitFork)\n\ttypes.RegExec(AccountmanagerX, InitExecutor)\n}", "func NewModule(name string, outerEnv Environment) *Module {\n\tmethods := make(map[string]RubyMethod)\n\treturn newModule(name, methods, outerEnv)\n}", "func makeModule(ed *Editor) eval.Namespace {\n\tns := eval.Namespace{}\n\t// Populate builtins.\n\tfor _, b := range builtins {\n\t\tns[eval.FnPrefix+b.name] = eval.NewPtrVariable(&EditBuiltin{b, ed})\n\t}\n\t// Populate binding tables in the variable $binding.\n\t// TODO Make binding specific to the Editor.\n\tbinding := map[eval.Value]eval.Value{\n\t\teval.String(\"insert\"): BindingTable{keyBindings[modeInsert]},\n\t\teval.String(\"command\"): BindingTable{keyBindings[modeCommand]},\n\t\teval.String(\"completion\"): BindingTable{keyBindings[modeCompletion]},\n\t\teval.String(\"navigation\"): BindingTable{keyBindings[modeNavigation]},\n\t\teval.String(\"history\"): BindingTable{keyBindings[modeHistory]},\n\t}\n\tns[\"binding\"] = eval.NewPtrVariable(eval.NewMap(binding))\n\n\treturn ns\n}", "func init() {\n\tvar p vm.Provider = &Provider{}\n\tif _, err := exec.LookPath(\"gcloud\"); err != nil {\n\t\tp = flagstub.New(p, \"please install the gcloud CLI utilities \"+\n\t\t\t\"(https://cloud.google.com/sdk/downloads)\")\n\t} else {\n\t\tgceP := makeProvider()\n\t\tp = &gceP\n\t}\n\tvm.Providers[ProviderName] = p\n}", "func init() {\n\n\t// Workflow.AddCommand(workflow.Pause)\n\t// Workflow.AddCommand(workflow.Resume)\n\t// Workflow.AddCommand(workflow.Deploy)\n\t// Workflow.AddCommand(workflow.Test)\n\t// Workflow.AddCommand(workflow.Validate)\n\t// Workflow.AddCommand(workflow.List)\n\t// Workflow.AddCommand(workflow.Kill)\n\t// Workflow.AddCommand(workflow.Topup)\n\t// Workflow.AddCommand(workflow.Log)\n\t// Workflow.AddCommand(workflow.Detail)\n\n\t// RootCmd.AddCommand(Workflow)\n}", "func Init() error {\n\n}", "func (vm *VotingMachine) InitModule(hs *hotstuff.HotStuff, _ *hotstuff.OptionsBuilder) {\n\tvm.mod = hs\n}", "func New(iface string) *Module {\n\tm := &Module{intf: iface}\n\tl.Label(m, iface)\n\tl.Register(m, \"outputFunc\")\n\t// Default output is just 'VPN' when connected.\n\tm.Output(func(s State) bar.Output {\n\t\tif s.Connected() {\n\t\t\treturn outputs.Text(\"VPN\")\n\t\t}\n\t\treturn nil\n\t})\n\treturn m\n}", "func init() {\n\tiHub = NewHub()\n}", "func init() {\n\tCommands = make(map[string][]string)\n\tcommands := [][]string{\n\t\t{\"module\", \"--stdout=true\", \".examples/modules/sockshop\"},\n\t\t{\"module\", \"-s\", \".examples/modules/sockshop\", \"-p\", \"image_registry=gcr.io/sockshop\"},\n\t\t{\"module\", \"-s\", \".examples/modules/sockshop\", \"-p\", \"image_registry=quay.io/sockshop\"},\n\t\t{\"module\", \"-s\", \".examples/modules/weavecloud\", \"-p\", \"service_token=abc123\"},\n\t\t{\"bundle\", \"--stdout\", \".examples/sockshop.yml\"},\n\t\t{\"bundle\", \"--stdout\", \".examples/weavecloud.yml\"},\n\t\t{\"bundle\", \"--stdout\", \".examples/weavecloud.yml\", \".examples/sockshop.yml\"},\n\t\t{\"module\", \"--output=json\", \"--stdout=true\", \".examples/modules/sockshop\"},\n\t\t{\"module\", \"--output=json\", \"-s\", \".examples/modules/sockshop\", \"-p\", \"image_registry=gcr.io/sockshop\"},\n\t\t{\"module\", \"--output=json\", \"-s\", \".examples/modules/sockshop\", \"-p\", \"image_registry=quay.io/sockshop\"},\n\t\t{\"module\", \"--output=json\", \"-s\", \".examples/modules/weavecloud\", \"-p\", \"service_token=abc123\"},\n\t\t{\"bundle\", \"--output=json\", \"--stdout\", \".examples/sockshop.yml\"},\n\t\t{\"bundle\", \"--output=json\", \"--stdout\", \".examples/weavecloud.yml\"},\n\t\t{\"bundle\", \"--output=json\", \"--stdout\", \".examples/weavecloud.yml\", \".examples/sockshop.yml\"},\n\t}\n\n\tfor _, command := range commands {\n\t\thash := sha1.New()\n\t\thash.Write([]byte(strings.Join(command, \" \")))\n\t\tCommands[fmt.Sprintf(\".generated/%x\", hash.Sum(nil))] = command\n\t}\n}", "func New(provider Provider) *Module {\n\tm := &Module{\n\t\tprovider: provider,\n\t\tscheduler: timing.NewScheduler(),\n\t}\n\n\tm.notifyFn, m.notifyCh = notifier.New()\n\tm.outputFunc.Set(func(info Info) bar.Output {\n\t\tif info.Updates == 1 {\n\t\t\treturn outputs.Text(\"1 update\")\n\t\t}\n\t\treturn outputs.Textf(\"%d updates\", info.Updates)\n\t})\n\n\tm.Every(time.Hour)\n\n\treturn m\n}", "func init() {\n\tif err := mb.Registry.AddMetricSet(\"haproxy\", \"info\", New); err != nil {\n\t\tpanic(err)\n\t}\n}", "func Module(mod ModuleFunc) func(*Runner) error {\n\treturn func(r *Runner) error {\n\t\tswitch mod := mod.(type) {\n\t\tcase ModuleExec:\n\t\t\tif mod == nil {\n\t\t\t\tmod = DefaultExec\n\t\t\t}\n\t\t\tr.Exec = mod\n\t\tcase ModuleOpen:\n\t\t\tif mod == nil {\n\t\t\t\tmod = DefaultOpen\n\t\t\t}\n\t\t\tr.Open = mod\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown module type: %T\", mod)\n\t\t}\n\t\treturn nil\n\t}\n}", "func main() {\n\tfset := token.NewFileSet()\n\tf, err := parser.ParseFile(fset, \"hello.go\", src, 0)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"=== CheckInstances ===\")\n\tpkg, err := CheckInstances(fset, f)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"=== Instantiate ===\")\n\tif err := Instantiate(pkg); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func init() {\n\tifStarted = false\n\t/* Public and Private Key need to be created upon Node initialization */\n\t/* Need to generate a Curve first with the elliptic library, then generate key based on that curve */\n\tsignature_p.GeneratePublicAndPrivateKey()\n}", "func init() {\n\tworkflow.Register(usecase.Workflow)\n\tactivity.Register(usecase.HelloworldActivity)\n\tactivity.Register(usecase.HelloworldGuys)\n\tactivity.Register(usecase.HelloMoving)\n\tactivity.Register(usecase.HelloNoContext)\n\n\tworkflow.Register(usecase.OrchestrationWorkflow)\n\tactivity.Register(usecase.ValidateProductPackage)\n\tactivity.Register(usecase.ValidateVoucher)\n\tactivity.Register(usecase.CreateOrder)\n\tactivity.Register(usecase.CreatePayment)\n\tactivity.Register(usecase.RollbackOrder)\n}", "func init() {\n\tapid.RegisterPlugin(initPlugin)\n}", "func NewModule(name string, requires []string, configFn interface{}) *Module {\n\tif configFn == nil {\n\t\tconfigFn = func() {}\n\t}\n\n\ttransformedFunc, err := MakeFuncInjectable(configFn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &Module{js.Global.Get(\"angular\").Call(\"module\", name, requires, transformedFunc)}\n}", "func init() {\n\tSetup()\n}", "func NewModule(name string) *Module {\n\treturn &Module{Name: name, Fields: make(map[string]lua.LValue), Functions: make(map[string]lua.LGFunction)}\n}", "func init() {\n\t// Reset commands, so `pegnetnode` is the only h\n\tpcmd.RootCmd.ResetCommands()\n\tpcmd.RootCmd.Flags().Bool(\"mock\", false, \"Do not actually connect to discord\")\n\tpcmd.RootCmd.Run = func(cmd *cobra.Command, args []string) {\n\t\tdiscordNode.Run(cmd, args)\n\t}\n}", "func moduleInfo(um *internal.UnitMeta) *internal.ModuleInfo {\n\treturn &internal.ModuleInfo{\n\t\tModulePath: um.ModulePath,\n\t\tVersion: um.Version,\n\t\tCommitTime: um.CommitTime,\n\t\tIsRedistributable: um.IsRedistributable,\n\t\tSourceInfo: um.SourceInfo,\n\t}\n}", "func NewModule() *Module {\n\treturn &Module{}\n}", "func init() {\n\tnetwork.RegisterMessage(AnnounceAggregation{})\n\tnetwork.RegisterMessage(ReplySumCipherBytes{})\n\tonet.GlobalProtocolRegister(AggregationProtocolName, NewAggregationProtocol)\n}", "func Module(opts Opts) fx.Option {\n\toptions := []fx.Option{\n\t\tfx.Provide(\n\t\t\tstartService(opts),\n\n\t\t\tprovideRegisterFunc,\n\n\t\t\tprovideRegisteredChecksFunc,\n\t\t\tprovideCheckResultsFunc,\n\n\t\t\tprovideSubscribeForRegisteredChecks,\n\t\t\tprovideSubscribeForCheckResults,\n\n\t\t\tprovideOverallHealth,\n\t\t\tprovideMonitorOverallHealth,\n\t\t),\n\t}\n\tif opts.FailFastOnStartup {\n\t\toptions = append(options, fx.Invoke(checkHealthOnStart))\n\t}\n\treturn fx.Options(options...)\n}", "func NewJsEvalModule(bot *common.Bot) *JsEval {\n jsEval := &JsEval {\n bot: bot,\n vm: otto.New(),\n }\n return jsEval\n}" ]
[ "0.6326365", "0.6156704", "0.6133761", "0.609392", "0.6085594", "0.60381615", "0.5934613", "0.5912358", "0.5849248", "0.56977695", "0.56488967", "0.563328", "0.56289256", "0.55948055", "0.55802166", "0.5574413", "0.55700535", "0.5553146", "0.55527955", "0.5502587", "0.5500804", "0.549866", "0.54703087", "0.54545903", "0.54511803", "0.54490453", "0.5446241", "0.5445099", "0.5441672", "0.54349476", "0.5427476", "0.5394964", "0.5374611", "0.537177", "0.53642845", "0.53620034", "0.5336384", "0.5312397", "0.5305531", "0.53029495", "0.5299032", "0.52919555", "0.52906257", "0.5280897", "0.52775025", "0.5272511", "0.5270058", "0.5267707", "0.52534837", "0.52458525", "0.5244933", "0.5236017", "0.52251047", "0.52242553", "0.52195066", "0.5219461", "0.52169013", "0.5215485", "0.52117336", "0.5199341", "0.5193243", "0.5191991", "0.5190273", "0.5185188", "0.5183498", "0.51724905", "0.516616", "0.5160465", "0.51598847", "0.51584154", "0.51562846", "0.51556987", "0.5150238", "0.51484394", "0.51449186", "0.51407504", "0.5132515", "0.51196253", "0.51166385", "0.510998", "0.5103787", "0.5102829", "0.51001", "0.50992346", "0.5084075", "0.50778204", "0.5071595", "0.5071092", "0.5070381", "0.50671", "0.50662667", "0.50553495", "0.5038658", "0.50377667", "0.50309384", "0.50305146", "0.5015896", "0.50113696", "0.50090533", "0.50010455" ]
0.5472836
22
testBackends returns a backend with predictabale values for the test biais are zeroes and matrices are 1
func testBackends(inputSize, outputSize int, hiddenSize int) *backends { var back backends initValue := float32(1e-3) back.InputSize = inputSize back.OutputSize = outputSize back.HiddenSize = hiddenSize back.Wi = make([]float32, hiddenSize*inputSize) for i := 0; i < hiddenSize*inputSize; i++ { back.Wi[i] = initValue * rand.Float32() } back.Ui = make([]float32, hiddenSize*hiddenSize) for i := 0; i < hiddenSize*hiddenSize; i++ { back.Ui[i] = initValue * rand.Float32() } back.BiasI = make([]float32, hiddenSize) back.Wo = make([]float32, hiddenSize*inputSize) for i := 0; i < hiddenSize*inputSize; i++ { back.Wo[i] = initValue * rand.Float32() } back.Uo = make([]float32, hiddenSize*hiddenSize) for i := 0; i < hiddenSize*hiddenSize; i++ { back.Uo[i] = initValue * rand.Float32() } back.BiasO = make([]float32, hiddenSize) back.Wf = make([]float32, hiddenSize*inputSize) for i := 0; i < hiddenSize*inputSize; i++ { back.Wf[i] = initValue * rand.Float32() } back.Uf = make([]float32, hiddenSize*hiddenSize) for i := 0; i < hiddenSize*hiddenSize; i++ { back.Uf[i] = initValue * rand.Float32() } back.BiasF = make([]float32, hiddenSize) back.Wc = make([]float32, hiddenSize*inputSize) for i := 0; i < hiddenSize*inputSize; i++ { back.Wc[i] = initValue * rand.Float32() } back.Uc = make([]float32, hiddenSize*hiddenSize) for i := 0; i < hiddenSize*hiddenSize; i++ { back.Uc[i] = initValue * rand.Float32() } back.BiasC = make([]float32, hiddenSize) back.Wy = make([]float32, hiddenSize*outputSize) for i := 0; i < hiddenSize*outputSize; i++ { back.Wy[i] = initValue * rand.Float32() } back.BiasY = make([]float32, outputSize) return &back }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetAllBackendServer(t *testing.T) {\n\tcloud, _, resp, err := beforeTestBlb()\n\tif err != nil {\n\t\tt.Errorf(\"beforeTestBlb err, err: %v\", err)\n\t}\n\tctx := context.Background()\n\t// bs is nil\n\tlb := &blb.LoadBalancer{\n\t\tBlbId: resp.LoadBalancerId,\n\t}\n\tbs, err := cloud.getAllBackendServer(ctx, lb)\n\tif err != nil {\n\t\tt.Errorf(\"getAllBackendServer err, err: %v\", err)\n\t}\n\tif len(bs) != 0 {\n\t\tt.Errorf(\"getAllBackendServer err, bs should be nil but get : %v\", bs)\n\t}\n\t// add bs\n\tbsAdd := []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"1\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"2\",\n\t\t},\n\t}\n\targs := blb.AddBackendServersArgs{\n\t\tLoadBalancerId: lb.BlbId,\n\t\tBackendServerList: bsAdd,\n\t}\n\terr = cloud.clientSet.BLBClient.AddBackendServers(ctx, &args, &bce.SignOption{\n\t\tCustomSignFunc: CCEServiceSign,\n\t})\n\tif err != nil {\n\t\tt.Errorf(\"AddBackendServers err, err: %v\", err)\n\t}\n\t// get bs\n\tbs, err = cloud.getAllBackendServer(ctx, lb)\n\tif err != nil {\n\t\tt.Errorf(\"getAllBackendServer err, err: %v\", err)\n\t}\n\tif len(bs) != 2 {\n\t\tt.Errorf(\"getAllBackendServer err, bs should be nil but get : %v\", bs)\n\t}\n}", "func main() {\n\n\tvar features [][]float64\n\tvar labels [][]float64\n\n\tfeatures = [][]float64{\n\t\t{10, 1},\n\t\t{100, 10},\n\t}\n\n\tlabels = [][]float64{\n\t\t{1},\n\t\t{10},\n\t}\n\n\tnn := enn.CreateNeuralNetwork()\n\n\tstate := nn.CreateState()\n\n\t// need to be declared before adding hidden layers\n\tnn.SetDataset(features, labels, &state)\n\n\t// use after SetDataset !\n\n\tnn.AddHiddenLayer(2, &state)\n\tnn.AddHiddenLayer(2, &state)\n\n\tnn.Learn(1000, &state)\n\n\tvar testPrediction1 []float64 = nn.Predict(&state, features[0])\n\tvar testPrediction2 []float64 = nn.Predict(&state, features[1])\n\n\tfmt.Println(\"Test Prediction Expected:\", labels[0], testPrediction1)\n\tfmt.Println(\"Test Prediction Expected:\", labels[1], testPrediction2)\n\tfmt.Println(\"final loss: \", state.Loss)\n\n}", "func testModel(weights []float64) float64 {\n\n\truntime.LockOSThread()\n\n\t_gstate := python.PyGILState_Ensure()\n\n\targArray := python.PyList_New(len(weights))\n\n\tfor i := 0; i < len(weights); i++ {\n\t\tpython.PyList_SetItem(argArray, i, python.PyFloat_FromDouble(weights[i]))\n\t}\n\n\tvar trainErr float64\n\tpyTrainResult := pyTrainFunc.CallFunction(argArray)\n\ttrainErr = python.PyFloat_AsDouble(pyTrainResult)\n\n\tpython.PyGILState_Release(_gstate)\t\n\n\treturn trainErr\n\n}", "func testBackend(segwit bool) (*Backend, func()) {\n\tlogger := dex.StdOutLogger(\"TEST\", dex.LevelTrace)\n\t// skip both loading config file and rpcclient.New in Connect. Manually\n\t// create the Backend and set the node to our node stub.\n\tbtc := newBTC(\"btc\", segwit, testParams, logger, nil)\n\tbtc.node = &testNode{}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tbtc.run(ctx)\n\t\twg.Done()\n\t}()\n\tshutdown := func() {\n\t\tcancel()\n\t\twg.Wait()\n\t}\n\treturn btc, shutdown\n}", "func TestBackend(t *testing.T, newBackend NewBackend) {\n\tt.Run(\"TestGetPut\", func(t *testing.T) {\n\t\ttestGetPut(t, newBackend)\n\t})\n\tt.Run(\"TestListAll\", func(t *testing.T) {\n\t\ttestListAll(t, newBackend)\n\t})\n\tt.Run(\"TestSeparators\", func(t *testing.T) {\n\t\ttestSeparators(t, newBackend)\n\t})\n\tt.Run(\"TestRename\", func(t *testing.T) {\n\t\ttestRename(t, newBackend)\n\t})\n\tt.Run(\"TestRenameNX\", func(t *testing.T) {\n\t\ttestRenameNX(t, newBackend)\n\t})\n\tt.Run(\"TestLocking\", func(t *testing.T) {\n\t\ttestLocking(t, newBackend)\n\t})\n}", "func svmTest(model *ml.ModelContainer, dc data.Container) ([]float64, error) {\n\tif *verbose {\n\t\tfmt.Printf(\"\\ttesting svm model:%v\\n\", model.Name)\n\t\tfmt.Printf(\"\\t%+v\\n\", model)\n\t}\n\tfd := dc.Filter(model.Features)\n\tsvm, ok := model.Model.(*svm.SVM)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"not an SVM\")\n\t}\n\treturn svm.Predictions(fd)\n}", "func TestDeleteAllBackendServers(t *testing.T) {\n\tcloud, _, resp, err := beforeTestBlb()\n\tif err != nil {\n\t\tt.Errorf(\"beforeTestBlb err, err: %v\", err)\n\t}\n\tctx := context.Background()\n\tlb := &blb.LoadBalancer{\n\t\tBlbId: resp.LoadBalancerId,\n\t}\n\t// bs is nil\n\terr = cloud.deleteAllBackendServers(ctx, lb)\n\tif err != nil {\n\t\tt.Errorf(\"deleteAllBackendServers err, err : %v\", err)\n\t}\n\t// add bs\n\tbsAdd := []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"1\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"2\",\n\t\t},\n\t}\n\targs := blb.AddBackendServersArgs{\n\t\tLoadBalancerId: lb.BlbId,\n\t\tBackendServerList: bsAdd,\n\t}\n\terr = cloud.clientSet.BLBClient.AddBackendServers(ctx, &args, &bce.SignOption{\n\t\tCustomSignFunc: CCEServiceSign,\n\t})\n\tif err != nil {\n\t\tt.Errorf(\"AddBackendServers err, err: %v\", err)\n\t}\n\terr = cloud.deleteAllBackendServers(ctx, lb)\n\tif err != nil {\n\t\tt.Errorf(\"deleteAllBackendServers err, err : %v\", err)\n\t}\n\tbs, err := cloud.getAllBackendServer(ctx, lb)\n\tif err != nil {\n\t\tt.Errorf(\"getAllBackendServer err, err: %v\", err)\n\t}\n\tif len(bs) != 0 {\n\t\tt.Errorf(\"getAllBackendServer err, bs should be nil but get : %v\", bs)\n\t}\n}", "func TESTB(ir, amr operand.Op) { ctx.TESTB(ir, amr) }", "func TestBaselineOutput(t *testing.T) {\n\tnetwork := neuralnet.Network{\n\t\t&neuralnet.DenseLayer{\n\t\t\tInputCount: 4,\n\t\t\tOutputCount: 6,\n\t\t},\n\t\tneuralnet.HyperbolicTangent{},\n\t}\n\tnetwork.Randomize()\n\n\tfor stateSize := 0; stateSize < 4; stateSize++ {\n\t\tstart := &autofunc.Variable{Vector: make(linalg.Vector, stateSize)}\n\t\tfor i := range start.Vector {\n\t\t\tstart.Vector[i] = rand.NormFloat64()\n\t\t}\n\t\ttoTest := rnn.BlockSeqFunc{\n\t\t\tB: &rnn.BatcherBlock{\n\t\t\t\tB: network.BatchLearner(),\n\t\t\t\tStateSize: stateSize,\n\t\t\t\tStart: start,\n\t\t\t},\n\t\t}\n\t\tseqs, rv := randBaselineTestSeqs(network, 4-stateSize)\n\t\trv[start] = make(linalg.Vector, len(start.Vector))\n\t\tfor i := range rv[start] {\n\t\t\trv[start][i] = rand.NormFloat64()\n\t\t}\n\t\tres := toTest.ApplySeqsR(rv, seqfunc.VarRResult(rv, seqs))\n\t\tactual := res.OutputSeqs()\n\t\tactualR := res.ROutputSeqs()\n\t\texpected, expectedR := manualNetworkSeq(rv, network, start, seqs, stateSize)\n\t\tif len(expected) != len(actual) {\n\t\t\tt.Errorf(\"stateSize %d: len(expected) [%d] != len(actual) [%d]\", stateSize,\n\t\t\t\tlen(expected), len(actual))\n\t\t\tcontinue\n\t\t}\n\t\tfor i, act := range actual {\n\t\t\tactR := actualR[i]\n\t\t\texp := expected[i]\n\t\t\texpR := expectedR[i]\n\t\t\tif len(act) != len(exp) {\n\t\t\t\tt.Errorf(\"stateSize %d seq %d: len(act) [%d] != len(exp) [%d]\",\n\t\t\t\t\tstateSize, i, len(act), len(act))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor j, a := range act {\n\t\t\t\tx := exp[j]\n\t\t\t\tif len(a) != len(x) || x.Copy().Scale(-1).Add(a).MaxAbs() > 1e-5 {\n\t\t\t\t\tt.Errorf(\"stateSize %d seq %d entry %d: expected %v got %v\",\n\t\t\t\t\t\tstateSize, i, j, x, a)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor j, a := range actR {\n\t\t\t\tx := expR[j]\n\t\t\t\tif len(a) != len(x) || x.Copy().Scale(-1).Add(a).MaxAbs() > 1e-5 {\n\t\t\t\t\tt.Errorf(\"stateSize %d seq %d entry %d (R): expected %v got %v\",\n\t\t\t\t\t\tstateSize, i, j, x, a)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func newTestMetricsBackend() *testMetricsBackend {\n\treturn &testMetricsBackend{\n\t\tcounters: make(map[metricsLabels]int64),\n\t\tdurations: make(map[metricsLabels][]float64),\n\t}\n}", "func KTESTB(k, k1 operand.Op) { ctx.KTESTB(k, k1) }", "func VPTESTNMQ_BCST(ops ...operand.Op) { ctx.VPTESTNMQ_BCST(ops...) }", "func Nbc(param *NbcOptionalParam) (*mat.Dense, nbcModel, *mat.Dense, *mat.Dense, *mat.Dense) {\n params := getParams(\"nbc\")\n timers := getTimers()\n\n disableBacktrace()\n disableVerbose()\n // Detect if the parameter was passed; set if so.\n if param.IncrementalVariance != false {\n setParamBool(params, \"incremental_variance\", param.IncrementalVariance)\n setPassed(params, \"incremental_variance\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.InputModel != nil {\n setNBCModel(params, \"input_model\", param.InputModel)\n setPassed(params, \"input_model\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Labels != nil {\n gonumToArmaUrow(params, \"labels\", param.Labels)\n setPassed(params, \"labels\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Test != nil {\n gonumToArmaMat(params, \"test\", param.Test)\n setPassed(params, \"test\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Training != nil {\n gonumToArmaMat(params, \"training\", param.Training)\n setPassed(params, \"training\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Verbose != false {\n setParamBool(params, \"verbose\", param.Verbose)\n setPassed(params, \"verbose\")\n enableVerbose()\n }\n\n // Mark all output options as passed.\n setPassed(params, \"output\")\n setPassed(params, \"output_model\")\n setPassed(params, \"output_probs\")\n setPassed(params, \"predictions\")\n setPassed(params, \"probabilities\")\n\n // Call the mlpack program.\n C.mlpackNbc(params.mem, timers.mem)\n\n // Initialize result variable and get output.\n var outputPtr mlpackArma\n output := outputPtr.armaToGonumUrow(params, \"output\")\n var outputModel nbcModel\n outputModel.getNBCModel(params, \"output_model\")\n var outputProbsPtr mlpackArma\n outputProbs := outputProbsPtr.armaToGonumMat(params, \"output_probs\")\n var predictionsPtr mlpackArma\n predictions := predictionsPtr.armaToGonumUrow(params, \"predictions\")\n var probabilitiesPtr mlpackArma\n probabilities := probabilitiesPtr.armaToGonumMat(params, \"probabilities\")\n // Clean memory.\n cleanParams(params)\n cleanTimers(timers)\n // Return output(s).\n return output, outputModel, outputProbs, predictions, probabilities\n}", "func VPTESTNMB(ops ...operand.Op) { ctx.VPTESTNMB(ops...) }", "func NewTestingBackend() *TestingBackend {\n\treturn &TestingBackend{\n\t\tFeatures: make(map[string]*wave.Feature),\n\t}\n}", "func SetupRegression(app string, version string) {\n\tdbVersion := QueryAppVersion(app)\n\tfmt.Println(\"DB version : \" + dbVersion)\n\tfmt.Println(\"current version : \" + version)\n\tif dbVersion == \"0\" {\n\t\tfmt.Printf(\"Insert app %s version %s to AppVersion table...\\n\", app, version)\n\t\tInsertAppVersion(app, version)\n\t}\n\t// Set up the table when app / version is updated\n\tresult := CompareVersion(version, dbVersion)\n\tif result == 1 {\n\t\tfmt.Printf(\"Current version %s is greater than DB version %s ..\\n\", version, dbVersion)\n\t\tUpdateAppVersion(app, version)\n\t\tfor runtime := range runtimes {\n\t\t\tfor _, imageNum := range setupImageNums {\n\t\t\t\tSchedule(runtime, imageNum, app, version, false)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"Current version %s equals to / is less than DB version %s .. \\n\", version, dbVersion)\n\t\tfmt.Println(\"Checking if at least two data points exist for each runtime...\")\n\t\tfor runtime := range runtimes {\n\t\t\tvar (\n\t\t\t\tX mat.Matrix\n\t\t\t\trows int = 0\n\t\t\t)\n\t\t\t// At least 2 data points exist for each app & version\n\t\t\tX, _ = QueryDataSet(runtime, app, version, 2)\n\t\t\tif X != nil {\n\t\t\t\trows, _ = X.Dims()\n\t\t\t}\n\t\t\tif rows < 2 {\n\t\t\t\tfor _, imageNum := range setupImageNums {\n\t\t\t\t\tSchedule(runtime, imageNum, app, version, false)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func VPTESTMQ_BCST(ops ...operand.Op) { ctx.VPTESTMQ_BCST(ops...) }", "func getTestMatrix_Ok() [][]string {\n\treturn [][]string{{\"1\", \"2\", \"3\"}, {\"4\", \"5\", \"6\"}, {\"7\", \"8\", \"9\"}}\n}", "func TestLabels() map[string]string {\n\treturn map[string]string{\n\t\t\"e2e-test\": \"true\",\n\t}\n}", "func VPTESTMB(ops ...operand.Op) { ctx.VPTESTMB(ops...) }", "func TestMergeBackend(t *testing.T) {\n\t// case1\n\tcandidateBackends := []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"1\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"2\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"3\",\n\t\t},\n\t}\n\texistingBackends := []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"4\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"5\",\n\t\t},\n\t}\n\trsToAdd, rsToDel, err := mergeBackend(candidateBackends, existingBackends, 1)\n\tif err != nil {\n\t\tt.Errorf(\"mergeBackend err, err: %v\", err)\n\t}\n\tif !arraysHelp(rsToAdd, \"1\") && !arraysHelp(rsToAdd, \"2\") && !arraysHelp(rsToAdd, \"3\") ||\n\t\t!arraysHelp(rsToDel, \"4\") || !arraysHelp(rsToDel, \"5\") {\n\t\tt.Errorf(\"mergeBackend err, want 1 or 2 or 3| 4 ,5 get %v | %v, %v\", rsToAdd[0].InstanceId,\n\t\t\trsToDel[0].InstanceId, rsToDel[1].InstanceId)\n\t}\n\t// case2\n\tcandidateBackends = []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"1\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"2\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"3\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"4\",\n\t\t},\n\t}\n\texistingBackends = []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"4\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"5\",\n\t\t},\n\t}\n\trsToAdd, rsToDel, err = mergeBackend(candidateBackends, existingBackends, 1)\n\tif err != nil {\n\t\tt.Errorf(\"mergeBackend err, err: %v\", err)\n\t}\n\tif len(rsToAdd) != 0 || !arraysHelp(rsToDel, \"5\") {\n\t\tt.Errorf(\"mergeBackend err, want nil | 5 get %v | %v\", rsToAdd[0].InstanceId,\n\t\t\trsToDel[0].InstanceId)\n\t}\n\t//case3\n\tcandidateBackends = []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"1\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"2\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"3\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"4\",\n\t\t},\n\t}\n\texistingBackends = []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"4\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"5\",\n\t\t},\n\t}\n\trsToAdd, rsToDel, err = mergeBackend(candidateBackends, existingBackends, 3)\n\tif err != nil {\n\t\tt.Errorf(\"mergeBackend err, err: %v\", err)\n\t}\n\tif !arraysHelp(rsToAdd, \"1\", \"2\") && !arraysHelp(rsToAdd, \"2\", \"3\") &&\n\t\t!arraysHelp(rsToAdd, \"1\", \"3\") || !arraysHelp(rsToDel, \"5\") {\n\t\tt.Errorf(\"mergeBackend err, want 1,2 or 2,3 or 1,3| 5 get %v, %v | %v\", rsToAdd[0].InstanceId,\n\t\t\trsToAdd[1].InstanceId, rsToDel[0].InstanceId)\n\t}\n}", "func Framework(hostinfo models.HostInfo, clusterInfoJSON string) []models.Result {\n\t// json decode the host info\n\thostinfoJSON,_ := json.Marshal(hostinfo)\n\tmoduleResult := \"[\"\n\t\n\t// iterate over each module\t\n\tfor _,m := range hostinfo.Module {\n\t\t// get module information\n\t\tmodules := GetModule(m)\t\n\n\t\t// result of all tests for each module\n\t\ttestResult := \"[\"\n\n\t\t// iterate over each test to be run for the module\n\t\tfor _,t := range modules.TestsToRun {\n\t\t\t// get test information\n\t\t\ttest := GetTest(t)\n\n\t\t\t// convert struct to key-value pair\n\t\t\tmt := structs.Map(test)\n\n\t\t\t// add additional cluster and host information to map\n \t\t\tmt[\"HostInfo\"] = string(hostinfoJSON)\n \t\t\tmt[\"ClusterInfo\"] = clusterInfoJSON\n\n\t\t\t// run the test with the required information\n\t\t\ttestResult += ( RunTest(mt,hostinfo) + \",\" )\n\t\t}\n\n\t\ttestResult = strings.Trim(testResult,\",\")\n\t\ttestResult += \"]\"\n\n\t\teval := make(map[string] interface {})\n\t\teval[\"HostInfo\"] = string(hostinfoJSON)\n\t\teval[\"ClusterInfo\"] = clusterInfoJSON\n\t\teval[\"TestResult\"] = testResult\n\t\teval[\"File\"] = modules.EvaluationFile\n\t\teval[\"Name\"] = modules.Name\n\t\tmoduleResult += ( RunModuleEvaluation(eval) + \",\" )\n\t}\n\t\n\tmoduleResult = strings.Trim(moduleResult,\",\")\n\tmoduleResult += \"]\"\t\n\n\tvar result []models.Result\n\tjson.Unmarshal([]byte(moduleResult), &result)\n\n\treturn result\n}", "func VPTESTNMD_BCST(ops ...operand.Op) { ctx.VPTESTNMD_BCST(ops...) }", "func Test0() []bool {\n\tvar res0 []bool\n\treturn res0\n}", "func (s *backendSuite) setUpTest(c *C) {\n\ts.controller = gomock.NewController(c)\n\ts.mockBackend = mock.NewMockBackend(s.controller)\n\ts.backend = kv.MakeBackend(s.mockBackend)\n}", "func TestPersistNaiveBayesShouldPass1(t *testing.T) {\n\tvar err error\n\n\t// create the channel of data and errors\n\tstream := make(chan base.TextDatapoint, 100)\n\terrors := make(chan error)\n\n\t// make a new NaiveBayes model with\n\t// 2 classes expected (classes in\n\t// datapoints will now expect {0,1}.\n\t// in general, given n as the classes\n\t// variable, the model will expect\n\t// datapoint classes in {0,...,n-1})\n\tmodel := NewNaiveBayes(stream, 3, base.OnlyWordsAndNumbers)\n\n\tgo model.OnlineLearn(errors)\n\n\tfor i := 1; i < 10; i++ {\n\t\tstream <- base.TextDatapoint{\n\t\t\tX: \"I love the city\",\n\t\t\tY: 1,\n\t\t}\n\n\t\tstream <- base.TextDatapoint{\n\t\t\tX: \"I hate Los Angeles\",\n\t\t\tY: 0,\n\t\t}\n\t}\n\n\tclose(stream)\n\n\tfor {\n\t\terr, more := <-errors\n\t\tif more {\n\t\t\tfmt.Printf(\"Error passed: %v\", err)\n\t\t} else {\n\t\t\t// training is done!\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// now you can predict like normal\n\tclass := model.Predict(\"My mo~~~ther is in Los Angeles\") // 0\n\tassert.EqualValues(t, 0, class, \"Class should be 0\")\n\n\t// test small document classification\n\tclass, p := model.Probability(\"Mother Los Angeles\")\n\tassert.EqualValues(t, 0, class, \"Class should be 0\")\n\tassert.True(t, p > 0.75, \"There should be a greater than 75 percent chance the document is negative - Given %v\", p)\n\n\tclass, p = model.Probability(\"Love the CiTy\")\n\tassert.EqualValues(t, 1, class, \"Class should be 1\")\n\tassert.True(t, p > 0.75, \"There should be a greater than 75 percent chance the document is positive - Given %v\", p)\n\n\t// persist to file\n\terr = model.PersistToFile(\"/tmp/.goml/Bayes.json\")\n\tassert.Nil(t, err, \"Persistance error should be nil\")\n\n\tmodel.Words = concurrentMap{}\n\n\tclass, p = model.Probability(\"Mother Los Angeles\")\n\tassert.Equal(t, p, 0.5, \"With a blank model the prediction should be 0.5 for both classes\", p)\n\n\t// restore from file\n\terr = model.RestoreFromFile(\"/tmp/.goml/Bayes.json\")\n\tassert.Nil(t, err, \"Persistance error should be nil\")\n\n\tclass = model.Predict(\"My mo~~~ther is in Los Angeles\") // 0\n\tassert.EqualValues(t, 0, class, \"Class should be 0\")\n\n\tclass, p = model.Probability(\"Mother Los Angeles\")\n\tassert.EqualValues(t, 0, class, \"Class should be 0\")\n\tassert.True(t, p > 0.75, \"There should be a greater than 75 percent chance the document is negative - Given %v\", p)\n\n\tclass, p = model.Probability(\"Love the CiTy\")\n\tassert.EqualValues(t, 1, class, \"Class should be 1\")\n\tassert.True(t, p > 0.75, \"There should be a greater than 75 percent chance the document is positive - Given %v\", p)\n}", "func Test0() (res0 float64) {\n\treturn res0\n}", "func (backend *Backend) Testing() bool {\n\treturn backend.arguments.Testing()\n}", "func TestAckInstalledApplicationListDuplicateRegression(t *testing.T) {\n\n}", "func Test0() (res0 []byte) {\n\treturn res0\n}", "func predict(x_i interface{} , beta interface{} ) interface{} {\n//assumes that the first element of each x_i is 1\n\treturn dot(x_i,beta)\n}", "func NewBacktest(db *dbstore.DBStore, exchange, symbol, param string, start time.Time, end time.Time) (b *Backtest, err error) {\n\tb = new(Backtest)\n\tb.start = start\n\tb.end = end\n\tb.exchange = exchange\n\tb.symbol = symbol\n\tb.db = db\n\tb.balanceInit = 100000\n\tb.paramData = make(common.ParamData)\n\tif param != \"\" {\n\t\terr = json.Unmarshal([]byte(param), &b.paramData)\n\t}\n\treturn\n}", "func VPTESTMD_BCST(ops ...operand.Op) { ctx.VPTESTMD_BCST(ops...) }", "func xTestRealBackend(t *testing.T) {\n\tins, err := bq.NewInserter(etl.SW, time.Now())\n\tvar parser etl.Parser = parser.NewDiscoParser(ins)\n\n\tmeta := map[string]bigquery.Value{\"filename\": \"filename\", \"parse_time\": time.Now()}\n\tfor i := 0; i < 3; i++ {\n\t\t// Iterations:\n\t\t// Add two rows, no upload.\n\t\t// Add two more rows, triggering an upload of 3 rows.\n\t\t// Add two more rows, triggering an upload of 3 rows.\n\t\terr = parser.ParseAndInsert(meta, \"testName\", test_data)\n\t\tif ins.Accepted() != 2 {\n\t\t\tt.Error(\"Accepted = \", ins.Accepted())\n\t\t\tt.Fail()\n\t\t}\n\t}\n\n\tif ins.Accepted() != 6 {\n\t\tt.Error(\"Accepted = \", ins.Accepted())\n\t}\n\tif ins.RowsInBuffer() != 0 {\n\t\tt.Error(\"RowsInBuffer = \", ins.RowsInBuffer())\n\t}\n\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "func TestForest2(t *testing.T) {\n\trand.Seed(1)\n\tn := 100\n\tfeatures := 20\n\tclasses := 2\n\ttrees := 1000\n\n\tforest := randomforest.Forest{}\n\tdata, res := generator.CreateDataset(n, features, classes)\n\tfor j := 0; j < n; j++ {\n\t\tcreateFeatures2(&data[j])\n\t}\n\tforestData := randomforest.ForestData{X: data, Class: res}\n\tforest.Data = forestData\n\tforest.Train(trees)\n\t//test\n\ts := 0\n\tsw := 0\n\n\trand.Seed(2)\n\tdata, res = generator.CreateDataset(n, features, classes)\n\tfor i := 0; i < n; i++ {\n\t\tcreateFeatures2(&data[i])\n\t\tvote := forest.Vote(data[i])\n\t\tbestV := 0.0\n\t\tbestI := -1\n\t\tfor j, v := range vote {\n\t\t\tif v > bestV {\n\t\t\t\tbestV = v\n\t\t\t\tbestI = j\n\t\t\t}\n\t\t}\n\t\tif bestI == res[i] {\n\t\t\ts++\n\t\t}\n\n\t\t//\n\t\tvote = forest.WeightVote(data[i])\n\t\tbestV = 0.0\n\t\tbestI = -1\n\t\tfor j, v := range vote {\n\t\t\tif v > bestV {\n\t\t\t\tbestV = v\n\t\t\t\tbestI = j\n\t\t\t}\n\t\t}\n\t\tif bestI == res[i] {\n\t\t\tsw++\n\t\t}\n\n\t}\n\tfmt.Println(\"try\", n, \"times\")\n\tfmt.Printf(\"Correct: %5.2f %%\\n\", float64(s)*100/float64(n))\n\tfmt.Printf(\"Weight Correct: %5.2f %%\\n\", float64(sw)*100/float64(n))\n\tforest.PrintFeatureImportance()\n\n}", "func TestAddSchemesToFramework(t *testing.T) {\n\tlogf.SetLogger(logf.ZapLogger(true))\n\n\tt.Log(\"Adding ServiceBindingRequestList scheme to cluster...\")\n\tsbrlist := v1alpha1.ServiceBindingRequestList{}\n\trequire.NoError(t, framework.AddToFrameworkScheme(apis.AddToScheme, &sbrlist))\n\n\tt.Log(\"Adding ClusterServiceVersionList scheme to cluster...\")\n\tcsvList := olmv1alpha1.ClusterServiceVersionList{}\n\trequire.NoError(t, framework.AddToFrameworkScheme(olmv1alpha1.AddToScheme, &csvList))\n\n\tt.Log(\"Adding DatabaseList scheme to cluster...\")\n\tdbList := pgv1alpha1.DatabaseList{}\n\trequire.NoError(t, framework.AddToFrameworkScheme(pgsqlapis.AddToScheme, &dbList))\n\n\tt.Log(\"Adding EtcdCluster scheme to cluster...\")\n\tetcdCluster := v1beta2.EtcdCluster{}\n\trequire.Nil(t, framework.AddToFrameworkScheme(v1beta2.AddToScheme, &etcdCluster))\n\n\tt.Run(\"end-to-end\", func(t *testing.T) {\n\t\tt.Run(\"scenario-etcd-unannotated-app-db-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{AppStep, EtcdClusterStep, SBREtcdStep})\n\t\t})\n\t\tt.Run(\"scenario-db-app-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{DBStep, AppStep, SBRStep})\n\t\t})\n\t\tt.Run(\"scenario-app-db-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{AppStep, DBStep, SBRStep})\n\t\t})\n\t\tt.Run(\"scenario-db-sbr-app\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{DBStep, SBRStep, AppStep})\n\t\t})\n\t\tt.Run(\"scenario-app-sbr-db\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{AppStep, SBRStep, DBStep})\n\t\t})\n\t\tt.Run(\"scenario-sbr-db-app\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{SBRStep, DBStep, AppStep})\n\t\t})\n\t\tt.Run(\"scenario-sbr-app-db\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{SBRStep, AppStep, DBStep})\n\t\t})\n\t\tt.Run(\"scenario-csv-db-app-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{CSVStep, DBStep, AppStep, SBRStep})\n\t\t})\n\t\tt.Run(\"scenario-csv-app-db-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{CSVStep, AppStep, DBStep, SBRStep})\n\t\t})\n\t})\n}", "func testAbTest(t *testing.T, s *Service) {\n\tp := &model.ArgAbTest{\n\t\tGroups: \"不显示热门tab,显示热门tab\",\n\t\tIP: \"127.0.0.1\",\n\t}\n\tres, err := s.AbTest(context.TODO(), p)\n\tif err != nil {\n\t\tt.Logf(\"testAbTest error(%v) \\n\", err)\n\t\treturn\n\t}\n\tt.Logf(\"testAbTest res: %+v \\n\", res)\n}", "func TestProcessorBackendOK(t *testing.T) {\n\trequestInfo := []tests.RequestInfo{\n\t\t{Name: \"TestProcessErrorMinimalPayloadException\", Path: \"data/valid/error/minimal_payload_exception.json\"},\n\t\t{Name: \"TestProcessErrorMinimalPayloadLog\", Path: \"data/valid/error/minimal_payload_log.json\"},\n\t\t{Name: \"TestProcessErrorMinimalService\", Path: \"data/valid/error/minimal_service.json\"},\n\t\t{Name: \"TestProcessErrorMinimalProcess\", Path: \"data/valid/error/minimal_process.json\"},\n\t\t{Name: \"TestProcessErrorFull\", Path: \"data/valid/error/payload.json\"},\n\t\t{Name: \"TestProcessErrorNullValues\", Path: \"data/valid/error/null_values.json\"},\n\t}\n\tconf := processor.Config{ExcludeFromGrouping: nil}\n\ttests.TestProcessRequests(t, er.NewProcessor(&conf), requestInfo, map[string]string{})\n}", "func (s *CassandraBackendSuite) TestBackendGetSet(c *C) {\n\tif s.shouldSkip {\n\t\tc.Skip(\"Cassandra backend is not activated\")\n\t}\n\n\tcounter, err := s.backend.GetCount(\"key1\", time.Second)\n\tc.Assert(err, IsNil)\n\tc.Assert(counter, Equals, int64(0))\n\n\terr = s.backend.UpdateCount(\"key1\", time.Second, 2)\n\tc.Assert(err, IsNil)\n\n\tcounter, err = s.backend.GetCount(\"key1\", time.Second)\n\tc.Assert(err, IsNil)\n\tc.Assert(counter, Equals, int64(2))\n}", "func TestBackend(ctx context.Context, t *testing.T, a *assertions.Assertion, backend events.PubSub) {\n\tnow := time.Now()\n\tcorrelationID := fmt.Sprintf(\"%s@%s\", t.Name(), now)\n\n\tctx = events.ContextWithCorrelationID(ctx, correlationID)\n\n\ttimeout := test.Delay\n\tif deadline, ok := ctx.Deadline(); ok {\n\t\ttimeout = time.Until(deadline) / 10\n\t}\n\n\teui := types.EUI64{1, 2, 3, 4, 5, 6, 7, 8}\n\tdevAddr := types.DevAddr{1, 2, 3, 4}\n\tappID := ttnpb.ApplicationIdentifiers{\n\t\tApplicationId: \"test-app\",\n\t}\n\tdevID := ttnpb.EndDeviceIdentifiers{\n\t\tApplicationIds: &appID,\n\t\tDeviceId: \"test-dev\",\n\t\tDevEui: eui.Bytes(),\n\t\tJoinEui: eui.Bytes(),\n\t\tDevAddr: devAddr.Bytes(),\n\t}\n\tgtwID := ttnpb.GatewayIdentifiers{\n\t\tGatewayId: \"test-gtw\",\n\t\tEui: eui.Bytes(),\n\t}\n\n\tch0 := make(events.Channel, 10)\n\tch1 := make(events.Channel, 10)\n\tch2 := make(events.Channel, 10)\n\n\tcheckEvent := func(e events.Event) {\n\t\ta.So(e.Time().IsZero(), should.BeFalse)\n\t\ta.So(e.Context(), should.NotBeNil)\n\t}\n\n\tsubCtx, unsubscribe := context.WithCancel(ctx)\n\tdefer unsubscribe()\n\n\tbackend.Publish(events.New(ctx, \"test.some.evt1\", \"test event 1\", events.WithIdentifiers(&appID)))\n\n\truntime.Gosched()\n\ttime.Sleep(timeout)\n\n\tif store, ok := backend.(events.Store); ok {\n\t\tchx := make(events.Channel, 10)\n\t\thistSubCtx, cancel := context.WithCancel(subCtx)\n\t\tvar g errgroup.Group\n\t\tg.Go(func() error {\n\t\t\tafter := now.Add(-1 * time.Second)\n\t\t\treturn store.SubscribeWithHistory(\n\t\t\t\thistSubCtx,\n\t\t\t\t[]string{\"test.some.evt1\"},\n\t\t\t\t[]*ttnpb.EntityIdentifiers{appID.GetEntityIdentifiers()},\n\t\t\t\t&after, 1, chx,\n\t\t\t)\n\t\t})\n\t\tdefer func() {\n\t\t\tcancel()\n\t\t\tif err := g.Wait(); err != nil && !errors.IsCanceled(err) {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\ta.So(chx, should.HaveLength, 2)\n\t\t}()\n\t}\n\n\ta.So(backend.Subscribe(\n\t\tsubCtx,\n\t\t[]string{\"test.some.evt0\", \"test.some.evt1\"},\n\t\tnil,\n\t\tch0,\n\t), should.BeNil)\n\n\ta.So(backend.Subscribe(\n\t\tsubCtx,\n\t\t[]string{\"test.some.evt0\", \"test.some.evt1\"},\n\t\t[]*ttnpb.EntityIdentifiers{appID.GetEntityIdentifiers()},\n\t\tch1,\n\t), should.BeNil)\n\n\ta.So(backend.Subscribe(\n\t\tsubCtx,\n\t\t[]string{\"test.other.evt2\"},\n\t\t[]*ttnpb.EntityIdentifiers{gtwID.GetEntityIdentifiers()},\n\t\tch2,\n\t), should.BeNil)\n\n\truntime.Gosched()\n\ttime.Sleep(timeout)\n\n\tbackend.Publish(events.New(ctx, \"test.some.evt0\", \"test event 0\"))\n\tcheckEvt0 := func(e events.Event) {\n\t\tcheckEvent(e)\n\t\ta.So(e.Name(), should.Equal, \"test.some.evt0\")\n\t\ta.So(e.Identifiers(), should.BeNil)\n\t}\n\n\tbackend.Publish(events.New(ctx, \"test.some.evt1\", \"test event 1\", events.WithIdentifiers(&appID)))\n\tcheckEvt1 := func(e events.Event) {\n\t\tcheckEvent(e)\n\t\ta.So(e.Name(), should.Equal, \"test.some.evt1\")\n\t\tif a.So(e.Identifiers(), should.NotBeNil) && a.So(e.Identifiers(), should.HaveLength, 1) {\n\t\t\ta.So(e.Identifiers()[0].GetApplicationIds(), should.Resemble, &appID)\n\t\t}\n\t}\n\n\tbackend.Publish(events.New(ctx, \"test.other.evt2\", \"test event 2\", events.WithIdentifiers(&devID, &gtwID)))\n\tcheckEvt2 := func(e events.Event) {\n\t\tcheckEvent(e)\n\t\ta.So(e.Name(), should.Equal, \"test.other.evt2\")\n\t\tif a.So(e.Identifiers(), should.NotBeNil) && a.So(e.Identifiers(), should.HaveLength, 2) {\n\t\t\ta.So(e.Identifiers()[0].GetDeviceIds(), should.Resemble, &devID)\n\t\t\ta.So(e.Identifiers()[1].GetGatewayIds(), should.Resemble, &gtwID)\n\t\t}\n\t}\n\n\truntime.Gosched()\n\ttime.Sleep(timeout)\n\n\tif a.So(ch0, should.HaveLength, 2) {\n\t\tevt := <-ch0\n\t\tif evt.Name() == \"test.some.evt0\" { // Events may arrive out-of-order.\n\t\t\tcheckEvt0(evt)\n\t\t\tcheckEvt1(<-ch0)\n\t\t} else {\n\t\t\tcheckEvt1(evt)\n\t\t\tcheckEvt0(<-ch0)\n\t\t}\n\t}\n\n\tif a.So(ch1, should.HaveLength, 1) {\n\t\tcheckEvt1(<-ch1)\n\t}\n\n\tif a.So(ch2, should.HaveLength, 1) {\n\t\tcheckEvt2(<-ch2)\n\t}\n\n\tif store, ok := backend.(events.Store); ok {\n\t\tafter := now.Add(-1 * time.Second)\n\n\t\tevts, err := store.FetchHistory(ctx, []string{\n\t\t\t\"test.some.evt1\",\n\t\t}, []*ttnpb.EntityIdentifiers{\n\t\t\tappID.GetEntityIdentifiers(),\n\t\t\tdevID.GetEntityIdentifiers(),\n\t\t\tgtwID.GetEntityIdentifiers(),\n\t\t}, &after, 0)\n\t\ta.So(err, should.BeNil)\n\t\ta.So(evts, should.HaveLength, 2)\n\n\t\tevts, err = store.FetchHistory(ctx, nil, []*ttnpb.EntityIdentifiers{\n\t\t\tappID.GetEntityIdentifiers(),\n\t\t}, &after, 1)\n\t\ta.So(err, should.BeNil)\n\t\ta.So(evts, should.HaveLength, 1)\n\n\t\tevts, err = store.FindRelated(ctx, correlationID)\n\t\ta.So(err, should.BeNil)\n\t\ta.So(evts, should.HaveLength, 4)\n\t}\n}", "func createBackends() *services.Backend {\n\n\tdbhandler, _ := dblayer.NewPersistenceLayer(configuration.DBTypeDefault, configuration.DBConnectionDefault)\n\n\tidentitySrv := services.NewIdentityServer(dbhandler)\n\tauthSrv := services.NewAuthServer(identitySrv)\n\tmovieSrv := services.NewMovieServer(authSrv)\n\n\tauthSrv.JWT = server.NewJWTManager(services.SecretKey, 5*time.Minute)\n\tauthI := interceptors.NewAuthInterceptor(authSrv.JWT, accessRoles())\n\n\tlogger := &loggerObserver{}\n\tobserverRegistry := server.ShowcaseObserverRegistry()\n\tobserverRegistry.RegisterUnaryObserver(logger)\n\tobserverRegistry.RegisterStreamRequestObserver(logger)\n\tobserverRegistry.RegisterStreamResponseObserver(logger)\n\n\treturn &services.Backend{\n\t\tIdentityServer: identitySrv,\n\t\tAuthServer: authSrv,\n\t\tMovieServer: movieSrv,\n\t\tAuthInterceptor: authI,\n\n\t\tStdLog: stdLog,\n\t\tErrLog: errLog,\n\n\t\tObserverRegistry: observerRegistry,\n\t}\n}", "func TestEnd2EndAlisa(t *testing.T) {\n\ttestDBDriver := os.Getenv(\"SQLFLOW_TEST_DB\")\n\tif testDBDriver != \"alisa\" {\n\t\tt.Skip(\"Skipping non alisa tests\")\n\t}\n\tif os.Getenv(\"SQLFLOW_submitter\") != \"alisa\" {\n\t\tt.Skip(\"Skip non Alisa tests\")\n\t}\n\tdbConnStr = os.Getenv(\"SQLFLOW_TEST_DATASOURCE\")\n\ttmpDir, caCrt, caKey, err := generateTempCA()\n\tdefer os.RemoveAll(tmpDir)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to generate CA pair %v\", err)\n\t}\n\tcaseDB = os.Getenv(\"SQLFLOW_TEST_DB_MAXCOMPUTE_PROJECT\")\n\tif caseDB == \"\" {\n\t\tt.Fatalf(\"Must set env SQLFLOW_TEST_DB_MAXCOMPUTE_PROJECT\")\n\t}\n\tcaseTrainTable = caseDB + \".sqlflow_test_iris_train\"\n\tcaseTestTable = caseDB + \".sqlflow_test_iris_test\"\n\tcasePredictTable = caseDB + \".sqlflow_test_iris_predict\"\n\t// write model to current MaxCompute project\n\tcaseInto = \"sqlflow_test_kmeans_model\"\n\n\tgo start(caCrt, caKey, unitTestPort, false)\n\tserver.WaitPortReady(fmt.Sprintf(\"localhost:%d\", unitTestPort), 0)\n\t// TODO(Yancey1989): reuse CaseTrainXGBoostOnPAI if support explain XGBoost model\n\tt.Run(\"CaseTrainXGBoostOnAlisa\", CaseTrainXGBoostOnAlisa)\n\tt.Run(\"CaseTrainPAIKMeans\", CaseTrainPAIKMeans)\n}", "func BenchmarkPredictFull(b *testing.B) {\n\n\tmodel := &LinearSVC{\n\t\tcoefficients: Coefficients,\n\t\tintercepts: Intercepts,\n\t}\n\n\tvar internalResult int\n\tfor i := 0; i < b.N; i++ {\n\t\t// always record the result of Fib to prevent\n\t\t// the compiler eliminating the function call.\n\t\tinternalResult = model.Predict(Coefficients)\n\t}\n\n\t// always store the result to a package level variable\n\t// so the compiler cannot eliminate the Benchmark itself.\n\tresult = internalResult\n}", "func TestPlan_outBackend(t *testing.T) {\n\t// Create a temporary working directory that is empty\n\ttd := tempDir(t)\n\tcopy.CopyDir(testFixturePath(\"plan-out-backend\"), td)\n\tdefer os.RemoveAll(td)\n\tdefer testChdir(t, td)()\n\n\t// Our state\n\toriginalState := &terraform.State{\n\t\tModules: []*terraform.ModuleState{\n\t\t\t&terraform.ModuleState{\n\t\t\t\tPath: []string{\"root\"},\n\t\t\t\tResources: map[string]*terraform.ResourceState{\n\t\t\t\t\t\"test_instance.foo\": &terraform.ResourceState{\n\t\t\t\t\t\tType: \"test_instance\",\n\t\t\t\t\t\tPrimary: &terraform.InstanceState{\n\t\t\t\t\t\t\tID: \"bar\",\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\toriginalState.Init()\n\n\t// Setup our backend state\n\tdataState, srv := testBackendState(t, originalState, 200)\n\tdefer srv.Close()\n\ttestStateFileRemote(t, dataState)\n\n\toutPath := \"foo\"\n\tp := testProvider()\n\tui := new(cli.MockUi)\n\tc := &PlanCommand{\n\t\tMeta: Meta{\n\t\t\ttestingOverrides: metaOverridesForProvider(p),\n\t\t\tUi: ui,\n\t\t},\n\t}\n\n\targs := []string{\n\t\t\"-out\", outPath,\n\t}\n\tif code := c.Run(args); code != 0 {\n\t\tt.Fatalf(\"bad: %d\\n\\n%s\", code, ui.ErrorWriter.String())\n\t}\n\n\tplan := testReadPlan(t, outPath)\n\tif !plan.Diff.Empty() {\n\t\tt.Fatalf(\"Expected empty plan to be written to plan file, got: %s\", plan)\n\t}\n\n\tif plan.Backend.Empty() {\n\t\tt.Fatal(\"should have backend info\")\n\t}\n\tif !reflect.DeepEqual(plan.Backend, dataState.Backend) {\n\t\tt.Fatalf(\"bad: %#v\", plan.Backend)\n\t}\n}", "func (tbc *testbedCell) backend() {\n\tif err := tbc.behavior.Go(tbc, tbc, tbc); err != nil {\n\t\t// Notify subscribers about error.\n\t\ttbc.Emit(TopicError, PayloadCellError{\n\t\t\tCellName: tbc.Name(),\n\t\t\tError: err.Error(),\n\t\t})\n\t} else {\n\t\t// Notify subscribers about termination.\n\t\ttbc.Emit(TopicTerminated, PayloadTermination{\n\t\t\tCellName: tbc.Name(),\n\t\t})\n\t}\n}", "func (f *FakeOutput) Outputs() []operator.Operator { return nil }", "func TestController(t *testing.T) {\n\tfakeKubeClient, catalogClient, fakeBrokerCatalog, _, _, testController, _, stopCh := newTestController(t)\n\tdefer close(stopCh)\n\n\tt.Log(fakeKubeClient, catalogClient, fakeBrokerCatalog, testController, stopCh)\n\n\tfakeBrokerCatalog.RetCatalog = &brokerapi.Catalog{\n\t\tServices: []*brokerapi.Service{\n\t\t\t{\n\t\t\t\tName: \"test-service\",\n\t\t\t\tID: \"12345\",\n\t\t\t\tDescription: \"a test service\",\n\t\t\t\tPlans: []brokerapi.ServicePlan{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"test-plan\",\n\t\t\t\t\t\tFree: true,\n\t\t\t\t\t\tID: \"34567\",\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\tname := \"test-name\"\n\tbroker := &v1alpha1.Broker{\n\t\tObjectMeta: v1.ObjectMeta{Name: name},\n\t\tSpec: v1alpha1.BrokerSpec{\n\t\t\tURL: \"https://example.com\",\n\t\t},\n\t}\n\tbrokerClient := catalogClient.Servicecatalog().Brokers()\n\n\tbrokerServer, err := brokerClient.Create(broker)\n\tif nil != err {\n\t\tt.Fatalf(\"error creating the broker %q (%q)\", broker, err)\n\t}\n\n\tif err := wait.PollImmediate(500*time.Millisecond, wait.ForeverTestTimeout,\n\t\tfunc() (bool, error) {\n\t\t\tbrokerServer, err = brokerClient.Get(name)\n\t\t\tif nil != err {\n\t\t\t\treturn false,\n\t\t\t\t\tfmt.Errorf(\"error getting broker %s (%s)\",\n\t\t\t\t\t\tname, err)\n\t\t\t} else if len(brokerServer.Status.Conditions) > 0 {\n\t\t\t\tt.Log(brokerServer)\n\t\t\t\treturn true, nil\n\t\t\t} else {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t},\n\t); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// check\n\tserviceClassClient := catalogClient.Servicecatalog().ServiceClasses()\n\t_, err = serviceClassClient.Get(\"test-service\")\n\tif nil != err {\n\t\tt.Fatal(\"could not find the test service\", err)\n\t}\n\n\t// cleanup our broker\n\terr = brokerClient.Delete(name, &v1.DeleteOptions{})\n\tif nil != err {\n\t\tt.Fatalf(\"broker should be deleted (%s)\", err)\n\t}\n\n\t// uncomment if/when deleting a broker deletes the associated service\n\t// if class, err := serviceClassClient.Get(\"test-service\"); nil == err {\n\t// \tt.Fatal(\"found the test service that should have been deleted\", err, class)\n\t// }\n}", "func TestBBIExpandsWithoutPrefix(tt *testing.T) {\n\t//\tlines :=`DEBU[0000] expanded models: [240/001.mod 240/002.mod 240/003.mod 240/004.mod 240/005.mod 240/006.mod 240/007.mod 240/008.mod 240/009.mod]\n\t// INFO[0000] A total of 9 models have completed the initial preparation phase`\n\tt := wrapt.WrapT(tt)\n\n\tScenario := InitializeScenarios([]string{\n\t\t\"bbi_expansion\",\n\t})[0]\n\n\tScenario.Prepare(context.Background())\n\n\ttargets := `10[1:5].ctl`\n\n\tcommandAndArgs := []string{\n\t\t\"-d\", // Needs to be in debug mode to generate the expected output\n\t\t\"--threads\",\n\t\t\"2\",\n\t\t\"nonmem\",\n\t\t\"run\",\n\t\t\"local\",\n\t\t\"--nm_version\",\n\t\tos.Getenv(\"NMVERSION\"),\n\t\tfilepath.Join(Scenario.Workpath, \"model\", targets),\n\t}\n\n\toutput, err := executeCommand(context.Background(), \"bbi\", commandAndArgs...)\n\n\tt.R.NoError(err)\n\tt.R.NotEmpty(output)\n\n\tmodelsLine, _ := findOutputLine(strings.Split(output, \"\\n\"))\n\tmodelsLine = strings.TrimSuffix(modelsLine, \"\\n\")\n\texpandedModels := outputLineToModels(modelsLine)\n\n\t// Verify that we expanded to five models\n\tt.R.Len(expandedModels, 5)\n\n\t// Verify nonmem completed for all five\n\tfor _, m := range expandedModels {\n\t\tfile := filepath.Base(m)\n\t\textension := filepath.Ext(file)\n\t\tidentifier := strings.Replace(file, extension, \"\", 1)\n\t\toutputDir := filepath.Join(Scenario.Workpath, \"model\", identifier)\n\n\t\tinternalModel := Model{\n\t\t\tidentifier: identifier,\n\t\t\tfilename: file,\n\t\t\textension: extension,\n\t\t\tpath: outputDir,\n\t\t}\n\n\t\tnmd := NonMemTestingDetails{\n\t\t\tOutputDir: internalModel.path,\n\t\t\tModel: internalModel,\n\t\t\tOutput: output,\n\t\t\tScenario: Scenario,\n\t\t}\n\n\t\tAssertNonMemCompleted(t, nmd)\n\t\tAssertNonMemCreatedOutputFiles(t, nmd)\n\t}\n}", "func (t TestDescription) Beta() TestDescription {\n\treturn t.newLabel(\"BETA\")\n}", "func (storage *B2Storage) EnableTestMode() {\n for _, client := range storage.clients {\n client.TestMode = true\n }\n}", "func predict(input []float64, features *mat64.Dense, b []float64, featureWeights *mat64.Dense, output []float64) {\n\tfor i := range output {\n\t\toutput[i] = 0\n\t}\n\n\tnFeatures, _ := features.Dims()\n\t_, outputDim := featureWeights.Dims()\n\n\tsqrt2OverD := math.Sqrt(2.0 / float64(nFeatures))\n\t//for i, feature := range features {\n\tfor i := 0; i < nFeatures; i++ {\n\t\tz := computeZ(input, features.RowView(i), b[i], sqrt2OverD)\n\t\tfor j := 0; j < outputDim; j++ {\n\t\t\toutput[j] += z * featureWeights.At(i, j)\n\t\t}\n\t}\n}", "func TestMutableLabelblkPOST(t *testing.T) {\n\ttestConfig := server.TestConfig{CacheSize: map[string]int{\"labelarray\": 10}}\n\t// var testConfig server.TestConfig\n\tif err := server.OpenTest(testConfig); err != nil {\n\t\tt.Fatalf(\"can't open test server: %v\\n\", err)\n\t}\n\tdefer server.CloseTest()\n\n\t// Create testbed volume and data instances\n\tuuid, _ := initTestRepo()\n\tvar config dvid.Config\n\tserver.CreateTestInstance(t, uuid, \"labelarray\", \"labels\", config)\n\n\t// Post labels 1-4\n\tcreateLabelTestVolume(t, uuid, \"labels\")\n\n\tif err := datastore.BlockOnUpdating(uuid, \"labels\"); err != nil {\n\t\tt.Fatalf(\"Error blocking on sync of labels: %v\\n\", err)\n\t}\n\n\t// Make sure we have labels 1-4 sparsevol\n\tfor _, label := range []uint64{1, 2, 3, 4} {\n\t\t// Check fast HEAD requests\n\t\treqStr := fmt.Sprintf(\"%snode/%s/labels/sparsevol/%d\", server.WebAPIPath, uuid, label)\n\t\tresp := server.TestHTTPResponse(t, \"HEAD\", reqStr, nil)\n\t\tif resp.Code != http.StatusOK {\n\t\t\tt.Errorf(\"HEAD on %s did not return OK. Status = %d\\n\", reqStr, resp.Code)\n\t\t}\n\n\t\t// Check full sparse volumes\n\t\tencoding := server.TestHTTP(t, \"GET\", reqStr, nil)\n\t\tbodies[label-1].checkSparseVol(t, encoding, dvid.OptionalBounds{})\n\t}\n\n\t// Post labels 6-7\n\tcreateLabelTest2Volume(t, uuid, \"labels\")\n\n\tif err := datastore.BlockOnUpdating(uuid, \"labels\"); err != nil {\n\t\tt.Fatalf(\"Error blocking on sync of labels: %v\\n\", err)\n\t}\n\n\t// Make sure that labels 1-4 have no more sparse vol.\n\tfor _, label := range []uint64{1, 2, 3, 4} {\n\t\t// Check full sparse volumes aren't retrievable anymore\n\t\treqStr := fmt.Sprintf(\"%snode/%s/labels/sparsevol/%d\", server.WebAPIPath, uuid, label)\n\t\tserver.TestBadHTTP(t, \"GET\", reqStr, nil)\n\n\t\t// Make sure non-existent bodies return proper HEAD responses.\n\t\tresp := server.TestHTTPResponse(t, \"HEAD\", reqStr, nil)\n\t\tif resp.Code != http.StatusNoContent {\n\t\t\tt.Errorf(\"HEAD on %s did not return 204 (No Content). Status = %d\\n\", reqStr, resp.Code)\n\t\t}\n\t}\n\n\t// Make sure labels 6-7 are available as sparse vol.\n\tfor _, label := range []uint64{6, 7} {\n\t\t// Check fast HEAD requests\n\t\treqStr := fmt.Sprintf(\"%snode/%s/labels/sparsevol/%d\", server.WebAPIPath, uuid, label)\n\t\tresp := server.TestHTTPResponse(t, \"HEAD\", reqStr, nil)\n\t\tif resp.Code != http.StatusOK {\n\t\t\tt.Errorf(\"HEAD on %s did not return OK. Status = %d\\n\", reqStr, resp.Code)\n\t\t}\n\n\t\t// Check full sparse volumes\n\t\tencoding := server.TestHTTP(t, \"GET\", reqStr, nil)\n\t\tbodies[label-1].checkSparseVol(t, encoding, dvid.OptionalBounds{})\n\t}\n}", "func TestNewLabelgraphDifferent(t *testing.T) {\n\ttests.UseStore()\n\tdefer tests.CloseStore()\n\n\trepo, _ := initTestRepo()\n\n\t// Add data\n\tconfig := dvid.NewConfig()\n\tconfig.SetVersioned(true)\n\tdataservice1, err := repo.NewData(dtype, \"lg1\", config)\n\tif err != nil {\n\t\tt.Errorf(\"Error creating new labelgraph instance 1: %s\\n\", err.Error())\n\t}\n\tdata1, ok := dataservice1.(*Data)\n\tif !ok {\n\t\tt.Errorf(\"Returned new data instance 1 is not labelgraph.Data\\n\")\n\t}\n\tdataservice2, err := repo.NewData(dtype, \"lg2\", config)\n\tif err != nil {\n\t\tt.Errorf(\"Error creating new labelgraph instance 2: %s\\n\", err.Error())\n\t}\n\tdata2, ok := dataservice2.(*Data)\n\tif !ok {\n\t\tt.Errorf(\"Returned new data instance 2 is not labelgraph.Data\\n\")\n\t}\n\tif data1.InstanceID() == data2.InstanceID() {\n\t\tt.Errorf(\"Instance IDs should be different: %d == %d\\n\",\n\t\t\tdata1.InstanceID(), data2.InstanceID())\n\t}\n}", "func TestBBIExpandsWithPrefix(tt *testing.T) {\n\t//\tlines :=`DEBU[0000] expanded models: [240/001.mod 240/002.mod 240/003.mod 240/004.mod 240/005.mod 240/006.mod 240/007.mod 240/008.mod 240/009.mod]\n\t// INFO[0000] A total of 9 models have completed the initial preparation phase`\n\tt := wrapt.WrapT(tt)\n\n\tScenario := InitializeScenarios([]string{\n\t\t\"bbi_expansion\",\n\t})[0]\n\n\tScenario.Prepare(context.Background())\n\n\ttargets := `bbi_mainrun_10[1:3].ctl`\n\n\tcommandAndArgs := []string{\n\t\t\"-d\", // Needs to be in debug mode to generate the expected output\n\t\t\"--threads\",\n\t\t\"2\",\n\t\t\"nonmem\",\n\t\t\"run\",\n\t\t\"local\",\n\t\t\"--nm_version\",\n\t\tos.Getenv(\"NMVERSION\"),\n\t\tfilepath.Join(Scenario.Workpath, \"model\", targets),\n\t}\n\n\toutput, err := executeCommand(context.Background(), \"bbi\", commandAndArgs...)\n\n\tt.R.NoError(err)\n\tt.R.NotEmpty(output)\n\n\tmodelsLine, _ := findOutputLine(strings.Split(output, \"\\n\"))\n\tmodelsLine = strings.TrimSuffix(modelsLine, \"\\n\")\n\texpandedModels := outputLineToModels(modelsLine)\n\n\t// Verify that we expanded to three models\n\tt.R.Len(expandedModels, 3)\n\n\t// Verify nonmem completed for all five\n\tfor _, m := range expandedModels {\n\t\tfile := filepath.Base(m)\n\t\textension := filepath.Ext(file)\n\t\tidentifier := strings.Replace(file, extension, \"\", 1)\n\t\toutputDir := filepath.Join(Scenario.Workpath, \"model\", identifier)\n\n\t\tinternalModel := Model{\n\t\t\tidentifier: identifier,\n\t\t\tfilename: file,\n\t\t\textension: extension,\n\t\t\tpath: outputDir,\n\t\t}\n\n\t\tnmd := NonMemTestingDetails{\n\t\t\tOutputDir: internalModel.path,\n\t\t\tModel: internalModel,\n\t\t\tOutput: output,\n\t\t}\n\n\t\tAssertNonMemCompleted(t, nmd)\n\t\tAssertNonMemCreatedOutputFiles(t, nmd)\n\t}\n}", "func (t *NvidiaGPUUpgradeTest) Test(ctx context.Context, f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {\n\t<-done\n\tginkgo.By(\"Verifying gpu job success\")\n\tscheduling.VerifyJobNCompletions(ctx, f, completions)\n\tif upgrade == upgrades.MasterUpgrade || upgrade == upgrades.ClusterUpgrade {\n\t\t// MasterUpgrade should be totally hitless.\n\t\tjob, err := e2ejob.GetJob(ctx, f.ClientSet, f.Namespace.Name, \"cuda-add\")\n\t\tframework.ExpectNoError(err)\n\t\tframework.ExpectEqual(job.Status.Failed, 0, \"Job pods failed during master upgrade: %v\", job.Status.Failed)\n\t}\n}", "func ExampleNeuralNetwork_Predict () {\n\tnn.Predict([]float64 {1, 0})\n}", "func NewGetBackendsBackendIDTestOK() *GetBackendsBackendIDTestOK {\n\n\treturn &GetBackendsBackendIDTestOK{}\n}", "func (*TestingKnobs) ModuleTestingKnobs() {}", "func testMain(m *testing.M) int {\n\tkubeConfigPath := flag.String(\n\t\t\"kubeconfig\",\n\t\tclientcmd.RecommendedHomeFile,\n\t\t\"kube config path, default: $HOME/.kube/config\",\n\t)\n\n\topImageName := flag.String(\n\t\t\"operator-image\",\n\t\t\"\",\n\t\t\"operator image, e.g. quay.io/coreos/cluster-monitoring-operator\",\n\t)\n\n\tflag.Parse()\n\n\tvar err error\n\tf, err = framework.New(*kubeConfigPath, *opImageName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcleanUp, err := f.Setup()\n\t// Check cleanUp first, in case of an err, we still want to clean up.\n\tif cleanUp != nil {\n\t\tdefer cleanUp()\n\t}\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Wait for Prometheus operator.\n\terr = wait.Poll(time.Second, 5*time.Minute, func() (bool, error) {\n\t\t_, err := f.KubeClient.Apps().Deployments(f.Ns).Get(\"prometheus-operator\", metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn m.Run()\n}", "func Test0() []int8 {\n\tvar res0 []int8\n\treturn res0\n}", "func prediction(xi float64) float64 {\n\treturn b0 + b1*xi\n}", "func getTestMatrix_Empty() [][]string {\n\tvar m [][]string = make([][]string, 0)\n\treturn m\n}", "func (n *OpenBazaarNode) RegressionNetworkEnabled() bool { return n.RegressionTestEnable }", "func TestDeleteBackends(t *testing.T) {\n\tsuffix := rand.Intn(1000000)\n\tfilename := fmt.Sprintf(\"/tmp/test-%v\", suffix)\n\trouter := NewRoutes(filename)\n\n\trouter.CreateFrontend(\"frontend1\", \"http://127.0.0.1/test_frontend\")\n\trouter.AddAlias(\"alias1\", \"frontend1\")\n\n\tfrontend := router.GlobalRoutes[\"frontend1\"]\n\n\tprotocols := []string{\"http\", \"https\", \"Sti\"}\n\tendpoint := Endpoint{ID: \"my-endpoint\", IP: \"127.0.0.1\", Port: \"8080\"}\n\tendpoints := []Endpoint{endpoint}\n\n\tbackend := Backend{FePath: \"fe_server1\", BePath: \"be_server1\", Protocols: protocols}\n\trouter.AddRoute(&frontend, &backend, endpoints)\n\n\tfrontend, ok := router.GlobalRoutes[\"frontend1\"]\n\tif !ok {\n\t\tt.Error(\"Expected to find frontend\")\n\t}\n\n\trouter.DeleteBackends(\"frontend1\")\n\tfrontend = router.GlobalRoutes[\"frontend1\"]\n\tif len(frontend.Backends) != 0 {\n\t\tt.Error(\"Expected that frontend has empty backend\")\n\t}\n\n\t// Deleting an non existing frontend\n\trouter.DeleteBackends(\"frontend1_NOT_EXISTENT\")\n\tfrontend = router.GlobalRoutes[\"frontend1_NOT_EXISTENT\"]\n\tif len(frontend.Backends) != 0 {\n\t\tt.Error(\"Expected that frontend has empty backend\")\n\t}\n\n}", "func (m *Mind) Back(input *mat64.Dense, output *mat64.Dense) {\n\tErrorOutputLayer := mat64.NewDense(1, 1, nil)\n\tErrorOutputLayer.Sub(output, m.Results.OutputResult)\n\tDeltaOutputLayer := m.ActivatePrime(m.Results.OutputSum)\n\tDeltaOutputLayer.MulElem(DeltaOutputLayer, ErrorOutputLayer)\n\n\tHiddenOutputChanges := mat64.DenseCopyOf(m.Results.HiddenResult.T())\n\tHiddenOutputChanges.Product(DeltaOutputLayer)\n\tHiddenOutputChanges.Scale(m.LearningRate, HiddenOutputChanges)\n\tm.Weights.HiddenOutput.Add(m.Weights.HiddenOutput, HiddenOutputChanges)\n\n\tDeltaHiddenLayer := mat64.DenseCopyOf(DeltaOutputLayer)\n\tDeltaHiddenLayer.Product(DeltaOutputLayer, m.Weights.HiddenOutput.T())\n\tDeltaHiddenLayer.MulElem(DeltaHiddenLayer, m.ActivatePrime(m.Results.HiddenSum))\n\n\tInputHiddenChanges := mat64.DenseCopyOf(input.T())\n\tInputHiddenChanges.Product(DeltaHiddenLayer)\n\tInputHiddenChanges.Scale(m.LearningRate, InputHiddenChanges)\n\tm.Weights.InputHidden.Add(m.Weights.InputHidden, InputHiddenChanges)\n}", "func TestApp_ABCI(t *testing.T) {\n\tapp := setup(setupForGeneralInfo)\n\tt.Run(\"ABCI function should return non empty ABCI\", func(t *testing.T) {\n\n\t\tabci := app.ABCI()\n\t\tassert.NotEmpty(t, abci)\n\t})\n\n\tt.Run(\"Header should return empty app header\", func(t *testing.T) {\n\t\theader := app.Header()\n\t\tassert.Empty(t, header)\n\t})\n\n\tt.Run(\"Node should return empty app node\", func(t *testing.T) {\n\t\tnode := app.Node()\n\t\tassert.Empty(t, node)\n\t})\n}", "func (bt *BackTest) Reset() {\n\tbt.EventQueue.Reset()\n\tbt.Datas.Reset()\n\tbt.Portfolio.Reset()\n\tbt.Statistic.Reset()\n\tbt.Exchange.Reset()\n\tbt.Funding.Reset()\n\tbt.exchangeManager = nil\n\tbt.orderManager = nil\n\tbt.databaseManager = nil\n}", "func validateManagedBackendServiceBackends(backends []interface{}, d *schema.ResourceDiff) error {\n\tsum := 0.0\n\n\tfor _, b := range backends {\n\t\tif b == nil {\n\t\t\tcontinue\n\t\t}\n\t\tbackend := b.(map[string]interface{})\n\t\tif v, ok := backend[\"capacity_scaler\"]; ok && v != nil {\n\t\t\tsum += v.(float64)\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"capacity_scaler is required for each backend in managed backend service\")\n\t\t}\n\t}\n\tif sum == 0.0 {\n\t\treturn fmt.Errorf(\"managed backend service must have at least one non-zero capacity_scaler for backends\")\n\t}\n\treturn nil\n}", "func testMockIATBatchHeaderFF(t testing.TB) {\n\tbh := mockIATBatchHeaderFF()\n\tif err := bh.Validate(); err != nil {\n\t\tt.Error(\"mockIATBatchHeaderFF does not validate and will break other tests: \", err)\n\t}\n\tif bh.ServiceClassCode != CreditsOnly {\n\t\tt.Error(\"ServiceClassCode dependent default value has changed\")\n\t}\n\tif bh.ForeignExchangeIndicator != \"FF\" {\n\t\tt.Error(\"ForeignExchangeIndicator does not validate and will break other tests\")\n\t}\n\tif bh.ForeignExchangeReferenceIndicator != 3 {\n\t\tt.Error(\"ForeignExchangeReferenceIndicator does not validate and will break other tests\")\n\t}\n\tif bh.ISODestinationCountryCode != \"US\" {\n\t\tt.Error(\"DestinationCountryCode dependent default value has changed\")\n\t}\n\tif bh.OriginatorIdentification != \"123456789\" {\n\t\tt.Error(\"OriginatorIdentification dependent default value has changed\")\n\t}\n\tif bh.StandardEntryClassCode != IAT {\n\t\tt.Error(\"StandardEntryClassCode dependent default value has changed\")\n\t}\n\tif bh.CompanyEntryDescription != \"TRADEPAYMT\" {\n\t\tt.Error(\"CompanyEntryDescription dependent default value has changed\")\n\t}\n\tif bh.ISOOriginatingCurrencyCode != \"CAD\" {\n\t\tt.Error(\"ISOOriginatingCurrencyCode dependent default value has changed\")\n\t}\n\tif bh.ISODestinationCurrencyCode != \"USD\" {\n\t\tt.Error(\"ISODestinationCurrencyCode dependent default value has changed\")\n\t}\n\tif bh.ODFIIdentification != \"23138010\" {\n\t\tt.Error(\"ODFIIdentification dependent default value has changed\")\n\t}\n}", "func TestInternalFritzAPI(t *testing.T) {\n\ttestCases := []struct {\n\t\ttc func(t *testing.T, internal Internal)\n\t}{\n\t\t{testListLanDevices},\n\t\t{testListLogs},\n\t\t{testInetStats},\n\t\t{testBoxInfo},\n\t}\n\tfor _, testCase := range testCases {\n\t\tt.Run(fmt.Sprintf(\"Test aha api %s\", runtime.FuncForPC(reflect.ValueOf(testCase.tc).Pointer()).Name()), func(t *testing.T) {\n\t\t\tsrv := mock.New().Start()\n\t\t\tdefer srv.Close()\n\t\t\tinternal := setUpClient(t, srv)\n\t\t\tassert.NotNil(t, internal)\n\t\t\ttestCase.tc(t, internal)\n\t\t})\n\t}\n}", "func TestData(t *testing.T) { TestingT(t) }", "func (s *BackendSuite) TestServerUpdates(c *C) {\n\tbeCfg, err := engine.NewHTTPBackend(\"foo\", engine.HTTPBackendSettings{})\n\tc.Assert(err, IsNil)\n\tbe, err := newBackend(*beCfg, Options{}, []engine.Server{{Id: \"1\"}, {Id: \"3\"}})\n\tc.Assert(err, IsNil)\n\n\t// When/Then\n\tc.Assert(be.upsertServer(engine.Server{Id: \"2\"}), Equals, true)\n\tc.Assert(be.upsertServer(engine.Server{Id: \"3\"}), Equals, false)\n\tc.Assert(be.upsertServer(engine.Server{Id: \"4\"}), Equals, true)\n\tc.Assert(be.deleteServer(engine.ServerKey{Id: \"5\"}), Equals, false)\n\tc.Assert(be.deleteServer(engine.ServerKey{Id: \"1\"}), Equals, true)\n\tc.Assert(be.upsertServer(engine.Server{Id: \"5\"}), Equals, true)\n\tc.Assert(be.deleteServer(engine.ServerKey{Id: \"2\"}), Equals, true)\n\tc.Assert(be.upsertServer(engine.Server{Id: \"1\"}), Equals, true)\n\tc.Assert(be.upsertServer(engine.Server{Id: \"1\"}), Equals, false)\n\tc.Assert(be.upsertServer(engine.Server{Id: \"3\"}), Equals, false)\n\tc.Assert(be.deleteServer(engine.ServerKey{Id: \"5\"}), Equals, true)\n\n\t_, srvCfgs := be.snapshot()\n\tc.Assert(srvCfgs, DeepEquals, []engine.Server{{Id: \"3\"}, {Id: \"4\"}, {Id: \"1\"}})\n}", "func getTestMatrix_Big() [][]string {\n\treturn [][]string{{strMaxInt, strMaxInt, strMaxInt}, {strMaxInt, strMaxInt, strMaxInt}, {strMaxInt, strMaxInt, strMaxInt}}\n}", "func VPTESTNMQ(ops ...operand.Op) { ctx.VPTESTNMQ(ops...) }", "func TestMinimalGCEInternalLoadBalancer(t *testing.T) {\n\tnewIntegrationTest(\"minimal-gce-ilb.example.com\", \"minimal_gce_ilb\").\n\t\twithAddons(\n\t\t\tdnsControllerAddon,\n\t\t\tgcpCCMAddon,\n\t\t\tgcpPDCSIAddon,\n\t\t).\n\t\trunTestTerraformGCE(t)\n}", "func TestSIFTLib2(t *testing.T) { TestingT(t) }", "func NewBackends(httpClient *http.Client) *Backends {\n\treturn &Backends{\n\t\tYFin: &BackendConfiguration{\n\t\t\tYFinBackend, YFinURL, httpClient,\n\t\t},\n\t\tBats: &BackendConfiguration{\n\t\t\tBATSBackend, BATSURL, httpClient,\n\t\t},\n\t}\n}", "func NewTestSystemWithBackend(n, f uint64) *testSystem {\n\ttestLogger.SetHandler(elog.StdoutHandler)\n\n\taddrs := generateValidators(int(n))\n\tsys := newTestSystem(n)\n\tconfig := istanbul.DefaultConfig\n\n\tfor i := uint64(0); i < n; i++ {\n\t\tvset := validator.NewSet(addrs, istanbul.NewRoundRobinProposerPolicy())\n\t\tbackend := sys.NewBackend(i)\n\t\tbackend.peers = vset\n\t\tbackend.address = vset.GetByIndex(i).Address()\n\n\t\tcore := New(backend, config)\n\t\tcore.state = ibfttypes.StateAcceptRequest\n\t\tcore.current = newRoundState(&istanbul.View{\n\t\t\tRound: big.NewInt(0),\n\t\t\tSequence: big.NewInt(1),\n\t\t}, vset, common.Hash{}, nil, nil, func(hash common.Hash) bool {\n\t\t\treturn false\n\t\t})\n\t\tcore.valSet = vset\n\t\tcore.logger = testLogger\n\t\tcore.validateFn = backend.CheckValidatorSignature\n\n\t\tbackend.engine = core\n\t}\n\n\treturn sys\n}", "func TestPredictionCreatorSmoothData4(t *testing.T) {\n\tt.Log(\"Initialisation of prediction configuration and data slice ...\")\n\tsmoothingCreator.smoothingRange = 1000\n\tvar dataSlice [](*model.Data)\n\tdataEntries := 4\n\trunningTime := time.Now()\n\trunningBytes := 10\n\tfor i:=0; i<dataEntries; i++ {\n\t\tdataSlice = append(dataSlice, &model.Data{\n\t\t\tBytes: uint(runningBytes),\n\t\t\tTime: runningTime,\n\t\t})\n\t\trunningTime = runningTime.Add(time.Duration(5000) * time.Millisecond)\n\t\trunningBytes += 5\n\t}\n\n\tt.Log(\"Execution of data smoothing ...\")\n\tsmoothedData := smoothingCreator.SmoothData(&dataSlice)\n\t/*for i:=0; i<len(*smoothedData); i++ {\n\t\tif (*smoothedData)[i] != nil {\n\t\t\tfmt.Println((*smoothedData)[i].DataElement)\n\t\t} else {\n\t\t\tfmt.Println(nil)\n\t\t}\n\t}*/\n\n\tt.Log(\"Verification of smoothed data slice ...\")\n\tvalidData := []uint64{10.0, 0.0, 0.0, 0.0, 0.0, 15.0, 0.0, 0.0, 0.0, 0.0, 20.0, 0.0, 0.0, 0.0, 0.0, 25.0}\n\tif len(*smoothedData) != len(validData) {\n\t\tt.Fatalf(\"The length of smoothed data is invalid - expected length: %d, actual length: %d\",\n\t\t\tlen(validData), len(*smoothedData))\n\t}\n\tfor i:=0; i<len(validData); i++ {\n\t\tif validData[i] != (*smoothedData)[i].DataElement {\n\t\t\tt.Errorf(\"Expected data element of smoothed vector: %d, actual value: %d\",\n\t\t\t\tvalidData[i], (*smoothedData)[i].DataElement)\n\t\t}\n\t}\n}", "func TestDemo(t *testing.T) {\n\tvar (\n\t\ttn string\n\t\terr error\n\t)\n\trefreshErrHandler := func(err error) {\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\tctx := context.Background()\n\tconfigStorage, err := onlinelab.NewConsulConfigStorage(&api.Config{})\n\tif err != nil {\n\t\tt.Error(\"failed to create config storage\")\n\t}\n\ttreatmentControoler, err := onlinelab.CreateTreatmentController(ctx, configStorage,\n\t\t\"HelloLab\", time.Second*1, refreshErrHandler)\n\tif err != nil {\n\t\tt.Error(\"failed to create treatment controller\")\n\t}\n\n\tcntT1 := 0\n\tcntT2 := 0\n\tfor i := 1; i <= 1000000; i++ {\n\t\ttn, err = treatmentControoler.GetNextTreatment(i)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tbreak\n\t\t}\n\t\tswitch tn {\n\t\tcase \"T1\":\n\t\t\tcntT1++\n\t\tcase \"T2\":\n\t\t\tcntT2++\n\t\t}\n\t}\n\tt.Logf(\"T1 count: %d; T2 count: %d\", cntT1, cntT2)\n}", "func GraphTest() error {\n\tst := llb.Image(\"ubuntu:18.04\")\n\n\tdef, err := st.Marshal()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"marshaling state\")\n\t}\n\n\treturn llb.WriteTo(def, os.Stdout)\n}", "func PTEST(mx, x operand.Op) { ctx.PTEST(mx, x) }", "func testModels() ([]string, []string, []string) {\n\tfiles := []string{\n\t\t\"../../../YangModels/yang/standard/ietf/RFC/[email protected]\",\n\t\t\"../../../openconfig/public/release/models/interfaces/openconfig-interfaces.yang\",\n\t\t\"../../../openconfig/public/release/models/system/openconfig-messages.yang\",\n\t\t\"../../../openconfig/public/release/models/telemetry/openconfig-telemetry.yang\",\n\t\t\"../../../openconfig/public/release/models/openflow/openconfig-openflow.yang\",\n\t\t\"../../../openconfig/public/release/models/platform/openconfig-platform.yang\",\n\t\t\"../../../openconfig/public/release/models/system/openconfig-system.yang\",\n\t\t\"../../../neoul/yangtree/testdata/sample/sample.yang\",\n\t}\n\tdir := []string{\"../../../openconfig/public/\", \"../../../YangModels/yang\"}\n\texcluded := []string{\"ietf-interfaces\"}\n\treturn files, dir, excluded\n}", "func TestK8gbSpecKeepsStableAfterIngressUpdates(t *testing.T) {\n\tt.Parallel()\n\t// name of ingress and gslb\n\tconst name = \"test-gslb-lifecycle\"\n\n\tassertStrategy := func(t *testing.T, options *k8s.KubectlOptions) {\n\t\tutils.AssertGslbSpec(t, options, name, \"spec.strategy.splitBrainThresholdSeconds\", \"600\")\n\t\tutils.AssertGslbSpec(t, options, name, \"spec.strategy.dnsTtlSeconds\", \"60\")\n\t\tutils.AssertGslbSpec(t, options, name, \"spec.strategy.primaryGeoTag\", settings.PrimaryGeoTag)\n\t\tutils.AssertGslbSpec(t, options, name, \"spec.strategy.type\", \"failover\")\n\t}\n\n\tkubeResourcePath, err := filepath.Abs(\"../examples/failover-lifecycle.yaml\")\n\tingressResourcePath, err := filepath.Abs(\"../examples/ingress-annotation-failover.yaml\")\n\trequire.NoError(t, err)\n\t// To ensure we can reuse the resource config on the same cluster to test different scenarios, we setup a unique\n\t// namespace for the resources for this test.\n\t// Note that namespaces must be lowercase.\n\tnamespaceName := fmt.Sprintf(\"k8gb-test-spec-keeps-stable-after-ingress-updates-%s\", strings.ToLower(random.UniqueId()))\n\n\t// Here we choose to use the defaults, which is:\n\t// - HOME/.kube/config for the kubectl config file\n\t// - Current context of the kubectl config file\n\t// - Random namespace\n\toptions := k8s.NewKubectlOptions(\"\", \"\", namespaceName)\n\n\tk8s.CreateNamespace(t, options, namespaceName)\n\tdefer k8s.DeleteNamespace(t, options, namespaceName)\n\n\t// create gslb\n\tutils.CreateGslb(t, options, settings, kubeResourcePath)\n\tk8s.WaitUntilIngressAvailable(t, options, name, 60, 1*time.Second)\n\n\tassertStrategy(t, options)\n\n\t// reapply ingress\n\tutils.CreateGslb(t, options, settings, ingressResourcePath)\n\n\tk8s.WaitUntilIngressAvailable(t, options, name, 60, 1*time.Second)\n\n\tingress := k8s.GetIngress(t, options, name)\n\n\trequire.Equal(t, ingress.Name, name)\n\t// assert Gslb strategy has initial values, ingress doesn't change it\n\tassertStrategy(t, options)\n}", "func (m *MockapprunnerDescriber) Outputs() (map[string]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Outputs\")\n\tret0, _ := ret[0].(map[string]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func VPTESTMQ(ops ...operand.Op) { ctx.VPTESTMQ(ops...) }", "func (e PreconditionFailed) IsPreconditionFailed() {}", "func newLoadTestWithMultipleClientsAndServers(clientNum int, serverNum int) *grpcv1.LoadTest {\n\tcloneImage := \"docker.pkg.github.com/grpc/test-infra/clone\"\n\tcloneRepo := \"https://github.com/grpc/grpc.git\"\n\tcloneGitRef := \"master\"\n\n\tbuildImage := \"l.gcr.io/google/bazel:latest\"\n\tbuildCommand := []string{\"bazel\"}\n\tbuildArgs := []string{\"build\", \"//test/cpp/qps:qps_worker\"}\n\n\tdriverImage := \"docker.pkg.github.com/grpc/test-infra/driver\"\n\trunImage := \"docker.pkg.github.com/grpc/test-infra/cxx\"\n\trunCommand := []string{\"bazel-bin/test/cpp/qps/qps_worker\"}\n\n\tclientRunArgs := []string{\"--driver_port=10000\"}\n\tserverRunArgs := append(clientRunArgs, \"--server_port=10010\")\n\n\tbigQueryTable := \"grpc-testing.e2e_benchmark.foobarbuzz\"\n\n\tdriverPool := \"drivers\"\n\tworkerPool := \"workers\"\n\n\tdriverComponentName := \"driver-1\"\n\n\tcreatedLoadTest := &grpcv1.LoadTest{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"test-loadtest-multiple-clients-and-servers\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\n\t\tSpec: grpcv1.LoadTestSpec{\n\t\t\tDriver: &grpcv1.Driver{\n\t\t\t\tName: &driverComponentName,\n\t\t\t\tLanguage: \"cxx\",\n\t\t\t\tPool: &driverPool,\n\t\t\t\tRun: []corev1.Container{{\n\t\t\t\t\tImage: driverImage,\n\t\t\t\t}},\n\t\t\t},\n\t\t\tResults: &grpcv1.Results{\n\t\t\t\tBigQueryTable: &bigQueryTable,\n\t\t\t},\n\n\t\t\tScenariosJSON: \"{\\\"scenarios\\\": []}\",\n\t\t},\n\t}\n\n\tserverNames := []string{}\n\tfor i := 1; i <= serverNum; i++ {\n\t\tserverNames = append(serverNames, fmt.Sprintf(\"server-%d\", i))\n\t}\n\tfor i := 1; i <= len(serverNames); i++ {\n\t\tcreatedLoadTest.Spec.Servers = append(createdLoadTest.Spec.Servers, grpcv1.Server{\n\t\t\tName: &serverNames[i-1],\n\t\t\tLanguage: \"cxx\",\n\t\t\tPool: &workerPool,\n\t\t\tClone: &grpcv1.Clone{\n\t\t\t\tImage: &cloneImage,\n\t\t\t\tRepo: &cloneRepo,\n\t\t\t\tGitRef: &cloneGitRef,\n\t\t\t},\n\t\t\tBuild: &grpcv1.Build{\n\t\t\t\tImage: &buildImage,\n\t\t\t\tCommand: buildCommand,\n\t\t\t\tArgs: buildArgs,\n\t\t\t},\n\t\t\tRun: []corev1.Container{{\n\t\t\t\tImage: runImage,\n\t\t\t\tCommand: runCommand,\n\t\t\t\tArgs: serverRunArgs,\n\t\t\t}},\n\t\t})\n\t}\n\n\tclientName := []string{}\n\tfor i := 1; i <= clientNum; i++ {\n\t\tclientName = append(clientName, fmt.Sprintf(\"client-%d\", i))\n\t}\n\tfor i := 1; i <= len(clientName); i++ {\n\t\tcreatedLoadTest.Spec.Clients = append(createdLoadTest.Spec.Clients, grpcv1.Client{\n\t\t\tName: &clientName[i-1],\n\t\t\tLanguage: \"cxx\",\n\t\t\tPool: &workerPool,\n\t\t\tClone: &grpcv1.Clone{\n\t\t\t\tImage: &cloneImage,\n\t\t\t\tRepo: &cloneRepo,\n\t\t\t\tGitRef: &cloneGitRef,\n\t\t\t},\n\t\t\tBuild: &grpcv1.Build{\n\t\t\t\tImage: &buildImage,\n\t\t\t\tCommand: buildCommand,\n\t\t\t\tArgs: buildArgs,\n\t\t\t},\n\t\t\tRun: []corev1.Container{{\n\t\t\t\tImage: runImage,\n\t\t\t\tCommand: runCommand,\n\t\t\t\tArgs: clientRunArgs,\n\t\t\t}},\n\t\t})\n\t}\n\tcreatedLoadTest.SetUID(types.UID(\"matching-test-uid\"))\n\treturn createdLoadTest\n}", "func InitializeBackends(ctx context.Context, ps versioned.Interface, kc kubernetes.Interface, cfg config.Config) (map[string]Backend, error) {\n\t// Add an entry here for every configured backend\n\tconfiguredBackends := []string{}\n\tif cfg.Artifacts.TaskRuns.Enabled() {\n\t\tconfiguredBackends = append(configuredBackends, sets.List[string](cfg.Artifacts.TaskRuns.StorageBackend)...)\n\t}\n\tif cfg.Artifacts.OCI.Enabled() {\n\t\tconfiguredBackends = append(configuredBackends, sets.List[string](cfg.Artifacts.OCI.StorageBackend)...)\n\t}\n\tif cfg.Artifacts.PipelineRuns.Enabled() {\n\t\tconfiguredBackends = append(configuredBackends, sets.List[string](cfg.Artifacts.PipelineRuns.StorageBackend)...)\n\t}\n\n\t// Now only initialize and return the configured ones.\n\tbackends := map[string]Backend{}\n\tfor _, backendType := range configuredBackends {\n\t\tswitch backendType {\n\t\tcase gcs.StorageBackendGCS:\n\t\t\tgcsBackend, err := gcs.NewStorageBackend(ctx, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbackends[backendType] = gcsBackend\n\t\tcase tekton.StorageBackendTekton:\n\t\t\tbackends[backendType] = tekton.NewStorageBackend(ps)\n\t\tcase oci.StorageBackendOCI:\n\t\t\tociBackend := oci.NewStorageBackend(ctx, kc, cfg)\n\t\t\tbackends[backendType] = ociBackend\n\t\tcase docdb.StorageTypeDocDB:\n\t\t\tdocdbBackend, err := docdb.NewStorageBackend(ctx, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbackends[backendType] = docdbBackend\n\t\tcase grafeas.StorageBackendGrafeas:\n\t\t\tgrafeasBackend, err := grafeas.NewStorageBackend(ctx, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbackends[backendType] = grafeasBackend\n\t\tcase pubsub.StorageBackendPubSub:\n\t\t\tpubsubBackend, err := pubsub.NewStorageBackend(ctx, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbackends[backendType] = pubsubBackend\n\t\t}\n\n\t}\n\treturn backends, nil\n}", "func DecisionStump(param *DecisionStumpOptionalParam) (dsModel, *mat.Dense) {\n resetTimers()\n enableTimers()\n disableBacktrace()\n disableVerbose()\n restoreSettings(\"Decision Stump\")\n\n // Detect if the parameter was passed; set if so.\n if param.BucketSize != 6 {\n setParamInt(\"bucket_size\", param.BucketSize)\n setPassed(\"bucket_size\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.InputModel != nil {\n setDSModel(\"input_model\", param.InputModel)\n setPassed(\"input_model\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Labels != nil {\n gonumToArmaUrow(\"labels\", param.Labels)\n setPassed(\"labels\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Test != nil {\n gonumToArmaMat(\"test\", param.Test)\n setPassed(\"test\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Training != nil {\n gonumToArmaMat(\"training\", param.Training)\n setPassed(\"training\")\n }\n\n // Detect if the parameter was passed; set if so.\n if param.Verbose != false {\n setParamBool(\"verbose\", param.Verbose)\n setPassed(\"verbose\")\n enableVerbose()\n }\n\n // Mark all output options as passed.\n setPassed(\"output_model\")\n setPassed(\"predictions\")\n\n // Call the mlpack program.\n C.mlpackDecisionStump()\n\n // Initialize result variable and get output.\n var outputModel dsModel\n outputModel.getDSModel(\"output_model\")\n var predictionsPtr mlpackArma\n predictions := predictionsPtr.armaToGonumUrow(\"predictions\")\n\n // Clear settings.\n clearSettings()\n\n // Return output(s).\n return outputModel, predictions\n}", "func availableKvBackends() []string {\n\tvar available_kv_backends []string\n\tfor k, _ := range kvBackendFactories {\n\t\tavailable_kv_backends = append(available_kv_backends, k)\n\t}\n\treturn available_kv_backends\n}", "func (m *Model) IsRegression() bool { return m.target.IsNumeric() }", "func testBackend(t *testing.T, b core.Backend, id int64) {\n\tassert.Equal(t, b.LineCount(), 12, \"lineCount\")\n\tassert.Equal(t, b.SrcLoc(), \"../test_data/file1.txt\", \"srcLoc\")\n\n\ts1 := b.Slice(0, 0, 0, 9)\n\ts := core.RunesToString(*s1.Text())\n\tassert.Equal(t, s, \"1234567890\", \"slice1\")\n\ts = core.RunesToString(*b.Slice(3, 4, 3, 4).Text())\n\tassert.Equal(t, s, \"E\", \"slice2\")\n\ts = core.RunesToString(*b.Slice(2, 1, 2, 3).Text())\n\tassert.Equal(t, s, \"bcd\", \"slice3\")\n\ts = core.RunesToString(*b.Slice(6, 1, 6, 5).Text())\n\tassert.Equal(t, s, \"βξδεφ\", \"slice4\")\n\t// Should be an \"absolute\" move.\n\ts = core.RunesToString(*b.Slice(0, 0, 0, 9).Text())\n\tassert.Equal(t, s, \"1234567890\", \"slice5\")\n\t// actual rectangle slice\n\texpected := \"567890\\n\\nefghijkl\\nEFGHIJKL\\n\\n\\nεφγηιςκλ\\nΕΦΓΗΙςΚΛ\"\n\ts6 := b.Slice(0, 4, 7, 11)\n\ts = core.RunesToString(*s6.Text())\n\tassert.Equal(t, s6.R1, 0, \"slice6.R1\")\n\tassert.Equal(t, s6.C1, 4, \"slice6.C1\")\n\tassert.Equal(t, s6.R2, 7, \"slice6.R2\")\n\tassert.Equal(t, s6.C2, 11, \"slice6.C2\")\n\tassert.Equal(t, s, expected, \"slice6\")\n\ts = core.RunesToString(*b.Slice(9, 2, 9, 3).Text())\n\tassert.Equal(t, s, \"ab\", \"slice7\")\n\t// \"backward\" and mostly out of bounds slice\n\ts = core.RunesToString(*b.Slice(11, 20, 11, 9).Text())\n\tassert.Equal(t, s, `\"wide\" runes`, \"slice8\")\n\n\tinsertionTests(t, b)\n\t// TODO: test save etc ....\n\t// Test file MD5\n}", "func TestCBOWithoutAnalyze(t *testing.T) {\n\tstore, dom := testkit.CreateMockStoreAndDomain(t)\n\ttestKit := testkit.NewTestKit(t, store)\n\ttestKit.MustExec(\"use test\")\n\ttestKit.MustExec(\"create table t1 (a int)\")\n\ttestKit.MustExec(\"create table t2 (a int)\")\n\th := dom.StatsHandle()\n\trequire.NoError(t, h.HandleDDLEvent(<-h.DDLEventCh()))\n\trequire.NoError(t, h.HandleDDLEvent(<-h.DDLEventCh()))\n\ttestKit.MustExec(\"insert into t1 values (1), (2), (3), (4), (5), (6)\")\n\ttestKit.MustExec(\"insert into t2 values (1), (2), (3), (4), (5), (6)\")\n\trequire.NoError(t, h.DumpStatsDeltaToKV(handle.DumpAll))\n\trequire.NoError(t, h.Update(dom.InfoSchema()))\n\tvar input []string\n\tvar output []struct {\n\t\tSQL string\n\t\tPlan []string\n\t}\n\tanalyzeSuiteData := GetAnalyzeSuiteData()\n\tanalyzeSuiteData.LoadTestCases(t, &input, &output)\n\tfor i, sql := range input {\n\t\tplan := testKit.MustQuery(sql)\n\t\ttestdata.OnRecord(func() {\n\t\t\toutput[i].SQL = sql\n\t\t\toutput[i].Plan = testdata.ConvertRowsToStrings(plan.Rows())\n\t\t})\n\t\tplan.Check(testkit.Rows(output[i].Plan...))\n\t}\n}", "func TestCompliancetestDemo(t *testing.T) {\n\t// Register new Vendor account\n\tvendor := utils.CreateNewAccount(auth.AccountRoles{auth.Vendor}, testconstants.VID)\n\n\t// Register new TestHouse account\n\ttestHouse := utils.CreateNewAccount(auth.AccountRoles{auth.TestHouse}, 0)\n\n\t// Register new TestHouse account\n\tsecondTestHouse := utils.CreateNewAccount(auth.AccountRoles{auth.TestHouse}, 0)\n\n\t// Publish model info\n\tmodel := utils.NewMsgAddModel(vendor.Address, testconstants.VID)\n\t_, _ = utils.AddModel(model, vendor)\n\t// Publish modelVersion\n\tmodelVersion := utils.NewMsgAddModelVersion(model.VID, model.PID,\n\t\ttestconstants.SoftwareVersion, testconstants.SoftwareVersionString, vendor.Address)\n\t_, _ = utils.AddModelVersion(modelVersion, vendor)\n\n\t// Publish first testing result using Sign and Broadcast AddTestingResult message\n\tfirstTestingResult := utils.NewMsgAddTestingResult(model.VID, model.PID,\n\t\tmodelVersion.SoftwareVersion, modelVersion.SoftwareVersionString, testHouse.Address)\n\tutils.SignAndBroadcastMessage(testHouse, firstTestingResult)\n\n\t// Check testing result is created\n\treceivedTestingResult, _ := utils.GetTestingResult(firstTestingResult.VID,\n\t\tfirstTestingResult.PID, firstTestingResult.SoftwareVersion)\n\trequire.Equal(t, receivedTestingResult.VID, firstTestingResult.VID)\n\trequire.Equal(t, receivedTestingResult.PID, firstTestingResult.PID)\n\trequire.Equal(t, receivedTestingResult.SoftwareVersion, firstTestingResult.SoftwareVersion)\n\trequire.Equal(t, 1, len(receivedTestingResult.Results))\n\trequire.Equal(t, receivedTestingResult.Results[0].TestResult, firstTestingResult.TestResult)\n\trequire.Equal(t, receivedTestingResult.Results[0].TestDate, firstTestingResult.TestDate)\n\trequire.Equal(t, receivedTestingResult.Results[0].Owner, firstTestingResult.Signer)\n\n\t// Publish second model info\n\tsecondModel := utils.NewMsgAddModel(vendor.Address, testconstants.VID)\n\t_, _ = utils.AddModel(secondModel, vendor)\n\t// Publish second modelVersion\n\tsecondModelVersion := utils.NewMsgAddModelVersion(secondModel.VID, secondModel.PID,\n\t\ttestconstants.SoftwareVersion, testconstants.SoftwareVersionString, vendor.Address)\n\t_, _ = utils.AddModelVersion(secondModelVersion, vendor)\n\n\t// Publish second testing result using POST\n\tsecondTestingResult := utils.NewMsgAddTestingResult(secondModel.VID, secondModel.PID,\n\t\tsecondModelVersion.SoftwareVersion, secondModelVersion.SoftwareVersionString, testHouse.Address)\n\t_, _ = utils.PublishTestingResult(secondTestingResult, testHouse)\n\n\t// Check testing result is created\n\treceivedTestingResult, _ = utils.GetTestingResult(secondTestingResult.VID,\n\t\tsecondTestingResult.PID, secondTestingResult.SoftwareVersion)\n\trequire.Equal(t, receivedTestingResult.VID, secondTestingResult.VID)\n\trequire.Equal(t, receivedTestingResult.PID, secondTestingResult.PID)\n\trequire.Equal(t, receivedTestingResult.SoftwareVersion, secondTestingResult.SoftwareVersion)\n\trequire.Equal(t, 1, len(receivedTestingResult.Results))\n\trequire.Equal(t, receivedTestingResult.Results[0].TestResult, secondTestingResult.TestResult)\n\trequire.Equal(t, receivedTestingResult.Results[0].TestDate, secondTestingResult.TestDate)\n\trequire.Equal(t, receivedTestingResult.Results[0].Owner, secondTestingResult.Signer)\n\n\t// Publish new testing result for second model\n\tthirdTestingResult := utils.NewMsgAddTestingResult(secondModel.VID, secondModel.PID,\n\t\tsecondModelVersion.SoftwareVersion, secondModelVersion.SoftwareVersionString, secondTestHouse.Address)\n\t_, _ = utils.PublishTestingResult(thirdTestingResult, secondTestHouse)\n\n\t// Check testing result is created\n\treceivedTestingResult, _ = utils.GetTestingResult(secondTestingResult.VID,\n\t\tsecondTestingResult.PID, secondTestingResult.SoftwareVersion)\n\trequire.Equal(t, 2, len(receivedTestingResult.Results))\n\trequire.Equal(t, receivedTestingResult.Results[0].Owner, secondTestingResult.Signer)\n\trequire.Equal(t, receivedTestingResult.Results[0].TestResult, secondTestingResult.TestResult)\n\trequire.Equal(t, receivedTestingResult.Results[1].Owner, thirdTestingResult.Signer)\n\trequire.Equal(t, receivedTestingResult.Results[1].TestResult, thirdTestingResult.TestResult)\n}", "func (decTree Tree) Test(allData []*dataTypes.Data) {\n\tmisclassified := 0\n\tfmt.Printf(\"+-----------+----------+\\n\")\n\tfmt.Printf(\"| Predicted | Actual |\\n\")\n\tfmt.Printf(\"+-----------+----------+\\n\")\n\tfor _, datum := range allData {\n\t\tprediction := decTree.GetClass(*datum)\n\t\tif prediction != datum.Class {\n\t\t\tmisclassified++\n\t\t}\n\t\tfmt.Printf(\"| %d | %d |\\n\", prediction, datum.Class)\n\t}\n\tfmt.Printf(\"+-----------+----------+\\n\")\n\n\tfmt.Printf(\"%d out of %d wrongly classified\\n\", misclassified, len(allData))\n\tfmt.Printf(\"Misclassified: %f\\n\", float64(misclassified)/float64(len(allData)))\n}", "func TestConcurrentPredictionAndLearningShouldNotFail(t *testing.T) {\n\tc := make(chan base.TextDatapoint, 100)\n\tmodel := NewNaiveBayes(c, 2, base.OnlyWords)\n\terrors := make(chan error)\n\n\t// fill the buffer\n\tvar i uint8\n\tfor i = 0; i < 99; i++ {\n\t\tc <- base.TextDatapoint{\n\t\t\tX: strings.Repeat(\"a whole bunch of words that will take some time to iterate through\", 50),\n\t\t\tY: i % 2,\n\t\t}\n\t}\n\n\t// spin off a \"long\" running loop of predicting\n\t// and then start another goroutine for OnlineLearn\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor i := 0; i < 500; i++ {\n\t\t\tmodel.Predict(strings.Repeat(\"some stuff that might be in the training data like iterate\", 25))\n\t\t}\n\t}()\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tmodel.OnlineLearn(errors)\n\t}()\n\n\tgo func() {\n\t\tfor err, more := <-errors; more; err, more = <-errors {\n\t\t\tif err != nil {\n\t\t\t\tt.Logf(\"Error passed: %s\\n\", err.Error())\n\t\t\t\tt.Fail()\n\t\t\t}\n\t\t}\n\t}()\n\n\tclose(c)\n\twg.Wait()\n}", "func TestFrameworkFlagMetaReady(t *testing.T) {\n\tappName := \"framework_test_flagmetaready\"\n\t// launch testing etcd server\n\tm := etcdutil.MustNewMember(t, appName)\n\tm.Launch()\n\tdefer m.Terminate(t)\n\turl := fmt.Sprintf(\"http://%s\", m.ClientListeners[0].Addr().String())\n\n\t// launch controller to setup etcd layout\n\tctl := controller.New(appName, etcd.NewClient([]string{url}), 2)\n\tif err := ctl.InitEtcdLayout(); err != nil {\n\t\tt.Fatalf(\"initEtcdLayout failed: %v\", err)\n\t}\n\tdefer ctl.DestroyEtcdLayout()\n\n\tpDataChan := make(chan *tDataBundle, 1)\n\tcDataChan := make(chan *tDataBundle, 1)\n\n\t// simulate two tasks on two nodes -- 0 and 1\n\t// 0 is parent, 1 is child\n\tf0 := &framework{\n\t\tname: appName,\n\t\tetcdURLs: []string{url},\n\t\tln: createListener(t),\n\t}\n\tf1 := &framework{\n\t\tname: appName,\n\t\tetcdURLs: []string{url},\n\t\tln: createListener(t),\n\t}\n\n\tvar wg sync.WaitGroup\n\ttaskBuilder := &testableTaskBuilder{\n\t\tdataMap: nil,\n\t\tcDataChan: cDataChan,\n\t\tpDataChan: pDataChan,\n\t\tsetupLatch: &wg,\n\t}\n\tf0.SetTaskBuilder(taskBuilder)\n\tf0.SetTopology(example.NewTreeTopology(2, 2))\n\tf1.SetTaskBuilder(taskBuilder)\n\tf1.SetTopology(example.NewTreeTopology(2, 2))\n\n\ttaskBuilder.setupLatch.Add(2)\n\tgo f0.Start()\n\tgo f1.Start()\n\ttaskBuilder.setupLatch.Wait()\n\tif f0.GetTaskID() != 0 {\n\t\tf0, f1 = f1, f0\n\t}\n\n\tdefer f0.ShutdownJob()\n\n\ttests := []struct {\n\t\tcMeta string\n\t\tpMeta string\n\t}{\n\t\t{\"parent\", \"child\"},\n\t\t{\"ParamReady\", \"GradientReady\"},\n\t}\n\n\tfor i, tt := range tests {\n\t\t// 0: F#FlagChildMetaReady -> 1: T#ParentMetaReady\n\t\tf0.flagMetaToChild(tt.cMeta, 0)\n\t\t// from child(1)'s view\n\t\tdata := <-pDataChan\n\t\texpected := &tDataBundle{0, tt.cMeta, \"\", nil}\n\t\tif !reflect.DeepEqual(data, expected) {\n\t\t\tt.Errorf(\"#%d: data bundle want = %v, get = %v\", i, expected, data)\n\t\t}\n\n\t\t// 1: F#FlagParentMetaReady -> 0: T#ChildMetaReady\n\t\tf1.flagMetaToParent(tt.pMeta, 0)\n\t\t// from parent(0)'s view\n\t\tdata = <-cDataChan\n\t\texpected = &tDataBundle{1, tt.pMeta, \"\", nil}\n\t\tif !reflect.DeepEqual(data, expected) {\n\t\t\tt.Errorf(\"#%d: data bundle want = %v, get = %v\", i, expected, data)\n\t\t}\n\t}\n}", "func (o TestMatrixOutput) FailFast() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v *TestMatrix) pulumi.BoolOutput { return v.FailFast }).(pulumi.BoolOutput)\n}", "func generateTrainset(trainSet []core.TrainsetData, inputset []Testdata, output []string) ([]core.TrainsetData, int, int) {\n\n\tcorrect := 0\n\n\tparam, problem, err := core.Setup(trainSet)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error while setup the core:\", err)\n\t}\n\tmodel := core.Train(param, problem)\n\tif model.L != len(trainSet) {\n\t\tfor i := 0; i < len(inputset); i++ {\n\t\t\tfeatures := inputset[i].Feature\n\t\t\tris := core.Predict(features, model)\n\t\t\tif output[int(ris)-1] == inputset[i].Name[0] {\n\t\t\t\tcorrect++\n\t\t\t}\n\t\t}\n\t}\n\n\treturn trainSet, correct, model.L\n}" ]
[ "0.5675537", "0.54292744", "0.54187274", "0.53565943", "0.5325607", "0.52448905", "0.5237421", "0.51743776", "0.5173155", "0.51139605", "0.5112347", "0.49735153", "0.49342164", "0.48942074", "0.48798493", "0.48688337", "0.48481598", "0.48478714", "0.48443323", "0.482911", "0.4795248", "0.47897482", "0.47549108", "0.47207826", "0.4715398", "0.47081053", "0.46893394", "0.4683286", "0.46543503", "0.46365696", "0.46312237", "0.46250355", "0.46151355", "0.45888895", "0.45876727", "0.45839813", "0.4583426", "0.45777756", "0.4570937", "0.45685676", "0.4522398", "0.45148107", "0.4510796", "0.44926214", "0.44855353", "0.4484561", "0.44784477", "0.44638723", "0.44401804", "0.44391003", "0.44337007", "0.44250703", "0.4419809", "0.4417335", "0.4416204", "0.4409289", "0.44076577", "0.4403081", "0.43990514", "0.43896684", "0.4383118", "0.4380987", "0.4376035", "0.43690324", "0.43646085", "0.4362026", "0.43501702", "0.43448", "0.43423474", "0.4341126", "0.43346515", "0.43336096", "0.4332735", "0.43282354", "0.43259206", "0.4323033", "0.43212217", "0.43114966", "0.43015802", "0.42929468", "0.42900056", "0.42885613", "0.42748573", "0.42710257", "0.42579898", "0.42542943", "0.4251048", "0.42488036", "0.42479977", "0.4243233", "0.42423782", "0.42414075", "0.42346057", "0.42328778", "0.4225435", "0.42234567", "0.42168936", "0.42157662", "0.42144924", "0.42089084" ]
0.71547174
0
FromObject takes the Foo field of a TestObject and prepends a null.
func (*CustomIndex) FromObject(obj interface{}) (bool, []byte, error) { t, ok := obj.(*TestObject) if !ok { return false, nil, fmt.Errorf("not a test object") } // Prepend a null so we can address an empty Foo field. out := "\x00" + t.Foo return true, []byte(out), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MustFromObject(obj interface{}) *BytesObj {\n\tbo, err := NewFromObject(obj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn bo\n}", "func NewFromObject(obj interface{}) (*BytesObj, error) {\n\tbts, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn New(bts)\n}", "func (h *Handler) GetFromObject(obj interface{}) (*corev1.Namespace, error) {\n\tns, ok := obj.(*corev1.Namespace)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *corev1.Namespace\")\n\t}\n\treturn h.getNamespace(ns)\n}", "func (dec *Decoder) ObjectNull(v interface{}) error {\n\tinitialKeysDone := dec.keysDone\n\tinitialChild := dec.child\n\tdec.keysDone = 0\n\tdec.called = 0\n\tdec.child |= 1\n\tnewCursor, err := dec.decodeObjectNull(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdec.cursor = newCursor\n\tdec.keysDone = initialKeysDone\n\tdec.child = initialChild\n\tdec.called |= 1\n\treturn nil\n}", "func Object(k string, v valf.ValueObject) Field {\n\treturn Field{Key: k, Value: valf.Object(v)}\n}", "func (_m *AWSResourceFactory) EmptyObject() runtime.Object {\n\tret := _m.Called()\n\n\tvar r0 runtime.Object\n\tif rf, ok := ret.Get(0).(func() runtime.Object); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(runtime.Object)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (h *Handler) CreateFromObject(obj interface{}) (*networkingv1.IngressClass, error) {\n\tingc, ok := obj.(*networkingv1.IngressClass)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *networkingv1.IngressClass\")\n\t}\n\treturn h.createIngressclass(ingc)\n}", "func (t *Typed) Object(key string) *Typed {\n\to := t.ObjectOr(key, nil)\n\tif o == nil {\n\t\treturn New(nil)\n\t}\n\treturn o\n}", "func (h *Handler) CreateFromObject(obj interface{}) (*corev1.ConfigMap, error) {\n\tcm, ok := obj.(*corev1.ConfigMap)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *corev1.ConfigMap\")\n\t}\n\treturn h.createConfigmap(cm)\n}", "func (e *Expect) Object(value map[string]interface{}) *Object {\n\topChain := e.chain.enter(\"Object()\")\n\tdefer opChain.leave()\n\n\treturn newObject(opChain, value)\n}", "func (_m *AWSResourceFactory) ResourceFromObject(_a0 runtime.Object) types.AWSResource {\n\tret := _m.Called(_a0)\n\n\tvar r0 types.AWSResource\n\tif rf, ok := ret.Get(0).(func(runtime.Object) types.AWSResource); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(types.AWSResource)\n\t\t}\n\t}\n\n\treturn r0\n}", "func UpdateFromObject(ctx context.Context, c client.Client, newObject client.Object, oldMeta metav1.ObjectMeta) error {\n\tnewObject.SetResourceVersion(oldMeta.ResourceVersion)\n\treturn c.Update(ctx, newObject)\n}", "func valFromObject(jp string, obj *unstructured.Unstructured) (reflect.Value, error) {\n\tjPath := jsonpath.New(\"parse\")\n\tif err := jPath.Parse(jp); err != nil {\n\t\treturn reflect.Value{}, fmt.Errorf(\"parsing JSONPath: %w\", err)\n\t}\n\n\tv, err := jPath.FindResults(obj.Object)\n\tif err != nil {\n\t\treturn reflect.Value{}, fmt.Errorf(\"finding results using JSONPath in the YAML file: %w\", err)\n\t}\n\n\tif len(v) == 0 || len(v[0]) == 0 {\n\t\treturn reflect.Value{}, nil\n\t}\n\n\treturn v[0][0], nil\n}", "func (j *Env) NewByteArrayFromObject(o *ObjectRef) *ByteArray {\n\tba := &ByteArray{}\n\tba.SetObject(o)\n\tba.n = int(getArrayLength(j.jniEnv, jarray(ba.arr)))\n\treturn ba\n}", "func (f *Fuzzer) FuzzNoCustom(obj interface{}) {\n\tv := reflect.ValueOf(obj)\n\tif v.Kind() != reflect.Ptr {\n\t\tpanic(\"needed ptr!\")\n\t}\n\tv = v.Elem()\n\tf.fuzzWithContext(v, flagNoCustomFuzz)\n}", "func (suite *TestModelsSuite) TestFillObject() {\n\tjobConfigRecord := JobConfigRecord{}\n\tdata := make(map[string]interface{})\n\tdata[\"Version\"] = 1\n\tdata[\"MyKey\"] = \"MyValue\"\n\terr := FillObject(data, &jobConfigRecord, reflect.TypeOf(jobConfigRecord))\n\tsuite.NoError(err)\n\tsuite.Equal(data[\"Version\"], jobConfigRecord.Version)\n\n\t// Test SetObjectField error\n\tdata[\"Version\"] = \"Invalid Type\"\n\terr = FillObject(data, &jobConfigRecord, reflect.TypeOf(jobConfigRecord))\n\tsuite.Error(err)\n}", "func GetObjectReferenceFromObject(obj metav1.Object, opts ...ObjectRefOptionsFunc) (ref corev1.ObjectReference) {\n\tref.Name = obj.GetName()\n\tfor _, o := range opts {\n\t\to(obj, &ref)\n\t}\n\treturn\n}", "func Object(key string, val core.ObjectMarshaler) Field {\n\treturn Field{Key: key, Type: core.ObjectMarshalerType, Interface: val}\n}", "func ObjectKeyFromObject(obj client.Object) types.NamespacedName {\n\treturn types.NamespacedName{\n\t\tName: obj.GetName(),\n\t\tNamespace: obj.GetNamespace(),\n\t}\n}", "func (h *Handler) ApplyFromObject(obj interface{}) (*corev1.ServiceAccount, error) {\n\tsa, ok := obj.(*corev1.ServiceAccount)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *corev1.ServiceAccount\")\n\t}\n\treturn h.applySA(sa)\n}", "func (h *Handler) UpdateFromObject(obj interface{}) (*corev1.Service, error) {\n\tsvc, ok := obj.(*corev1.Service)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *corev1.Service\")\n\t}\n\treturn h.updateService(svc)\n}", "func (h *Handler) GetFromObject(obj interface{}) (*corev1.Secret, error) {\n\tsecret, ok := obj.(*corev1.Secret)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *corev1.Secret\")\n\t}\n\treturn h.getSecret(secret)\n}", "func ToJSONFromObject(sch *schema.Schema, obj *object.Object, rootJSON string, rootPath string, setRootPath bool) (string, error) {\n\ttbl := obj.Type\n\ttable := sch.Tables[tbl]\n\tfieldsMap := table.Columns\n\n\tif rootJSON == \"\" {\n\t\trootJSON = \"{}\"\n\t}\n\tif setRootPath {\n\t\tif rootPath == \"\" {\n\t\t\trootPath = tbl\n\t\t} else {\n\t\t\trootPath += \".\" + tbl\n\t\t}\n\t\trootPath = rootPath + \".\"\n\t}\n\t// Populate object's key-value pairs into JSON\n\tfor k, v := range obj.KV {\n\t\tfield, ok := fieldsMap[k]\n\t\tif !ok {\n\t\t\treturn \"\", errors.New(\"ToJSONFromObject: empty field for field \" + k)\n\t\t}\n\n\t\tvar err error\n\t\t// TODO: use table.JSONRoot or something instead of tbl here?\n\t\trootJSON, err = sjson.Set(rootJSON, rootPath+field.Source, v)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tif obj.Children != nil && len(obj.Children) > 0 {\n\t\tfor k, v := range obj.Children {\n\t\t\tfor _, childObj := range v {\n\t\t\t\tchildJSON, err := ToJSONFromObject(sch, childObj, \"\", \"\", false)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"ToObjectFromJSON: error %s with child [k:%v v:%v]\", err.Error(), k, v)\n\t\t\t\t}\n\t\t\t\t// TODO: use i iterator variable somewhere here with SetRaw.. ? bench that?\n\n\t\t\t\trootJSON, err = sjson.SetRaw(rootJSON, rootPath+k, childJSON)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"ToObjectFromJSON: error %s with child [k:%v v:%v]\", err.Error(), k, v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn rootJSON, nil\n}", "func ptr(obj MilpaObject) MilpaObject {\n\tv := reflect.ValueOf(obj)\n\tif v.Kind() == reflect.Ptr {\n\t\treturn obj\n\t}\n\tv2 := reflect.New(v.Type())\n\tv2.Elem().Set(v)\n\treturn v2.Interface().(MilpaObject)\n}", "func FieldObject(key string, val interface{}) Field {\n\treturn zap.Reflect(key, val)\n}", "func (h *Handler) UpdateFromObject(obj interface{}) (*corev1.ConfigMap, error) {\n\tcm, ok := obj.(*corev1.ConfigMap)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *corev1.ConfigMap\")\n\t}\n\treturn h.updateConfigmap(cm)\n}", "func patchFieldValueToObject(fieldPath string, value any, to runtime.Object, mo *xpv1.MergeOptions) error {\n\tpaved, err := fieldpath.PaveObject(to)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := paved.MergeValue(fieldPath, value, mo); err != nil {\n\t\treturn err\n\t}\n\n\treturn runtime.DefaultUnstructuredConverter.FromUnstructured(paved.UnstructuredContent(), to)\n}", "func (o *Object) Reset() {\n\to.Value = nil\n\to.Initialized = false\n\tObjectPool.Put(o)\n}", "func (*Base) ObjectField(p ASTPass, field *ast.ObjectField, ctx Context) {\n\tswitch field.Kind {\n\tcase ast.ObjectLocal:\n\t\tp.Fodder(p, &field.Fodder1, ctx)\n\t\tp.Fodder(p, &field.Fodder2, ctx)\n\t\tp.FieldParams(p, field, ctx)\n\t\tp.Fodder(p, &field.OpFodder, ctx)\n\t\tp.Visit(p, &field.Expr2, ctx)\n\n\tcase ast.ObjectFieldID:\n\t\tp.Fodder(p, &field.Fodder1, ctx)\n\t\tp.FieldParams(p, field, ctx)\n\t\tp.Fodder(p, &field.OpFodder, ctx)\n\t\tp.Visit(p, &field.Expr2, ctx)\n\n\tcase ast.ObjectFieldStr:\n\t\tp.Visit(p, &field.Expr1, ctx)\n\t\tp.FieldParams(p, field, ctx)\n\t\tp.Fodder(p, &field.OpFodder, ctx)\n\t\tp.Visit(p, &field.Expr2, ctx)\n\n\tcase ast.ObjectFieldExpr:\n\t\tp.Fodder(p, &field.Fodder1, ctx)\n\t\tp.Visit(p, &field.Expr1, ctx)\n\t\tp.Fodder(p, &field.Fodder2, ctx)\n\t\tp.FieldParams(p, field, ctx)\n\t\tp.Fodder(p, &field.OpFodder, ctx)\n\t\tp.Visit(p, &field.Expr2, ctx)\n\n\tcase ast.ObjectAssert:\n\t\tp.Fodder(p, &field.Fodder1, ctx)\n\t\tp.Visit(p, &field.Expr2, ctx)\n\t\tif field.Expr3 != nil {\n\t\t\tp.Fodder(p, &field.OpFodder, ctx)\n\t\t\tp.Visit(p, &field.Expr3, ctx)\n\t\t}\n\t}\n\n\tp.Fodder(p, &field.CommaFodder, ctx)\n}", "func DeleteFromObject(fieldPath []string, paramsData, key, root string) (string, error) {\n\tprops, err := ToMap(key, paramsData, root)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcur := props\n\n\tfor i, k := range fieldPath {\n\t\tif i == len(fieldPath)-1 {\n\t\t\tdelete(cur, k)\n\t\t} else {\n\t\t\tm, ok := cur[k].(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn \"\", errors.New(\"path not found\")\n\t\t\t}\n\n\t\t\tcur = m\n\t\t}\n\t}\n\n\tupdatePath := []string{root}\n\tif key != \"\" {\n\t\tupdatePath = []string{root, key}\n\t}\n\n\treturn updateFn(updatePath, paramsData, props)\n}", "func (h *Handler) UpdateFromObject(obj interface{}) (*appsv1.StatefulSet, error) {\n\tsts, ok := obj.(*appsv1.StatefulSet)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *appsv1.StatefulSet\")\n\t}\n\treturn h.updateStatefulset(sts)\n}", "func testNilIsPanObject() {\n\tvar _ PanObject = NewPanNil()\n}", "func (c Continue) FuzzNoCustom(obj interface{}) {\n\tv := reflect.ValueOf(obj)\n\tif v.Kind() != reflect.Ptr {\n\t\tpanic(\"needed ptr!\")\n\t}\n\tv = v.Elem()\n\tc.fc.doFuzz(v, flagNoCustomFuzz)\n}", "func patchFieldValueToObject(fieldPath string, value interface{}, to runtime.Object, mo *xpv1.MergeOptions) error {\n\tpaved, err := fieldpath.PaveObject(to)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := paved.MergeValue(fieldPath, value, mo); err != nil {\n\t\treturn err\n\t}\n\n\treturn runtime.DefaultUnstructuredConverter.FromUnstructured(paved.UnstructuredContent(), to)\n}", "func Object(o metav1.Object, err error) metav1.Object {\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn o\n}", "func (m *TestObj) Clone(interface{}) (interface{}, error) { return nil, nil }", "func CopyNoneZeroField(from, to interface{}) {\n\tfValue := reflect.ValueOf(from)\n\ttValue := reflect.ValueOf(to)\n\tif fValue.Type() != tValue.Type() {\n\t\tpanic(fmt.Sprintf(\"from/to must by same type:from=%v, to=%v\", fValue.Type(), tValue.Type()))\n\t}\n\tfValue = fValue.Elem()\n\ttValue = tValue.Elem()\n\tif !tValue.CanAddr() {\n\t\tpanic(\"copy destination must be CanAddr\")\n\t}\n\n\tfor i := 0; i < fValue.NumField(); i++ {\n\t\tfield := fValue.Field(i)\n\t\tif !field.IsZero() && field.CanSet() {\n\t\t\ttValue.Field(i).Set(field)\n\t\t}\n\t}\n}", "func (s *stackLogRest) ProducesObject(verb string) interface{} {\n\treturn nil\n}", "func (c *podConverter) ConvertObject(originalObj interface{}) (convertedObj interface{}, err error) {\n\tpod, ok := originalObj.(*corev1.Pod)\n\tif ok {\n\t\treturn c.stripDownPod(pod), nil\n\t}\n\n\tif deleteTombstone, ok := originalObj.(cache.DeletedFinalStateUnknown); ok {\n\t\tpod, ok = deleteTombstone.Obj.(*corev1.Pod)\n\t\tif ok {\n\t\t\t//the object on a DeletedFinalStateUnknown will be from the cache we don't need to strip it again\n\t\t\treturn pod, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"failed to convert object to pod\")\n}", "func NullJSONStrFrom(dst []byte) NullJSONStr {\n\treturn ToNullJSONStr(dst)\n}", "func MapAsZerologObject(m map[string]interface{}) LoggerFunc {\n\treturn LoggerFunc(func(e *zerolog.Event) {\n\t\te.\n\t\t\tFields(m)\n\t})\n}", "func TypedObjectReferenceFromObject(obj runtime.Object, scheme *runtime.Scheme) (*v1alpha1.TypedObjectReference, error) {\n\tmetaObj, err := meta.Accessor(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgvk, err := apiutil.GVKForObject(obj, scheme)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &v1alpha1.TypedObjectReference{\n\t\tAPIVersion: gvk.GroupVersion().String(),\n\t\tKind: gvk.Kind,\n\t\tObjectReference: v1alpha1.ObjectReference{\n\t\t\tName: metaObj.GetName(),\n\t\t\tNamespace: metaObj.GetNamespace(),\n\t\t},\n\t}, nil\n}", "func AsObject(dt DataType) *Object {\n\tswitch t := dt.(type) {\n\tcase *UserTypeExpr:\n\t\treturn AsObject(t.Type)\n\tcase *ResultTypeExpr:\n\t\treturn AsObject(t.Type)\n\tcase *Object:\n\t\treturn t\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (e ChainEntry) Object(k string, obj gojay.MarshalerJSONObject) ChainEntry {\n\tif e.disabled {\n\t\treturn e\n\t}\n\te.enc.ObjectKey(k, obj)\n\treturn e\n}", "func ObjectCast(obj Object) Object {\n\treturn obj\n}", "func RunJSONSerializationTestForJsonFieldWithDefault(subject JsonFieldWithDefault) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual JsonFieldWithDefault\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "func testOltObject(testOlt *fields) *OpenOLT {\n\treturn &OpenOLT{\n\t\tdeviceHandlers: testOlt.deviceHandlers,\n\t\teventProxy: testOlt.eventProxy,\n\t\tnumOnus: testOlt.numOnus,\n\t\tKVStoreAddress: testOlt.KVStoreAddress,\n\t\tKVStoreType: testOlt.KVStoreType,\n\t\texitChannel: testOlt.exitChannel,\n\t}\n}", "func (h *Handler) DeleteFromObject(obj interface{}) error {\n\trc, ok := obj.(*corev1.ReplicationController)\n\tif !ok {\n\t\treturn fmt.Errorf(\"object type is not *corev1.ReplicationController\")\n\t}\n\treturn h.deleteRC(rc)\n}", "func OwnerReferenceFromObject(obj client.Object) metav1.OwnerReference {\n\treturn metav1.OwnerReference{\n\t\tAPIVersion: obj.GetObjectKind().GroupVersionKind().GroupVersion().String(),\n\t\tKind: obj.GetObjectKind().GroupVersionKind().Kind,\n\t\tName: obj.GetName(),\n\t\tUID: obj.GetUID(),\n\t}\n}", "func (o MetricSpecPatchOutput) Object() ObjectMetricSourcePatchPtrOutput {\n\treturn o.ApplyT(func(v MetricSpecPatch) *ObjectMetricSourcePatch { return v.Object }).(ObjectMetricSourcePatchPtrOutput)\n}", "func (o MetricSpecPatchOutput) Object() ObjectMetricSourcePatchPtrOutput {\n\treturn o.ApplyT(func(v MetricSpecPatch) *ObjectMetricSourcePatch { return v.Object }).(ObjectMetricSourcePatchPtrOutput)\n}", "func Zero(t testing.TB, object interface{}, msgAndArgs ...interface{}) bool {\n\tif !IsObjectZero(object) {\n\t\treturn failTest(t, 1, fmt.Sprintf(\"Zero: expected to be zero value, actual `%#v`\", object), msgAndArgs...)\n\t}\n\n\treturn true\n}", "func (suite *TestModelsSuite) TestSetObjectField() {\n\tjobConfigRecord := &JobConfigRecord{\n\t\tVersion: 1,\n\t}\n\terr := SetObjectField(jobConfigRecord, \"Version\", 2)\n\tsuite.NoError(err)\n\tsuite.Equal(2, jobConfigRecord.Version)\n\n\t// Test setting invalid field\n\terr = SetObjectField(jobConfigRecord, \"name\", \"myjob\")\n\tsuite.Error(err)\n\n\t// Test setting field to incorrect type\n\terr = SetObjectField(jobConfigRecord, \"Version\", \"invalid\")\n\tsuite.Error(err)\n}", "func ZeroValue(t JType) interface{} {\n\tif t.IsPrimitive() {\n\t\treturn basicZeroValue(t.Orig.Underlying().(*types.Basic))\n\t} else {\n\t\tv := \"new \" + t.JName() + \"(\"\n\t\tif t.NeedsAddress() {\n\t\t\tv += fmt.Sprint(FakeAddressFor(t.Ident))\n\t\t}\n\t\tv += \")\"\n\t\treturn v\n\t}\n}", "func TestUnmarshalNulls(t *testing.T) {\n\t// Unmarshal docs:\n\t// The JSON null value unmarshals into an interface, map, pointer, or slice\n\t// by setting that Go value to nil. Because null is often used in JSON to mean\n\t// ``not present,'' unmarshaling a JSON null into any other Go type has no effect\n\t// on the value and produces no error.\n\n\tjsonData := []byte(`{\n\t\t\t\t\"Bool\" : null,\n\t\t\t\t\"Int\" : null,\n\t\t\t\t\"Int8\" : null,\n\t\t\t\t\"Int16\" : null,\n\t\t\t\t\"Int32\" : null,\n\t\t\t\t\"Int64\" : null,\n\t\t\t\t\"Uint\" : null,\n\t\t\t\t\"Uint8\" : null,\n\t\t\t\t\"Uint16\" : null,\n\t\t\t\t\"Uint32\" : null,\n\t\t\t\t\"Uint64\" : null,\n\t\t\t\t\"Float32\" : null,\n\t\t\t\t\"Float64\" : null,\n\t\t\t\t\"String\" : null,\n\t\t\t\t\"PBool\": null,\n\t\t\t\t\"Map\": null,\n\t\t\t\t\"Slice\": null,\n\t\t\t\t\"Interface\": null,\n\t\t\t\t\"PRaw\": null,\n\t\t\t\t\"PTime\": null,\n\t\t\t\t\"PBigInt\": null,\n\t\t\t\t\"PText\": null,\n\t\t\t\t\"PBuffer\": null,\n\t\t\t\t\"PStruct\": null,\n\t\t\t\t\"Raw\": null,\n\t\t\t\t\"Time\": null,\n\t\t\t\t\"BigInt\": null,\n\t\t\t\t\"Text\": null,\n\t\t\t\t\"Buffer\": null,\n\t\t\t\t\"Struct\": null\n\t\t\t}`)\n\tnulls := NullTest{\n\t\tBool: true,\n\t\tInt: 2,\n\t\tInt8: 3,\n\t\tInt16: 4,\n\t\tInt32: 5,\n\t\tInt64: 6,\n\t\tUint: 7,\n\t\tUint8: 8,\n\t\tUint16: 9,\n\t\tUint32: 10,\n\t\tUint64: 11,\n\t\tFloat32: 12.1,\n\t\tFloat64: 13.1,\n\t\tString: \"14\",\n\t\tPBool: new(bool),\n\t\tMap: map[string]string{},\n\t\tSlice: []string{},\n\t\tInterface: new(MustNotUnmarshalJSON),\n\t\tPRaw: new(RawMessage),\n\t\tPTime: new(time.Time),\n\t\tPBigInt: new(big.Int),\n\t\tPText: new(MustNotUnmarshalText),\n\t\tPStruct: new(struct{}),\n\t\tPBuffer: new(bytes.Buffer),\n\t\tRaw: RawMessage(\"123\"),\n\t\tTime: time.Unix(123456789, 0),\n\t\tBigInt: *big.NewInt(123),\n\t}\n\n\tbefore := nulls.Time.String()\n\n\terr := Unmarshal(jsonData, &nulls)\n\tif err != nil {\n\t\tt.Errorf(\"Unmarshal of null values failed: %v\", err)\n\t}\n\tif !nulls.Bool || nulls.Int != 2 || nulls.Int8 != 3 || nulls.Int16 != 4 || nulls.Int32 != 5 || nulls.Int64 != 6 ||\n\t\tnulls.Uint != 7 || nulls.Uint8 != 8 || nulls.Uint16 != 9 || nulls.Uint32 != 10 || nulls.Uint64 != 11 ||\n\t\tnulls.Float32 != 12.1 || nulls.Float64 != 13.1 || nulls.String != \"14\" {\n\t\tt.Errorf(\"Unmarshal of null values affected primitives\")\n\t}\n\n\tif nulls.PBool != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.PBool\")\n\t}\n\tif nulls.Map != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.Map\")\n\t}\n\tif nulls.Slice != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.Slice\")\n\t}\n\tif nulls.Interface != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.Interface\")\n\t}\n\tif nulls.PRaw != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.PRaw\")\n\t}\n\tif nulls.PTime != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.PTime\")\n\t}\n\tif nulls.PBigInt != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.PBigInt\")\n\t}\n\tif nulls.PText != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.PText\")\n\t}\n\tif nulls.PBuffer != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.PBuffer\")\n\t}\n\tif nulls.PStruct != nil {\n\t\tt.Errorf(\"Unmarshal of null did not clear nulls.PStruct\")\n\t}\n\n\tif string(nulls.Raw) != \"null\" {\n\t\tt.Errorf(\"Unmarshal of RawMessage null did not record null: %v\", string(nulls.Raw))\n\t}\n\tif nulls.Time.String() != before {\n\t\tt.Errorf(\"Unmarshal of time.Time null set time to %v\", nulls.Time.String())\n\t}\n\tif nulls.BigInt.String() != \"123\" {\n\t\tt.Errorf(\"Unmarshal of big.Int null set int to %v\", nulls.BigInt.String())\n\t}\n}", "func (e Entry) Object(k string, obj gojay.MarshalerJSONObject) Entry {\n\te.enc.ObjectKey(k, obj)\n\treturn e\n}", "func (m mockS3Impl) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error) {\n\treturn &s3.GetObjectOutput{\n\t\tBody: nopCloser{bytes.NewBufferString(m.InMemoryStore[*input.Key])},\n\t}, nil\n}", "func (_m *Repository) Object(_a0 plumbing.ObjectType, _a1 plumbing.Hash) (object.Object, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 object.Object\n\tif rf, ok := ret.Get(0).(func(plumbing.ObjectType, plumbing.Hash) object.Object); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(object.Object)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(plumbing.ObjectType, plumbing.Hash) 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}", "func (h *Handler) ApplyFromObject(obj interface{}) (*appsv1.StatefulSet, error) {\n\tsts, ok := obj.(*appsv1.StatefulSet)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"object type is not *appsv1.StatefulSet\")\n\t}\n\treturn h.applyStatefulset(sts)\n}", "func (mci MongoCartItem) DefaultObject(ci *CartItem) *CartItem {\n\tif ci == nil {\n\t\treturn &CartItem{\n\t\t\tID: mci.ID.Hex(),\n\t\t\tCartID: mci.CartID.Hex(),\n\t\t\tProduct: mci.Product,\n\t\t\tQuantity: mci.Quantity,\n\t\t}\n\t}\n\n\tci.ID = mci.ID.Hex()\n\tci.CartID = mci.CartID.Hex()\n\tci.Product = mci.Product\n\tci.Quantity = mci.Quantity\n\n\treturn ci\n}", "func RunPropertyAssignmentTestForJsonFieldWithDefault(subject JsonFieldWithDefault) string {\n\t// Copy subject to make sure assignment doesn't modify it\n\tcopied := subject.DeepCopy()\n\n\t// Use AssignPropertiesTo() for the first stage of conversion\n\tvar other v20200601s.JsonFieldWithDefault\n\terr := copied.AssignProperties_To_JsonFieldWithDefault(&other)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Use AssignPropertiesFrom() to convert back to our original type\n\tvar actual JsonFieldWithDefault\n\terr = actual.AssignProperties_From_JsonFieldWithDefault(&other)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for a match\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "func (_m *AWSResourceDescriptor) EmptyRuntimeObject() runtime.Object {\n\tret := _m.Called()\n\n\tvar r0 runtime.Object\n\tif rf, ok := ret.Get(0).(func() runtime.Object); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(runtime.Object)\n\t\t}\n\t}\n\n\treturn r0\n}", "func CastToObject(object *Object) *Object {\n\treturn ObjectNewFromC(object.ToC())\n}", "func ClearFields(obj interface{}, fields ...string) {\n\tr := reflect.ValueOf(obj)\n\n\tfor _, v := range fields {\n\t\tf := reflect.Indirect(r).FieldByName(v)\n\t\tif f.CanSet() {\n\t\t\tf.Set(reflect.Zero(f.Type()))\n\t\t} else {\n\t\t\tlog.Println(\"No se puede setear \", v)\n\t\t}\n\t}\n}", "func Object(props *ObjectProps, children ...Element) *ObjectElem {\n\trProps := &_ObjectProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &ObjectElem{\n\t\tElement: createElement(\"object\", rProps, children...),\n\t}\n}", "func (i *DeserializerV1) BuildObject(pkg string, data map[interface{}]interface{}) (interface{}, error) {\n\tvar tt, t reflect.Type\n\tvar exist bool\n\n\t// find pkg from type map\n\tif tt, exist = i.typeMap[pkg]; !exist {\n\t\treturn nil, fmt.Errorf(\"can not find package %s in type map\", pkg)\n\t}\n\n\t// check\n\tif tt.Kind() == reflect.Ptr {\n\t\tt = tt.Elem()\n\t} else {\n\t\tt = tt\n\t}\n\n\t// create new object (ptr)\n\ttv := reflect.New(t)\n\n\t// write value to fields\n\tfor j, l := 0, t.NumField(); j < l; j++ {\n\t\tif val, exist := data[t.Field(j).Tag.Get(tagName)]; exist {\n\t\t\tif val == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttv.Elem().Field(j).Set(reflect.ValueOf(val))\n\t\t}\n\t}\n\n\t// return ptr if mapping type is ptr\n\tif tt.Kind() == reflect.Ptr {\n\t\treturn tv.Interface(), nil\n\t}\n\n\t// return struct if mapping type is struct\n\treturn tv.Elem().Interface(), nil\n}", "func NewStackTraceElementFromObject(env *Env, stackTraceElement *ObjectRef) (*StackTraceElement, error) {\n\n\tif stackTraceElement.IsNil() {\n\t\treturn nil, nil\n\t}\n\n\tgetStringAndAssign := func(method string, assign func(s string)) error {\n\t\treturn callStringMethodAndAssign(env, stackTraceElement, method, assign)\n\t}\n\n\tout := StackTraceElement{}\n\n\t// ClassName\n\tif err := getStringAndAssign(\"getClassName\", func(s string) {\n\t\tout.ClassName = s\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// FileName\n\tif err := getStringAndAssign(\"getFileName\", func(s string) {\n\t\tout.FileName = s\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// MethodName\n\tif err := getStringAndAssign(\"getMethodName\", func(s string) {\n\t\tout.MethodName = s\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// ToString\n\tif err := getStringAndAssign(\"toString\", func(s string) {\n\t\tout.AsString = s\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// LineNumber\n\t{\n\t\tenv.PrecalculateSignature(\"()I\")\n\t\tvar lineNum int\n\t\terr := stackTraceElement.CallMethod(env, \"getLineNumber\", &lineNum)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout.LineNumber = lineNum\n\t}\n\n\t// IsNativeMethod\n\t{\n\t\tenv.PrecalculateSignature(\"()Z\")\n\t\tvar isNative bool\n\t\terr := stackTraceElement.CallMethod(env, \"isNativeMethod\", &isNative)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout.IsNativeMethod = isNative\n\t}\n\n\treturn &out, nil\n}", "func TestToOne(t *testing.T) {}", "func TestToOne(t *testing.T) {}", "func TestToOne(t *testing.T) {}", "func TestToOne(t *testing.T) {}", "func NewObject() *Value {\n\treturn &Value{kind: kindObject, objectContent: make(map[string]Value)}\n}", "func Null(fieldPtr interface{}) Filter {\n\treturn &NullFilter{fieldPtr}\n}", "func ToObject(v []byte, output interface{}) error {\n\t_, err := newStructDecoder(output).Decode(v) // nolint\n\treturn err\n}", "func (o *FakeObject) String() string { return o.Value.(string) }", "func NewObject(rawType encoding.RawType, opts ...ObjectOption) *Object {\n\toptions := makeObjectOptions(opts...)\n\tfilter, _ := makeBloomFilter(options.Bloom, nil)\n\treturn &Object{\n\t\toptions: options,\n\t\tpages: []*Page{NewPage(rawType)},\n\t\tfilters: []*bloom.BloomFilter{filter},\n\t\trawType: rawType,\n\t}\n}", "func (o MetricSpecOutput) Object() ObjectMetricSourcePtrOutput {\n\treturn o.ApplyT(func(v MetricSpec) *ObjectMetricSource { return v.Object }).(ObjectMetricSourcePtrOutput)\n}", "func (o MetricSpecOutput) Object() ObjectMetricSourcePtrOutput {\n\treturn o.ApplyT(func(v MetricSpec) *ObjectMetricSource { return v.Object }).(ObjectMetricSourcePtrOutput)\n}", "func ParseObjectSafe(data []byte) (*Object, error) {\n\treturn parseObject(data, false, true)\n}", "func NewRootObjectFunc() SurroundingObjectFunc {\n\treturn func(x interface{}) (map[string]interface{}, AccessorFunc, error) {\n\t\tobj, ok := x.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\"object root default value must be of object type\")\n\t\t}\n\t\treturn obj, func(root map[string]interface{}) (interface{}, bool, error) {\n\t\t\treturn root, true, nil\n\t\t}, nil\n\t}\n}", "func MakeFakeObject(value interface{}) *FakeObject {\n\tif o, ok := value.(*FakeObject); ok {\n\t\treturn o\n\t}\n\treturn &FakeObject{\n\t\tValue: value,\n\t\tProperties: make(map[string]interface{}),\n\t\tMethods: make(map[string]MethodFunc),\n\t}\n}", "func (*Base) Object(p ASTPass, node *ast.Object, ctx Context) {\n\tp.ObjectFields(p, &node.Fields, ctx)\n\tp.Fodder(p, &node.CloseFodder, ctx)\n}", "func (f LoggerFunc) MarshalZerologObject(e *zerolog.Event) {\n\tf(e)\n}", "func (n *Null) Type() ObjectType { return NULL_OBJ }", "func AuditConfigFromObject(in interface{}) (*AuditConfig, error) {\n\tvar cfg AuditConfig\n\tif in == nil {\n\t\treturn &cfg, nil\n\t}\n\tif err := utils.ObjectToStruct(in, &cfg); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn &cfg, nil\n}", "func objIsNil(obj client.Object) bool {\n\treturn obj == nil || reflect.ValueOf(obj).IsNil()\n}", "func NullUUIDFromPtr(ptr *UUID) NullUUID {\n\tif ptr == nil {\n\t\treturn NullUUID{}\n\t}\n\treturn NewNullUUID(*ptr, true)\n}", "func (m *memClient) GetObjectExplicit(ctx context.Context, serviceName string, objectName string) (io.ReadCloser, error) {\n\treturn nil, errors.New(\"unimplemented\")\n}", "func NullCompactJSONStrFrom(dst []byte) NullCompactJSONStr {\n\treturn ToNullCompactJSONStr(dst)\n}", "func fromObj(obj types.Object, fset *token.FileSet, f *ast.File, off int) (string, string, error) {\n\tswitch o := obj.(type) {\n\tcase *types.Builtin:\n\t\treturn \"builtin\", o.Name(), nil\n\tcase *types.PkgName:\n\t\treturn o.Imported().Path(), \"\", nil\n\tcase *types.Const, *types.Func, *types.Nil, *types.TypeName, *types.Var:\n\t\tif obj.Pkg() == nil {\n\t\t\treturn \"builtin\", obj.Name(), nil\n\t\t}\n\t\tif !isImported(fset, f, off) {\n\t\t\timpDir, err := currImportDir()\n\t\t\treturn impDir, obj.Name(), err\n\t\t}\n\t\treturn obj.Pkg().Path(), obj.Name(), nil\n\tdefault:\n\t\treturn \"\", \"\", fmt.Errorf(\"cannot print documentation of %v\\n\", obj)\n\t}\n}", "func CastToInitiallyUnowned(object *Object) *InitiallyUnowned {\n\treturn InitiallyUnownedNewFromC(object.ToC())\n}", "func (e ChainEntry) ObjectFunc(k string, v func(Entry)) ChainEntry {\n\tif e.disabled {\n\t\treturn e\n\t}\n\te.enc.ObjectKey(k, Object(func(enc *Encoder) {\n\t\tv(e.Entry)\n\t}))\n\treturn e\n}", "func TestZeroWithPrivateField(t *testing.T) {\n\ttype PrivateFieldStruct struct {\n\t\tprivField *int\n\t\tPublicField *int\n\t}\n\tpfstruct := new(PrivateFieldStruct)\n\n\terr := Zero(pfstruct)\n\n\tif err != nil {\n\t\tt.Errorf(\"Private field struct produced error: %v\", err)\n\t}\n\n\tif pfstruct.privField != nil {\n\t\tt.Errorf(\"Private field is not nil: %v\", pfstruct.privField)\n\t}\n\n\tif pfstruct.PublicField == nil || *pfstruct.PublicField != 0 {\n\t\tt.Errorf(\"Public field was not allocated correctly: %v\", pfstruct.PublicField)\n\t}\n}", "func (o *Object) UnWrap() fs.Object {\n\treturn o.Object\n}", "func (o *Object) UnWrap() fs.Object {\n\treturn o.Object\n}", "func (se *SubscriptionExtension) GetHostFromObject(obj metav1.Object) *types.NamespacedName {\n\treturn utils.GetHostSubscriptionFromObject(obj)\n}", "func ResetObjectMetadata(obj metav1.Object) {\n\tobj.SetGenerateName(\"\")\n\tobj.SetSelfLink(\"\")\n\tobj.SetUID(\"\")\n\tobj.SetResourceVersion(\"\")\n\tobj.SetGeneration(0)\n\tobj.SetCreationTimestamp(metav1.Time{})\n\tobj.SetDeletionTimestamp(nil)\n\tobj.SetDeletionGracePeriodSeconds(nil)\n\tobj.SetOwnerReferences(nil)\n\tobj.SetFinalizers(nil)\n\tobj.SetClusterName(\"\")\n\tobj.SetManagedFields(nil)\n}", "func (d *Document) Object() Node {\n\tid := uint(len(d.nodes))\n\tn := d.grow()\n\tn.reset(vObject|infRoot, \"\", n.values[:0])\n\treturn d.Node(id)\n}", "func (dec *Decoder) AddObjectNull(v interface{}) error {\n\treturn dec.ObjectNull(v)\n}", "func (b *Bucket) ensureNoNulls() {\n\tif b.Metadata == nil {\n\t\tb.Metadata = make(map[string]Metadata)\n\t}\n}" ]
[ "0.5721032", "0.5456178", "0.5353691", "0.53340507", "0.51139414", "0.48458168", "0.48345616", "0.47850585", "0.47749147", "0.47177723", "0.4681525", "0.4681505", "0.4647269", "0.46292272", "0.46257848", "0.46203116", "0.4615476", "0.46050805", "0.4587628", "0.45718405", "0.45503506", "0.45290673", "0.45005667", "0.44978082", "0.44818258", "0.44784272", "0.44716272", "0.44512048", "0.4445808", "0.44420156", "0.4440516", "0.44243172", "0.43992442", "0.43965188", "0.43746465", "0.43735626", "0.43683326", "0.43608975", "0.43556198", "0.43480504", "0.43392053", "0.43371707", "0.43303618", "0.43291837", "0.43291506", "0.43206474", "0.43124327", "0.43091235", "0.42906234", "0.42754844", "0.42754844", "0.42752045", "0.42671362", "0.4266813", "0.42532784", "0.42435938", "0.42429057", "0.42390347", "0.42344368", "0.42301196", "0.42294887", "0.42294234", "0.42194623", "0.42071027", "0.41949525", "0.41888192", "0.41814995", "0.41772598", "0.41772598", "0.41772598", "0.41772598", "0.41719687", "0.41702917", "0.41684267", "0.4161326", "0.41544786", "0.41514042", "0.41514042", "0.41474494", "0.41393098", "0.41384423", "0.4136666", "0.4135328", "0.4135317", "0.41317913", "0.41223493", "0.41186124", "0.41172686", "0.41079006", "0.4102933", "0.4101574", "0.40946126", "0.40901026", "0.40877214", "0.40877214", "0.40850416", "0.4080162", "0.40768766", "0.4070345", "0.4053597" ]
0.5428286
2
FromArgs always returns an error.
func (*CustomIndex) FromArgs(args ...interface{}) ([]byte, error) { return nil, fmt.Errorf("only prefix lookups are supported") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func progFromArgs(args []string) (prog *loader.Program, rest []string, err error) {\n\t// Configure type checker.\n\tvar conf loader.Config\n\trest, err = conf.FromArgs(args, false)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Load Go package.\n\tprog, err = conf.Load()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn prog, rest, nil\n}", "func parseArguments() service.Arguments {\n args := service.ParseArguments()\n _, err := args.IsValid()\n\n if err == nil {\n return args\n }\n\n if service.IsUnknownArgumentsError(err) {\n flag.Usage()\n os.Exit(ERR_WRONG_USAGE)\n return args\n }\n\n StdErr.Write([]byte(err.Error() + \"\\n\"))\n os.Exit(ERR_WRONG_USAGE)\n\n return args\n}", "func (s service) checkArgs() error {\n\tif len(s.args) < 1 {\n\t\treturn errors.New(\"no file added as a command line argument\")\n\t}\n\n\tif s.args[0] == \"\" {\n\t\treturn errors.New(\"filename cannot be empty\")\n\t}\n\n\treturn nil\n}", "func FromArgs(args []string) (Config, error) {\n\tm := make(map[string]interface{})\n\n\tfor _, f := range args {\n\t\tif f == \"--\" {\n\t\t\tcontinue\n\t\t}\n\t\tassign := strings.SplitN(strings.TrimLeft(f, \"-\"), \"=\", 2)\n\t\tif len(assign) != 2 {\n\t\t\treturn nil, errors.Errorf(\"expected assignment, got: %s\", f)\n\t\t}\n\t\tm[assign[0]] = assign[1]\n\t}\n\n\treturn flatMap(m), nil\n}", "func (cmd *Command) checkArgs(args []string) {\n\tif len(args) < cmd.MinArgs {\n\t\tsyntaxError()\n\t\tfmt.Fprintf(os.Stderr, \"Command %s needs %d arguments mininum\\n\", cmd.Name, cmd.MinArgs)\n\t\tos.Exit(1)\n\t} else if len(args) > cmd.MaxArgs {\n\t\tsyntaxError()\n\t\tfmt.Fprintf(os.Stderr, \"Command %s needs %d arguments maximum\\n\", cmd.Name, cmd.MaxArgs)\n\t\tos.Exit(1)\n\t}\n}", "func ParseFlagsFromArgsOrDie(appname, version string, data interface{}, args []string) *flags.Parser {\n\tparser, extraArgs, err := ParseFlags(appname, data, args)\n\tif err != nil && err.(*flags.Error).Type == flags.ErrUnknownFlag && strings.Contains(err.(*flags.Error).Message, \"`version'\") {\n\t\tfmt.Printf(\"%s version %s\\n\", appname, version)\n\t\tos.Exit(0) // Ignore other errors if --version was passed.\n\t}\n\tif err != nil {\n\t\tparser.WriteHelp(os.Stderr)\n\t\tfmt.Printf(\"\\n%s\\n\", err)\n\t\tos.Exit(1)\n\t} else if len(extraArgs) > 0 {\n\t\tfmt.Printf(\"Unknown option %s\\n\", extraArgs)\n\t\tparser.WriteHelp(os.Stderr)\n\t\tos.Exit(1)\n\t}\n\treturn parser\n}", "func parseArgs(args []string) (*arguments, error) {\n\tif len(args) == 0 {\n\t\treturn nil, errors.Errorf(\"required input \\\" --src <Src_File> \\\" not found !\")\n\t}\n\n\tapp := kingpin.New(\"mircat\", \"Utility for processing Mir state event logs.\")\n\tsrc := app.Flag(\"src\", \"The input file to read (defaults to stdin).\").Default(os.Stdin.Name()).File()\n\t_, err := app.Parse(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &arguments{\n\t\tsrcFile: *src,\n\t}, nil\n}", "func validateArgs() {\n\tif *inputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n}", "func (conf *Config) FromArgs(args []string) ([]string, error) {\n\tvar rest []string\n\tfor i, arg := range args {\n\t\tif arg == \"--\" {\n\t\t\trest = args[i+1:]\n\t\t\targs = args[:1]\n\t\t\tbreak // consume \"--\" and return the remaining args\n\t\t}\n\t}\n\n\tif len(args) > 0 && strings.HasSuffix(args[0], \".t3xf\") {\n\t\treturn nil, errors.New(\"t3xf format is not supported\")\n\t}\n\n\tsuite, err := st.NewFromArgs(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuite.SetEnv()\n\tsort.Strings(suite.Sources)\n\tconf.Name = suite.Name\n\tconf.Dir = suite.Dir()\n\tconf.Sources = suite.Sources\n\tconf.ImportPackages = suite.Imports\n\treturn rest, nil\n}", "func validateArguments(args ...string) error {\n\tif args == nil {\n\t\treturn errors.New(\"No command line args were specified\")\n\t}\n\tfor _, arg := range args {\n\t\tif arg == \"\" {\n\t\t\treturn errors.New(\"Unspecified required command line args\")\n\t\t}\n\t}\n\treturn nil\n}", "func validateArgs(linkIndex int, fn reflect.Type, args []Argument) error {\n\tif !fn.IsVariadic() && (fn.NumIn() != len(args)) {\n\t\treturn argumentMismatchError(linkIndex, len(args), fn.NumIn())\n\t}\n\n\treturn nil\n}", "func validateArgs() {\n\tif *optionsEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *inputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *outputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n}", "func (args *CliArgs) checkArgs() {\n\t// print all filed of the object\n\tif !(args.startPage > 0 && args.endPage > 0 && args.endPage-args.startPage >= 0) {\n\t\tfmt.Fprintf(os.Stderr, \"start page and end page should be positive and endpage should be bigger than startpage\")\n\t\tos.Exit(1)\n\t}\n\n\tif args.isFtype {\n\t\tif args.lineNumPerPage != specialNum {\n\t\t\tfmt.Fprintln(os.Stderr, \"Fatal: setting -f and -l simultaneously is not allowed\")\n\t\t\tos.Exit(1)\n\t\t}\n\t} else {\n\t\tif args.lineNumPerPage == specialNum {\n\t\t\targs.lineNumPerPage = defaultLineNum\n\t\t} else if args.lineNumPerPage < 0 {\n\t\t\tfmt.Fprintln(os.Stderr, \"Fatal: the linenum should be positive\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\t// set default number of linenumber\n\tif pflag.NArg() != 0 {\n\t\targs.inFilename = pflag.Args()[0]\n\t}\n\n\tfmt.Printf(\"%+v\", args)\n}", "func checkArgs() error {\n\tnargs := len(os.Args)\n\tpiped := isPiped()\n\tswitch {\n\tcase (2 != nargs) && piped:\n\t\treturn PipeArgErr\n\tcase (3 != nargs) && !piped:\n\t\treturn FileArgErr\n\t}\n\treturn nil\n}", "func (s S3Handler) commandFromArgs(args []string) (ex command.Executor, err error) {\n\tswitch args[0] {\n\n\tcase command.CmdLs:\n\t\tex = command.NewLs(s.s3, s.con)\n\tcase command.CmdCd:\n\t\tex = command.NewCd(s.s3, s.con, args[1:])\n\tcase command.CmdGet:\n\t\tex = command.NewGet(s.s3, s.con, args[1:])\n\tcase command.CmdPut:\n\t\tex = command.NewPut(s.s3, s.con, args[1:])\n\tcase command.CmdPwd:\n\t\tex = command.NewPwd(s.con)\n\tcase command.CmdClear:\n\t\tex = command.NewClear()\n\tcase command.CmdExit:\n\t\tex = command.NewExit()\n\n\tdefault:\n\t\terr = errors.New(\"Unknown Command: \" + args[0])\n\t}\n\n\treturn ex, err\n}", "func New(format string, args ...interface{}) error {\n\treturn &usererr{errors.Errorf(format, args...)}\n}", "func (cb *ConfigBuilder) FromArgs() *ConfigBuilder {\n\tcb.config.Username = args.GlobalArgs.DefaultJMXUser\n\tcb.config.Password = args.GlobalArgs.DefaultJMXPassword\n\tcb.config.RequestTimeoutMs = int64(args.GlobalArgs.Timeout)\n\tif args.GlobalArgs.KeyStore != \"\" && args.GlobalArgs.KeyStorePassword != \"\" && args.GlobalArgs.TrustStore != \"\" && args.GlobalArgs.TrustStorePassword != \"\" {\n\t\tcb.config.KeyStore = args.GlobalArgs.KeyStore\n\t\tcb.config.KeyStorePassword = args.GlobalArgs.KeyStorePassword\n\t\tcb.config.TrustStore = args.GlobalArgs.TrustStore\n\t\tcb.config.TrustStorePassword = args.GlobalArgs.TrustStorePassword\n\t}\n\treturn cb\n}", "func ParseArgs(args []string) error {\n\tif len(args) < 1 {\n\t\tfmt.Println(argDropletFailMsg)\n\t\tos.Exit(1)\n\t}\n\tswitch args[0] {\n\tcase \"list\":\n\t\tParseArgsListDrop(args[1:])\n\tcase \"create\":\n\t\tif err := ParseArgsCreateDrop(args[1:]); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"delete\":\n\t\tif err := ParseArgsDeleteDrop(args[1:]); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tdefault:\n\t\tfmt.Print(\"Incorrect arg: \")\n\t\tsupport.RedBold.Println(args[0])\n\t\tfmt.Println(argDropletFailMsg)\n\t\tos.Exit(1)\n\t}\n\treturn nil\n}", "func (p *argParser) Parse(args interface{}) (interface{}, error) {\n\tif p == nil {\n\t\treturn nilParseArguments(args)\n\t}\n\tparsed := reflect.New(p.Type).Elem()\n\tif err := p.FromJSON(args, parsed); err != nil {\n\t\treturn nil, err\n\t}\n\treturn parsed.Interface(), nil\n}", "func Parse(a interface{}, args []string) error {\n\trv := reflect.ValueOf(a)\n\trt := reflect.TypeOf(a)\n\tif rv.Kind() != reflect.Ptr || rv.Elem().Kind() != reflect.Struct {\n\t\treturn &InvalidParseError{rt}\n\t}\n\trv = rv.Elem()\n\trt = rt.Elem()\n\n\tfor i, arg := range args {\n\t\tif rt.Field(i).Name != extract(arg) {\n\t\t\treturn &InvalidArgumentError{arg}\n\t\t}\n\t}\n\treturn nil\n}", "func (o *Options) validate(args []string) error {\n\tif len(args) != 0 {\n\t\treturn errors.New(\"arguments are not supported\")\n\t}\n\treturn nil\n}", "func (c AutoIndexingServiceRepositoryIDsWithErrorsFuncCall) Args() []interface{} {\n\treturn []interface{}{c.Arg0, c.Arg1, c.Arg2}\n}", "func (mv *MoveValidator) ValidateArgs(args []string) error {\n\tfor _, arg := range args {\n\t\tif !validpath.Valid(arg) {\n\t\t\treturn fmt.Errorf(\"%s is not a valid argument\", arg)\n\t\t}\n\t}\n\tif len(args) != 2 {\n\t\treturn fmt.Errorf(\"Expected there to be 2 arguments, but got %d\", len(args))\n\t}\n\treturn nil\n}", "func (c *MigrationsCmd) CheckArgs(cmd *cobra.Command, args []string) error {\n\treturn nil\n}", "func checkNumberOfArgs(name string, nargs, nresults, min, max int) error {\n\tif min == max {\n\t\tif nargs != max {\n\t\t\treturn ExceptionNewf(TypeError, \"%s() takes exactly %d arguments (%d given)\", name, max, nargs)\n\t\t}\n\t} else {\n\t\tif nargs > max {\n\t\t\treturn ExceptionNewf(TypeError, \"%s() takes at most %d arguments (%d given)\", name, max, nargs)\n\t\t}\n\t\tif nargs < min {\n\t\t\treturn ExceptionNewf(TypeError, \"%s() takes at least %d arguments (%d given)\", name, min, nargs)\n\t\t}\n\t}\n\n\tif nargs > nresults {\n\t\treturn ExceptionNewf(TypeError, \"Internal error: not enough arguments supplied to Unpack*/Parse*\")\n\t}\n\treturn nil\n}", "func TestOauth2BadArguments(t *testing.T) {\n\t// Arrange\n\tlc := logger.MockLogger{}\n\tconfig := &config.ConfigurationStruct{}\n\n\t// Setup test cases\n\tbadArgTestcases := [][]string{\n\t\t{}, // missing all required arguments\n\t\t{\"-badarg\"}, // invalid arg\n\t\t{\"--client_id\", \"someid\"}, // missing --client_secret & --admin_api_jwt\n\t\t{\"--client_id\", \"someid\", \"--client_secret\", \"somesecret\"}, // missing --admin_api_jwt\n\t}\n\n\tfor _, args := range badArgTestcases {\n\t\t// Act\n\t\tcommand, err := NewCommand(lc, config, args)\n\n\t\t// Assert\n\t\tassert.Error(t, err)\n\t\tassert.Nil(t, command)\n\t}\n}", "func checkArgs(nargs int, errMsg string) func(cmd *cobra.Command, args []string) error {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tif len(args) != nargs {\n\t\t\treturn errors.Errorf(errMsg)\n\t\t}\n\t\treturn nil\n\t}\n}", "func parseArgs() string {\n\tflag.BoolVar(&Verbose, \"v\", false, \"verbose output\")\n\tflag.Parse()\n\n\t// Validate input args\n\tif flag.NArg() == 1 {\n\t\treturn flag.Arg(0)\n\t} else if flag.NArg() < 1 {\n\t\tfmt.Println(\"Error: missing URL\")\n\t\tcliUsage()\n\t\tos.Exit(1)\n\t} else {\n\t\tfmt.Printf(\"Error: too many arguments. Expected 1, got %d\\n\", flag.NArg())\n\t\tcliUsage()\n\t\tos.Exit(1)\n\t}\n\treturn \"\"\n}", "func TestCmd_Validate_MissingArgs(t *testing.T) {\n\tlog.SetOutput(io.Discard)\n\tdefer log.SetOutput(os.Stdout)\n\tv := ValidateSpec{}\n\tresult := v.Execute([]string{})\n\tassert.Error(t, result)\n\n\tresult = v.Execute([]string{\"nowhere.json\"})\n\tassert.Error(t, result)\n}", "func Parse() *Args {\n\treturn New(os.Args)\n}", "func f1(arg int) (int, error) {\n\tif arg == 42 {\n\t\t// errors.New constructs a basic error value with the given error message.\n\t\treturn -1, errors.New(\"cant work with 42\")\n\t}\n\t// A nil value in the error position indicates that there was no error.\n\treturn arg + 3, nil\n}", "func nilParseArguments(args interface{}) (interface{}, error) {\n\tif args == nil {\n\t\treturn nil, nil\n\t}\n\tif args, ok := args.(map[string]interface{}); !ok || len(args) != 0 {\n\t\treturn nil, fmt.Errorf(\"unexpected args\")\n\t}\n\treturn nil, nil\n}", "func FromStr(e string) (ErrCode, error) {\n\terrStr := strings.TrimLeft(e, \"E\")\n\terrInt, err := strconv.Atoi(errStr)\n\tif err != nil {\n\t\treturn ErrCode(0), fmt.Errorf(\"error code '%s' is not a valid error code format, should be of the form Exxxx, ex. E1000\", e)\n\t}\n\treturn ErrCode(errInt), nil\n}", "func checkArgs() {\n\tif TemplatesPath == \"\" {\n\t\texitErr(\"-t is required\")\n\t}\n\n\tif PackagePath == \"\" {\n\t\texitErr(\"-p is required\")\n\t}\n\n\tif LeftDelim == \"\" {\n\t\tLeftDelim = \"{{\"\n\t}\n\n\tif RightDelim == \"\" {\n\t\tRightDelim = \"}}\"\n\t}\n\n\tif OutputFormat == \"\" {\n\t\tOutputFormat = \"plain\"\n\t}\n\tif OutputFormat != \"json\" && OutputFormat != \"plain\" {\n\t\texitErr(`unsupported output format: \"` + OutputFormat + `\"`)\n\t}\n}", "func FromErr(err error) *Failure {\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\treturn NewWithStatus(err.Error(), http.StatusBadRequest)\n}", "func ValidateArgs(args []string, validations []validate.Argument) error {\n\tif err := ValidateArgCount(len(validations), len(args)); err != nil {\n\t\treturn err\n\t}\n\n\tfor i, arg := range validations {\n\t\tif ok := arg.Validate(args[i]); !ok {\n\t\t\treturn fmt.Errorf(InvalidArg, arg.Name, args[i], arg.Validate.TypeName())\n\t\t}\n\t}\n\n\treturn nil\n}", "func validateProgramArgs() {\n\tif *version {\n\t\tshowVersion()\n\t}\n\n\tif *helpUsage {\n\t\tusage(0)\n\t}\n\n\tif *helpFull {\n\t\tshowHelp(0)\n\t}\n\n\tif *LocalFolderPath == \"\" ||\n\t\t(*dpUsername != \"\" && *dpRestURL == \"\" && *dpSomaURL == \"\") {\n\t\tusage(1)\n\t}\n\n}", "func Err2_1(){\n\t_, er := Err2(-1)\n\tif e1, ok := er.(*argError); ok {\n\t\tfmt.Println(e1.arg)\n\t\tfmt.Println(e1.prob)\n\t}\n}", "func (e Error) FromBytes(b []byte) error {\n\treturn e.Base.FromBytes(b, &e)\n}", "func (c *UsersInfoCall) ValidateArgs() error {\n\tif len(c.user) <= 0 {\n\t\treturn errors.New(`required field user not initialized`)\n\t}\n\treturn nil\n}", "func (Interface *LineInterface) ValidateArguments() {\n\tif len(os.Args) < 2 {\n\t\tInterface.PrintUsage()\n\t\truntime.Goexit()\n\t}\n}", "func ValidateArgs(config Config) error {\n\tvalidUpgradeScope := false\n\tfor _, scope := range config.TargetCluster.UpgradeScopes() {\n\t\tif config.TargetCluster.UpgradeScope == scope {\n\t\t\tvalidUpgradeScope = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !validUpgradeScope {\n\t\treturn errors.Errorf(\"invalid upgrade scope, must be one of %v\", config.TargetCluster.UpgradeScopes())\n\t}\n\n\tif _, err := semver.ParseTolerant(config.KubernetesVersion); err != nil {\n\t\treturn errors.Errorf(\"Invalid Kubernetes version: %q\", config.KubernetesVersion)\n\t}\n\n\tif (config.MachineUpdates.Image.ID == \"\" && config.MachineUpdates.Image.Field != \"\") ||\n\t\t(config.MachineUpdates.Image.ID != \"\" && config.MachineUpdates.Image.Field == \"\") {\n\t\treturn errors.New(\"when specifying image id, image field is required (and vice versa)\")\n\t}\n\n\tif config.MachineDeployment.Name != \"\" && config.MachineDeployment.LabelSelector != \"\" {\n\t\treturn errors.New(\"you may only set one of machine deployment name and label selector, but not both\")\n\t}\n\n\treturn nil\n}", "func TestParseArguments(t *testing.T) {\n\n\t// Set our expectations\n\texpectedConfig := `.\\fake.yaml`\n\texpectedVerbose := true\n\texpectedDebug := true\n\texpectedCheckOnly := true\n\n\t// Save the original arguments\n\torigArgs := os.Args\n\tdefer func() { os.Args = origArgs }()\n\n\t// Override with our input\n\tos.Args = []string{\"gorilla.exe\", \"--verbose\", \"--debug\", \"--checkonly\", \"--config\", `.\\fake.yaml`}\n\n\t// Run code\n\tconfigArg, verboseArg, debugArg, checkonlyArg := parseArguments()\n\n\t// Compare config\n\tif have, want := configArg, expectedConfig; have != want {\n\t\tt.Errorf(\"have %s, want %s\", have, want)\n\t}\n\n\t// Compare checkonly\n\tif have, want := checkonlyArg, expectedCheckOnly; have != want {\n\t\tt.Errorf(\"have %v, want %v\", have, want)\n\t}\n\n\t// Compare verbose\n\tif have, want := verboseArg, expectedVerbose; have != want {\n\t\tt.Errorf(\"have %v, want %v\", have, want)\n\t}\n\n\t// Compare debug\n\tif have, want := debugArg, expectedDebug; have != want {\n\t\tt.Errorf(\"have %v, want %v\", have, want)\n\t}\n}", "func (c RealmGateway_import) Args() RealmGateway_import_Params {\n\treturn RealmGateway_import_Params{Struct: c.Call.Args()}\n}", "func checkArgs(c *cli.Context) (rtn int) {\n rtn = 0\n if c.NArg() < 3 {\n color.Red(\"Wrong Input.\")\n color.Red(\"Use mo sqlite3 <dbFullName> <UserToChange> <PasswordToSet>\")\n color.Red(\"Example: mo sqlite3 USER.DB admin 111111 \")\n rtn = 1\n return\n }\n\n _, err := os.Stat(c.Args().First())\n if err != nil {\n if os.IsNotExist(err) {\n color.Red(\"File %s does not exist.\", c.Args().First())\n rtn = 2\n return\n }\n }\n return\n\n}", "func legacyArgs(cmd *Command, args []string) error {\n\t// no subcommand, always take args\n\tif !cmd.HasSubCommands() {\n\t\treturn nil\n\t}\n\n\t// root command with subcommands, do subcommand checking.\n\tif !cmd.HasParent() && len(args) > 0 {\n\t\treturn fmt.Errorf(\"unknown command %q for %q%s\", args[0], cmd.CommandPath(), cmd.findSuggestions(args[0]))\n\t}\n\treturn nil\n}", "func (ap *AddParams) FromPositional(params []interface{}) error {\n\tif len(params) != 2 {\n\t\treturn errors.New(\"exactly two integers are required\")\n\t}\n\n\tx := params[0].(float64)\n\ty := params[1].(float64)\n\tap.X = &x\n\tap.Y = &y\n\n\treturn nil\n}", "func (es Slice) FromRaw(rawSlice []any) error {\n\tif len(rawSlice) == 0 {\n\t\t*es.getOrig() = nil\n\t\treturn nil\n\t}\n\tvar errs error\n\torigs := make([]otlpcommon.AnyValue, len(rawSlice))\n\tfor ix, iv := range rawSlice {\n\t\terrs = multierr.Append(errs, newValue(&origs[ix]).FromRaw(iv))\n\t}\n\t*es.getOrig() = origs\n\treturn errs\n}", "func checkForArgErrors(token string, platform string) error {\n\tif token == \"\" {\n\t\treturn errors.New(\"Token needs to be a device token\")\n\t} else if platform != PlatformIos && platform != PlatformAndroid {\n\t\treturn errors.New(\"Platform must be either PlatformIos or PlatformAndroid\")\n\t}\n\treturn nil\n}", "func (al *ArgumentLoaderImpl) LoadArgs() (*CmdArgs, error) {\n\n\tif !al.usageSet {\n\t\treturn nil, errors.New(\"Usage not set\")\n\t}\n\t// Get flags\n\tport := flag.Int(\"P\", 3000, \"Port\") // todo read server port from C file\n\tflag.Parse()\n\n\t//Get args\n\targs := flag.Args()\n\n\tif len(args) < 2 {\n\t\treturn nil, errors.New(al.usage)\n\t}\n\n\tsource, destination := args[0], args[1]\n\tserver, isSourceServer, err := getServer(&source, &destination)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &CmdArgs{\n\t\tPort: *port,\n\t\tSourceFilePath: source,\n\t\tDestinationFilePath: destination,\n\t\tServer: server,\n\t\tIsSourceServer: isSourceServer,\n\t}, nil\n}", "func FromArg(arg string) (key, value string) {\n\tparts := strings.Split(arg, \"=\")\n\tif len(parts) == 1 {\n\t\treturn parts[0], \"\"\n\t}\n\treturn parts[0], parts[1]\n}", "func NewDetectorFromArg(arg string) (*OfflineAgentDetector, error) {\n\tif arg == \"\" {\n\t\treturn nil, fmt.Errorf(\"No arg specified\")\n\t}\n\n\tparts := strings.Split(arg, \",\")\n\tswitch len(parts) {\n\tcase 1:\n\t\treturn NewDetector(parts[0], \"\", \"\"), nil\n\tcase 3:\n\t\treturn NewDetector(parts[0], parts[1], parts[2]), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"The format of the config string was not recognized: %s\", arg)\n\t}\n}", "func TestAddUserBadArg(t *testing.T) {\n\t// Arrange\n\tlc := logger.MockLogger{}\n\tconfig := &config.ConfigurationStruct{}\n\tbadArgTestcases := [][]string{\n\t\t{}, // missing token type\n\t\t{\"-badarg\"}, // invalid arg\n\t\t{\"--user\"}, // missing username\n\t\t{\"--user\", \"foo\", \"--tokenTTL\"}, // missing tokenTTL\n\t\t{\"--user\", \"foo\", \"--jwtTTL\"}, // missing jwtTTL\n\t}\n\n\tfor _, args := range badArgTestcases {\n\t\t// Act\n\t\tcommand, err := NewCommand(lc, config, args)\n\n\t\t// Assert\n\t\tassert.Error(t, err, \"Args: %v\", args)\n\t\tassert.Nil(t, command)\n\t}\n}", "func (entity *Report) FillFromArguments(stub shim.ChaincodeStubInterface, args []string) error {\n\tif len(args) < reportBasicArgumentsNumber {\n\t\treturn errors.New(fmt.Sprintf(\"arguments array must contain at least %d items\", reportBasicArgumentsNumber))\n\t}\n\treturn nil\n}", "func ParseArgs() Order {\n\tvar operation int\n\tvar snapshot string\n\tvar apk string\n\ttakeCmd := flag.NewFlagSet(\"take\", flag.ExitOnError)\n\tscanCmd := flag.NewFlagSet(\"scan\", flag.ExitOnError)\n\ttakeSnapshotVal := takeCmd.String(\"snapshot\", \"./permissions.json\", \"The permission snapshot file.\")\n\ttakeApkVal := takeCmd.String(\"apk\", \"\", \"The APK file to analyze.\")\n\tscanSnapshotVal := scanCmd.String(\"snapshot\", \"./permissions.json\", \"The permission snapshot file.\")\n\tscanApkVal := scanCmd.String(\"apk\", \"\", \"The APK file to analyze.\")\n\tif len(os.Args) < 2 {\n\t\tfmt.Println(\"Require sub-command: 'take' or 'scan'\")\n\t\tos.Exit(2)\n\t}\n\tswitch os.Args[1] {\n\tcase \"take\":\n\t\toperation = Take\n\t\ttakeCmd.Parse(os.Args[2:])\n\tcase \"scan\":\n\t\toperation = Scan\n\t\tscanCmd.Parse(os.Args[2:])\n\tdefault:\n\t\tfmt.Println(\"Supported sub-commands: 'take' or 'scan'\")\n\t\tos.Exit(2)\n\t}\n\tif takeCmd.Parsed() {\n\t\tif *takeApkVal == \"\" {\n\t\t\ttakeCmd.PrintDefaults()\n\t\t\tos.Exit(2)\n\t\t}\n\t\tsnapshot = *takeSnapshotVal\n\t\tapk = *takeApkVal\n\t}\n\tif scanCmd.Parsed() {\n\t\tif *scanApkVal == \"\" {\n\t\t\tscanCmd.PrintDefaults()\n\t\t\tos.Exit(2)\n\t\t}\n\t\tsnapshot = *scanSnapshotVal\n\t\tapk = *scanApkVal\n\t}\n\treturn Order{operation, snapshot, apk}\n}", "func ValidateArgs(args []string) error {\n\targsSorted := make([]string, len(args))\n\tcopy(argsSorted, args)\n\tsort.Strings(argsSorted)\n\tif i := sort.SearchStrings(argsSorted, separatorArg); i == len(argsSorted) || argsSorted[i] != separatorArg {\n\t\treturn fmt.Errorf(\"missing the argument %s\", separatorArg)\n\t}\n\n\treturn nil\n}", "func ParseArgs() (*Arguments, error) {\n\tvar (\n\t\toldCSVFile string\n\t\tnewCSVFile string\n\t\touputCSVFile string\n\t\tshowVersion bool\n\t)\n\n\tflag.StringVar(&oldCSVFile, \"old\", \"old.csv\", \"old CSV file\")\n\n\tflag.StringVar(&newCSVFile, \"new\", \"new.csv\", \"new CSV file\")\n\n\tflag.StringVar(&ouputCSVFile, \"output\", \"output_diff.csv\", \"output CSV file\")\n\tflag.StringVar(&ouputCSVFile, \"o\", \"output_diff.csv\", \"output CSV file\")\n\n\tflag.BoolVar(&showVersion, \"version\", false, \"show version\")\n\tflag.BoolVar(&showVersion, \"v\", false, \"show version\")\n\n\tflag.Usage = func() {\n\n\t\tfmt.Fprintln(os.Stderr, \"\t-old | --old\", \"old CSV file\")\n\t\tfmt.Fprintln(os.Stderr, \"\t-new | --new\", \"new CSV file\")\n\t\tfmt.Fprintln(os.Stderr, \"\t-o | --o\", \"output CSV file\")\n\t\tfmt.Fprintln(os.Stderr, \"\t-v | --version\", \"show ngos version\")\n\n\t}\n\n\tflag.Parse()\n\n\tif len(oldCSVFile) <= 0 {\n\t\treturn &Arguments{Help: flag.Usage}, errors.New(\"\t(-old) arg required\")\n\t}\n\n\tif len(newCSVFile) <= 0 {\n\t\treturn &Arguments{Help: flag.Usage}, errors.New(\"\t(-new) arg required\")\n\t}\n\n\treturn &Arguments{\n\t\tOldCSVFile: oldCSVFile,\n\t\tNewCSVFile: newCSVFile,\n\t\tOutputCSVFile: ouputCSVFile,\n\t\tShowVersion: showVersion,\n\t\tHelp: flag.Usage,\n\t}, nil\n}", "func parseArguments() (int, int, int) {\n\tcontracts.Require(func() bool {\n\t\treturn len(os.Args) > 3\n\t}, \"The program receives number of producers, consumers and buffer size.\"+np+help)\n\n\tvar nProd, errProd = strconv.Atoi(os.Args[1])\n\tvar nCons, errCons = strconv.Atoi(os.Args[2])\n\tvar bufferSize, errBuffer = strconv.Atoi(os.Args[3])\n\n\tcontracts.Require(func() bool {\n\t\tif errProd == nil && errCons == nil && errBuffer == nil {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}, \"Arguments must be int.\"+np+help)\n\n\treturn nProd, nCons, bufferSize\n}", "func Invalid(args []string) error {\n\treturn fmt.Errorf(\"invalid interface for: %s\", args)\n}", "func (c *UsersGetPresenceCall) ValidateArgs() error {\n\tif len(c.user) <= 0 {\n\t\treturn errors.New(`required field user not initialized`)\n\t}\n\treturn nil\n}", "func parseArgs(conf *Config) {\n\tvar parser = flags.NewParser(conf, flags.Default)\n\n\t/*\n\t Input validation. Don't silently fail. Print the usage instead.\n\t We might do something with \"unparsed\" later, but the Args nested\n\t struct in Config slurps the rest of the arguments into command.\n\n\t There seems to be a bug where --help prints twice... I tried to\n\t mitigate it by overriding with my own --help. I think it's caused\n\t by the fact that I have required args? Not worth investing any more\n\t time\n\t*/\n\n\tunparsed, err := parser.Parse()\n\tif err != nil || len(unparsed) > 1 || conf.Help {\n\t\tprintHelp(parser)\n\t}\n}", "func (Service) TooManyArguments(a, b string) {\n}", "func (opts *ToolOptions) ParseArgs(args []string) ([]string, error) {\n\tLogSensitiveOptionWarnings(args)\n\n\tif err := opts.ParseConfigFile(args); err != nil {\n\t\treturn []string{}, err\n\t}\n\n\targs, err := opts.CallArgParser(args)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tif opts.SSLAllowInvalidCert || opts.SSLAllowInvalidHost {\n\t\tlog.Logvf(log.Always, deprecationWarningSSLAllow)\n\t}\n\n\tif opts.parsePositionalArgsAsURI {\n\t\targs, err = opts.setURIFromPositionalArg(args)\n\t\tif err != nil {\n\t\t\treturn []string{}, err\n\t\t}\n\t}\n\n\tfailpoint.ParseFailpoints(opts.Failpoints)\n\n\terr = opts.NormalizeOptionsAndURI()\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\treturn args, err\n}", "func validArgs(args *runtimeArgs) bool {\n\tflag.Usage = showHelp\n\n\targs.fg = flag.String(\"fg\", \"black\", \"foreground color\")\n\targs.bg = flag.String(\"bg\", \"green\", \"background color\")\n\n\tflag.Parse()\n\n\tif args.fg == nil || hue.StringToHue[*args.fg] == 0 {\n\t\tbadColor(*args.fg) // prints an error message w/ a list of supported colors\n\t\treturn false\n\t}\n\n\tif args.fg == nil || hue.StringToHue[*args.bg] == 0 {\n\t\tbadColor(*args.bg)\n\t\treturn false\n\t}\n\n\t// Get the remaining flags, which should\n\t// consist of a pattern, and optionally, one or more file names.\n\trem := flag.Args()\n\n\tswitch {\n\tcase len(rem) == 0:\n\t\tfmt.Println(\"Error: No pattern specified.\")\n\t\tshowHelp()\n\t\treturn false\n\tcase len(rem) == 1:\n\t\targs.pattern = &rem[0]\n\tcase len(rem) >= 2:\n\t\targs.pattern = &rem[0]\n\n\t\tfor i := 1; i < len(rem); i++ {\n\t\t\targs.files = append(args.files, &rem[i])\n\t\t}\n\t}\n\n\treturn true\n}", "func TestLoadArgs(t *testing.T) {\n\tkubeletArgs := \"IgnoreUnknown=1;K8S_POD_NAMESPACE=istio-system;\" +\n\t\t\"K8S_POD_NAME=istio-sidecar-injector-8489cf78fb-48pvg;\" +\n\t\t\"K8S_POD_INFRA_CONTAINER_ID=3c41e946cf17a32760ff86940a73b06982f1815e9083cf2f4bfccb9b7605f326\"\n\n\tk8sArgs := K8sArgs{}\n\tif err := types.LoadArgs(kubeletArgs, &k8sArgs); err != nil {\n\t\tt.Fatalf(\"LoadArgs failed with error: %v\", err)\n\t}\n\n\tif string(k8sArgs.K8S_POD_NAMESPACE) == \"\" || string(k8sArgs.K8S_POD_NAME) == \"\" {\n\t\tt.Fatalf(\"LoadArgs didn't convert args properly, K8S_POD_NAME=\\\"%s\\\";K8S_POD_NAMESPACE=\\\"%s\\\"\",\n\t\t\tstring(k8sArgs.K8S_POD_NAME), string(k8sArgs.K8S_POD_NAMESPACE))\n\t}\n}", "func (this *NowStr) MinArgs() int { return 0 }", "func (err *RuleNotSatisfied) GetArgs() Args {\n\treturn err.Args\n}", "func (mr *mockCommandMockRecorder) ParseArgs(strings interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ParseArgs\", reflect.TypeOf((*mockCommand)(nil).ParseArgs), strings)\n}", "func ParseArgsOrDie(ap *argparser.ArgParser, args []string, usagePrinter UsagePrinter) *argparser.ArgParseResults {\n\tapr, err := ap.Parse(args)\n\n\tif err != nil {\n\t\tif err != argparser.ErrHelp {\n\t\t\tPrintErrln(err.Error())\n\n\t\t\tif usagePrinter != nil {\n\t\t\t\tusagePrinter()\n\t\t\t}\n\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// --help param\n\t\tif usagePrinter != nil {\n\t\t\tusagePrinter()\n\t\t}\n\t\tos.Exit(0)\n\t}\n\n\treturn apr\n}", "func NewFromError(tag Tag, cause error) Gerror {\n\tif cause != nil {\n\t\tvar stack [stackSize]byte\n\n\t\tn := runtime.Stack(stack[:], false)\n\n\t\treturn &err{tag, reflect.TypeOf(tag), \"Error caused by: \" + cause.Error(), stack[:n]}\n\t} else {\n\t\treturn nil\n\t}\n}", "func (err *DuplicatedRecord) GetArgs() Args {\n\treturn err.Args\n}", "func (rv *RemoveValidator) ValidateArgs(args []string) error {\n\tfor _, arg := range args {\n\t\tif !validpath.Valid(arg) {\n\t\t\treturn fmt.Errorf(\"%s is not a valid argument\", arg)\n\t\t}\n\t}\n\tif len(args) != 1 {\n\t\treturn fmt.Errorf(\"Expected there to be 1 argument, but got %d\", len(args))\n\t}\n\treturn nil\n}", "func (c *Chainable) From(args ...Argument) *Chainable {\n\tc.from = args\n\treturn c\n}", "func (c *UsersIdentityCall) ValidateArgs() error {\n\treturn nil\n}", "func New(format string, args ...interface{}) error {\n\treturn Error(fmt.Sprintf(format, args...))\n}", "func checkArgs(ctxt context.Context, s string, args ...interface{}) {\n\tc := 0\n\tfor _, f := range []string{\"%s\", \"%d\", \"%v\", \"%#v\", \"%t\", \"%p\"} {\n\t\tc += strings.Count(s, f)\n\t}\n\tl := len(args)\n\tif c != l {\n\t\tWarningf(ctxt, \"Wrong number of args for format string, [%d != %d]\", l, c)\n\t}\n}", "func ArbitraryArgs(cmd *Command, args []string) error {\n\treturn nil\n}", "func New(format string, args ...interface{}) error {\n\terr := &Error{\n\t\tmsg: fmt.Sprintf(format, args...),\n\t\tstack: GetStack(),\n\t}\n\treturn err\n}", "func Must(args ...interface{}) {\n\terr, ok := args[len(args)-1].(error)\n\tif ok && err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func InvalidArgument(msg string, fields []FieldError) error {\n\treturn APIError{\n\t\tcode: http.StatusBadRequest,\n\t\tMessage: msg,\n\t\tFields: fields,\n\t}\n}", "func parseFlagsAndArgs() error {\n\t// parse flags\n\tflag.Parse()\n\tif cfg.Path == \"\" {\n\t\treturn errors.New(\"no config path given\")\n\t}\n\tif cfg.ServerID == \"\" {\n\t\treturn errors.New(\"no server identifier given\")\n\t}\n\n\t// parse positional args\n\n\tcfg.Endpoints = flag.Args()\n\tif len(cfg.Endpoints) < 1 {\n\t\treturn errors.New(\"at least one etcd endpoint has to be given\")\n\t}\n\n\treturn nil\n}", "func (*CustomIndex) PrefixFromArgs(args ...interface{}) ([]byte, error) {\n\tif len(args) != 1 {\n\t\treturn nil, fmt.Errorf(\"must provide only a single argument\")\n\t}\n\targ, ok := args[0].(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"argument must be a string: %#v\", args[0])\n\t}\n\targ = \"\\x00\" + arg\n\treturn []byte(arg), nil\n}", "func (c *UsersSetActiveCall) ValidateArgs() error {\n\treturn nil\n}", "func ParseArguments() {\n\t/** Initializing system */\n\tconfigParams := InitSystem()\n\n\t/** Parse arguments */\n\tglobalFlags()\n\tkubectl(configParams)\n\tdockerBuild(configParams)\n\thelm(configParams)\n\n\t/** Default behavior */\n\tAlert(\"ERR\", \"This command doesn't exists!\", false)\n\tos.Exit(1)\n}", "func E(args ...interface{}) []interface{} {\n\terr, ok := args[len(args)-1].(error)\n\tif ok {\n\t\tpanic(err)\n\t}\n\treturn args\n}", "func NewArgs(schema string, args []string) (*Args, error) {\n\ta := Args{\n\t\tschema: schema,\n\t\targs: args,\n\t\tunexpectedArguments: make([]rune, 0),\n\t\tmarhalers: map[rune]argumentMarshaler{},\n\t\tcurrentArgument: nil,\n\t}\n\n\treturn &a, a.parse()\n}", "func YumInstalledFromArgs(args Args) (Checker, error) {\n\tyi := YumInstalled{}\n\n\tif err := requiredArgs(args, \"packages\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := decodeFromArgs(args, &yi); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn yi, nil\n}", "func InvalidArgument(msg string, args ...interface{}) error {\n\tif len(args) > 0 {\n\t\treturn status.Errorf(codes.InvalidArgument, msg, args...)\n\t}\n\treturn status.Error(codes.InvalidArgument, msg)\n}", "func (m *Import) call(f interface{}, args []interface{}) (interface{}, error) {\n\t// If a function call isn't supported for this key, then it is an error\n\tif f == nil {\n\t\treturn nil, fmt.Errorf(\"function call unsupported\")\n\t}\n\n\t// Reflect on the function and verify it is a function\n\tfuncVal := reflect.ValueOf(f)\n\tif funcVal.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"internal error: import didn't return function for key\")\n\t}\n\tfuncType := funcVal.Type()\n\n\t// Verify argument count\n\tif len(args) != funcType.NumIn() {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"expected %d arguments, got %d\",\n\t\t\tfuncType.NumIn(), len(args))\n\t}\n\n\t// Go through the arguments and convert them to the proper type\n\tfuncArgs := make([]reflect.Value, funcType.NumIn())\n\tfor i := 0; i < funcType.NumIn(); i++ {\n\t\targ := args[i]\n\t\targValue := reflect.ValueOf(arg)\n\n\t\t// If the raw argument cannot be assign to the expected arg\n\t\t// types then we attempt a conversion. This is slow because we\n\t\t// expect this to be rare.\n\t\tt := funcType.In(i)\n\t\tif !argValue.Type().AssignableTo(t) {\n\t\t\tv, err := encoding.GoToValue(arg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\"error converting argument to %s: %s\",\n\t\t\t\t\tt, err)\n\t\t\t}\n\n\t\t\targ, err = encoding.ValueToGo(v, t)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\"error converting argument to %s: %s\",\n\t\t\t\t\tt, err)\n\t\t\t}\n\n\t\t\targValue = reflect.ValueOf(arg)\n\t\t}\n\n\t\tfuncArgs[i] = argValue\n\t}\n\n\t// Call the function\n\tfuncRets := funcVal.Call(funcArgs)\n\n\t// Build the return values\n\tvar err error\n\tif len(funcRets) > 1 {\n\t\tif v := funcRets[1].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\n\treturn funcRets[0].Interface(), err\n}", "func Test1ArgMinimum(t *testing.T) {\n\toutErr := new(bytes.Buffer)\n\tRootCmd.SetErr(outErr)\n\tRootCmd.SetArgs([]string{})\n\n\t_, err := RootCmd.ExecuteC()\n\n\tif err == nil {\n\t\tt.Fatalf(`err = nil`)\n\t}\n}", "func LoadArgs(argConfs []snlapi.Arg, cliArgs []string) (map[string]*string, error) {\n\targRes := map[string]*string{}\n\n\tam := map[string]snlapi.Arg{}\n\tposSl := []snlapi.Arg{}\n\tfor _, ac := range argConfs {\n\t\tif ac.Type == \"\" || ac.Type == \"bool\" || ac.Type == \"named\" {\n\t\t\tam[ac.Name] = ac\n\t\t\tcontinue\n\t\t}\n\t\tif ac.Type == \"pos\" {\n\t\t\tposSl = append(posSl, ac)\n\t\t\tcontinue\n\t\t}\n\t\t//TODO: Validation\n\t\treturn nil, fmt.Errorf(\"unknown argument type: name: '%s', type: '%s' should be one of: pos, bool, named\", ac.Name, ac.Type)\n\t}\n\n\tprevHandled := false\n\tpassedPosArg := 0\n\tfor i, cliArg := range cliArgs {\n\t\tif prevHandled {\n\t\t\tprevHandled = false\n\t\t\tcontinue\n\t\t}\n\t\t// Whitespace separated named or bool flag\n\t\tif match := argWsSeparatedRegex.MatchString(cliArg); match {\n\t\t\targName := strings.TrimLeft(cliArg, \"-\")\n\t\t\tc, exists := am[argName]\n\t\t\tif !exists {\n\t\t\t\treturn nil, fmt.Errorf(\"named argument does not exist: name '%s'\", argName)\n\t\t\t}\n\t\t\t// Bool flag\n\t\t\tif c.Type != \"\" && c.Type == \"bool\" {\n\t\t\t\ttrueVal := \"1\"\n\t\t\t\targRes[argName] = &trueVal\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif c.Type == \"\" || c.Type == \"named\" {\n\t\t\t\t// Named flag whitespace separated\n\t\t\t\tif i+1 >= len(cliArgs) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"missing value after last named argument: name '%s'\", cliArg)\n\t\t\t\t}\n\t\t\t\targRes[argName] = &cliArgs[i+1]\n\t\t\t\tprevHandled = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// Equal sign separated named argument\n\t\tif match := argEqSeparatedRegex.MatchString(cliArg); match {\n\t\t\ttmpS := strings.TrimLeft(cliArg, \"-\")\n\t\t\tspl := strings.SplitN(tmpS, \"=\", 2)\n\t\t\targName, argValue := spl[0], spl[1]\n\t\t\tc, exists := am[argName]\n\t\t\tif !exists {\n\t\t\t\treturn nil, fmt.Errorf(\"named argument does not exist: '%s'\", argName)\n\t\t\t}\n\t\t\tif !(c.Type == \"\" || c.Type == \"named\") {\n\t\t\t\treturn nil, fmt.Errorf(\"value provided for non-named argument %s: '%s'\", argName, cliArg)\n\t\t\t}\n\t\t\targRes[argName] = &argValue\n\t\t\tcontinue\n\t\t}\n\n\t\t// Positional arguments\n\t\tif len(posSl) > passedPosArg {\n\t\t\ta := posSl[passedPosArg]\n\t\t\targRes[a.Name] = &cliArgs[i]\n\t\t\tpassedPosArg++\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"too many positional arguments given: '%s'\", cliArg)\n\t\t}\n\t}\n\n\tfor i := range argConfs {\n\t\targName := argConfs[i].Name\n\t\tif _, exists := argRes[argName]; !exists {\n\t\t\tif argConfs[i].FromEnvVar != nil {\n\t\t\t\tvalue, isSet := os.LookupEnv(argName)\n\t\t\t\tif isSet {\n\t\t\t\t\targRes[argName] = &value\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif argConfs[i].Default != nil {\n\t\t\t\targRes[argName] = argConfs[i].Default\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif argConfs[i].Type == \"bool\" {\n\t\t\t\tfalseVal := \"0\"\n\t\t\t\targRes[argName] = &falseVal\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif argConfs[i].Type == \"pos\" {\n\t\t\t\treturn nil, fmt.Errorf(\"value for positional argument missing: '%s'\", argName)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"value for argument missing: not given via parameter, environment variable or default value: '%s'\", argName)\n\t\t}\n\t}\n\tlogrus.Trace(\"parsed args\", argRes)\n\n\treturn argRes, nil\n}", "func Args(args... interface{}) (NamedArgs, error) {\n\treturn ArgsChecked(nil, args...)\n}", "func New(_err string) error {\n\treturn errors.New(_err)\n\t// pc, fn, line, _ := runtime.Caller(1)\n\t// errorX := fmt.Sprintf(\"[error] in %s[%s:%d] %v\", runtime.FuncForPC(pc).Name(), fn, line, err.Error())\n}", "func ParseArgs(args []string) ([]string, string, error) {\n\tlog.Infof(\"Parsing arguments\")\n\n\tif len(args) < 2 {\n\t\treturn args, \"\", nil\n\t}\n\n\tvar lastPositionalArg int\n\tfor i, arg := range args {\n\t\tif strings.HasPrefix(arg, \"-\") {\n\t\t\tbreak\n\t\t}\n\t\tlastPositionalArg = i\n\t}\n\n\tif lastPositionalArg == 0 {\n\t\treturn args, \"\", nil\n\t}\n\n\tif lastPositionalArg == 1 {\n\t\treturn append([]string{args[0]}, args[2:]...), args[1], nil\n\t}\n\n\treturn nil, \"\", fmt.Errorf(\"unexpected positional argument(s) %v\", args[2:lastPositionalArg+1])\n}", "func ValueFrom(err error) int32 {\n\tif err != nil {\n\t\tfor err != nil {\n\t\t\t//from grpc status\n\t\t\tif st, ok := status.FromError(err); ok {\n\t\t\t\treturn int32(st.Code())\n\t\t\t}\n\t\t\t//from error coder implement\n\t\t\tif cd, ok := err.(coder); ok {\n\t\t\t\treturn cd.Value()\n\t\t\t}\n\t\t\terr = errors.Unwrap(err)\n\t\t}\n\t\treturn -1\n\t}\n\treturn 0\n}", "func TestParseArgsFull(t *testing.T) {\n\ta := false\n\tc := false\n\taargs := []string{\"app_arg1\", \"app_arg2\"}\n\tcargs := []string{\"cmd_arg1\", \"cmd_arg2\", \"cmd_arg3\"}\n\tunit, cmd := newParserTestUnit(&a, &c)\n\targuments, _ := newArgs(true, true, aargs, cargs)\n\n\tassert.That(t, cmd, newParserMatcher(unit, arguments))\n\n\tassert.True(t, \"app flag\", a)\n\tassert.True(t, \"cmd flag\", c)\n\n\tassert.Equals(t, \"app arg count\", unit.NArg(), 2)\n\tassert.Equals(t, \"cmd arg count\", cmd.NArg(), 3)\n\n\tassert.StringArrayEquals(t, \"app args\", unit.Args(), aargs)\n\tassert.StringArrayEquals(t, \"cmd args\", cmd.Args(), cargs)\n}", "func (mr *messageResponse) ParseArgs(Groups GroupMgr) (args Arguments, msg string, ok bool) {\n\tmr.FromMaster = false\n\t//The admin of the bot can be changed via configs, but they are defined by\n\t//the id google gives them, incase their name changes, and how they reach out.\n\t//i.e. The bot will only recognize the admin if messaged via DM. an admin\n\t//shouldn't be doing admin things in front of the common folk.\n\tif mr.Room.Type == \"DM\" && mr.Message.Sender.GID == MasterID {\n\t\tmr.FromMaster = true\n\t\t//This prepends the botname to the message so that the admin doesn't have to\n\t\t//@ the bot when DM-ing it. The conditional allows you to do either.\n\t\tif !strings.HasPrefix(mr.Message.Text, BotName) {\n\t\t\tmr.Message.Text = BotName + \" \" + mr.Message.Text\n\t\t}\n\t}\n\n\ttempArgs := strings.Fields(mr.Message.Text)\n\tnArgs := len(tempArgs)\n\tif nArgs < 2 {\n\t\tmsg = BotName + \" seems to have been called with no params. Just a heads up.\"\n\t\tok = false\n\n\t\treturn\n\t}\n\n\targs = make(Arguments)\n\tok = true\n\tmsg = \"\"\n\n\tif tempArgs[0] == BotName {\n\t\toption := strings.ToLower(tempArgs[1])\n\n\t\t//I'd like to find a cleaner way to triage the string, but this seems\n\t\t//to be the best as of now. I do worry, that this could get hard to maintain.\n\t\tif option != \"create\" &&\n\t\t\toption != \"add\" &&\n\t\t\toption != \"remove\" &&\n\t\t\toption != \"disband\" &&\n\t\t\toption != \"restrict\" &&\n\t\t\toption != \"list\" &&\n\t\t\toption != \"syncgroup\" &&\n\t\t\toption != \"syncallgroups\" &&\n\t\t\toption != \"schedule\" &&\n\t\t\toption != \"usage\" &&\n\t\t\toption != \"help\" {\n\t\t\tif Groups.IsGroup(tempArgs[1]) {\n\t\t\t\targs[\"action\"] = \"notify\"\n\t\t\t\targs[\"groupName\"] = tempArgs[1]\n\t\t\t} else {\n\t\t\t\tmsg = fmt.Sprintf(\"Invalid option received. I'm not sure what to do about %q.\", tempArgs[1])\n\t\t\t\tok = false\n\t\t\t}\n\t\t} else {\n\t\t\targs[\"action\"] = option\n\t\t}\n\t} else {\n\t\targs[\"action\"] = \"notify\"\n\t}\n\n\tif args[\"action\"] == \"schedule\" {\n\t\terr := parseScheduleArgs(Groups, tempArgs, &args)\n\t\tif err != nil {\n\t\t\tok = false\n\t\t\tmsg = err.Error()\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tif nArgs < 3 {\n\t\t\targs[\"groupName\"] = \"\"\n\t\t} else {\n\t\t\targs[\"groupName\"] = tempArgs[2]\n\t\t}\n\t}\n\n\t//Logic introduced for adding/removing yourself from a group\n\tif args[\"action\"] == \"add\" || args[\"action\"] == \"remove\" || args[\"action\"] == \"create\" {\n\t\tfor _, item := range tempArgs {\n\t\t\tif strings.ToLower(item) == \"self\" {\n\t\t\t\targs[\"self\"] = \"self\"\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t//This one is a bit jank, I'll admit (PR's Welcome :D). What's happening is gi\n\t//is a value set to be arbitrarily high, it stands for group index. The for loop\n\t//loops through the words given by the message text, separated by whitespace. When\n\t//When it identified the bot name, it sets gi. After gi is set, the next thing should\n\t//be the group name. So the loop just sets the next item to be the group name and\n\t//proceeds\n\tif args[\"action\"] == \"notify\" {\n\t\tgi := 100000\n\n\t\tfor i, v := range tempArgs {\n\t\t\tif v == BotName {\n\t\t\t\tgi = i\n\t\t\t}\n\n\t\t\tif i == gi+1 {\n\t\t\t\targs[\"groupName\"] = v\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "func TestHelloWithEmptyValidArg(t *testing.T) {\n\n\t//test for validy argument\n\tresult := hello(\"Mike\")\n\n\tif result != \"Hello Mike!\" {\n\t\tt.Errorf(\"Hello(\\\"\\\") failed, expected %v, got %v\", \"Hello Dude!\", result)\n\t} else {\n\t\tt.Logf(\"Hello(\\\"\\\") success, expected %v, got %v\", \"Hello Dude!\", result)\n\t}\n}", "func (c *cli) parseArgs(args []string) (*cliArgs, error) {\n\tparsedArgs := &cliArgs{}\n\n\tapp := kingpin.New(appName, \"\")\n\n\t// Do not call os.Exit\n\tapp.Terminate(nil)\n\n\t// Write output to stderr\n\tapp.Writer(c.stderr)\n\n\t// Add --version flag with to display build info\n\tapp.Version(fmt.Sprintf(\"%s version %s (%s) built on %s\", appName, version, commitHash, buildDate))\n\n\t// Add --config flag to specify path to the config\n\tapp.Flag(\"config\", \"Set the configuration file path\").\n\t\tShort('c').\n\t\tPlaceHolder(\"PATH\").\n\t\tDefault(filepath.Join(filepath.Dir(os.Args[0]), \"gevulot.toml\")).\n\t\tStringVar(&parsedArgs.configPath)\n\n\t// Add --verbose flag to enable debug output\n\tapp.Flag(\"verbose\", \"Enable debug output\").\n\t\tShort('v').\n\t\tBoolVar(&parsedArgs.isVerbose)\n\n\t// Expose --help and --version flags to our struct\n\tapp.HelpFlag.BoolVar(&parsedArgs.isHelp)\n\tapp.VersionFlag.BoolVar(&parsedArgs.isHelp)\n\n\t_, err := app.Parse(args)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn parsedArgs, nil\n}", "func (c *modAccountRun) validate(args []string) error {\n\tif len(args) < 2 {\n\t\treturn errors.New(\"not enough arguments\")\n\t}\n\n\tif len(args) > 2 {\n\t\treturn errors.New(\"too many arguments\")\n\t}\n\n\treturn nil\n}" ]
[ "0.5909873", "0.5837284", "0.5835201", "0.5714883", "0.5544728", "0.5519505", "0.5502871", "0.548456", "0.53911287", "0.5372323", "0.53482527", "0.52780676", "0.525999", "0.52420926", "0.5204053", "0.51970226", "0.51490456", "0.5147711", "0.5131719", "0.51281655", "0.51262283", "0.5102858", "0.50838286", "0.5078438", "0.50744224", "0.5040057", "0.5036445", "0.5029782", "0.50216204", "0.5002596", "0.50018466", "0.4997262", "0.49889728", "0.49768117", "0.49665958", "0.4927463", "0.49149173", "0.4907889", "0.49043366", "0.48986223", "0.4897351", "0.4893268", "0.48882365", "0.4884854", "0.48842233", "0.48745158", "0.48713204", "0.48590183", "0.485546", "0.48540202", "0.48482755", "0.48419708", "0.48398042", "0.48350057", "0.4827454", "0.4821874", "0.48186785", "0.4811847", "0.4807101", "0.48020726", "0.4799622", "0.4796873", "0.4795695", "0.4791932", "0.4778001", "0.47703546", "0.47650513", "0.47590196", "0.4756486", "0.47556788", "0.4752993", "0.47388104", "0.47290692", "0.4726882", "0.47254965", "0.47190586", "0.47154245", "0.47085348", "0.47050652", "0.4701272", "0.47011337", "0.46906653", "0.46897036", "0.4686907", "0.4671256", "0.46701503", "0.46643132", "0.4663", "0.46535197", "0.46480653", "0.46465263", "0.46439898", "0.4643028", "0.46285203", "0.4623609", "0.46074402", "0.46050522", "0.46026745", "0.45967788", "0.45934328" ]
0.5376342
9
Prefix from args takes the argument as a string and prepends a null.
func (*CustomIndex) PrefixFromArgs(args ...interface{}) ([]byte, error) { if len(args) != 1 { return nil, fmt.Errorf("must provide only a single argument") } arg, ok := args[0].(string) if !ok { return nil, fmt.Errorf("argument must be a string: %#v", args[0]) } arg = "\x00" + arg return []byte(arg), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func addPrepullPrefix(component string) string {\n\treturn fmt.Sprintf(\"%s%s\", prepullPrefix, component)\n}", "func prependIfMissing(str string, prefix string, ignoreCase bool, prefixes ...string) string {\n if IsEmpty(prefix) || internalStartsWith(str, prefix, ignoreCase) {\n\t\treturn str\n\t}\n\tfor _, pref := range prefixes {\n\t\tif pref == \"\" || internalStartsWith(str, pref, ignoreCase) {\n\t\t\treturn str\n\t\t}\n\t}\n\treturn prefix + str\n}", "func PrependIfMissing(str string, prefix string, prefixes ...string) string {\n\treturn prependIfMissing(str, prefix, false, prefixes...)\n}", "func TrimPrefix(prefix, operand string) string { return strings.TrimPrefix(operand, prefix) }", "func trimFirstArg(args []string) []string {\n\tl := len(args)\n\tif l > 1 {\n\t\treturn args[1:]\n\t}\n\treturn []string(nil)\n}", "func Prefix(value string) Option {\n\treturn addParam(\"prefix\", value)\n}", "func trimToPrefix(str, prefix string) string {\n\ti := strings.Index(str, prefix)\n\tif i < 0 {\n\t\treturn str\n\t}\n\treturn str[i:]\n}", "func (o BucketMetricFilterPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketMetricFilter) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func Coalesce(strArgs ...string) string {\n\tfor _, str := range strArgs {\n\t\tif len(str) > 0 {\n\t\t\treturn str\n\t\t}\n\t}\n\treturn \"\"\n}", "func MaybeCompletePrefix(s string) string {\n\tif s != \"\" && !strings.HasSuffix(s, \"-\") {\n\t\treturn s + \"-\"\n\t}\n\treturn s\n}", "func CmdPrefix(ctx *system.Context) {\n\tgconfig := ctx.Get(\"gconfig\").(*models.Guild)\n\tSetString(ctx, gconfig, \"Prefix\", \"\", &gconfig.Prefix)\n}", "func (*Prefix) Default() string { return defaultPrefix }", "func prefixJoin(prefix string, array []string, separator string) (result string) {\n\tif len(array) == 0 {\n\t\treturn\n\t}\n\tfor index, val := range array {\n\t\tif index == 0 {\n\t\t\tresult = val\n\t\t} else {\n\t\t\tresult = join(result, concat(prefix, val), separator)\n\t\t}\n\t}\n\treturn\n}", "func (o InventoryFilterPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *InventoryFilter) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func (o *SignalPersonName) SetPrefixNil() {\n\to.Prefix.Set(nil)\n}", "func compactPrefix() []byte { return []byte{0, 3, 0, 0} }", "func trimOutPrefix(str, prefix string) string {\n\ti := strings.Index(str, prefix)\n\tif i < 0 {\n\t\treturn str\n\t}\n\treturn str[i+len(prefix):]\n}", "func (o AnalyticsConfigurationFilterPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AnalyticsConfigurationFilter) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func (o BucketReplicationConfigRuleFilterAndPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketReplicationConfigRuleFilterAnd) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func SetPrefix(prefix string) { std.SetPrefix(prefix) }", "func trimPrefix(command, prefix string) (string, bool) {\n\tvar c string\n\tif prefix == \"\" && command != \"\" {\n\t\treturn command, true\n\t}\n\tif command == \"\" {\n\t\treturn command, false\n\t}\n\tif c = strings.TrimPrefix(command, prefix); c == command {\n\t\treturn \"\", false\n\t}\n\n\treturn c, len(c) != 0 // if command was \"[prefix]\" and it's trimmed into \"\" it should be false\n\n}", "func compactPrefix() []byte { return []byte{0, 1, 0, 0} }", "func prefix0(needle int) (zstr string) {\n\tvar str string = strconv.Itoa(needle)\n\tif len(str) < 2 {\n\t\tzstr = \"0\" + str\n\t} else {\n\t\tzstr = str\n\t}\n\treturn zstr\n}", "func Prefix(p string) Option {\n\treturn func(s *Source) { s.prefix = p }\n}", "func (ub *UpdateBuilder) Prefix(\n\tsql string,\n\targs ...interface{},\n) *UpdateBuilder {\n\tub.sql = ub.sql.Prefix(sql, args...)\n\treturn ub\n}", "func Prefix(l string) Option {\n\treturn func(c *Config) Option {\n\t\tprevious := c.Pfx\n\t\tc.Pfx = l\n\t\treturn Prefix(previous)\n\t}\n}", "func Prefix(s string) Option {\n\treturn optionFunc(func(l *lineWriter) {\n\t\tl.prefixes = append(l.prefixes, func() string { return s })\n\t})\n}", "func ensurePrefix(s, prefix string) string {\n\tif !strings.HasPrefix(s, prefix) {\n\t\ts = prefix + s\n\t}\n\treturn s\n}", "func (this *NowStr) MinArgs() int { return 0 }", "func EnsurePrefix(s, prefix string) string {\n\tif strings.HasPrefix(s, prefix) {\n\t\treturn s\n\t}\n\treturn prefix + s\n}", "func Prefix(prefix string) Option {\n\treturn func(o *options) {\n\t\to.prefix = prefix\n\t}\n}", "func (o BucketReplicationConfigurationRuleFilterPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketReplicationConfigurationRuleFilter) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func constructTaskWithPrefix(prefix string, args ...string) string {\n\tvar builder strings.Builder\n\n\tbuilder.WriteString(prefix)\n\n\tfor _, s := range args {\n\t\tbuilder.WriteRune(MagicRune)\n\t\tbuilder.WriteString(s)\n\t}\n\n\treturn builder.String()\n}", "func (o BucketReplicationConfigRuleFilterPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketReplicationConfigRuleFilter) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func urlPrefix(_ string) string {\n\treturn \"\"\n}", "func name(parts ...string) string {\n\n\tconst null = \"\"\n\n\tvar notNull []string\n\n\tfor _, value := range parts {\n\n\t\tif value != null {\n\t\t\tnotNull = append(notNull, value)\n\t\t}\n\n\t}\n\n\treturn strings.Join(notNull, \"-\")\n\n}", "func (f *filter) Prefix(prefix string) Filter {\n\tif f.prefixed || prefix == \"\" {\n\t\treturn f\n\t}\n\n\tif len(f.allowed) > 0 {\n\t\tfor _, r := range f.allowed {\n\t\t\tr.prefix(prefix)\n\t\t}\n\n\t\tf.prefixed = true\n\t}\n\n\treturn f\n}", "func Prefix(p string) Option {\n\treturn func(s *storage) {\n\t\ts.prefix = p\n\t}\n}", "func (this *ClockStr) MinArgs() int { return 0 }", "func DropOptionalHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldDropOptional, v))\n}", "func firstArg(args []string) string {\n\tl := len(args)\n\tif l >= 1 {\n\t\treturn args[0]\n\t}\n\treturn \"\"\n}", "func (o InventoryDestinationBucketPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *InventoryDestinationBucket) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func print_prefix_name(p int32)(str string){\nl:=name_dir[p].name[0]\nstr= fmt.Sprint(string(name_dir[p].name[1:]))\nif int(l)<len(name_dir[p].name){\nstr+= \"...\"\n}\nreturn\n}", "func (o BucketMetricFilterOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketMetricFilter) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func FirstArg(args []string) string {\n\tif len(args) > 0 {\n\t\treturn args[0]\n\t}\n\treturn \"\"\n}", "func prefix(c *cobra.Command) []string {\n\tprefixes := []string{}\n\tif c.Parent() == nil {\n\t\treturn prefixes\n\t}\n\n\tp := prefix(c.Parent())\n\tif len(p) == 0 {\n\t\tprefixes = append(prefixes, c.Name())\n\t\treturn prefixes\n\t}\n\n\tprefixes = append(prefixes, p...)\n\tprefixes = append(prefixes, fmt.Sprintf(\"%s.%s\", p[len(p)-1], c.Name()))\n\n\treturn prefixes\n}", "func (o BucketReplicationConfigRuleFilterAndOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigRuleFilterAnd) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func accountPrefix(parts []string) (string, []string) {\n\t// TODO(jba): handle repo import paths like \"example.org/foo/bar.hg\".\n\tvar n int // index of account in parts\n\t// The first two cases below handle the special cases that the go command does.\n\t// See \"go help importpath\".\n\n\tswitch {\n\tcase internal.VCSHostWithThreeElementRepoName(parts[0]):\n\t\tn = 1\n\tcase parts[0] == \"gopkg.in\":\n\t\tn = 1\n\tcase parts[0] == \"hub.jazz.net\":\n\t\tn = 2\n\tdefault:\n\t\t// For custom import paths, use the host as the first prefix.\n\t\tn = 0\n\t}\n\tif n >= len(parts)-1 {\n\t\treturn strings.Join(parts, \"/\"), parts\n\t}\n\treturn strings.Join(parts[:n+1], \"/\") + \"/\", parts[:n+1]\n}", "func (n Name) Prefix(suffix Name) Name {\n\toffset := len(n) - len(suffix)\n\tif offset < 0 {\n\t\treturn n\n\t}\n\tif n[offset:].Equal(suffix) {\n\t\treturn n[:offset]\n\t}\n\treturn n\n}", "func NullOutArgs(query string) string {\n\tlastChunkEnd := 0\n\tchunks := []string{}\n\tquoteRune := 'X'\n\targStart := -1\n\n\tfor i, r := range query {\n\t\tif argStart >= 0 {\n\t\t\tif unicode.IsDigit(r) && r <= 127 { // is it an ascii digit\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif i > argStart+1 { // we have seen at least one digit past the $\n\t\t\t\tchunks = append(chunks, query[lastChunkEnd:argStart])\n\t\t\t\tchunks = append(chunks, \"NULL\")\n\t\t\t\tlastChunkEnd = i\n\t\t\t\targStart = -1\n\t\t\t}\n\t\t}\n\n\t\tswitch r {\n\t\tcase '\"':\n\t\t\tfallthrough\n\t\tcase '\\'':\n\t\t\trealQuoteChar := true\n\t\t\tif i > 0 && query[i-1] == '\\\\' {\n\t\t\t\trealQuoteChar = false\n\t\t\t}\n\n\t\t\tif realQuoteChar {\n\t\t\t\tif quoteRune == 'X' {\n\t\t\t\t\tquoteRune = r\n\t\t\t\t} else if r == quoteRune {\n\t\t\t\t\tquoteRune = 'X'\n\t\t\t\t}\n\t\t\t}\n\t\tcase '$':\n\t\t\tif quoteRune == 'X' {\n\t\t\t\targStart = i\n\t\t\t}\n\t\t}\n\t}\n\n\tif argStart >= 0 {\n\t\t// the very last bit was an escape sequence\n\t\tchunks = append(chunks, query[lastChunkEnd:argStart])\n\t\tchunks = append(chunks, \"NULL\")\n\t} else {\n\t\tchunks = append(chunks, query[lastChunkEnd:])\n\t}\n\n\treturn strings.Join(chunks, \"\")\n}", "func (r ResourceName) Prepend(prefix string) ResourceName {\n\treturn ResourceName(path.Join(prefix, string(r)))\n}", "func (r *Routing) Prefix(prefix string, f func()) {\n\n\tdefer func() {\n\t\tr.routerWithPrefix = nil\n\t\tif len(r.prefixes) > 0 {\n\t\t\tr.prefixes = r.prefixes[:len(r.prefixes)-1]\n\t\t}\n\t}()\n\n\tif len(prefix) == 0 {\n\t\tpanic(\"Prefix(): the prefix can't be empty\")\n\t}\n\n\tr.prefixes = append(r.prefixes, prefix)\n\n\tvar mergePrefix = strings.Join(r.prefixes, \"/\")\n\n\tr.routerWithPrefix = r.Router.PathPrefix(fmt.Sprintf(\"/%s\", mergePrefix)).Subrouter().StrictSlash(true)\n\tf()\n\n}", "func (o InventoryFilterOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InventoryFilter) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func formatPrefixTable(addr uint8, len int) string {\n\tif len < 0 { // this happens for inversePrefixIndex(0)\n\t\treturn \"<nil>\"\n\t}\n\treturn fmt.Sprintf(\"%3d/%d\", addr, len)\n}", "func (o BuildStrategySpecBuildStepsEnvFromOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsEnvFrom) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func (c *FileSystemCache) Prefix(p ...string) Cache {\n\tc.prefix = p\n\treturn c\n}", "func (si *SyncIndexJob) Prefix(p string) {\n\tsi.DestinationPrefix(p)\n}", "func (f FunctionSelector) WithoutPrefix() string { return f.String()[2:] }", "func (o AnalyticsConfigurationFilterOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AnalyticsConfigurationFilter) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func Prefix() string {\n\treturn std.Prefix()\n}", "func (o BucketLifecycleConfigurationV2RuleFilterAndPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleConfigurationV2RuleFilterAnd) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func pkgPrefix(funcName string) string {\n\tconst pathSep = \"/\"\n\tend := strings.LastIndex(funcName, pathSep)\n\tif end == -1 {\n\t\treturn \"\"\n\t}\n\treturn funcName[:end]\n}", "func (rc *RedisInfo) joinPrefix(originKey string) string {\n\tif rc.key != \"\" {\n\t\treturn fmt.Sprintf(\"%s:%s\", rc.key, originKey)\n\t}\n\treturn originKey\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvFromOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsEnvFrom) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func FlagPrefix(prefix string) Option {\n\treturn flagPrefixOpt(prefix)\n}", "func Prefix(target Logger, f string, v ...interface{}) Logger {\n\tp := fmt.Sprintf(f, v...)\n\n\treturn prefixer{\n\t\ttarget,\n\t\tp,\n\t\tstrings.ReplaceAll(p, \"%\", \"%%\"),\n\t}\n}", "func (p FloatFormalParam) Prefix() string {\n\n\t// TODO need to add complex back\n\t//\tif p.IsComplex {\n\t//\t\treturn \"_Complex \"\n\t//\t}\n\treturn \"\"\n}", "func genPrefix(globalPrefix string, heritage []*node.Node) (prefix string) {\n\tif globalPrefix != \"\" {\n\t\tprefix = globalPrefix\n\t}\n\tfor _, hn := range heritage {\n\t\tenvName := nodeEnvName(hn)\n\t\tif envName == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif prefix == \"\" {\n\t\t\tprefix += envName\n\t\t} else {\n\t\t\tprefix += \"_\" + envName\n\t\t}\n\t}\n\n\treturn prefix\n}", "func (b UpdateBuilder) Prefix(sql string, args ...interface{}) UpdateCondition {\n\treturn builder.Append(b, \"Prefixes\", Expr(sql, args...)).(UpdateBuilder)\n}", "func (o BucketReplicationConfigurationRuleFilterOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigurationRuleFilter) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func PrependIfMissingIgnoreCase(str string, prefix string, prefixes ...string) string {\n\treturn prependIfMissing(str, prefix, true, prefixes...)\n}", "func (d *Discord) CommandPrefix() string {\n\tif len(os.Args) > 1 {\n\t\treturn fmt.Sprintf(\"r.\")\n\t}\n\treturn fmt.Sprintf(\"rt.\")\n}", "func (n *Name) Prefix() string {\n\t// TODO handle gender\n\treturn n.pick(namePrefix + \"/prefix\")\n}", "func (o BucketReplicationConfigRuleFilterOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigRuleFilter) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func Prefix(prefix string) Option {\n\treturn func(s *Store) {\n\t\ts.prefix = prefix\n\t}\n}", "func (o BucketIntelligentTieringConfigurationFilterPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketIntelligentTieringConfigurationFilter) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func (o InventoryDestinationBucketOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InventoryDestinationBucket) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func (r *Request) Prefix(segments ...string) *Request {\n\tif r.err != nil {\n\t\treturn r\n\t}\n\n\tr.pathPrefix = path.Join(r.pathPrefix, path.Join(segments...))\n\n\treturn r\n}", "func SetPrefix(p string) {\n\tprefix = p\n}", "func Nop(_ string, _ ...interface{}) {}", "func CleanPrefix(prefix string) string {\n\trunes := []rune(prefix)\n\tif len(runes) == 0 {\n\t\treturn prefix\n\t}\n\t// Trim duplicate leading slash(es).\n\tif runes[0] == '/' {\n\t\tfor len(runes) > 1 && runes[1] == '/' {\n\t\t\trunes = runes[1:]\n\t\t}\n\t}\n\t// Trim trailing slash(es).\n\tfor len(runes) > 0 && runes[len(runes)-1] == '/' {\n\t\trunes = runes[:len(runes)-1]\n\t}\n\t// Were there nothing but slashes?\n\tif len(runes) == 0 {\n\t\treturn \"\"\n\t}\n\t// Build a properly formatted string.\n\tvar b strings.Builder\n\tif runes[0] != '/' {\n\t\tb.Grow(len(runes) + 1)\n\t\tb.WriteRune('/')\n\t} else {\n\t\tb.Grow(len(runes))\n\t}\n\tfor _, r := range runes {\n\t\tb.WriteRune(r)\n\t}\n\treturn b.String()\n}", "func ProgPrefix(p *syntax.Prog,) (string, bool)", "func shortPrefix(t goraptor.Term) string {\n\tstr := termStr(t)\n\tfor short, long := range rdfPrefixes {\n\t\tif strings.HasPrefix(str, long) {\n\t\t\treturn strings.Replace(str, long, short, 1)\n\t\t}\n\t}\n\treturn str\n}", "func resolveSourcePrefix(source string, sa Source) string {\n\tif sa.Prefix == \"false\" || sa.Prefix == \"\" {\n\t\treturn \"\"\n\t} else if sa.Prefix == \"true\" {\n\t\treturn source + \"_\"\n\t} else {\n\t\treturn sa.Prefix + \"_\"\n\t}\n}", "func fixArgs(args []interface{}) {\n\tfor i, arg := range args {\n\t\tvArg := reflect.ValueOf(arg)\n\t\tswitch vArg.Kind() {\n\t\tcase reflect.String:\n\t\t\targs[i] = vArg.String()\n\t\t\tif args[i] == \"\" {\n\t\t\t\targs[i] = nil\n\t\t\t}\n\t\t}\n\t}\n}", "func TrimPrefix(prefix string) MapFunc {\n\treturn func(s string) string { return strings.TrimPrefix(s, prefix) }\n}", "func (o StaticRouteOutput) Prefix() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *StaticRoute) pulumi.StringOutput { return v.Prefix }).(pulumi.StringOutput)\n}", "func trimSpaceAndJoin(args []string, sep string) string {\n\ttrimmedArgs := make([]string, len(args))\n\tfor i, arg := range args {\n\t\ttrimmedArgs[i] = strings.TrimSpace(arg)\n\t}\n\treturn strings.TrimSpace(strings.Join(trimmedArgs, sep))\n}", "func (o BucketLifecycleConfigurationV2RuleFilterPtrOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleConfigurationV2RuleFilter) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Prefix\n\t}).(pulumi.StringPtrOutput)\n}", "func Prefixed(prefix string) Option {\n\treturn func(opts *logOptions) {\n\t\tif opts.prefix != `` {\n\t\t\topts.prefix = fmt.Sprintf(`%s.%s`, opts.prefix, prefix)\n\t\t\treturn\n\t\t}\n\t\topts.prefix = prefix\n\t}\n}", "func SedifyNull(rules []Rule, p int, in, null string) string {\n\tpartitions := PartitionRules(rules, p)\n\t// 's@http://d-nb.info/gnd/@gnd:@g; s@http://d-nb.info/standards/elementset/gnd#@dnb:@g'\n\tvar replacements []string\n\tfor i, p := range partitions {\n\t\tcommands := make([]string, len(p))\n\t\tfor j, rule := range p {\n\t\t\tif rule.Shortcut == null {\n\t\t\t\tcommands[j] = fmt.Sprintf(\"s@%s@@g\", rule.Prefix)\n\t\t\t} else {\n\t\t\t\tcommands[j] = fmt.Sprintf(\"s@%s@%s:@g\", rule.Prefix, rule.Shortcut)\n\t\t\t}\n\t\t}\n\t\tif i == 0 && in != \"\" {\n\t\t\tcmd := fmt.Sprintf(\"LANG=C perl -lnpe '%s' < '%s'\", strings.Join(commands, \"; \"), in)\n\t\t\treplacements = append(replacements, cmd)\n\t\t} else {\n\t\t\tcmd := fmt.Sprintf(\"LANG=C perl -lnpe '%s'\", strings.Join(commands, \"; \"))\n\t\t\treplacements = append(replacements, cmd)\n\t\t}\n\n\t}\n\treturn strings.Join(replacements, \" | \")\n}", "func (o BucketLifecycleConfigurationV2RuleFilterAndOutput) Prefix() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleConfigurationV2RuleFilterAnd) *string { return v.Prefix }).(pulumi.StringPtrOutput)\n}", "func WithPrefix(value string) *Entry {\n\treturn NewDefaultEntry().WithField(\"prefix\", value)\n}", "func slash(prefix string) string {\n\tprefix = strings.TrimSpace(prefix)\n\tif prefix == \"\" || prefix == \"/\" {\n\t\treturn \"/\"\n\t}\n\tif prefix[0] != '/' {\n\t\tif prefix[len(prefix)-1] == '/' {\n\t\t\treturn \"/\" + prefix[:len(prefix)-1]\n\t\t}\n\t\treturn \"/\" + prefix\n\t}\n\tif prefix[len(prefix)-1] == '/' {\n\t\treturn prefix[:len(prefix)-1]\n\t}\n\treturn prefix\n}", "func (pkg Package) Prefix() string {\n\treturn fmt.Sprintf(\"%s/%s\", pkg.Domain.Name, pkg.Path)\n}", "func (t *TST) Prefix(p string) []string {\n\tif p == \"\" {\n\t\treturn nil\n\t}\n\tn := t.root.get(p)\n\tif n == nil {\n\t\treturn nil // nothing has this prefix\n\t}\n\tmatches := []string{}\n\tif n.val != nil {\n\t\tmatches = append(matches, p)\n\t}\n\tn.eqkid.rprefix(p, &matches)\n\tif len(matches) > 0 {\n\t\treturn matches\n\t}\n\treturn nil\n}", "func MakePrefix(environment, app, hostname string) string {\n\tunderscoreHostname := strings.Replace(hostname, \".\", \"_\", -1)\n\treturn environment + \".\" + app + \".\" + underscoreHostname + \".\"\n}", "func prefixZipcode(zipcode string) {\n\tvar buffer bytes.Buffer\n\n\tfor i := 0; i < 5-len(zipcode); i++ {\n\t\tbuffer.WriteString(\"0\")\n\t}\n\tbuffer.WriteString(zipcode)\n\n\tfmt.Println(buffer.String())\n}", "func SetPrefix(pre string) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tprefix = pre\n}", "func (b DeleteBuilder) Prefix(sql string, args ...interface{}) DeleteCondition {\n\treturn builder.Append(b, \"Prefixes\", Expr(sql, args...)).(DeleteBuilder)\n}" ]
[ "0.6281822", "0.6254861", "0.6236796", "0.60054636", "0.58168834", "0.58079535", "0.5780335", "0.5743967", "0.57231885", "0.5713911", "0.5701314", "0.56998223", "0.56986034", "0.5695343", "0.56574893", "0.56402034", "0.56279725", "0.5611049", "0.55931294", "0.55855465", "0.5579493", "0.5571963", "0.5538461", "0.55208886", "0.55122596", "0.5511607", "0.55084807", "0.550364", "0.54976994", "0.5477421", "0.5476437", "0.54673964", "0.5467174", "0.5466353", "0.5442856", "0.54427487", "0.54409534", "0.54397506", "0.54343", "0.5424742", "0.5420839", "0.54192495", "0.5412184", "0.54102707", "0.54094595", "0.54084724", "0.5387594", "0.5385618", "0.5367651", "0.53625673", "0.534905", "0.533693", "0.53347117", "0.53307545", "0.53224164", "0.5307778", "0.53023374", "0.5301816", "0.52990466", "0.52938426", "0.52890617", "0.52854526", "0.5267134", "0.52579707", "0.5251221", "0.5250359", "0.52382463", "0.5236865", "0.523546", "0.52342594", "0.52328366", "0.52298385", "0.52230066", "0.5219952", "0.5211135", "0.5205314", "0.51929146", "0.51857734", "0.5182463", "0.5180968", "0.51808566", "0.51675856", "0.5161889", "0.5147186", "0.5143111", "0.5142889", "0.51425093", "0.51391006", "0.5138783", "0.51386476", "0.5130623", "0.51256186", "0.5124308", "0.5117656", "0.5112042", "0.51119316", "0.51106983", "0.50992435", "0.5093466", "0.5092772" ]
0.65966773
0
On Registers a handler for a specific http error status ( overrides the NotFound and MethodNotAllowed)
func (he *HTTPErrors) On(httpStatus int, handler HandlerFunc) { if httpStatus == http.StatusOK { return } /* httpHandlerOfficialType := reflect.TypeOf((*http.Handler)(nil)).Elem() if !reflect.TypeOf(handler).Implements(httpHandlerOfficialType) { //it is not a http.Handler //it is func(res,req) we will convert it to a handler using http.HandlerFunc handler = ToHandlerFunc(handler.(func(res http.ResponseWriter, req *http.Request))) } */ if errH := he.getByCode(httpStatus); errH != nil { errH.handler = handler } else { he.ErrorHanders = append(he.ErrorHanders, &errorHandler{code: httpStatus, handler: handler}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func errorHandler(w http.ResponseWriter, r *http.Request, status int) {\n\tw.WriteHeader(status)\n\tif status == http.StatusNotFound {\n\n\t}\n}", "func errorHandler(w http.ResponseWriter, req *http.Request, status int) {\n w.WriteHeader(status)\n if status == http.StatusNotFound {\n e := Error{ErrMsg: \"MessageResponse not found\", ErrCode:http.StatusNotFound}\n json.NewEncoder(w).Encode(e)\n }\n if status == http.StatusBadRequest {\n e := Error{ErrMsg: \"Cannot process your request\", ErrCode:http.StatusBadRequest}\n json.NewEncoder(w).Encode(e)\n }\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func Error(w http.ResponseWriter, r *http.Request, err error) {\n\thandler, ok := err.(http.Handler)\n\tif !ok {\n\t\terrCode, ok := err.(ErrorCode)\n\t\tif !ok {\n\t\t\terrCode = errcode.Add(500, err)\n\t\t}\n\t\thandler = errorCodeHandler{\n\t\t\terr: errCode,\n\t\t}\n\t}\n\thandler.ServeHTTP(w, r)\n}", "func errorHandler(w http.ResponseWriter, req *http.Request, status int){\n\tw.WriteHeader(status)\n\tif status == http.StatusNotFound {\n\t\tfmt.Fprint(w, \"<html><body><p> These are not the URLs you're looking for.\")\n\t\tfmt.Fprint(w, \"</p></body></html>\")\n\t}\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tglog.V(0).Infof(\"unsupported %s %s\", r.Method, r.RequestURI)\n\tWriteErrorResponse(w, r, ErrMethodNotAllowed)\n}", "func errHandler(w http.ResponseWriter, code int, err error) {\n\tlog.Println(\"Error:\", err)\n\thttp.Error(w, http.StatusText(code), code)\n}", "func defaultHandle(writer http.ResponseWriter, request *http.Request) {\n\tlog.Println(\"Not valid route\")\n\thttp.Error(writer, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n}", "func (router *GorillaMuxRouter) MethodNotAllowedHandler(next http.Handler) {\n\trouter.router.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tmethods := router.getMethods(r)\n\t\tif len(methods) > 0 {\n\t\t\tw.Header().Set(\"Allow\", strings.Join(methods, \", \"))\n\t\t} else {\n\t\t\t// 404\n\t\t\tif router.notFound != nil {\n\t\t\t\t// 404 handler is defined by user\n\t\t\t\tnext = router.notFound\n\t\t\t} else {\n\t\t\t\t// Fallback 404\n\t\t\t\thttp.NotFoundHandler().ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func unsupportedMethodHandler(ctx apiContext, w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)\n}", "func notFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tglog.V(0).Infof(\"unsupported %s %s\", r.Method, r.RequestURI)\n\twriteErrorResponse(w, s3err.ErrMethodNotAllowed, r.URL)\n}", "func custom404PageHandler(w http.ResponseWriter, r *http.Request, status int) {\n\tw.Header().Set(\"Content-Type\", \"text/html\") // set the content header type\n\tw.WriteHeader(status) // this automatically generates a 404 status code\n\tif reflect.DeepEqual(status, http.StatusNotFound) {\n\t\tdata404Page := \"This page does not exist ... 404!\" // custom error message content\n\t\tio.WriteString(w, data404Page)\n\t}\n}", "func errorHandler(f func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := f(w, r)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tswitch err.(type) {\n\t\tcase badRequest:\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tcase notFound:\n\t\t\thttp.Error(w, \"task not found\", http.StatusNotFound)\n\t\tdefault:\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, \"oops\", http.StatusInternalServerError)\n\t\t}\n\t}\n}", "func errorHandler(f func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := f(w, r)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tswitch err.(type) {\n\t\tcase badRequest:\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tcase notFound:\n\t\t\thttp.Error(w, \"task not found\", http.StatusNotFound)\n\t\tdefault:\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, \"oops\", http.StatusInternalServerError)\n\t\t}\n\t}\n}", "func errorHandler(f func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := f(w, r)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tswitch err.(type) {\n\t\tcase badRequest:\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tcase notFound:\n\t\t\thttp.Error(w, \"task not found\", http.StatusNotFound)\n\t\tdefault:\n\t\t\thttp.Error(w, \"oops: \"+err.Error(), http.StatusInternalServerError)\n\t\t}\n\t}\n\n}", "func errorHandler(f func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := f(w, r)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tswitch err.(type) {\n\t\tcase badRequest:\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tcase notFound:\n\t\t\thttp.Error(w, \"note not found\", http.StatusNotFound)\n\t\tdefault:\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, \"oops\", http.StatusInternalServerError)\n\t\t}\n\t}\n}", "func ServeHandleIncorrect(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Handle Incorrect\", http.StatusNotFound)\n}", "func (app *App) SetNotFoundHandler(fn http.HandlerFunc) {\n\tapp.router.NotFoundHandler = fn\n}", "func wrapHandler(handler http.Handler, conf Config) http.HandlerFunc {\n return func(write http.ResponseWriter, req *http.Request) {\n\n // Add response headers\n setupResponse(&write, req, conf)\n if (*req).Method == \"OPTIONS\" {\n return\n }\n\n nfrw := &NotFoundRedirectRespWr{ResponseWriter: write}\n handler.ServeHTTP(nfrw, req)\n\n if conf.Debug {\n log.Debug(conf.DebugMsgPref, \"%s %s Response header: %s\", \"Serving:\", req.RequestURI, nfrw.status)\n }\n\n // If status code is 404 - crete logger output and redirect request to custom 404 page\n if nfrw.status == 404 {\n if conf.Debug {\n log.Debug(conf.DebugMsgPref, \"Redirecting %s to %s\", req.RequestURI, conf.NotFoundPage)\n }\n http.Redirect(write, req, conf.NotFoundPage, http.StatusFound)\n }\n }\n}", "func (h *Handler) SetNotFoundHandler(nfh http.Handler) {\n\th.notFound = nfh\n}", "func repportErrorHandler(w *http.ResponseWriter, err string, code int) {\n\tlog.Println(err)\n\thttp.Error(*w, err, code)\n}", "func MethodNotAllowedHandler(method string) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"Method (%s) not allowed on url (%s)\", r.Method, r.URL.String())\n\t\tservice.WriteProblem(w, fmt.Sprintf(\"Method not allowed. Allowed methods are (%s)\", method), \"ERROR_METHOD_NOT_ALLOWED\", http.StatusMethodNotAllowed, errors.New(\"Method not allowed\"))\n\t}\n}", "func (nfh NotFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tlogger.For(pkg, \"NotFoundHandler\").WithField(\"url\", r.URL).Infof(\"not found\")\n\tresponse.ErrorString(\"404: not found\", w, http.StatusNotFound)\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func (r *Router) SetNotFoundHandler(handler RequestHandler) {\n\tr.notFound = handler\n}", "func HandleNotFound(lgc *logic.Logic) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": r.URL.Path, \"method\": r.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\tw.WriteHeader(404)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write([]byte(fmt.Sprintf(\n\t\t\t`{\"message\":\"Page Not Found %s %s\"}`, r.Method, r.URL.Path)))\n\t}\n}", "func invalid_request(w http.ResponseWriter, statCode int, message string){\n w.Header().Set(\"Content-Type\", \"application/json\")\n switch statCode {\n case 400: w.WriteHeader(http.StatusBadRequest)\n case 403: w.WriteHeader(http.StatusForbidden)\n case 404: w.WriteHeader(http.StatusNotFound)\n default: w.WriteHeader(http.StatusNotFound)\n }\n err := Error {\n StatusCode: statCode,\n ErrorMessage: message}\n json.NewEncoder(w).Encode(err)\n}", "func Handler(w http.ResponseWriter, err error) {\n\tvar res *errors.Error\n\tErr, ok := err.(*errors.Error)\n\tif ok {\n\t\tres = Err\n\t} else {\n\t\tres = errors.NewError(\"500\", \"Error server\", err)\n\t}\n\tsc, ok := statusMap()[res.Code]\n\tif !ok {\n\t\tsc = http.StatusInternalServerError\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(sc)\n\tif err = render.Write(w, res); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprint(w, \"Error rendering response\")\n\t}\n}", "func (r *Router) notFoundHandler(w http.ResponseWriter, req *http.Request) {\n\tWriteError(w, 404, \"404 Not Found\")\n}", "func defaultUnauthorizedHandler(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)\n}", "func BadRequestHandler() Handler {\n\treturn HandlerFunc(BadRequest)\n}", "func (f ErrorHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request, err error) {\n\tf(w, r, err)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func (wa *webapi) defaultHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n}", "func handleError(w http.ResponseWriter, err error, prefix string, logger api.Logger) {\n\tmessage := prefix\n\tif message != \"\" {\n\t\tmessage += \": \"\n\t}\n\tmessage += err.Error()\n\tlogger.Error(message)\n\tvar ec int\n\tswitch e := err.(type) {\n\tcase *errorx.Error:\n\t\tswitch e.Code() {\n\t\tcase errorx.NOT_FOUND:\n\t\t\tec = http.StatusNotFound\n\t\tdefault:\n\t\t\tec = http.StatusBadRequest\n\t\t}\n\tdefault:\n\t\tec = http.StatusBadRequest\n\t}\n\thttp.Error(w, message, ec)\n}", "func defaulErrHandle(c *Context, err interface{}) {\n\tvar msg interface{}\n\tswitch err.(type) {\n\tcase string:\n\t\tmsg = err.(string)\n\tcase error:\n\t\tmsg = err.(error).Error()\n\tcase []interface{}:\n\t\tmsg = err.([]interface{})\n\tcase map[string]string:\n\t\tmsg = err.(map[string]string)\n\tcase []string:\n\t\tmsg = err.([]string)\n\t}\n\tvar code interface{}\n\t// default code :request params failed to exam.\n\tcode = 402\n\tif c.ErrCode != nil {\n\t\tcode = c.ErrCode\n\t}\n\tc.GinContext.JSON(http.StatusOK, gin.H{\n\t\t\"state\": 0,\n\t\t\"code\": code,\n\t\t\"msg\": msg,\n\t})\n\tc.GinContext.Abort()\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func (h *TaskHandler) notFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tpe := &errors2.Error{\n\t\tCode: errors2.ENotFound,\n\t\tMsg: \"url not found\",\n\t\tErr: fmt.Errorf(\"%s: not found\", r.URL.String()),\n\t}\n\th.HandleHTTPError(ctx, pe, w)\n}", "func statusHandler(c *gin.Context) {\n\tprovide.Render(nil, 204, c)\n}", "func PanicHandler() http.Handler { return panicHandler{} }", "func FourOhFourHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Print(\"404\")\n\thttp.Error(w, `Y u do this`, http.StatusNotFound)\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func customResponseCode(w http.ResponseWriter, r *http.Request){\n\tw.WriteHeader(501)\n\tfmt.Fprintln(w, \"You have reached an endpoint that does not exist\")\n\n}", "func internalServerError(rw http.ResponseWriter, r *http.Request) {\n\n}", "func methodNotAllowed(resp *ApiResponse, msg string) error {\n resp.StatusCode = http.StatusMethodNotAllowed\n resp.Message = []byte(msg)\n resp.ErrorMessage = msg\n\n return nil\n}", "func renderMethodNotAllowed(w http.ResponseWriter, r *http.Request) {\n\tif r.Proto == \"HTTP/1.1\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\tw.Write([]byte(\"Method Not Allowed\"))\n\t} else {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"Bad Request\"))\n\t}\n}", "func (b BadRequest) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// we return 200 for any OPTIONS request\n\tif r.Method == \"OPTIONS\" {\n\t\tw.WriteHeader(200)\n\t\treturn\n\t}\n\n\tlog.Printf(\"Page not found - 404:\\n\")\n\tlog.Printf(\"%s Accept-Encoding: %s, %4s %s\", r.RemoteAddr, r.Header.Get(\"Accept-Encoding\"), r.Method, r.URL)\n\n\tw.WriteHeader(404)\n\tfmt.Fprintf(w, \"Page not found - 404\\n\")\n}", "func (r *Responder) MethodNotAllowed() { r.write(http.StatusMethodNotAllowed) }", "func (b *Baa) DefaultNotFoundHandler(c *Context) {\n\tcode := http.StatusNotFound\n\tmsg := http.StatusText(code)\n\thttp.Error(c.Resp, msg, code)\n}", "func errorHandler(statusCode int, requestId string, errorCode string, message string) error {\n\n switch errorCode {\n case InvalidParameter, InvalidSubscription, InvalidCursor:\n return NewInvalidParameterError(statusCode, requestId, errorCode, message)\n case ResourceNotFound, NoSuchTopic, NoSuchProject, NoSuchSubscription, NoSuchShard, NoSuchConnector,\n NoSuchMeterInfo, NoSuchConsumer:\n return NewResourceNotFoundError(statusCode, requestId, errorCode, message)\n case SeekOutOfRange:\n return NewSeekOutOfRangeError(statusCode, requestId, errorCode, message)\n case ResourceAlreadyExist, ProjectAlreadyExist, TopicAlreadyExist, ConnectorAlreadyExist:\n return NewResourceExistError(statusCode, requestId, errorCode, message)\n case UnAuthorized:\n return NewAuthorizationFailedError(statusCode, requestId, errorCode, message)\n case NoPermission:\n return NewNoPermissionError(statusCode, requestId, errorCode, message)\n case OperatorDenied:\n return NewInvalidOperationError(statusCode, requestId, errorCode, message)\n case LimitExceed:\n return NewLimitExceededError(statusCode, requestId, errorCode, message)\n case SubscriptionOffline:\n return NewSubscriptionOfflineError(statusCode, requestId, errorCode, message)\n case OffsetReseted:\n return NewSubscriptionOffsetResetError(statusCode, requestId, errorCode, message)\n case OffsetSessionClosed, OffsetSessionChanged:\n return NewSubscriptionSessionInvalidError(statusCode, requestId, errorCode, message)\n case MalformedRecord:\n return NewMalformedRecordError(statusCode, requestId, errorCode, message)\n case ConsumerGroupInProcess:\n return NewServiceInProcessError(statusCode, requestId, errorCode, message)\n case InvalidShardOperation:\n return NewShardSealedError(statusCode, requestId, errorCode, message)\n }\n return NewDatahubClientError(statusCode, requestId, errorCode, message)\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"Not Found: %s\", r.URL.String())\n\tservice.WriteProblem(w, \"No route found\", \"ERROR_NOT_FOUND\", http.StatusNotFound, errors.New(\"Route not found\"))\n}", "func badRequestHandler(w http.ResponseWriter, r *http.Request, e error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tio.WriteString(w, e.Error())\n}", "func adaptCheckToHandler(c func(r *http.Request) error) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := c(r)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"internal server error: %v\", err), http.StatusInternalServerError)\n\t\t} else {\n\t\t\t_, _ = fmt.Fprint(w, \"ok\")\n\t\t}\n\t}\n}", "func makeNotFoundHandler(handlerName string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\t_, _ = w.Write([]byte(fmt.Sprintf(\"%s is only available in enterprise\", handlerName)))\n\t})\n}", "func makeNotFoundHandler(handlerName string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\t_, _ = w.Write([]byte(fmt.Sprintf(\"%s is only available in enterprise\", handlerName)))\n\t})\n}", "func handleError(URL string, resp *http.Response) error {\n\terrBytes, _ := ioutil.ReadAll(resp.Body)\n\terrInfo := string(errBytes)\n\t// Check if we have a JSON representation of the failure, if so decode it.\n\tif resp.Header.Get(\"Content-Type\") == contentTypeJSON {\n\t\terrorResponse, err := unmarshallError(errBytes)\n\t\t//TODO (hduran-8): Obtain a logger and log the error\n\t\tif err == nil {\n\t\t\terrInfo = errorResponse.Error()\n\t\t}\n\t}\n\thttpError := &HttpError{\n\t\tresp.StatusCode, map[string][]string(resp.Header), URL, errInfo,\n\t}\n\tswitch resp.StatusCode {\n\tcase http.StatusNotFound:\n\t\treturn errors.NewNotFoundf(httpError, \"\", \"Resource at %s not found\", URL)\n\tcase http.StatusForbidden, http.StatusUnauthorized:\n\t\treturn errors.NewUnauthorisedf(httpError, \"\", \"Unauthorised URL %s\", URL)\n\tcase http.StatusBadRequest:\n\t\tdupExp, _ := regexp.Compile(\".*already exists.*\")\n\t\tif dupExp.Match(errBytes) {\n\t\t\treturn errors.NewDuplicateValuef(httpError, \"\", string(errBytes))\n\t\t}\n\t}\n\treturn httpError\n}", "func adaptCheckToHandler(c func() error) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\terr := c()\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"FAILED internal server error: %v\", err), http.StatusInternalServerError)\n\t\t} else {\n\t\t\tfmt.Fprint(w, \"OK\")\n\t\t}\n\t})\n}", "func ServeHandlePatternNotMatch(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Please, use 0-9 A-Z a-z _ for handle.\", http.StatusBadRequest)\n}", "func errorRoute(g *gin.Engine) {\n\t// No route\n\tg.NoRoute(func(c *gin.Context) {\n\t\tc.HTML(404, \"error.html\", gin.H{\n\t\t\t\"code\": 404,\n\t\t\t\"message\": \"The Page Could Not be Found\",\n\t\t})\n\t})\n\n\t// No Method\n\tg.NoMethod(func(c *gin.Context) {\n\t\tc.JSON(405, gin.H{\n\t\t\t\"code\": 405,\n\t\t\t\"message\": \"The Method Could Not be Found\",\n\t\t})\n\t})\n}", "func methodNotAllowed(rw http.ResponseWriter, r *http.Request) {\n\n}", "func errHandler(context router.Context, e error) {\n\n\t// Cast the error to a status error if it is one, if not wrap it in a Status 500 error\n\terr := router.ToStatusError(e)\n\n\tview := view.New(context)\n\n\tview.AddKey(\"title\", err.Title)\n\tview.AddKey(\"message\", err.Message)\n\n\tif !context.Production() {\n\t\tview.AddKey(\"status\", err.Status)\n\t\tview.AddKey(\"file\", err.FileLine())\n\t\tview.AddKey(\"error\", err.Err)\n\t}\n\n\t// Set the status correctly for errors\n\tcontext.Writer().WriteHeader(err.Status)\n\n\t// Use our error template\n\tview.Template(\"app/views/error.html.got\")\n\n\tcontext.Logf(\"#error %s\\n\", err)\n\tview.Render()\n}", "func DefaultHTTPStatusHandler(ctx context.Context, resp *http.Response) (*http.Response, error) {\n\tif resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {\n\t\treturn nil, ErrInvalidStatusCode\n\t}\n\n\treturn resp, nil\n}", "func (h *Handler) UnknownHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n}", "func forbiddenHTTPHandler(w http.ResponseWriter, r *http.Request) {\n\tincMetric(metricAPIReq)\n\tutils.DebugHTTPDump(r, settingsmgr.DebugHTTP(settings.ServiceAdmin, settings.NoEnvironment), true)\n\t// Send response\n\tutils.HTTPResponse(w, \"\", http.StatusForbidden, []byte(errorContent))\n\tincMetric(metricAPIErr)\n}", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func handleErr(err error, w http.ResponseWriter) {\n\tif err != nil {\n\t\tlog.Println(\"jwt/handler.go: Error \" + err.Error())\n\t\tw.WriteHeader(500)\n\t}\n}", "func (r *Router) SetNotAllowedHandler(handler RequestHandler) {\n\tr.notAllowedMethod = handler\n}", "func (h *Handler) error(w http.ResponseWriter, error string, code int) {\n\t// TODO: Return error as JSON.\n\thttp.Error(w, error, code)\n}", "func (h *badRequestHandler) ServeHTTP(w stdhttp.ResponseWriter, r *stdhttp.Request) {\n\tw.WriteHeader(stdhttp.StatusBadRequest)\n\t_, err := w.Write([]byte(\"bad request\"))\n\th.require.NoError(err)\n}", "func RegisterHandler(code int, f http.Handler) {\n\thandlerMu.Lock()\n\tdefer handlerMu.Unlock()\n\tswitch f {\n\tcase nil:\n\t\tdelete(handlerMap, code)\n\tdefault:\n\t\thandlerMap[code] = f\n\t}\n}", "func (r *Router) Error(w http.ResponseWriter, err error, statusCode int) {\n\thttp.Error(w, err.Error(), statusCode)\n}", "func methodNotAllowedHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(405)\n\tif _, err := w.Write(nil); err != nil {\n\t\tpanic(err)\n\t}\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func handle_bad_request(w http.ResponseWriter, r *http.Request) {\n\trespond_with_error(w, http.StatusBadRequest, r.Method, r.URL.Path)\n}", "func NotFoundHandler(*Context) error {\n\treturn NewHTTPError(StatusNotFound)\n}", "func notFoundHandler(res http.ResponseWriter, req *http.Request) {\n\tdefer server.LogRequest(req, http.StatusNotFound)\n\n\tres.WriteHeader(http.StatusNotFound)\n\trenderBaseTemplate(res, \"404.html\", nil)\n}", "func HandleErr(w http.ResponseWriter, err error) {\n\thttp.Error(w, fmt.Sprintf(\"%+v\", err), 500)\n}", "func homeHandler(w http.ResponseWriter, req *http.Request){\n\terrorHandler(w, req, http.StatusNotFound)\n}", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func NotAllowed(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusMethodNotAllowed]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotAllowed(w, r)\n\t}\n}", "func HTTPHandler(router *mux.Router) {\n\trouter.Handle(\"/\", ImageHandler())\n\trouter.PathPrefix(\"/unsafe/\").Handler(ImageHandler())\n\trouter.Handle(\"/healthcheck\", HealthcheckHandler())\n}", "func (j *JWT) SetErrHandler(h http.Handler) {\n\tj.errHandler = h\n}", "func methodNotAllowed(w http.ResponseWriter){\n w.WriteHeader(405)\n fmt.Fprintln(w, \"Method not allowed\")\n return\n}", "func (r *Router) HandleMethodNotAllowed(newValue bool) (oldValue bool) {\n\tr.initRouter()\n\toldValue = r.router.HandleMethodNotAllowed\n\tr.router.HandleMethodNotAllowed = newValue\n\treturn\n}", "func NotFound(fn http.HandlerFunc) {\n\tinfoMutex.Lock()\n\tvestigo.CustomNotFoundHandlerFunc(fn)\n\tinfoMutex.Unlock()\n}", "func SimpleNotFoundHandler(c *Context) error {\n\thttp.NotFound(c.W, c.R)\n\treturn nil\n}", "func (mx *Mux) NotFound(handler interface{}) {\n\t// Build NotFound handler chain\n\tm := mx\n\thh := HttpHandler(handler)\n\tif mx.inline && mx.parent != nil {\n\t\tm = mx.parent\n\t\thh = mx.chainHandler(hh)\n\t}\n\n\t// Update the notFoundHandler from this point forward\n\tm.notFoundHandler.Add(hh)\n\tm.updateSubRoutes(func(subMux *Mux) {\n\t\tif subMux.notFoundHandler == nil {\n\t\t\tsubMux.NotFound(hh)\n\t\t}\n\t})\n}", "func custom404PageHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/html\") // set the content header type\n\tw.WriteHeader(http.StatusNotFound) // this automatically generates a 404 status code\n\tdata404Page := \"This page does not exist ... 404!\" // page content\n\tio.WriteString(w, data404Page)\n}", "func MethodNotAllowed(w http.ResponseWriter) {\n\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n}", "func (m *Mux) HandleNotFound(rw http.ResponseWriter, req *http.Request) {\n\tif m.notFound != nil {\n\t\tm.notFound.ServeHTTP(rw, req)\n\t} else {\n\t\thttp.NotFound(rw, req)\n\t}\n}", "func (r *Route) NotFound(handler http.Handler) *Route {\n\tr.handlers[notFound] = handler\n\treturn r\n}", "func (r *Route) methodNotAllowed() http.Handler {\n\n\t// determine what methods ARE supported by this route\n\tmethods := make([]string, 0, 8)\n\n\tfor method := range r.handlers {\n\t\tif method != methodAny && method != notFound {\n\t\t\tmethods = append(methods, method)\n\t\t}\n\t}\n\n\t// 405 only makes sense if some methods are allowed\n\tif len(methods) > 0 {\n\t\treturn methodNotAllowedHandler(methods)\n\t}\n\n\treturn nil\n}", "func responseHandler(f func(w http.ResponseWriter, r *http.Request) (interface{}, error)) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tres, err := f(w, r)\n\n\t\tif err != nil {\n\t\t\tvar sc = 500\n\t\t\tvar message = err.Error()\n\t\t\tvar logError = err\n\n\t\t\tif restErr, ok := err.(RestError); ok {\n\t\t\t\tsc = restErr.Status()\n\t\t\t\tif restErr.Nested() != nil {\n\t\t\t\t\tlogError = restErr.Nested()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlog.Println(logError)\n\t\t\tsendError(w, sc, message)\n\t\t} else {\n\t\t\tsendSuccess(w, res)\n\t\t}\n\t}\n}", "func (f *ForbiddenPaths) Handler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t// Timings\n\t\tt := timings.Tracker{}\n\t\tt.Start()\n\n\t\tfor i, f := range f.Paths {\n\t\t\tif f.MatchString(r.URL.Path) {\n\t\t\t\tDebugOut.Printf(\"ForbiddenPath '%s' matched #%d\\n\", r.URL.Path, i)\n\t\t\t\tRequestErrorResponse(r, w, ErrForbiddenError.Error(), http.StatusForbidden)\n\t\t\t\tTimingOut.Printf(\"ForbiddenPathsHandler handler (matched) took %s\\n\", t.Since().String())\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tTimingOut.Printf(\"ForbiddenPathsHandler handler (no match) took %s\\n\", t.Since().String())\n\t\tnext.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func (b *Baa) SetNotFound(h HandlerFunc) {\n\tb.notFoundHandler = h\n}", "func rootHandler(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Image Server\", http.StatusNotImplemented)\n}", "func ServeNotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n}", "func (lh *AuthorizationCodeLocalhost) statusGetHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"Status OK\"))\n\treturn\n}", "func notFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\n\twritten, err := json.Marshal(struct{ Message string }{Message: \"Bulamadık :(\"})\n\tif err != nil {\n\t\tbadImplementationHandler(w, r, err)\n\t}\n\t_, err = w.Write(written)\n\tif err != nil {\n\n\t\tbadImplementationHandler(w, r, err)\n\t}\n}" ]
[ "0.6819148", "0.66177964", "0.66138715", "0.65375066", "0.64617366", "0.63929397", "0.63880557", "0.61377674", "0.6135936", "0.6110557", "0.61038584", "0.60984", "0.6087718", "0.6087718", "0.60746896", "0.6073172", "0.60659385", "0.60290414", "0.60071427", "0.59947276", "0.59830076", "0.5981472", "0.5958609", "0.59528273", "0.59528273", "0.5925797", "0.592446", "0.5898559", "0.58971316", "0.5879282", "0.5848146", "0.5842365", "0.58271784", "0.5818817", "0.5810326", "0.58048296", "0.58014536", "0.5791744", "0.5776342", "0.57650286", "0.57224834", "0.5717145", "0.5706997", "0.5702393", "0.56952554", "0.5684938", "0.5661575", "0.5657997", "0.5653737", "0.5647681", "0.5645767", "0.5645265", "0.5644847", "0.5644736", "0.56390274", "0.56390274", "0.5623229", "0.5621273", "0.5614487", "0.5610835", "0.5601511", "0.5587667", "0.55799294", "0.5579914", "0.5573343", "0.55723536", "0.5567503", "0.55637974", "0.5561667", "0.55594236", "0.55575424", "0.55496013", "0.55479854", "0.55319923", "0.55266017", "0.55241334", "0.5521949", "0.5517729", "0.5517003", "0.5498375", "0.5497943", "0.5491427", "0.54833084", "0.5466605", "0.54646134", "0.5462645", "0.54604876", "0.54493475", "0.5438099", "0.5437883", "0.5430738", "0.5428451", "0.54266024", "0.54194915", "0.54189247", "0.5414767", "0.54139376", "0.5413582", "0.54085296", "0.54060584" ]
0.6987875
0
Emit executes the handler of the given error http status code
func (he *HTTPErrors) Emit(errCode int, ctx *Context) { if errHandler := he.getByCode(errCode); errHandler != nil { errHandler.handler.Serve(ctx) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func errHandler(w http.ResponseWriter, code int, err error) {\n\tlog.Println(\"Error:\", err)\n\thttp.Error(w, http.StatusText(code), code)\n}", "func Error(w http.ResponseWriter, r *http.Request, err error) {\n\thandler, ok := err.(http.Handler)\n\tif !ok {\n\t\terrCode, ok := err.(ErrorCode)\n\t\tif !ok {\n\t\t\terrCode = errcode.Add(500, err)\n\t\t}\n\t\thandler = errorCodeHandler{\n\t\t\terr: errCode,\n\t\t}\n\t}\n\thandler.ServeHTTP(w, r)\n}", "func (h *Handler) error(w http.ResponseWriter, error string, code int) {\n\t// TODO: Return error as JSON.\n\thttp.Error(w, error, code)\n}", "func errorHandler(w http.ResponseWriter, req *http.Request, status int) {\n w.WriteHeader(status)\n if status == http.StatusNotFound {\n e := Error{ErrMsg: \"MessageResponse not found\", ErrCode:http.StatusNotFound}\n json.NewEncoder(w).Encode(e)\n }\n if status == http.StatusBadRequest {\n e := Error{ErrMsg: \"Cannot process your request\", ErrCode:http.StatusBadRequest}\n json.NewEncoder(w).Encode(e)\n }\n}", "func (r *Router) Error(w http.ResponseWriter, err error, statusCode int) {\n\thttp.Error(w, err.Error(), statusCode)\n}", "func handleErr(w http.ResponseWriter, statusCode int, msg string) {\n\tw.WriteHeader(statusCode)\n\tw.Write([]byte(msg + \"\\n\"))\n}", "func sendHttpErr(w http.ResponseWriter, status int) {\n\thttp.Error(w, http.StatusText(status), status)\n}", "func (he *HTTPErrors) On(httpStatus int, handler HandlerFunc) {\n\tif httpStatus == http.StatusOK {\n\t\treturn\n\t}\n\n\t/*\thttpHandlerOfficialType := reflect.TypeOf((*http.Handler)(nil)).Elem()\n\t\tif !reflect.TypeOf(handler).Implements(httpHandlerOfficialType) {\n\t\t\t//it is not a http.Handler\n\t\t\t//it is func(res,req) we will convert it to a handler using http.HandlerFunc\n\t\t\thandler = ToHandlerFunc(handler.(func(res http.ResponseWriter, req *http.Request)))\n\t\t}\n\t*/\n\tif errH := he.getByCode(httpStatus); errH != nil {\n\t\terrH.handler = handler\n\t} else {\n\t\the.ErrorHanders = append(he.ErrorHanders, &errorHandler{code: httpStatus, handler: handler})\n\t}\n\n}", "func (err errorCodeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tcode := err.err.Code()\n\tif code == 0 {\n\t\tcode = http.StatusInternalServerError\n\t}\n\tif usePlainText(r) {\n\t\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t\tw.WriteHeader(code)\n\t\tio.Copy(w, strings.NewReader(err.err.Error()))\n\t\tw.Write([]byte(\"\\n\"))\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tw.WriteHeader(code)\n\t\tpage := &Page{\n\t\t\tBody: h.Frag{\n\t\t\t\th.String(err.err.Error()),\n\t\t\t\t&h.Script{Inner: h.Unsafe(\"window.location.hash = ''\")},\n\t\t\t},\n\t\t}\n\t\th.Write(context.TODO(), w, page)\n\t}\n}", "func repportErrorHandler(w *http.ResponseWriter, err string, code int) {\n\tlog.Println(err)\n\thttp.Error(*w, err, code)\n}", "func Error(w http.ResponseWriter, code int, msg string, data interface{}) error {\n\tif Log {\n\t\tlog.Printf(\"Error %v: %v\", code, msg)\n\t}\n\n\treturn sendResponse(w, Resp{ERROR, code, msg, data, ErrorHttpCode})\n}", "func (a errorServer) ServeHTTP(w http.ResponseWriter, _ *http.Request) {\n\thttp.Error(w, \"random error\", http.StatusInternalServerError)\n}", "func errorHandler(w http.ResponseWriter, r *http.Request, status int) {\n\tw.WriteHeader(status)\n\tif status == http.StatusNotFound {\n\n\t}\n}", "func handleErr(err error, w http.ResponseWriter) {\n\tif err != nil {\n\t\tlog.Println(\"jwt/handler.go: Error \" + err.Error())\n\t\tw.WriteHeader(500)\n\t}\n}", "func Handler(w http.ResponseWriter, err error) {\n\tvar res *errors.Error\n\tErr, ok := err.(*errors.Error)\n\tif ok {\n\t\tres = Err\n\t} else {\n\t\tres = errors.NewError(\"500\", \"Error server\", err)\n\t}\n\tsc, ok := statusMap()[res.Code]\n\tif !ok {\n\t\tsc = http.StatusInternalServerError\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(sc)\n\tif err = render.Write(w, res); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprint(w, \"Error rendering response\")\n\t}\n}", "func customResponseCode(w http.ResponseWriter, r *http.Request){\n\tw.WriteHeader(501)\n\tfmt.Fprintln(w, \"You have reached an endpoint that does not exist\")\n\n}", "func errorHandler(w http.ResponseWriter, req *http.Request, status int){\n\tw.WriteHeader(status)\n\tif status == http.StatusNotFound {\n\t\tfmt.Fprint(w, \"<html><body><p> These are not the URLs you're looking for.\")\n\t\tfmt.Fprint(w, \"</p></body></html>\")\n\t}\n}", "func (c *Sender) EmitStatus(status string, code int) {\n\tc.status = status\n\tc.statusCode = code\n}", "func (o *UnclaimTrafficFilterLinkIDInternalServerError) Code() int {\n\treturn 500\n}", "func handleErr(w http.ResponseWriter, errorcode int, err error, msg string) {\n\tif err != nil {\n\t\tlogger.WithField(\"error\", err.Error()).Error(msg)\n\t} else {\n\t\tlogger.Error(msg)\n\t}\n\thttp.Error(w, \"\", errorcode)\n}", "func (app *application) clientError(res http.ResponseWriter, statusCode int) {\n\thttp.Error(res, http.StatusText(statusCode), statusCode)\n}", "func sendErrorJsonGenerator(c *gin.Context, err error, code int) {\n\tc.JSON(code, gin.H{\n\t\t\"status\": false,\n\t\t\"error\": err.Error(),\n\t\t\"code\": http.StatusText(code),\n\t})\n}", "func (app *application) clientError(writer http.ResponseWriter, status int) {\n\thttp.Error(writer, http.StatusText(status), status)\n}", "func HandleStatusCode(res *http.Response, err error) (*http.Response, error) {\n\tif err != nil || (res.StatusCode >= 200 && res.StatusCode < 300) {\n\t\treturn res, err\n\t}\n\tvar sb strings.Builder\n\tfmt.Fprintln(&sb, \"http error with status code:\", res.StatusCode)\n\tif err = printPayload(res, &sb); err != nil {\n\t\treturn res, err\n\t}\n\treturn res, errors.New(sb.String())\n}", "func ERROR(w http.ResponseWriter, statusCode int, err error) {\n\tif err != nil {\n\t\tJSON(w, statusCode, struct {\n\t\t\tError string `json:\"error\"`\n\t\t}{\n\t\t\tError: err.Error(),\n\t\t})\n\t} else {\n\t\tJSON(w, http.StatusBadRequest, nil)\n\t}\n}", "func invalid_request(w http.ResponseWriter, statCode int, message string){\n w.Header().Set(\"Content-Type\", \"application/json\")\n switch statCode {\n case 400: w.WriteHeader(http.StatusBadRequest)\n case 403: w.WriteHeader(http.StatusForbidden)\n case 404: w.WriteHeader(http.StatusNotFound)\n default: w.WriteHeader(http.StatusNotFound)\n }\n err := Error {\n StatusCode: statCode,\n ErrorMessage: message}\n json.NewEncoder(w).Encode(err)\n}", "func (app *application) clientError(w http.ResponseWriter, status int) {\n\thttp.Error(w, http.StatusText(status), status)\n}", "func errHandle(w http.ResponseWriter, longmsg string, shortmsg string, status int) {\n\tlog.Errorf(longmsg)\n\terrorResponse := ErrorResponse{\n\t\tStatus: status,\n\t\tErrorMessage: shortmsg,\n\t}\n\tdata, _ := json.Marshal(errorResponse)\n\tresponse := JSONResponse{}\n\tresponse.status = http.StatusUnauthorized\n\tresponse.data = data\n\tresponse.Write(w)\n}", "func errorHandler(statusCode int, requestId string, errorCode string, message string) error {\n\n switch errorCode {\n case InvalidParameter, InvalidSubscription, InvalidCursor:\n return NewInvalidParameterError(statusCode, requestId, errorCode, message)\n case ResourceNotFound, NoSuchTopic, NoSuchProject, NoSuchSubscription, NoSuchShard, NoSuchConnector,\n NoSuchMeterInfo, NoSuchConsumer:\n return NewResourceNotFoundError(statusCode, requestId, errorCode, message)\n case SeekOutOfRange:\n return NewSeekOutOfRangeError(statusCode, requestId, errorCode, message)\n case ResourceAlreadyExist, ProjectAlreadyExist, TopicAlreadyExist, ConnectorAlreadyExist:\n return NewResourceExistError(statusCode, requestId, errorCode, message)\n case UnAuthorized:\n return NewAuthorizationFailedError(statusCode, requestId, errorCode, message)\n case NoPermission:\n return NewNoPermissionError(statusCode, requestId, errorCode, message)\n case OperatorDenied:\n return NewInvalidOperationError(statusCode, requestId, errorCode, message)\n case LimitExceed:\n return NewLimitExceededError(statusCode, requestId, errorCode, message)\n case SubscriptionOffline:\n return NewSubscriptionOfflineError(statusCode, requestId, errorCode, message)\n case OffsetReseted:\n return NewSubscriptionOffsetResetError(statusCode, requestId, errorCode, message)\n case OffsetSessionClosed, OffsetSessionChanged:\n return NewSubscriptionSessionInvalidError(statusCode, requestId, errorCode, message)\n case MalformedRecord:\n return NewMalformedRecordError(statusCode, requestId, errorCode, message)\n case ConsumerGroupInProcess:\n return NewServiceInProcessError(statusCode, requestId, errorCode, message)\n case InvalidShardOperation:\n return NewShardSealedError(statusCode, requestId, errorCode, message)\n }\n return NewDatahubClientError(statusCode, requestId, errorCode, message)\n}", "func errorFunc(server string, w dns.ResponseWriter, r *dns.Msg, rc int) {\n\tstate := request.Request{W: w, Req: r}\n\n\tanswer := new(dns.Msg)\n\tanswer.SetRcode(r, rc)\n\tstate.SizeAndDo(answer)\n\n\tw.WriteMsg(answer)\n}", "func handleError(w http.ResponseWriter, err error, prefix string, logger api.Logger) {\n\tmessage := prefix\n\tif message != \"\" {\n\t\tmessage += \": \"\n\t}\n\tmessage += err.Error()\n\tlogger.Error(message)\n\tvar ec int\n\tswitch e := err.(type) {\n\tcase *errorx.Error:\n\t\tswitch e.Code() {\n\t\tcase errorx.NOT_FOUND:\n\t\t\tec = http.StatusNotFound\n\t\tdefault:\n\t\t\tec = http.StatusBadRequest\n\t\t}\n\tdefault:\n\t\tec = http.StatusBadRequest\n\t}\n\thttp.Error(w, message, ec)\n}", "func Error(ctx *fiber.Ctx, msg string, e error, status int) error {\n\treturn response(ctx, status, fiber.Map{\n\t\t\"success\": false,\n\t\t\"message\": msg,\n\t\t\"data\": e,\n\t})\n}", "func ServeWithError(context echo.Context, statusCode int, err error) error {\n\thandleError(err)\n\n\treturn context.NoContent(statusCode)\n}", "func errHandler(context router.Context, e error) {\n\n\t// Cast the error to a status error if it is one, if not wrap it in a Status 500 error\n\terr := router.ToStatusError(e)\n\n\tview := view.New(context)\n\n\tview.AddKey(\"title\", err.Title)\n\tview.AddKey(\"message\", err.Message)\n\n\tif !context.Production() {\n\t\tview.AddKey(\"status\", err.Status)\n\t\tview.AddKey(\"file\", err.FileLine())\n\t\tview.AddKey(\"error\", err.Err)\n\t}\n\n\t// Set the status correctly for errors\n\tcontext.Writer().WriteHeader(err.Status)\n\n\t// Use our error template\n\tview.Template(\"app/views/error.html.got\")\n\n\tcontext.Logf(\"#error %s\\n\", err)\n\tview.Render()\n}", "func (m *manager) sendErr(w http.ResponseWriter, errorCode int64, errorData interface{}) {\n\tw.WriteHeader(http.StatusInternalServerError)\n\tenc := json.NewEncoder(w)\n\tenc.Encode(map[string]interface{}{\n\t\t\"ok\": false,\n\t\t\"error_code\": errorCode,\n\t\t\"error_data\": errorData,\n\t})\n}", "func Error(ctx *fiber.Ctx, status int, resp interface{}) error {\n\tctx.Status(status)\n\tswitch v := resp.(type) {\n\tcase error, string:\n\t\treturn ctx.JSON(map[string]interface{}{\n\t\t\t\"error\": fmt.Sprintf(\"%v\", v),\n\t\t\t\"status\": status,\n\t\t})\n\tdefault:\n\t\treturn ctx.JSON(resp)\n\t}\n}", "func statusCodeError(got int, expected int) error {\n\treturn errors.New(fmt.Sprintf(\"api returned status code %d where %d was expected\", got, expected))\n}", "func (s *Service) sendError(rsp http.ResponseWriter, req *Request, err error) {\n var m string\n var r int\n var c error\n var h map[string]string\n \n switch v := err.(type) {\n case *Error:\n r = v.Status\n h = v.Headers\n c = v.Cause\n m = fmt.Sprintf(\"%s: [%v] %v\", s.name, req.Id, c)\n if d := formatDetail(c); d != \"\" {\n m += \"\\n\"+ d\n }\n default:\n r = http.StatusInternalServerError\n c = basicError{http.StatusInternalServerError, err.Error()}\n m = fmt.Sprintf(\"%s: [%v] %v\", s.name, req.Id, err)\n }\n \n // propagate non-success, non-client errors; just log others\n if r < 200 || r >= 500 {\n alt.Error(m, nil, nil)\n }else{\n alt.Debug(m)\n }\n if req.Accepts(\"text/html\") {\n s.sendEntity(rsp, req, r, h, htmlError(r, h, c))\n }else{\n s.sendEntity(rsp, req, r, h, c)\n }\n}", "func ErrorHandler(w http.ResponseWriter, r *http.Request, errMsg string, status int) {\n\tvar buffer bytes.Buffer\n\n\t// Get current user information for signin links\n\tctx := appengine.NewContext(r)\n\tgoogleUser := appengineUser.Current(ctx)\n\tvar loginUrl string\n\tvar loginMessage string\n\tvar err error\n\n\t// Build correct login/logout links for Google but don't worry about\n\t// showing full user information, so don't get user object\n\tif googleUser == nil {\n\t\tloginUrl, err = appengineUser.LoginURL(ctx, html.EscapeString(r.URL.Path))\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tloginMessage = \"Sign In\"\n\t} else {\n\t\tloginUrl, err = appengineUser.LogoutURL(ctx, \"/\")\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tloginMessage = \"Sign Out\"\n\t}\n\n\tdata := map[string]interface{}{\n\t\t\"title\": status,\n\t\t\"errMsg\": errMsg,\n\t\t\"LoginUrl\": loginUrl,\n\t\t\"LoginMessage\": loginMessage,\n\t}\n\n\tw.WriteHeader(status)\n\terr = templates[\"dormant/error\"].ExecuteTemplate(&buffer, baseName, data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tio.Copy(w, &buffer)\n}", "func respondHTTPCodeOnly(w http.ResponseWriter, code int) {\n w.WriteHeader(code)\n}", "func setError(w http.ResponseWriter, desc string, status int) {\n\te := map[string]interface{}{\"code\": status, \"msg\": desc}\n\tmsg, _ := json.Marshal(e)\n\tlog.DebugJson(e)\n\t//w.WriteHeader(status)\n\tw.Write(msg)\n}", "func SendError(w http.ResponseWriter, status int, errMsg string) {\n header(w, status)\n data := ErrJson {\n Status: status,\n Error: errMsg,\n }\n json.NewEncoder(w).Encode(data)\n}", "func sendErrorResponse(func_name string, w http.ResponseWriter, http_code int, resp_body string, log_message string) {\n\tutils.Log(fmt.Sprintf(\"%s: %s\", func_name, log_message))\n\tw.WriteHeader(http_code)\n\tw.Write([]byte(resp_body))\n\treturn\n}", "func (f ErrorHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request, err error) {\n\tf(w, r, err)\n}", "func HandleErr(w http.ResponseWriter, err error) {\n\thttp.Error(w, fmt.Sprintf(\"%+v\", err), 500)\n}", "func raiseForStatus(response *http.Response, module int) (err error) {\n\tif response.StatusCode >= 300 {\n\t\tbody, err := ioutil.ReadAll(response.Body)\n\t\tvar explanation string = \"\"\n\t\tif err != nil {\n\t\t\texplanation = string(body)\n\t\t}\n\n\t\treturn APIError {\n\t\t\tGetGeneralStatusError(response.StatusCode, module),\n\t\t\tresponse.StatusCode,\n\t\t\texplanation,\n\t\t}\n\t}\n\n\treturn err\n}", "func (o *QueryAWSAccountsForIDsInternalServerError) Code() int {\n\treturn 500\n}", "func (c *Context) error(status int, err string) {\n\tc.status(status)\n\tc.f.Error(err, status)\n}", "func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\terr := h.H(h.AirtableClient, w, r)\n\tif err != nil {\n\t\tswitch e := err.(type) {\n\t\tcase structs.Error:\n\t\t\t// We can retrieve the status here and write out a specific\n\t\t\t// HTTP status code.\n\t\t\tglog.Infof(\"HTTP %d - %s\", e.Status(), e)\n\t\t\thttp.Error(w, e.Error(), e.Status())\n\t\tdefault:\n\t\t\t// Any error types we don't specifically look out for default\n\t\t\t// to serving a HTTP 500\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError),\n\t\t\t\thttp.StatusInternalServerError)\n\t\t}\n\t}\n}", "func (cr *CustomResponse) Error(c *extend.Context, statusCode int, code string) {\n\tc.JSON(statusCode, ErrorResp{\n\t\tError: Err {\n\t\t\tMessage: config.GetError(c.Lang(), code),\n\t\t\tCode: code,\n\t\t},\n\t})\n}", "func internalServerError(w http.ResponseWriter, r *http.Request) {\r\n\tw.WriteHeader(http.StatusInternalServerError)\r\n\tw.Write([]byte(\"internal server error\"))\r\n}", "func errorResponse(w http.ResponseWriter, reason string, statusCode int) error {\n\tw.WriteHeader(statusCode)\n\terrResponse := ErrorResponse{Err: reason}\n\terr := json.NewEncoder(w).Encode(errResponse)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func writeError(w http.ResponseWriter, status int, err error) {\n\twrite(w, status, Error{Err: err.Error()})\n}", "func internalServerError(rw http.ResponseWriter, r *http.Request) {\n\n}", "func (o *ListNodePoolsInternalServerError) Code() int {\n\treturn 500\n}", "func writeErrorResponse(w http.ResponseWriter, status int, body string) {\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.WriteHeader(status)\n\n\t_, _ = fmt.Fprintf(os.Stderr, \"error: %s\", body)\n\tif _, err := w.Write([]byte(body)); err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"cannot write to stream: %v\\n\", err)\n\t\treturn\n\t}\n}", "func errWriter(w http.ResponseWriter, httpSts int, err error) {\n\tlog.Print(err)\n\thttp.Error(w, http.StatusText(httpSts), httpSts)\n}", "func respondWithError(w http.ResponseWriter, code int, message string) {\n respondWithJSON(w, code, map[string]string{\"error\": message})\n}", "func SendResponseErr(w http.ResponseWriter, httpStatus int, resp Response) {\n\tif resp.Code == \"0\" {\n\t\tresp.Code = \"-1\"\n\t}\n\n\tjson, _ := json.Marshal(resp)\n\n\tw.WriteHeader(httpStatus)\n\tw.Write(json)\n}", "func errorHandler(code int, text string, err *error) {\n\tvar ok bool\n\tclientError.Text, ok = statusText[code]\n\tif !ok {\n\t\terrorHandler(statusNotExpected, \"\", err)\n\t\treturn\n\t}\n\tclientError.Code = code\n\tif text != \"\" {\n\t\tclientError.Text += \": \" + text\n\t}\n\tif code == statusNotExpected {\n\t\t*err = errors.WithStack(*err)\n\t} else {\n\t\t*err = errCustomNil\n\t}\n}", "func endRequestWithError(w http.ResponseWriter, r *http.Request, statusCode int, err error) {\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), statusCode)\n\t} else {\n\t\thttp.Error(w, \"\", statusCode)\n\t}\n}", "func ERROR(r *gin.Context, statusCode int, err error) {\n\tres := map[string]string{\n\t\t\"message\": string(err.Error()),\n\t}\n\n\tr.AbortWithStatusJSON(statusCode, gin.H{\n\t\t\"status\": statusCode,\n\t\t\"data\": res,\n\t})\n}", "func ClientError(w http.ResponseWriter, status int) {\n\tapp.InfoLog.Println(\"Client error with status of\", status)\n\thttp.Error(w, http.StatusText(status), status)\n}", "func serve(code int) HandlerFunc {\n\treturn func(w ResponseWriter, r *Request) {\n\t\tw.WriteHeader(code)\n\t}\n}", "func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\terr := h.H(h.Ctx, w, r)\n\tif err != nil {\n\t\tswitch e := err.(type) {\n\t\tcase Error:\n\t\t\t// We can retrieve the status here and write out a specific\n\t\t\t// HTTP status code.\n\t\t\th.Ctx.Log.Error(\"HTTP %d - %s\", e.Status(), e)\n\t\t\thttp.Error(w, e.Error(), e.Status())\n\t\tdefault:\n\t\t\t// Any error types we don't specifically look out for default\n\t\t\t// to serving a HTTP 500\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError),\n\t\t\t\thttp.StatusInternalServerError)\n\t\t}\n\t}\n}", "func (c *Context) Status(code int) {\n\tc.Response.WriteHeader(code)\n}", "func Err(w http.ResponseWriter, statusCode int, err error) {\n\tpresentation.JSON(w, statusCode, struct {\n\t\tErr string `json:\"erro\"`\n\t}{\n\t\tErr: err.Error(),\n\t})\n}", "func responseHandler(f func(w http.ResponseWriter, r *http.Request) (interface{}, error)) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tres, err := f(w, r)\n\n\t\tif err != nil {\n\t\t\tvar sc = 500\n\t\t\tvar message = err.Error()\n\t\t\tvar logError = err\n\n\t\t\tif restErr, ok := err.(RestError); ok {\n\t\t\t\tsc = restErr.Status()\n\t\t\t\tif restErr.Nested() != nil {\n\t\t\t\t\tlogError = restErr.Nested()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlog.Println(logError)\n\t\t\tsendError(w, sc, message)\n\t\t} else {\n\t\t\tsendSuccess(w, res)\n\t\t}\n\t}\n}", "func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif err := h(w, r); err != nil {\n\t\tvar data interface{}\n\t\tvar status int\n\t\tswitch err := err.(type) {\n\t\tcase *errors.Error:\n\t\t\tstatus = int(err.Kind())\n\t\t\tdata = err.Context()\n\t\tdefault:\n\t\t\tstatus = http.StatusInternalServerError\n\t\t\tdata = \"Oops! Something went wrong\"\n\t\t}\n\t\tzap.L().Error(\"error occurred while handle request\", zap.String(\"error\", err.Error()))\n\t\tif err := WriteErrorResponse(w, status, data); err != nil {\n\t\t\tlogrus.Errorf(\"unable to write the json response: %v\", err)\n\t\t}\n\t}\n}", "func (h *handler) writeStatus(status int, message string) {\n\tif status < 300 {\n\t\th.response.WriteHeader(status)\n\t\th.setStatus(status, message)\n\t\treturn\n\t}\n\t// Got an error:\n\tvar errorStr string\n\tswitch status {\n\tcase http.StatusNotFound:\n\t\terrorStr = \"not_found\"\n\tcase http.StatusConflict:\n\t\terrorStr = \"conflict\"\n\tdefault:\n\t\terrorStr = http.StatusText(status)\n\t\tif errorStr == \"\" {\n\t\t\terrorStr = fmt.Sprintf(\"%d\", status)\n\t\t}\n\t}\n\n//\th.disableResponseCompression()\n\th.setHeader(\"Content-Type\", \"application/json\")\n\th.response.WriteHeader(status)\n\th.setStatus(status, message)\n\tjsonOut, _ := json.Marshal(db.Body{\"error\": errorStr, \"reason\": message})\n\th.response.Write(jsonOut)\n}", "func (o *QueryGroupMembersInternalServerError) Code() int {\n\treturn 500\n}", "func (o *ObjectsGetInternalServerError) Code() int {\n\treturn 500\n}", "func output500Error(r render.Render, err error) {\n\tfmt.Println(err)\n\tr.JSON(500, map[string]interface{}{\"error\": err.Error()})\n}", "func (c *Operation) writeErrorResponse(rw http.ResponseWriter, status int, msg string) {\n\tlogger.Errorf(msg)\n\n\trw.WriteHeader(status)\n\n\tif _, err := rw.Write([]byte(msg)); err != nil {\n\t\tlogger.Errorf(\"Unable to send error message, %s\", err)\n\t}\n}", "func (o *ListAvailableStreamsOAuth2InternalServerError) Code() int {\n\treturn 500\n}", "func writeError(w http.ResponseWriter, err error, code int) error {\n\ttags := []string{\n\t\t\"error_\" + strings.ToLower(\n\t\t\tstrings.ReplaceAll(http.StatusText(code), \" \", \"_\"),\n\t\t),\n\t}\n\n\tdata, err := jsoniter.ConfigFastest.Marshal(map[string]interface{}{\n\t\t\"success\": false,\n\t\t\"code\": code,\n\t\t\"message\": err.Error(),\n\t\t\"tags\": tags,\n\t})\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\n\t_, err = w.Write(data)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"writeError:%w\", err)\n\t}\n\n\treturn err\n}", "func responderRedireccionError(w http.ResponseWriter, r *http.Request, code int, message string) {\n\thttp.Redirect(w, r, configuracion.UrlMono() + configuracion.PathError() + message, http.StatusSeeOther)\n}", "func responseWithError(w http.ResponseWriter, code int, err error) {\n\tresponseWithJSON(w, code, map[string]string{\"error\": err.Error()})\n}", "func Handle(w http.ResponseWriter, mutator func() error) {\n\terr := mutator()\n\tif err == nil {\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\tswitch err := err.(type) {\n\tcase errs.BadRequestError:\n\t\thttperr.ClientError(w, err.Error())\n\tcase errs.UnauthorizedError:\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(err.Error()))\n\tdefault:\n\t\thttperr.ServerError(w, err.Error())\n\t}\n}", "func (app *application) errorResponse(w http.ResponseWriter, r *http.Request, status int, message interface{}) {\n\tresp := clientResponse{\"error\": message}\n\t// Write the response using the helper method.\n\terr := app.writeJSON(w, status, resp)\n\tif err != nil {\n\t\tapp.logError(r, err)\n\t\tw.WriteHeader(500)\n\t}\n}", "func (o *QueryApplicationsInternalServerError) Code() int {\n\treturn 500\n}", "func (o *CreateMoveTaskOrderInternalServerError) Code() int {\n\treturn 500\n}", "func HTTPStatus(code string) int {\n\tif status, ok := errorCodeMap[code]; ok {\n\t\treturn status\n\t}\n\treturn errorCodeMap[UnexpectedError]\n}", "func (m *ErrorMiddleware) Handler() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// before request\n\t\tc.Next()\n\n\t\t// Skip if no errors\n\t\tif c.Errors.Last() == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Get last error, clear all errors\n\t\terr := c.Errors.Last().Err\n\t\tc.Errors = c.Errors[:0]\n\n\t\t// Form the output dict\n\t\t// Only takes stuff that has string as a key.\n\t\tout := ApiError{Message: err.Error(), Details: map[string]interface{}{}}\n\t\tfor key, val := range merry.Values(err) {\n\t\t\tif key == \"message\" || key == \"http status code\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif key, ok := key.(string); ok {\n\t\t\t\tout.Details[key] = val\n\t\t\t}\n\t\t}\n\n\t\t// Add the error's stack if Debug is enabled\n\t\tif m.Debug {\n\t\t\tout.Details[`stack`] = merry.Stacktrace(err)\n\t\t}\n\n\t\terrCode := merry.HTTPCode(err)\n\t\t// Log the error\n\t\tif m.LogFunc != nil {\n\t\t\tm.LogFunc(err.Error(),errCode,out.Details)\n\t\t}\n\n\t\t// Hide error 500\n\t\tif merry.HTTPCode(err) == 500 {\n\t\t\tout.Message = m.GenericError\n\t\t\tout.Details = nil\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(merry.HTTPCode(err), out)\n\t}\n}", "func failWithRcode(w dns.ResponseWriter, r *dns.Msg, rCode int) {\n m := new(dns.Msg)\n m.SetRcode(r, rCode)\n w.WriteMsg(m)\n m = nil\n}", "func (ths *ReceiveBackEnd) handleError(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close();\n\tths.log.Println(\"Error request arrived...\");\n\thttp.Error(w, \"No such service\", http.StatusBadGateway);\n}", "func (o *UpdateMTOServiceItemStatusInternalServerError) Code() int {\n\treturn 500\n}", "func (o *UpdateFirewallPoliciesInternalServerError) Code() int {\n\treturn 500\n}", "func writeErrorResponse(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusInternalServerError)\n\ter := errorResponse{Message: \"unable to process request\"}\n\tbs, err := json.Marshal(er)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tif _, err := w.Write(bs); err != nil {\n\t\tlog.Error(err)\n\t}\n}", "func (r *Responder) BadRequest() { r.write(http.StatusBadRequest) }", "func serverError(w http.ResponseWriter, err error) {\n\tlog.Printf(\"error: %s\\n\", err)\n\thttp.Error(w, fmt.Sprintf(\"%s\", err), http.StatusInternalServerError)\n}", "func (hw HandlerWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\t//execute the wrapped handler\n\terr := hw.Handler(w, r, vars)\n\n\tif err != nil {\n\t\tvar statusCode int\n\t\tvar errorResponse string\n\n\t\tswitch e := err.(type) {\n\t\tcase *common.HttpError:\n\t\t\tstatusCode = e.StatusCode\n\t\t\terrorResponse = e.Error()\n\t\tdefault:\n\t\t\t// Any error types we don't specifically look out for default\n\t\t\t// to serving a HTTP 500 - Internal Server Error\n\t\t\tfallbackError := &common.HttpError{\n\t\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\t\tStatusText: http.StatusText(http.StatusInternalServerError),\n\t\t\t}\n\t\t\tstatusCode = fallbackError.StatusCode\n\t\t\terrorResponse = fallbackError.Error()\n\t\t}\n\n\t\tw.WriteHeader(statusCode)\n\t\tw.Write([]byte(errorResponse))\n\t}\n}", "func (o *PostMalQueryHuntV1InternalServerError) Code() int {\n\treturn 500\n}", "func (o *CreateActionsV1InternalServerError) Code() int {\n\treturn 500\n}", "func code(err error) int {\n\tswitch errors.Unwrap(err) {\n\tcase custom.ErrBadRequest:\n\t\treturn 400\n\tcase custom.ErrUnauthorized:\n\t\treturn 401\n\tcase custom.ErrNotFound:\n\t\treturn 404\n\tcase custom.ErrConflict:\n\t\treturn 409\n\tcase custom.ErrInternalServer:\n\t}\n\n\treturn 500\n}", "func (o *SchemaObjectsShardsGetInternalServerError) Code() int {\n\treturn 500\n}", "func httpHandler(w http.ResponseWriter, r *http.Request) {\n\tb, err := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\treq := json.GetRPCRequestFromJSON(string(b))\n\trespBody, statusCode := handler(req)\n\tw.WriteHeader(statusCode)\n\tw.Write([]byte(respBody))\n}", "func getCode(err error) int {\n\terr = errors.Cause(err)\n\n\tif err == nil {\n\t\treturn 200\n\t}\n\n\tvar code = 500\n\n\tif c, ok := err.(coded); ok {\n\t\tcode = c.Code()\n\t}\n\n\treturn code\n}", "func errorResponse(r *http.Request, w http.ResponseWriter, code int, err error) {\n\tresp := map[string]interface{}{\n\t\t\"error\": err.Error(),\n\t}\n\n\twriteResponse(r, w, code, resp)\n}", "func writeApiReqErr(w http.ResponseWriter, status int, message string) {\n\tw.Header().Set(\"Content-Type\", util.ContentTypeTextPlainUTF8)\n\tif status > 0 && status != 200 {\n\t\tw.WriteHeader(status)\n\t} else {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\tw.Write([]byte(message))\n}" ]
[ "0.68709457", "0.6737671", "0.6507406", "0.6210767", "0.61020494", "0.5998608", "0.59950167", "0.5966289", "0.5951723", "0.59284073", "0.57699734", "0.57692206", "0.5748869", "0.57404643", "0.57381713", "0.56994647", "0.5682142", "0.56637657", "0.5644247", "0.5632672", "0.5630545", "0.5599994", "0.55887085", "0.5570931", "0.55659044", "0.5548483", "0.55442804", "0.55186373", "0.5516152", "0.55155295", "0.55117273", "0.5511092", "0.5506531", "0.54985905", "0.548972", "0.5484225", "0.54766583", "0.546819", "0.54394376", "0.5436598", "0.5435205", "0.54132867", "0.5403758", "0.53940564", "0.5391361", "0.5389184", "0.5388165", "0.53847337", "0.5364189", "0.5326096", "0.53104925", "0.5303985", "0.52943337", "0.5277425", "0.5264659", "0.5256551", "0.525111", "0.5250986", "0.5246566", "0.5235771", "0.5230519", "0.5229203", "0.5226437", "0.52120954", "0.52074206", "0.5199949", "0.519791", "0.51936764", "0.51909524", "0.51861435", "0.5177904", "0.51763403", "0.5162045", "0.5156574", "0.51552916", "0.51487255", "0.5145962", "0.5141055", "0.5132802", "0.5126212", "0.5125391", "0.51234084", "0.5110277", "0.51057994", "0.50990975", "0.50966525", "0.5094274", "0.50910014", "0.5086599", "0.50864553", "0.50813603", "0.5078258", "0.50773555", "0.5075387", "0.50602025", "0.50547576", "0.50510454", "0.50469065", "0.5039303", "0.5035033" ]
0.7576035
0
NotFound emits the registed NotFound (404) custom (or not) handler
func (he *HTTPErrors) NotFound(ctx *Context) { he.Emit(http.StatusNotFound, ctx) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func NotFound(fn http.HandlerFunc) {\n\tinfoMutex.Lock()\n\tvestigo.CustomNotFoundHandlerFunc(fn)\n\tinfoMutex.Unlock()\n}", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func (e *Engine) NotFound(handler Handler) {\n\te.notFoundHandler = handler\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func (web *WebServer) NotFound(handler http.HandlerFunc) {\n\tweb.router.NotFound(handler)\n}", "func (hr *httpRouter) NotFound(h http.Handler) {\n\thr.notFound = h\n}", "func notfound(out http.ResponseWriter, format string, args ...interface{}) {\n\tsend(http.StatusNotFound, out, format, args...)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (mx *Mux) NotFound(handlerFn http.HandlerFunc) {\n\t// Build NotFound handler chain\n\tmx.notFoundHandler = handlerFn\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func notFoundHandler(res http.ResponseWriter, req *http.Request) {\n\tdefer server.LogRequest(req, http.StatusNotFound)\n\n\tres.WriteHeader(http.StatusNotFound)\n\trenderBaseTemplate(res, \"404.html\", nil)\n}", "func NotFoundHandler() Handler {\n\treturn HandlerFunc(NotFound)\n}", "func (serv *Server) NotFound(handlers ...Handler) {\n\tAssert(len(handlers) > 0, \"there must be at least one handler\")\n\tAssert(len(serv.middleware)+len(handlers) < int(abortIndex), \"too many handlers\")\n\tserv.notFound = handlers\n}", "func (mx *Mux) NotFound(handler interface{}) {\n\t// Build NotFound handler chain\n\tm := mx\n\thh := HttpHandler(handler)\n\tif mx.inline && mx.parent != nil {\n\t\tm = mx.parent\n\t\thh = mx.chainHandler(hh)\n\t}\n\n\t// Update the notFoundHandler from this point forward\n\tm.notFoundHandler.Add(hh)\n\tm.updateSubRoutes(func(subMux *Mux) {\n\t\tif subMux.notFoundHandler == nil {\n\t\t\tsubMux.NotFound(hh)\n\t\t}\n\t})\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func (r *Router) notFound(w http.ResponseWriter, req *http.Request) {\n\tif r.root().notFoundHandler != nil {\n\t\tr.root().notFoundHandler.ServeHTTP(w, req)\n\t} else {\n\t\thttp.NotFound(w, req)\n\t}\n}", "func NotFound(rw http.ResponseWriter) {\n\tHttpError(rw, \"not found\", 404)\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func (r *Router) notFoundHandler(w http.ResponseWriter, req *http.Request) {\n\tWriteError(w, 404, \"404 Not Found\")\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func (r *Router) NotFound(i interface{}) {\n\thandler := r.buildHandler(i)\n\tr.dispatcher.NotFoundHandler(r.route, handler)\n}", "func (r *Router) noFound(w http.ResponseWriter, req *http.Request) {\n\t// HandlerFunc 404\n\tif r.NotFound != nil {\n\t\tr.NotFound.ServeHTTP(w, req)\n\t} else {\n\t\thttp.NotFound(w, req)\n\t}\n}", "func NotFound(e Event) {\n\t// log.Printf(\"[WARN] serfer: Not found event handler for event %s\", e.String())\n}", "func (r *Macross) NotFound(handlers ...Handler) {\n\tr.notFound = handlers\n\tr.notFoundHandlers = combineHandlers(r.handlers, r.notFound)\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"Not Found: %s\", r.URL.String())\n\tservice.WriteProblem(w, \"No route found\", \"ERROR_NOT_FOUND\", http.StatusNotFound, errors.New(\"Route not found\"))\n}", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func (r *Router) NotFound(notFoundHandler func(*Context)) {\n\tr.initRouter()\n\tr.router.NotFound = notFoundHandler\n}", "func NotFoundEventHandler() EventHandler {\n\treturn EventHandlerFunc(NotFound)\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func (router *Router) NotFound(handler http.Handler) *Router {\n\trouter.Mux.NotFound = handler\n\treturn router\n}", "func ServeNotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n}", "func (r *Route) NotFound(handler http.Handler) *Route {\n\tr.handlers[notFound] = handler\n\treturn r\n}", "func notFound(w http.ResponseWriter, req *http.Request) {\n\t// w.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tapiError := apirouter.ErrorFromRequest(req, fmt.Sprintf(\"404 occurred: %s\", req.RequestURI), \"Whoops - this request is not recognized\", http.StatusNotFound, http.StatusNotFound, \"\")\n\tapirouter.ReturnResponse(w, req, apiError.Code, apiError)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func (r *Response) NotFound(v interface{}) {\n\tr.writeResponse(http.StatusNotFound, v)\n}", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func NotFoundRoute(res http.ResponseWriter, req *http.Request) {\n res.Write([]byte(\"Oopsie woopsie this doesn't exist.\"))\n}", "func (response BasicJSONResponse) NotFound(writer http.ResponseWriter) {\n\tNotFound(writer, response)\n}", "func notFound(resource string) middleware.Responder {\n\tmessage := fmt.Sprintf(\"404 %s not found\", resource)\n\treturn operations.NewGetChartDefault(http.StatusNotFound).WithPayload(\n\t\t&models.Error{Code: helpers.Int64ToPtr(http.StatusNotFound), Message: &message},\n\t)\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func HandleNotFound(lgc *logic.Logic) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": r.URL.Path, \"method\": r.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\tw.WriteHeader(404)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write([]byte(fmt.Sprintf(\n\t\t\t`{\"message\":\"Page Not Found %s %s\"}`, r.Method, r.URL.Path)))\n\t}\n}", "func SimpleNotFoundHandler(c *Context) error {\n\thttp.NotFound(c.W, c.R)\n\treturn nil\n}", "func notFound(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\thttp.NotFound(w, req)\n}", "func notFound(rw http.ResponseWriter, r *http.Request) {\n\n}", "func (ctx *PlayLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (r Response) NotFound(code string, payload Payload, header ...ResponseHeader) {\n\tr.Response(code, http.NotFound, payload, header...)\n}", "func (h *HandleHelper) NotFound() {\n\terrResponse(http.StatusNotFound,\n\t\t\"the requested resource could not be found\",\n\t)(h.w, h.r)\n}", "func (c *Context) NotFound() {\n\tc.Handle(http.StatusNotFound, \"\", nil)\n}", "func (c *Context) NotFound() {\n\tc.JSON(404, ResponseWriter(404, \"page not found\", nil))\n}", "func NotFoundHandler() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tSendJSONNotFound(w)\n\t}\n}", "func (ctx *GetFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func notFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\n\twritten, err := json.Marshal(struct{ Message string }{Message: \"Bulamadık :(\"})\n\tif err != nil {\n\t\tbadImplementationHandler(w, r, err)\n\t}\n\t_, err = w.Write(written)\n\tif err != nil {\n\n\t\tbadImplementationHandler(w, r, err)\n\t}\n}", "func NotFound(w http.ResponseWriter, _ error) {\n\t(Response{Error: \"resource not found\"}).json(w, http.StatusNotFound)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\treturn\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\t// Set 404 status code\n\tw.WriteHeader(http.StatusNotFound)\n\tresp := app.HTMLResponse(w, r)\n\tmsg := strf.Format(resp.LocalizedDictionary().PPageNotFound, r.URL.String())\n\n\tif app.Config.HTTP.Log404Error {\n\t\tapp.Logger.NotFound(\"http\", r.URL.String())\n\t}\n\n\t// Note that pass `true` as the `expected` param so that template manager won't treat it as a 500 error.\n\tapp.MainPageManager.MustError(r, resp.Lang(), errors.New(msg), true, w)\n}", "func (nse ErrNoSuchEndpoint) NotFound() {}", "func HandleNotFound(lgc *logic.Logic) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\treq := c.Request()\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": req.URL.Path, \"method\": req.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\treturn c.JSON(404, map[string]string{\n\t\t\t\"message\": fmt.Sprintf(\"Page Not Found %s %s\", req.Method, req.URL.Path),\n\t\t})\n\t}\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func (ctx *ShowVerificationContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (r *bitroute) SetupNotFoundHandler(f func(router.Control)) {\n\tr.notFound = f\n}", "func (ctx *GetByIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler(w http.ResponseWriter, req *http.Request) {\n\tnotFoundTemplate, _ := template.ParseFiles(\"static/404.html\")\n\tnotFoundTemplate.Execute(w, nil)\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(context *gin.Context) {\n\tcontext.JSON(404, gin.H{\n\t\t\"error\": \"404 not found\",\n\t\t\"url\": context.Request.URL,\n\t})\n}", "func (nfh NotFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tlogger.For(pkg, \"NotFoundHandler\").WithField(\"url\", r.URL).Infof(\"not found\")\n\tresponse.ErrorString(\"404: not found\", w, http.StatusNotFound)\n}", "func (mx *Mux) NotFoundHandler() http.HandlerFunc {\n\tif mx.notFoundHandler != nil {\n\t\treturn mx.notFoundHandler\n\t}\n\treturn http.NotFound\n}", "func SendNotFound(c *gin.Context) {\n\tSendHTML(http.StatusNotFound, c, \"notfound\", nil)\n}", "func (resp *Response) NotFound(w http.ResponseWriter, queryParam string) {\n\tresp.Error = \"The user with id \" + queryParam + \" was not found\"\n\twrite(resp, w)\n}", "func NotFoundHandler(*Context) error {\n\treturn NewHTTPError(StatusNotFound)\n}", "func notFound(c router.Control) {\n\tc.Code(http.StatusNotFound)\n\tc.Body(\"Method not found for \" + c.Request().URL.Path)\n}", "func (b *Baa) NotFound(c *Context) {\n\tif b.notFoundHandler != nil {\n\t\tb.notFoundHandler(c)\n\t\treturn\n\t}\n\thttp.NotFound(c.Resp, c.Req)\n}", "func makeNotFoundHandler(handlerName string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\t_, _ = w.Write([]byte(fmt.Sprintf(\"%s is only available in enterprise\", handlerName)))\n\t})\n}", "func makeNotFoundHandler(handlerName string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\t_, _ = w.Write([]byte(fmt.Sprintf(\"%s is only available in enterprise\", handlerName)))\n\t})\n}", "func (ctx *GetLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (h *TaskHandler) notFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tpe := &errors2.Error{\n\t\tCode: errors2.ENotFound,\n\t\tMsg: \"url not found\",\n\t\tErr: fmt.Errorf(\"%s: not found\", r.URL.String()),\n\t}\n\th.HandleHTTPError(ctx, pe, w)\n}", "func SendNotFound(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeNotFound,\n\t\tMessage: \"Not found\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 404, &res)\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, message string) {\n\tfhirError(ctx, w, http.StatusNotFound, fhir.IssueSeverityWarning, fhir.IssueTypeNotFound, message)\n}", "func (ctx *GetAllHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func RenderNotFound(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, NotFound(message...))\n}", "func (uee *UnknownEndpointError) NotFound() {}", "func (ctx *AcceptOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tglog.V(0).Infof(\"unsupported %s %s\", r.Method, r.RequestURI)\n\tWriteErrorResponse(w, r, ErrMethodNotAllowed)\n}", "func RenderNotFound(w http.ResponseWriter) error {\n\tw.Header().Add(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\treturn template.ExecuteTemplate(w, \"404.amber\", nil)\n}", "func (ctx *GetOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"404 Not Found\")\n\t}\n\treturn Response{Status: http.StatusNotFound, Data: data, Logging: logging}\n}", "func (m *Mux) NotFoundFunc(handler http.HandlerFunc) {\n\tm.notFound = handler\n}", "func (h *Handler) UnknownHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n}" ]
[ "0.8156144", "0.8156144", "0.79097706", "0.7807912", "0.7795653", "0.77866733", "0.77447337", "0.7718901", "0.76650614", "0.7628474", "0.7616685", "0.75394857", "0.7510822", "0.74669296", "0.7466345", "0.7445879", "0.743468", "0.74214935", "0.7419369", "0.74159735", "0.7411142", "0.74085605", "0.7403856", "0.73827976", "0.7377878", "0.7360661", "0.7360041", "0.7341451", "0.7337594", "0.73252237", "0.7322292", "0.7317959", "0.7315818", "0.73036295", "0.72937393", "0.7285832", "0.7277451", "0.7267768", "0.7250024", "0.72380173", "0.7216246", "0.71943814", "0.7180046", "0.71757233", "0.7158788", "0.7156557", "0.7143466", "0.7143066", "0.7143066", "0.7135144", "0.7127914", "0.7103985", "0.707867", "0.70679235", "0.7063537", "0.7057031", "0.7032139", "0.70160663", "0.7014103", "0.6997372", "0.69873726", "0.698079", "0.69703555", "0.69634855", "0.694916", "0.6933676", "0.6927766", "0.6927766", "0.69014", "0.6895852", "0.6885372", "0.6884592", "0.6882372", "0.6854955", "0.6854903", "0.68377954", "0.6828834", "0.68212444", "0.6820712", "0.6812171", "0.6810029", "0.6804421", "0.6804421", "0.67991126", "0.6792334", "0.6780702", "0.67757297", "0.67712843", "0.67600274", "0.6750279", "0.6736694", "0.673329", "0.6732244", "0.67297614", "0.67280024", "0.67252254", "0.67219234", "0.67028636", "0.67018723", "0.6693672" ]
0.76252955
10
House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of nonnegative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police.
func rob(nums []int) int { t1, t2 := 0, 0 for i := range nums { t2, t1 = max(t2, t1+nums[i]), t2 } return t2 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func rob(nums []int) int {\n\t// let sum[i] be the max amount to rob for house[0...i],\n\t// then sum[i] = max( sum[i-1], sum[i-2]+nums[i] )\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\tsum := make([]int, len(nums)+1)\n\tsum[0] = 0\n\tsum[1] = nums[0]\n\tfor i := 2; i <= len(nums); i++ {\n\t\tsum[i] = max(sum[i-1], sum[i-2]+nums[i-1])\n\t}\n\treturn sum[len(nums)]\n}", "func HouseRobber(nums []int) int {\n\tif len(nums) == 1 {\n\t\treturn nums[0]\n\t}\n\n\ttwo_before, one_before := nums[0], max([]int{nums[0], nums[1]})\n\tfor i := 2; i < len(nums); i++ {\n\t\ttemp := max([]int{nums[i] + two_before, one_before})\n\t\ttwo_before = one_before\n\t\tone_before = temp\n\t}\n\treturn one_before\n}", "func rob(nums []int) int {\n\tn := len(nums)\n\tif n < 1 {\n\t\treturn 0\n\t} else if n == 1 {\n\t\treturn nums[0]\n\t}\n\tprofit := max(robRooms(nums, 0, n-1),\n\t\trobRooms(nums, 1, n))\n\t//profit = max(profit, robRooms(nums, 1, n-1))\n\treturn profit\n}", "func maximumWealth(accounts [][]int) int {\n\tmax := 0\n\tfor _, account := range accounts {\n\t\ttotal := 0\n\t\tfor _, bank := range account {\n\t\t\ttotal = total + bank\n\t\t\tif max < total {\n\t\t\t\tmax = total\n\t\t\t}\n\t\t}\n\t}\n\n\treturn max\n}", "func HouseRobberCircular(nums []int) int {\n\treturn max([]int{HouseRobber(nums[1:]), HouseRobber(nums[:len(nums)-1])})\n}", "func maximumWealth(accounts [][]int) int {\n var row = len(accounts)\n var col = len(accounts[0])\n \n var result = 0\n \n for r := 0; r < row; r++ {\n var sum = 0\n for c := 0; c < col; c++ {\n sum += accounts[r][c]\n }\n \n if sum > result {\n result = sum\n }\n }\n \n return result;\n}", "func rob(nums []int) int {\n\tl := len(nums)\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tdp := make([]int, l+1)\n\tdp[0] = 0\n\tdp[1] = nums[0]\n\tfor i := 1; i < l; i++ {\n\t\tdp[i+1] = utils.Max(dp[i], dp[i-1]+nums[i])\n\t}\n\treturn dp[l]\n}", "func bigBro(games []game) bool {\n\tvar totalAssist int\n\tfor _, game := range games {\n\t\ttotalAssist += game.Statistics.Assist\n\t}\n\tif totalAssist >= 5000 {\n\t\treturn true\n\t}\n\treturn false\n\n}", "func rob(nums []int) int {\n\t// 抢了第i个房间就不能抢第i-1个,因此,dp[i] = max(dp[i-2]+nums[i], dp[i-1])\n\tpre2, pre1 := 0, 0\n\tfor i := 0; i < len(nums); i++ {\n\t\tcur := max(pre2+nums[i], pre1)\n\t\tpre2 = pre1\n\t\tpre1 = cur\n\t}\n\treturn pre1\n}", "func maxProfit(prices []int) int {\n\tn := len(prices)\n\tif n < 2 {\n\t\treturn 0\n\t}\n\t// [empty]->(buy)->[full]->(sell)->[frozen]->(T+1)->[empty]\n\t// empty and full can be kept, but frozen not\n\tmaxEmpty := 0\n\tmaxFull := -prices[0]\n\tfrozen := 0\n\tfor i := 1; i < n; i++ {\n\t\tbuyToday := maxEmpty - prices[i]\n\t\tunfreezeToday := frozen\n\t\tfrozen = maxFull + prices[i] // sell today, unfreeze to empty next day\n\n\t\tif maxFull < buyToday {\n\t\t\tmaxFull = buyToday // buy cheaper\n\t\t}\n\t\tif maxEmpty < unfreezeToday {\n\t\t\tmaxEmpty = unfreezeToday\n\t\t}\n\t}\n\tif frozen > maxEmpty {\n\t\treturn frozen\n\t}\n\treturn maxEmpty\n}", "func lastPersonDistances(numStalls, numPeople uint64) (min uint64, max uint64) {\n\tb := newBathroom(numStalls)\n\n\tvar placed uint64\n\tfor numPeople > placed {\n\t\tvar count uint64\n\t\tmin, max, count = b.addPeople()\n\t\tplaced += count\n\t}\n\n\treturn min, max\n}", "func maximumWealth(accounts [][]int) int {\n\tsums := make([]int, len(accounts))\n\n\tmax := 0\n\tfor i := 0; i < len(accounts); i++ {\n\t\tfor j := 0; j < len(accounts[i]); j++ {\n\t\t\tsums[i] += accounts[i][j]\n\t\t}\n\t\tif sums[i] > max {\n\t\t\tmax = sums[i]\n\t\t}\n\t}\n\treturn max\n}", "func maxProfitWithFee(prices []int, fee int) int {\n\tsold, hold := 0, math.MinInt32\n\n\tfor _, price := range prices {\n\t\tsold = common.MaxInt(sold, hold+price-fee)\n\t\thold = common.MaxInt(sold-price, hold)\n\t\tfmt.Println(hold, sold)\n\t}\n\n\treturn sold\n}", "func maximumPeople(p []int64, x []int64, y []int64, r []int64) int64 {\n\tfree := int64(0)\n\tevents := generateCache(p, x, y, r)\n\n\tsum := make(map[int64]int64, 0)\n\tclouds := make(map[int64]bool, 0)\n\n\tfor _, e := range events {\n\t\tif e.t == 0 {\n\t\t\tclouds[e.idx] = true\n\t\t} else if e.t == 1 {\n\t\t\tif len(clouds) == 0 {\n\t\t\t\tfree += e.p\n\t\t\t} else {\n\t\t\t\tif len(clouds) == 1 {\n\t\t\t\t\tfor k := range clouds {\n\t\t\t\t\t\tsum[k] = sum[k] + e.p\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tdelete(clouds, e.idx)\n\t\t}\n\t}\n\n\treturn free + findMax(sum)\n}", "func minimumBribes(q []int32) {\n\tvar bribes = 0\n\n\t// Iterate from the last element\n\tfor i := int32(len(q) - 1); i >= 0; i-- {\n\n\t\t// Since the original array was a sorted number array of 1 to n with interval of 1,\n\t\t// For example:\n\t\t// In Test Case of {2, 5, 1, 3, 4}\n\t\t// The element 5 (with original position of 5, index of 4) can only be placed up to position 3, index of 2\n\t\t// On this case, element 5 is placed on index 1 or position 2, so we need to find whether the position is valid or not\n\t\t// KEY: The difference must not be greater than 2\n\t\t// So, we substract the current position (which is array index + 1) from the current value, which is 5\n\t\t// and the difference = 5 - (1 + 1) = 5 - 2 = 3, indicated that there was an invalid move\n\t\tif q[i]-int32(i+1) > 2 {\n\t\t\tfmt.Println(\"Too chaotic\")\n\t\t\treturn\n\t\t}\n\n\t\t// Here, we need to find out how many briberies were happened, knowing that the bribery limit is 2.\n\t\t// So, we need to ensure that the two queue number in front of the current number is always lower than the current number.\n\t\t// For example:\n\t\t//\n\t\t// Under the Test Case of {2, 1, 5, 3, 4}\n\t\t// Let's say we are checking the first element from the back, which is 4.\n\t\t// We expect that the two people in front of number 4 has lower number\n\t\tvar max int32\n\t\t// i: 4 -> Is 0 >= 4 - 2? false, then max = 2\n\t\t// i: 3 -> Is 0 >= 3 - 2? false, then max = 1\n\t\t// i: 2 -> Is 0 >= 5 - 2? false, then max = 3\n\t\t// i: 1 -> Is 0 >= 1 - 2? true, then max = 0\n\t\t// i: 0 -> Is 0 >= 0 - 2? true, then max = 0\n\n\t\t// To prevent looping from negative index\n\t\tif 0 >= q[i]-2 {\n\t\t\tmax = 0\n\t\t} else {\n\t\t\tmax = q[i] - 2\n\t\t}\n\n\t\t// Loop through the ranged specification\n\t\t// The first element from the back is 4, and the two in front of it is 2.\n\t\t// We start from the 2nd index element.\n\t\t// The element at 2nd index is 5, and 5 is greater than the element at 4th index which is 4.\n\t\t// This indicated that number 5 had bribed number 4.\n\t\t// On the next step, the 3rd index contains number 3, and 3 is lower than 4. That means no bribery happened.\n\t\t//\n\t\t// Then we check the second element from the back, which is 3.\n\t\t// The second element from the back is placed at 3rd index position, so we loop through 1st index position.\n\t\t// The element at 1st index is 1, and 1 is not greater than 3. No bribery happened.\n\t\t// Then we check the element at 2nd index, which is 5. 5 is greater than 3, that means 5 had bribed 3.\n\t\tfor j := max; j < i; j++ {\n\t\t\t// max: 2; i: 4\n\t\t\t// 5 > 4? true, bribes++\n\t\t\t// 3 > 4? false\n\t\t\t//\n\t\t\t// max: 1; i: 3\n\t\t\t// 1 > 3? false\n\t\t\t// 5 > 3? true, bribes++\n\t\t\t//\n\t\t\t// max: 3; i: 2\n\t\t\t// no checking\n\t\t\t//\n\t\t\t// max: 0; i: 1\n\t\t\t// 2 > 1? true, bribes++\n\t\t\t//\n\t\t\t// max: 0; i: 0\n\t\t\t// no checking\n\n\t\t\tif q[j] > q[i] {\n\t\t\t\tbribes++\n\t\t\t}\n\t\t}\n\t}\n\t// Expected result: 3\n\tfmt.Println(bribes)\n}", "func maxProfitWithFeeC(prices []int, fee int) int {\n\tsold, hold := 0, -prices[0]\n\n\tfor i := 1; i < len(prices); i++ {\n\t\t// tmp := hold\n\t\tsold = common.MaxInt(sold, hold+prices[i]-fee)\n\t\thold = common.MaxInt(sold-prices[i], hold)\n\t\tfmt.Println(hold, sold)\n\t}\n\n\treturn sold\n}", "func calculateMaxFuelFromOneBillionOre(numNeeded int, letter string, total *int) {\n\tvar output = 0\n\n\t_, isOreFormula := oreFormulas[letter]\n\tif isOreFormula {\n\t\tvar f = oreFormulas[letter]\n\t\toutput = f.numberOfOutput\n\n\t} else {\n\t\tvar f = normalFormulas[letter]\n\t\toutput = f.numberOfOutput\n\t}\n\n\tvar iterations = 0\n\n\t_, wasteExists := wasted[letter]\n\tif wasteExists {\n\t\tif wasted[letter] <= numNeeded {\n\t\t\tnumNeeded -= wasted[letter]\n\t\t\twasted[letter] = 0\n\t\t} else {\n\t\t\twasted[letter] -= numNeeded\n\t\t\tnumNeeded = 0\n\t\t}\n\t} else {\n\t\twasted[letter] = 0\n\t}\n\n\tif numNeeded == 0 {\n\t\treturn\n\t}\n\n\tif numNeeded <= output {\n\t\titerations = 1\n\t} else {\n\t\titerations = int(math.Ceil(float64(numNeeded) / float64(output)))\n\t}\n\n\t// check if waste generated\n\texcess := (iterations * output) - numNeeded\n\twasted[letter] += excess\n\n\tif isOreFormula {\n\n\t\tvar needed = numNeeded\n\t\tvar current = 0\n\t\tvar r = oreFormulas[letter]\n\n\t\tvar ore = 0\n\n\t\tfor current < needed {\n\t\t\tcurrent += r.numberOfOutput\n\n\t\t\ttempOre += r.numberOfOre\n\t\t\tif tempOre < 1000000000000 {\n\t\t\t\tore += r.numberOfOre\n\t\t\t} else {\n\t\t\t\tlimitReached = true\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t*total += ore\n\t} else {\n\t\tvar f = normalFormulas[letter]\n\n\t\tfor _, ingredient := range f.ingredients {\n\t\t\tcalculateMaxFuelFromOneBillionOre(ingredient.number*iterations, ingredient.letter, total)\n\t\t}\n\t}\n}", "func maximumToys(prices []int32, k int32) int32 {\n\tvar spendCounter int32\n\n\tsort.Slice(prices, func(i, j int) bool {\n\t\treturn prices[i] < prices[j]\n\t})\n\n\tfmt.Println(prices)\n\tfor j := 0; j < len(prices); j++ {\n\t\tif k-prices[j] > 0 {\n\t\t\tk -= prices[j]\n\t\t\tspendCounter++\n\t\t}\n\t}\n\n\treturn spendCounter\n}", "func MaxHailstoneValue(n int) int {\n var max int = n\n for n > 1 {\n var temp int = h(n)\n if temp > max {\n max = temp\n }\n n = temp\n }\n return max\n}", "func rob(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\n\tif len(nums) == 1 {\n\t\treturn nums[0]\n\t}\n\n\tvar n = len(nums)\n\treturn max(helper(nums, 0, n-2), helper(nums, 1, n-1))\n}", "func maxProfit(prices []int) int {\n\tresult := 0\n\tln := len(prices)\n\tif ln == 0 {\n\t\treturn 0\n\t}\n\tv := prices[0]\n\tp := prices[0]\n\n\ti := 0\n\tfor i < ln-1 {\n\t\tfor i < ln-1 && prices[i] >= prices[i+1] {\n\t\t\ti++\n\t\t}\n\t\tv = prices[i]\n\t\tfor i < ln-1 && prices[i] <= prices[i+1] {\n\t\t\ti++\n\t\t}\n\t\tp = prices[i]\n\t\tresult += p - v\n\t}\n\treturn result\n}", "func main() {\n\tvar N int\n\tfmt.Scan(&N)\n\n\tbudgets := make([]int, N)\n\tpayments := make([]int, N)\n\n\tvar C int\n\tfmt.Scan(&C)\n\n\tfor i := 0; i < N; i++ {\n\t\tvar B int\n\t\tfmt.Scan(&B)\n\t\tbudgets[i] = B\n\t}\n\tsort.Ints(budgets)\n\n\tfor i, val := range budgets {\n\t\tevenC := C / (len(budgets) - i)\n\t\tfmt.Fprintf(os.Stderr, \"%d - %d\\n\", evenC, val)\n\t\tif val < evenC {\n\t\t\tpayments[i] = val\n\t\t\tC = C - val\n\t\t} else {\n\t\t\tpayments[i] = evenC\n\t\t\tC = C - evenC\n\t\t}\n\n\t}\n\n\timpossible := false\n\n\tif C > 0 {\n\t\timpossible = true\n\t}\n\n\t//fmt.Fprintln(os.Stderr, \"Debug messages...\")\n\tif impossible {\n\t\tfmt.Println(\"IMPOSSIBLE\") // Write answer to stdout\n\t} else {\n\t\tfor _, val := range payments {\n\t\t\tfmt.Printf(\"%d\\n\", val)\n\t\t}\n\t}\n}", "func main() {\n\ttotal := int64(0)\n\tvectors := ways(10, top, 3)\n\tfor _, vector := range vectors {\n\t\ttotal += distribute(vector)\n\t}\n\n\tfmt.Println(\"172/ How many 18-digit numbers n (without leading zeros) are there such that no digit occurs more than three times in n?\")\n\tfmt.Println(total)\n}", "func maxProfit(prices []int) int {\n\tprofit := 0\n\n\tfor i := 0; i < len(prices)-1; i++ {\n\t\tcurrent := prices[i]\n\t\tnext := prices[i+1]\n\t\tif next > current {\n\t\t\tprofit += next - current\n\t\t}\n\t}\n\n\treturn profit\n}", "func main() {\n\tmaxWeight := []int {415, 5, 210, 435, 120, 75}\n\n\tfor _, v := range maxWeight {\n\t\tquiver(knapsack(len(boards) - 1, v))\n\t\tfmt.Printf(\"(%s %v)\\n\\n\\n===\\n\\n\", \"maximum weight\", v)\n\t}\n}", "func birthdayCakeCandles(candles []int32) int32 {\r\n\r\n // Declare and initialize the variables\r\n var i32MaximumValue int32 = candles[0]\r\n var i32MaximumCount int32 = 1\r\n \r\n // Do the loop to evalute the maximum count\r\n for i := 1; i < len(candles); i++ {\r\n if candles[i] > i32MaximumValue {\r\n i32MaximumValue = candles[i]\r\n i32MaximumCount = 1\r\n } else if candles[i] == i32MaximumValue {\r\n i32MaximumCount++\r\n }\r\n }\r\n \r\n return i32MaximumCount\r\n}", "func MaxProfit(prices []int) int {\n\tresult := 0\n\tfor i, num := range prices {\n\t\tif i == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif num > prices[i-1] {\n\t\t\tresult += num - prices[i-1]\n\t\t}\n\t}\n\treturn result\n}", "func numWaterBottles(numBottles int, numExchange int) int {\n\ttotal := numBottles\n\tempties := numBottles\n\tfor empties >= numExchange {\n\t\texchanged := empties / numExchange\n\t\ttotal += exchanged\n\t\tempties = exchanged + empties%numExchange\n\n\t}\n\n\treturn total\n}", "func maxProfit(prices []int, fee int) int {\n\tdp0, dp1 := 0, math.MinInt32\n\tfor _, p := range prices {\n\t\ta, b := dp1+p-fee, dp0-p\n\t\tif dp0 < a {\n\t\t\tdp0 = a\n\t\t}\n\t\tif dp1 < b {\n\t\t\tdp1 = b\n\t\t}\n\t}\n\treturn dp0\n}", "func maxProfit(prices []int) int {\n\tif len(prices) <= 1 {\n\t\treturn 0\n\t}\n\tmin := prices[0]\n\tmax := prices[0]\n\ti := 1\n\tprofit := 0\n\tbuy := false\n\tfor i < len(prices) {\n\t\tif prices[i] > prices[i-1] {\n\t\t\tif buy {\n\t\t\t\tmax = prices[i]\n\t\t\t} else {\n\t\t\t\tbuy = true\n\t\t\t\tmax = prices[i]\n\t\t\t}\n\t\t} else {\n\t\t\tif buy {\n\t\t\t\tprofit = profit + max - min\n\t\t\t\tbuy = false\n\t\t\t}\n\t\t\tmin = prices[i]\n\t\t}\n\t\ti++\n\t\tif i == len(prices) && buy {\n\t\t\tprofit = profit + max - min\n\t\t}\n\t}\n\treturn profit\n}", "func HowManyGames(p int32, d int32, m int32, s int32) int32 {\n\tvar (\n\t\tres int32 = 0\n\t\tsum int32 = 0\n\t\tcurPrice int32 = p\n\t)\n\tfor {\n\t\t// Check current sum with potential game price doesn't exceeds bugdet.\n\t\tif sum + curPrice > s {\n\t\t\tbreak\n\t\t}\n\n\t\t// Update game count and new sum.\n\t\tres++\n\t\tsum += curPrice\n\n\t\t// Update current price according to decrement and minimum game price.\n\t\tif curPrice - d > m {\n\t\t\tcurPrice -= d\n\t\t} else {\n\t\t\tcurPrice = m\n\t\t}\n\t}\n\treturn res\n}", "func maxProfitAssignment(difficulty []int, profit []int, worker []int) int {\n\tt := tuple{difficulty, profit}\n\tsort.Sort(t)\n\tsort.Sort(sort.IntSlice(worker))\n\ts := -1\n\tallprofit := 0\n\tcurprofit := 0\n\tfor _, w := range worker {\n\t\t// find first s that w>=difficulty[s]\n\t\tfor s+1<len(difficulty) && w>=difficulty[s+1] {\n\t\t\ts++\n\t\t\tif curprofit<profit[s] { // the profit we have seen\n\t\t\t\tcurprofit = profit[s]\n\t\t\t}\n\t\t} \n\t\tallprofit += curprofit\n\t}\n\treturn allprofit\n}", "func getMaximumGold(grid [][]int) int {\n\tdirections := [][]int{{0, 1}, {0, -1}, {1, 0}, {-1, 0}}\n\n\tif len(grid) == 0 {\n\t\treturn 0\n\t}\n\n\tm, n := len(grid), len(grid[0])\n\tresult := 0\n\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tresult = Max(result, findMaxGold(grid, i, j, directions))\n\t\t}\n\t}\n\treturn result\n}", "func maxProfitWithFeeB(prices []int, fee int) int {\n\tdp := [2][2]int{}\n\tdp[0][0], dp[0][1] = 0, -prices[0]\n\tfor i := 1; i < len(prices); i++ {\n\t\tdp[i%2][0] = common.MaxInt(dp[(i-1)%2][0], dp[(i-1)%2][1]+prices[i]-fee)\n\t\tdp[i%2][1] = common.MaxInt(dp[(i-1)%2][0]-prices[i], dp[(i-1)%2][1])\n\t}\n\tfor _, v := range dp {\n\t\tfmt.Println(v)\n\t}\n\treturn dp[(len(prices)-1)%2][0]\n}", "func maxProfit(prices []int) int {\n\tvar minPrice = math.MaxInt64\n\tvar maxProfit int\n\tfor _, price := range prices {\n\t\tif price < minPrice {\n\t\t\tminPrice = price\n\t\t} else if price-minPrice > maxProfit {\n\t\t\tmaxProfit = price - minPrice\n\t\t}\n\t}\n\n\treturn maxProfit\n}", "func maxProfit(prices []int) int {\n if len(prices) == 0 {\n return 0\n }\n\n dp := [][]int{}\n for k := 0; k < 3; k++ {\n dp = append(dp, make([]int, len(prices)))\n }\n\n for k := 1; k < 3; k++ {\n min := prices[0]\n for i := 1; i < len(prices); i++ {\n min = Min(min, prices[i] - dp[k-1][i-1])\n dp[k][i] = Max(dp[k][i-1], prices[i] - min)\n }\n }\n return dp[2][len(prices) - 1]\n}", "func maxProfit(k int, p []int) int {\n\tif k > len(p) / 2 {\n\t\tk = len(p) / 2\n\t}\n\tif k == 0 || len(p) == 0 {\n\t\treturn 0\n\t}\n\n\t// s: end with `sell` or `nothing`\n\t// b: must end with `buy`\n\ts, b := make([][]int, len(p)), make([][]int, len(p))\n\tfor i := 0; i < len(p); i++ {\n\t\ts[i] = make([]int, k)\n\t\tb[i] = make([]int, k)\n\t}\n\n\tb[0][0] = -p[0]\n\tfor i := 1; i < len(p); i++ {\n\t\tb[i][0] = max2(b[i-1][0], -p[i])\n\t\ts[i][0] = max2(s[i-1][0], p[i]+b[i-1][0])\n\t\t// fmt.Printf(\"s[%d][0]=%d, b[%d][0]=%d\\n\", i, s[i][0], i, b[i][0])\n\t}\n\n\t// s[day][tx]:\n\t// day: 0 1 2 3 4 5 6 7\n\t// b: 0 0 1 1 2 2 3 3 <= day/2\n\t// s: - 0 0 1 1 2 2 3 <= (day-1)/2\n\tfor i := 1; i < len(p); i++ {\n\t\tfor j := 1; j < k && j <= i/2; j++ {\n\t\t\t// fmt.Printf(\"[%d, %d] -> (price=%d): \", i, j, p[i])\n\t\t\tb[i][j] = s[i-1][j-1] - p[i]\n\t\t\t// *** you must be very very careful about these indices because thy might be invalid ***\n\t\t\tif j <= (i-1)/2 {\n\t\t\t\tb[i][j] = max2(b[i][j], b[i-1][j])\n\t\t\t}\n\n\t\t\t// fmt.Printf(\"b=%d\", b[i][j])\n\t\t\tif j <= (i-1)/2 {\n\t\t\t\ts[i][j] = b[i-1][j] + p[i]\n\t\t\t\t// *** be very very careful ***\n\t\t\t\tif j <= (i-1-1)/2 {\n\t\t\t\t\ts[i][j] = max2(s[i][j], s[i-1][j])\n\t\t\t\t}\n\t\t\t\t// fmt.Printf(\" s=%d\", s[i][j])\n\t\t\t}\n\t\t\t// fmt.Println()\n\t\t}\n\t}\n\n\tmax := 0\n\tfor i := 0; i < len(p); i++ {\n\t\tfor j := 0; j < k; j++ {\n\t\t\t// fmt.Printf(\"- s[%d][%d]=%d\\n\", i, j, s[i][j])\n\t\t\tmax = max2(max, s[i][j])\n\t\t}\n\t}\n\n\treturn max\n}", "func CalculateRollSpillage(delegatedContracts []DelegatedContract, delegateAddr string, cycle int) ([]DelegatedContract, error) {\n stakingBalance, err := GetDelegateStakingBalance(delegateAddr, cycle)\n if (err != nil){\n return delegatedContracts, errors.New(\"func CalculateRollSpillage(delegatedContracts []DelegatedContract, delegateAddr string) failed: \" + err.Error())\n }\n\n mod := math.Mod(stakingBalance, 10000)\n sum := mod * 10000\n\n for index, delegatedContract := range delegatedContracts{\n for i, contract := range delegatedContract.Contracts{\n if (contract.Cycle == cycle){\n stakingBalance = stakingBalance - contract.Amount\n if (stakingBalance < 0){\n delegatedContracts[index].Contracts[i].SharePercentage = (contract.Amount - stakingBalance) / sum\n }\n }\n }\n }\n\n return delegatedContracts, nil\n}", "func rob(nums []int) int {\n\tvar prev2 int\n\tvar prev1 int\n\tfor i := 0; i < len(nums); i++ {\n\t\tcur := max(prev1, prev2 + nums[i])\n\t\tprev2 = prev1\n\t\tprev1 = cur\n\t}\n\treturn prev1\n}", "func maxProfit(prices []int) int {\n\tmaxProfit := 0\n\n\tfor day := 1; day < len(prices); day++ {\n\t\tif prices[day] > prices[day-1] {\n\t\t\tmaxProfit += prices[day] - prices[day-1]\n\t\t}\n\t}\n\n\treturn maxProfit\n}", "func taumBday(b int32, w int32, bc int32, wc int32, z int32) int64 {\n // Write your code here\n var cost int64 = 0\n var bb int64 = int64(b) // black buy\n var wb int64 = int64(w) // white buy\n var bcc int64 = int64(bc) // black cost\n var wcc int64 = int64(wc) // white cost\n var bcost int64 = 0\n var wcost int64 = 0\n if bc+z < wc {\n // black+conversion cheaper, buy black and convert to white\n bcc = int64(bc)\n wcc = int64(bc+z)\n bcost = bb*bcc\n wcost = wb*wcc\n } else if wc+z < bc {\n // white+conversion cheaper, buy white and convert to black\n bcc = int64(wc+z)\n wcc = int64(wc)\n bcost = bb*bcc\n wcost = wb*wcc\n } else {\n // same cost, or no cost advantage to conversion\n bcc = int64(bc)\n wcc = int64(wc)\n bcost = bb*bcc\n wcost = wb*wcc\n }\n cost = bcost + wcost\n return cost\n}", "func takeCoinSide(nums []int) int {\n\tn := len(nums)\n\t//sum[i] is for sum to ith element\n\tsum := make([]int, n+1)\n\tfor i := 1; i <= n; i++ {\n\t\tsum[i] = sum[i-1] + nums[i-1]\n\t}\n\t//dp[i][j] is for max score given array index i~j\n\tdp := make([][]int, n)\n\tfor i := range dp {\n\t\tdp[i] = make([]int, n)\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tdp[i][i] = nums[i]\n\t}\n\tfor l := 2; l <= n; l++ {\n\t\tfor i := 0; i < n-l+1; i++ {\n\t\t\tj := i + l - 1\n\t\t\totherMin := min(dp[i][j-1], dp[i+1][j])\n\t\t\t//sum of index i~j\n\t\t\tdp[i][j] = sum[j+1] - sum[i] - otherMin\n\t\t}\n\t}\n\treturn dp[0][n-1]\n}", "func (s *solution) SmallestUnreachable() int {\n\t// Write your code here\n\tpowerSetHelper := func (original []int) [][]int {\n\t\tpowerSetSize := int(math.Pow(2, float64(len(original))))\n\t\tresult := make([][]int, 0, powerSetSize)\n\n\t\tvar index int\n\t\tfor index < powerSetSize {\n\t\tvar subSet []int\n\n\t\tfor j, elem := range original {\n\t\tif index& (1 << uint(j)) > 0 {\n\t\tsubSet = append(subSet, elem)\n\t}\n\t}\n\t\tresult = append(result, subSet)\n\t\tindex++\n\t}\n\t\treturn result\n\t}\n\n\n\tnbills := s.GetNumBills()\n\tfmt.Println(\"number of bills\", nbills)\n\tbills := make([]int, nbills)\n\tfor i := 0; i < nbills ; i++ {\n\t\tbills[i] = s.GetBill(i)\n\t}\n\tfmt.Println(\"Bills\", bills)\n\tprice := s.GetPrice()\n\tfmt.Println(\"Price\", price)\n\tpayment := s.GetPayment()\n\tfmt.Println(\"payment\", payment)\n\tdiff := payment - price\n\tfmt.Println(\"diff\", diff)\n\n\tp := powerSetHelper(bills)\n\tmax := 0\n\tmaxIndex := -1\n\tfor i,v := range p {\n\t\tsum := 0\n\t\tfor _,b := range v {\n\t\t\tsum += b\n\t\t}\n\t\tif sum > max {\n\t\t\tmax = sum\n\t\t\tmaxIndex = i\n\t\t}\n\t}\n\tfmt.Println(p[maxIndex])\n\n\treturn diff - max\n}", "func hurdleRace(k int32, height []int32) int32 {\n\tvar tallest int32\n\tfor _, v := range height {\n\t\tif v > tallest {\n\t\t\ttallest = v\n\t\t}\n\t}\n\n\tdoses := tallest - k\n\tif doses < 1 {\n\t\treturn 0\n\t}\n\treturn doses\n}", "func GetMaximumLoot (capacity int, values []int, weights []int) float64 {\n\tvar units []float64\n\tfor i := 0; i < len(values); i++ {\n\t\tunits = append(units, float64(values[i])/float64(weights[i]))\n\t}\n\n\tvar temp float64\n\tvar tempWeights int\n\tfor k := 0; k < len(units) - 2; k++ {\n\t\tfor i := 0; i < len(units) - 1; i++ {\n\t\t\tif units[i] > units[i + 1] {\n\t\t\t\ttemp = units[i]\n\t\t\t\ttempWeights = weights[i]\n\n\t\t\t\tunits[i] = units[i + 1]\n\t\t\t\tweights[i] = weights[i + 1]\n\n\t\t\t\tunits[i + 1] = temp\n\t\t\t\tweights[i + 1] = tempWeights\n\t\t\t}\n\t\t}\n\t}\n\n\tvar result float64\n\tresult = 0.0000\n\n\tfor m := len(units) - 1; m >= 0; m-- {\n\t\tif weights[m] <= capacity {\n\t\t\tresult += units[m] * float64(weights[m])\n\t\t\tcapacity -= weights[m]\n\t\t\tif capacity == 0 {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tresult += units[m] * float64(capacity)\n\t\tcapacity = 0\n\t\tbreak\n\t}\n\n\treturn RoundUp(result, 4)\n}", "func (player Player) findWinner(guesses []int, numberOfPlayers int, moneyBox int) int {\n\tplayer.talk(fmt.Sprintf(\"guesses = %v\", guesses))\n\tvar distance = make([]int, numberOfPlayers)\n\tfor i := 0; i < numberOfPlayers; i++ {\n\t\tdistance[i] = util.Abs(moneyBox - guesses[i])\n\t\t//distance[i] = util.Abs(guesses[len(guesses)-1] - guesses[i])\n\t}\n\tplayer.talk(fmt.Sprintf(\"distance = %v\", distance))\n\tvar winner = 0\n\tfor i := 0; i < numberOfPlayers; i++ {\n\t\tif distance[i] < distance[winner] {\n\t\t\twinner = i\n\t\t}\n\t}\n\treturn winner\n}", "func maxArea(height []int) int {\n maxArea := 0\n maxheight := 0\n for i := 0; i < len(height) -1; i++ {\n for j := i+1; j < len(height); j++ {\n if height[i] >= height[j] {\n maxheight = height[j]\n } else {\n maxheight = height[i]\n }\n if maxArea < (maxheight * (j-i)) {\n maxArea = (maxheight * (j-i))\n }\n }\n }\n return maxArea\n}", "func Solution(a []int) int {\n\tmaxGain := 0\n\tminPrice := 0\n\tfor i, price := range a {\n\t\tif i == 0 {\n\t\t\tminPrice = price\n\t\t\tcontinue\n\t\t}\n\n\t\tmaxGain = max(maxGain, price-minPrice)\n\t\tminPrice = min(minPrice, price)\n\t}\n\treturn maxGain\n}", "func howManyGames(p int32, d int32, m int32, s int32) int32 {\n\tvar i int32 = 0\n\tfor {\n\t\ts = s - p\n\t\tif s < 0 {\n\t\t\tbreak\n\t\t}\n\t\ti++\n\t\tif p-d > m {\n\t\t\tp = p - d\n\t\t} else {\n\t\t\tp = m\n\t\t}\n\t}\n\treturn i\n}", "func findCheapestPrice(n int, flights [][]int, src int, dst int, K int) int {\n \n}", "func distributeLockedAmount(ctx coretypes.Sandbox, bets []*BetInfo, totalLockedAmount int64) bool {\n\tsumsByPlayers := make(map[coretypes.AgentID]int64)\n\ttotalWinningAmount := int64(0)\n\tfor _, bet := range bets {\n\t\tif _, ok := sumsByPlayers[bet.Player]; !ok {\n\t\t\tsumsByPlayers[bet.Player] = 0\n\t\t}\n\t\tsumsByPlayers[bet.Player] += bet.Sum\n\t\ttotalWinningAmount += bet.Sum\n\t}\n\n\t// NOTE 1: float64 was avoided for determinism reasons\n\t// NOTE 2: beware overflows\n\n\tfor player, sum := range sumsByPlayers {\n\t\tsumsByPlayers[player] = (totalLockedAmount * sum) / totalWinningAmount\n\t}\n\n\t// make deterministic sequence by sorting. Eliminate possible rounding effects\n\tseqPlayers := make([]coretypes.AgentID, 0, len(sumsByPlayers))\n\tresultSum := int64(0)\n\tfor player, sum := range sumsByPlayers {\n\t\tseqPlayers = append(seqPlayers, player)\n\t\tresultSum += sum\n\t}\n\tsort.Slice(seqPlayers, func(i, j int) bool {\n\t\treturn bytes.Compare(seqPlayers[i][:], seqPlayers[j][:]) < 0\n\t})\n\n\t// ensure we distribute not more than totalLockedAmount iotas\n\tif resultSum > totalLockedAmount {\n\t\tsumsByPlayers[seqPlayers[0]] -= resultSum - totalLockedAmount\n\t}\n\n\t// filter out those who proportionally got 0\n\tfinalWinners := seqPlayers[:0]\n\tfor _, player := range seqPlayers {\n\t\tif sumsByPlayers[player] <= 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfinalWinners = append(finalWinners, player)\n\t}\n\t// distribute iotas\n\tfor i := range finalWinners {\n\n\t\tavailable := ctx.Balance(balance.ColorIOTA)\n\t\tctx.Event(fmt.Sprintf(\"sending reward iotas %d to the winner %s. Available iotas: %d\",\n\t\t\tsumsByPlayers[finalWinners[i]], finalWinners[i].String(), available))\n\n\t\t//if !ctx.MoveTokens(finalWinners[i], balance.ColorIOTA, sumsByPlayers[finalWinners[i]]) {\n\t\t//\treturn false\n\t\t//}\n\t}\n\treturn true\n}", "func (p * Player)LoseMoney()int{\n\tif len(p.Moneys) == 0 {\n\t\treturn 0\n\t}\n\tmax := p.Moneys[0]\n\tpos := 0\n\tfor i,money := range p.Moneys {\n\t\tif money > max {\n\t\t\tmax = money\n\t\t\tpos = i\n\t\t}\n\t}\n\tp.Moneys = append(p.Moneys[:pos],p.Moneys[pos+1:]...)\n\treturn max\n}", "func MaxProfit(prices []int) int {\n\tprofit := 0\n\tlength := len(prices) - 1\n\tfor i := 0; i < length; i++ {\n\t\t// 因为我们得知了未来的股票价格,所以我们就不能错过每一次股票的上涨,\n\t\t// 即只要股票上涨就继续持有,股票下跌就马上卖出。\n\t\t// 这里的逻辑基础是:\n\t\t// 1. 连续增加的区间的变化值就是开始和结束的区间结点之差,所以频繁买入卖出的利润和在谷买入峰卖出的利润是一致的。\n\t\t// 2. 这里运用的就是贪心思想,即我要吃掉每一次涨跌幅的利润。\n\t\tif prices[i+1]-prices[i] > 0 {\n\t\t\tprofit += prices[i+1] - prices[i]\n\t\t}\n\t}\n\treturn profit\n}", "func findBiggest(numbers ...int) int {\n\tvar biggest int\n\t//iterate over numbers\n\tfor _, v := range numbers {\n\t\tif v > biggest {\n\t\t\tbiggest = v\n\t\t}\n\t}\n\n\treturn biggest\n}", "func TestBenchlistMaxStake(t *testing.T) {\n\tvdrs := validators.NewSet()\n\tvdr0 := validators.GenerateRandomValidator(1000)\n\tvdr1 := validators.GenerateRandomValidator(1000)\n\tvdr2 := validators.GenerateRandomValidator(1000)\n\tvdr3 := validators.GenerateRandomValidator(2000)\n\tvdr4 := validators.GenerateRandomValidator(100)\n\t// Total weight is 5100\n\n\terrs := wrappers.Errs{}\n\terrs.Add(\n\t\tvdrs.AddWeight(vdr0.ID(), vdr0.Weight()),\n\t\tvdrs.AddWeight(vdr1.ID(), vdr1.Weight()),\n\t\tvdrs.AddWeight(vdr2.ID(), vdr2.Weight()),\n\t\tvdrs.AddWeight(vdr3.ID(), vdr3.Weight()),\n\t\tvdrs.AddWeight(vdr4.ID(), vdr4.Weight()),\n\t)\n\tif errs.Errored() {\n\t\tt.Fatal(errs.Err)\n\t}\n\n\tthreshold := 3\n\tduration := 1 * time.Hour\n\t// Shouldn't bench more than 2550 (5100/2)\n\tmaxPortion := 0.5\n\tbenchIntf, err := NewBenchlist(\n\t\tlogging.NoLog{},\n\t\tvdrs,\n\t\tthreshold,\n\t\tminimumFailingDuration,\n\t\tduration,\n\t\tmaxPortion,\n\t\t\"\",\n\t\tprometheus.NewRegistry(),\n\t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tb := benchIntf.(*benchlist)\n\tdefer b.timer.Stop()\n\tnow := time.Now()\n\tb.clock.Set(now)\n\n\t// Register [threshold-1] failures for 3 validators\n\tfor _, vdr := range []validators.Validator{vdr0, vdr1, vdr2} {\n\t\tfor i := 0; i < threshold-1; i++ {\n\t\t\tb.RegisterFailure(vdr.ID())\n\t\t}\n\t}\n\n\t// Advance the time to past the minimum failing duration\n\tnewTime := now.Add(minimumFailingDuration).Add(time.Second)\n\tb.lock.Lock()\n\tb.clock.Set(newTime)\n\tb.lock.Unlock()\n\n\t// Register another failure for all three\n\tfor _, vdr := range []validators.Validator{vdr0, vdr1, vdr2} {\n\t\tb.RegisterFailure(vdr.ID())\n\t}\n\n\t// Only vdr0 and vdr1 should be benched (total weight 2000)\n\t// Benching vdr2 (weight 1000) would cause the amount benched\n\t// to exceed the maximum\n\tb.lock.Lock()\n\tassert.True(t, b.isBenched(vdr0.ID()))\n\tassert.True(t, b.isBenched(vdr1.ID()))\n\tassert.False(t, b.isBenched(vdr2.ID()))\n\tassert.Equal(t, b.benchedQueue.Len(), 2)\n\tassert.Equal(t, b.benchlistSet.Len(), 2)\n\tassert.Len(t, b.failureStreaks, 1)\n\tfs := b.failureStreaks[vdr2.ID()]\n\tfs.consecutive = threshold\n\tfs.firstFailure = now\n\tb.lock.Unlock()\n\n\t// Register threshold - 1 failures for vdr4\n\tfor i := 0; i < threshold-1; i++ {\n\t\tb.RegisterFailure(vdr4.ID())\n\t}\n\n\t// Advance the time past min failing duration\n\tnewTime2 := newTime.Add(minimumFailingDuration).Add(time.Second)\n\tb.lock.Lock()\n\tb.clock.Set(newTime2)\n\tb.lock.Unlock()\n\n\t// Register another failure for vdr4\n\tb.RegisterFailure(vdr4.ID())\n\n\t// vdr4 should be benched now\n\tb.lock.Lock()\n\tassert.True(t, b.isBenched(vdr0.ID()))\n\tassert.True(t, b.isBenched(vdr1.ID()))\n\tassert.True(t, b.isBenched(vdr4.ID()))\n\tassert.Equal(t, 3, b.benchedQueue.Len())\n\tassert.Equal(t, 3, b.benchlistSet.Len())\n\tassert.Contains(t, b.benchlistSet, vdr0.ID())\n\tassert.Contains(t, b.benchlistSet, vdr1.ID())\n\tassert.Contains(t, b.benchlistSet, vdr4.ID())\n\tassert.Len(t, b.failureStreaks, 1) // for vdr2\n\tb.lock.Unlock()\n\n\t// More failures for vdr2 shouldn't add it to the bench\n\t// because the max bench amount would be exceeded\n\tfor i := 0; i < threshold-1; i++ {\n\t\tb.RegisterFailure(vdr2.ID())\n\t}\n\n\tb.lock.Lock()\n\tassert.True(t, b.isBenched(vdr0.ID()))\n\tassert.True(t, b.isBenched(vdr1.ID()))\n\tassert.True(t, b.isBenched(vdr4.ID()))\n\tassert.False(t, b.isBenched(vdr2.ID()))\n\tassert.Equal(t, 3, b.benchedQueue.Len())\n\tassert.Equal(t, 3, b.benchlistSet.Len())\n\tassert.Len(t, b.failureStreaks, 1)\n\tassert.Contains(t, b.failureStreaks, vdr2.ID())\n\n\t// Ensure the benched queue root has the min end time\n\tminEndTime := b.benchedQueue[0].benchedUntil\n\tbenchedIDs := []ids.ShortID{vdr0.ID(), vdr1.ID(), vdr4.ID()}\n\tfor _, benchedVdr := range b.benchedQueue {\n\t\tassert.Contains(t, benchedIDs, benchedVdr.validatorID)\n\t\tassert.True(t, !benchedVdr.benchedUntil.Before(minEndTime))\n\t}\n\n\tb.lock.Unlock()\n}", "func maxProfitWithFeeA(prices []int, fee int) int {\n\tdp := make([][2]int, len(prices))\n\tdp[0][0], dp[0][1] = 0, -prices[0]\n\tfor i := 1; i < len(prices); i++ {\n\t\tdp[i][0] = common.MaxInt(dp[i-1][0], dp[i-1][1]+prices[i]-fee)\n\t\tdp[i][1] = common.MaxInt(dp[i-1][0]-prices[i], dp[i-1][1])\n\t}\n\tfor _, v := range dp {\n\t\tfmt.Println(v)\n\t}\n\treturn dp[len(prices)-1][0]\n}", "func maxProfit714Dp(prices []int, fee int) int {\n\tl := len(prices)\n\tif l <= 1 {\n\t\treturn 0\n\t}\n\tdp := make([][]int, l)\n\tfor i := 0; i < l; i++ {\n\t\tdp[i] = make([]int, 2)\n\t}\n\tdp[0][0] = 0\n\tdp[0][1] = -prices[0]\n\tfor i := 1; i < l; i++ {\n\t\tdp[i][0] = utils.Max(dp[i-1][1]+prices[i]-fee, dp[i-1][0])\n\t\tdp[i][1] = utils.Max(dp[i-1][0]-prices[i], dp[i-1][1])\n\t}\n\treturn dp[l-1][0]\n}", "func GetMaximumCreaturePower(cards []Card) int {\n\tpower := 0\n\n\tfor _, card := range cards {\n\t\tif card.Power > power {\n\t\t\tpower = card.Power\n\t\t}\n\t}\n\n\treturn power\n}", "func main() {\n\td := []int{2, 3, 4, 5, 18, 17, 6}\n\tfmt.Println(maxArea(d))\n\n}", "func CutRodRecursive(p []int, n int) int {\n\tvar q int = 0 // keeping track of the max\n\n\t// a rod of length 0 has no price\n\tif n == 0 {\n\t\treturn q\n\t}\n\n\tfor i := 1; i <= n; i++ {\n\t\tmaxResultFromFollowingThisSubtree := p[i] + CutRodRecursive(p, n-i)\n\n\t\tif maxResultFromFollowingThisSubtree > q {\n\t\t\tq = maxResultFromFollowingThisSubtree\n\t\t}\n\t}\n\n\treturn q\n}", "func LeastCoins(targetTotal int, coinOptions []int) int {\n\tminNum := intMax\n\n\tmemo := make([][]int, targetTotal+1)\n\tfor i := range memo {\n\t\tmemo[i] = make([]int, len(coinOptions))\n\t}\n\tfmt.Println(\"start\")\n\tleastCoins(&minNum, 0, targetTotal, len(coinOptions)-1, coinOptions, memo)\n\tfmt.Println(\"end\")\n\n\treturn minNum\n\n}", "func FindWinningBids(bids bid.Bids, totalPercentage int) (bid.Bids, error) {\n\tvar divisible int\n\n\tthresholds := flatThresholds(bids)\n\tsort.Sort(bids)\n\n\tif len(thresholds) == 1 {\n\t\tvar n int\n\t\tfor t := range thresholds {\n\t\t\tn = t\n\t\t}\n\t\tdivisible = totalPercentage / n\n\t}\n\n\tvar winners bid.Bids\n\tif divisible != 0 {\n\t\tfor i, b := range bids {\n\t\t\tif i >= divisible {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\twinners = append(winners, b)\n\t\t}\n\t} else {\n\t\tfor t, v := range thresholds {\n\t\t\tfor _, b := range bids {\n\t\t\t\tif b.Threshold == t && b.Value == v {\n\t\t\t\t\twinners = append(winners, b)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn winners, nil\n}", "func MaxFuelForOre(reactions string, ore int64) int64 {\n\treactionLookup := parseReactions(reactions)\n\n\toreForOneFuel := calcMinOreForFuel(reactionLookup, 1)\n\n\tlowerFuelGuess := ore / oreForOneFuel\n\tupperFuelGuess := 2 * lowerFuelGuess\n\n\tfor upperFuelGuess-lowerFuelGuess > 1 {\n\t\tcenterFuelGuess := lowerFuelGuess + (upperFuelGuess-lowerFuelGuess)/2\n\n\t\tcenterOre := calcMinOreForFuel(reactionLookup, centerFuelGuess)\n\t\tif centerOre < ore {\n\t\t\tlowerFuelGuess = centerFuelGuess\n\t\t} else {\n\t\t\tupperFuelGuess = centerFuelGuess\n\t\t}\n\t}\n\n\treturn lowerFuelGuess\n}", "func distributeMax(total, max int) []int {\n\treturn distribute(total, (total+max-1)/max)\n}", "func balance(banks []int) ([]int, string) {\n\tindex := 0 // index of the highest element\n\thighest := banks[index] // we'll assume the first element is the biggest\n\n\tfor bank := 0; bank < len(banks); bank++ {\n\t\tif banks[bank] > highest {\n\t\t\thighest = banks[bank]\n\t\t\tindex = bank\n\t\t}\n\t} //end find highest\n\n\tbanks[index] = 0\n\trounds := 0 // we've balanced this many times\n\tindex += 1 // Index into the array, starting with the \"next\" memory bank after highest; could wrap\n\tif index >= len(banks) {\n\t\t// wrap around if we need to\n\t\tindex = 0\n\t}\n\n\t// Loop highest times and do manual positioning management of the list\n\tfor rounds < highest {\n\t\tbanks[index] += 1\n\t\trounds += 1\n\t\tindex += 1\n\t\tif index >= len(banks) {\n\t\t\t// wrap around if we need to\n\t\t\tindex = 0\n\t\t}\n\t}\n\treturn banks, arrayToString(banks)\n}", "func maxRetweets(rt_list []int) int {\r\n c := 0\r\n for _, cnt := range rt_list {\r\n if cnt > c {\r\n c = cnt\r\n }\r\n }\r\n return c\r\n}", "func minimumBribes(q []int32) {\n\tbribes := 0\n\tqbribes := make([]int, len(q))\n\treverse := false\n\tfor i, j := 0, len(q)-1; i < len(q); {\n\t\tif !reverse {\n\t\t\tfor x := 0; x < len(q)-i-1; x++ {\n\t\t\t\tif q[x]-1 == int32(x) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif q[x] > q[x+1] {\n\t\t\t\t\tqbribes[q[x]-1]++\n\t\t\t\t\tif qbribes[q[x]-1] > 2 {\n\t\t\t\t\t\tfmt.Printf(\"Too chaotic\\n\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tq[x], q[x+1] = q[x+1], q[x]\n\t\t\t\t\tbribes++\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++\n\t\t} else {\n\t\t\tfor x := j; x > i; x-- {\n\t\t\t\tif q[x]-1 == int32(x) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif q[x-1] > q[x] {\n\t\t\t\t\tqbribes[q[x-1]-1]++\n\t\t\t\t\tif qbribes[q[x-1]-1] > 2 {\n\t\t\t\t\t\tfmt.Printf(\"Too chaotic\\n\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tq[x-1], q[x] = q[x], q[x-1]\n\t\t\t\t\tbribes++\n\t\t\t\t}\n\t\t\t}\n\t\t\tj--\n\t\t}\n\t\treverse = !reverse\n\t}\n\tfmt.Printf(\"%d\\n\", bribes)\n}", "func Problem1046() {\n\n\tfmt.Println(lastStoneWeight([]int{2, 7, 4, 1, 8, 1}))\n\n}", "func Solution(a []int) int {\n\tpassingCars := 0\n\tcarsMovingWest := prefixSums(a)\n\ttotalCarsMovingWest := carsMovingWest[len(a)]\n\tfor i, item := range a {\n\t\tif item == 0 {\n\t\t\tpassingCars += totalCarsMovingWest - carsMovingWest[i]\n\t\t}\n\t}\n\tif passingCars > maxPassingCarsCount {\n\t\treturn tooManyPassingCars\n\t}\n\treturn passingCars\n}", "func candies(n int32, arr []int32) int64 {\n var result int64\n LtoR := make([]int32, len(arr))\n RtoL := make([]int32, len(arr))\n\n LtoR[0] = 1\n RtoL[len(arr)-1] = 1\n \n for i := 1; i < len(arr); i++ {\n if arr[i-1] < arr[i] {\n LtoR[i] = LtoR[i-1] + 1\n } else {\n LtoR[i] = 1\n }\n }\n \n for i := len(arr)-2; i >= 0; i-- {\n if arr[i] <= arr[i+1] {\n RtoL[i] = 1\n } else {\n RtoL[i] = RtoL[i+1] + 1\n }\n }\n result = compare(LtoR, RtoL)\n \n return result\n}", "func MostParticipantsUF(states []State) {\n\tvar maior = states[0]\n\tfor i := 0; i < len(states)-1; i++ {\n\t\tif states[i].Total < states[i+1].Total {\n\t\t\tmaior = states[i+1]\n\t\t}\n\t}\n\tfmt.Printf(\"O Estado com maior numero de participantes: %s\\n\", maior.Sigla)\n\tfmt.Printf(\"Numero de participantes: %v\", maior.Total)\n}", "func findGoldbachException() int {\n\tdefer timeTrack(time.Now(), \"findGoldbachException()\")\n\n\tconst LIMIT = 10000\n\n\tprimeList, compositeList := listPrimesAndOddComposites(LIMIT)\n\tresultsMap := make(map[int]bool)\n\n\t// the largest number that the integer portion can be and still have a result less than 'lim'\n\tintegerLimit := int(math.Sqrt(float64(LIMIT))) / 2\n\t// generate the resultMap where every\n\tfor primeIdx := 0; primeIdx < len(primeList); primeIdx++ {\n\t\tfor integer := 1; integer < integerLimit; integer++ {\n\t\t\tresult := primeList[primeIdx] + 2*integer*integer\n\t\t\t// pf(\"%d + 2*%d^2 = %d\\n\", primeList[primeIdx], integer, result)\n\t\t\t// only bother with the odd results\n\t\t\tif result%2 != 0 {\n\t\t\t\tresultsMap[result] = true\n\t\t\t}\n\t\t}\n\t}\n\n\t// p(resultsMap)\n\t// p(compositeList)\n\n\t// compare the resultsMap and the compositeList, but ignore the first prime (2)\n\tfor i := 0; i < len(compositeList); i++ {\n\t\tif resultsMap[compositeList[i]] == false {\n\t\t\treturn compositeList[i]\n\t\t}\n\t}\n\treturn 0\n\n}", "func (e *Square10) DetermineWinner() int {\n\tscore := []int{0, 0}\n\tfor _, owner := range e.ownership {\n\t\tif owner == contested {\n\t\t\tcontinue\n\t\t}\n\t\tscore[owner]++\n\t}\n\tfor player, points := range score {\n\t\tif points+player > 50 {\n\t\t\treturn player\n\t\t}\n\t}\n\treturn -1\n}", "func main() {\n\tbots := ReadInput(\"day23_input.txt\")\n\n\tvar largestBot Nanobot\n\tfor _, b := range bots {\n\t\tif b.r > largestBot.r {\n\t\t\tlargestBot = b\n\t\t}\n\t}\n\n\tinRangeCount := 0\n\tminX := math.MaxInt32\n\tminY := math.MaxInt32\n\tminZ := math.MaxInt32\n\tmaxX := math.MinInt32\n\tmaxY := math.MinInt32\n\tmaxZ := math.MinInt32\n\tmeanX := 0\n\tmeanY := 0\n\tmeanZ := 0\n\tfor _, b := range bots {\n\t\td := IntAbs(b.x - largestBot.x) + IntAbs(b.y - largestBot.y) + IntAbs(b.z - largestBot.z)\n\t\tmeanX += b.x\n\t\tmeanY += b.y\n\t\tmeanZ += b.z\n\n\t\tif d <= largestBot.r {\n\t\t\tinRangeCount += 1\n\t\t}\n\t\tif b.x > maxX {\n\t\t\tmaxX = b.x\n\t\t}\n\t\tif b.y > maxY {\n\t\t\tmaxY = b.y\n\t\t}\n\t\tif b.z > maxZ {\n\t\t\tmaxZ = b.z\n\t\t}\n\t\tif b.x < minX {\n\t\t\tminX = b.x\n\t\t}\n\t\tif b.y < minY {\n\t\t\tminY = b.y\n\t\t}\n\t\tif b.z < minZ {\n\t\t\tminZ = b.z\n\t\t}\n\t}\n\tmeanX = meanX / len(bots)\n\tmeanY = meanY / len(bots)\n\tmeanZ = meanZ / len(bots)\n\n\tfmt.Printf(\"Number in range for part 1: %d\\n\", inRangeCount)\n\t\n\t\n\tfmt.Printf(\"Number range x: (%d, %d), y: (%d, %d), z: (%d, %d)\\n\", minX, maxX, minY, maxY, minZ, maxZ)\n\n\t// The score at the center is a good heuristic to allow us to skip any \n\t// sub volumes with a lower score, so it will be used as the starting \"maxValue\"\n\tcenterScore := CubeScore(meanX, meanY, meanZ, 0, bots)\n\tfmt.Printf(\"Center: (%d, %d, %d), score: %d\\n\", meanX, meanY, meanZ, centerScore)\n\t\n\n\t// Do pyramid style search\n\tscores := ScaledSearch(minX, maxX, minY, maxY, minZ, maxZ, 4*1024*1024, bots)\n\tfmt.Println(\"Top 20 scores:\")\n\tfor i, s := range scores {\n\t\tfmt.Println(s.score)\n\t\tif i > 20 {\n\t\t\tbreak\n\t\t} \n\t}\n\n\ttopSize := 0\n\tif maxX - minX > topSize {\n\t\ttopSize = maxX - minX\n\t}\n\tif maxY - minY > topSize {\n\t\ttopSize = maxY - minY\n\t}\n\tif maxZ - minZ > topSize {\n\t\ttopSize = maxZ - minZ\n\t}\n\ttopVolume := Score{(minX + maxX)/2, (minY + maxY)/2, (minZ + maxZ)/2, topSize, 0}\n\tfmt.Printf(\"Initial volume: (%d, %d, %d) size: %d\\n\", topVolume.x, topVolume.y, topVolume.z, topVolume.size)\n\t// Do two passes: \n\t// - On first pass, only collect the top score\n\t// - On second pass, collect all the locations that achieve the top score\n\t// This is because the algorithm will waste much too much time collecting the many, many\n\t// locations that meet a lower score, before it figures out there are higher scores\n\ttopScore, _ := Recurse(topVolume, centerScore, bots, false)\n\tfmt.Println(\"Top score: \", topScore)\n\ttopScore, locations := Recurse(topVolume, topScore, bots, true)\n\tfmt.Printf(\"Found %d locations with score %d\\n\", len(locations), topScore)\n\tfor _, l := range locations {\n\t\tfmt.Println(\"Location: \", l)\n\t\t// Compute the distance to origin\n\t\tdistance := CubeDistance(0, 0, 0, 0, l.x, l.y, l.z)\n\t\t// re-compute the score...just as a sanity check\n\t\trecomputeScore := CubeScore(l.x, l.y, l.z, 0, bots)\n\t\tfmt.Println(\"Distance from origin: \", distance)\n\t\tfmt.Println(\"recomputed score: \", recomputeScore)\n\t}\n}", "func (game *Game) calculateGameWinner() {\n\twinningPlayer := 0\n\twinningTotal := MaxPossibleScore\n\n\tfor i := range game.players {\n\t\tplayerTotal := game.players[i].calcuateTotalGameScore()\n\n\t\tif playerTotal < winningTotal {\n\t\t\twinningTotal = playerTotal\n\t\t\twinningPlayer = i\n\t\t}\n\t}\n\n\tgame.gameWinner = winningPlayer\n}", "func distributeCoins(root *TreeNode) int {\n\tres := 0\n\tvar dfs func(root *TreeNode) int\n\tabs := func(a int) int {\n\t\tif a < 0 {\n\t\t\treturn -a\n\t\t}\n\t\treturn a\n\t}\n\tdfs = func(root *TreeNode) int {\n\t\tif root == nil {\n\t\t\treturn 0\n\t\t}\n\t\tleft := dfs(root.Left)\n\t\tright := dfs(root.Right)\n\t\tres += abs(left) + abs(right)\n\t\treturn left + right + root.Val - 1\n\t}\n\tdfs(root)\n\treturn res\n}", "func maxProfit123(prices []int) int {\n\tl := len(prices)\n\tif l <= 1 {\n\t\treturn 0\n\t}\n\tmin, max := prices[0], prices[l-1]\n\tdp1, dp2 := make([]int, l), make([]int, l)\n\tdp1[0], dp2[l-1] = 0, 0\n\tfor i := 1; i < l; i++ {\n\t\tdp1[i] = utils.Max(dp1[i-1], prices[i]-min)\n\t\tdp2[l-i-1] = utils.Max(dp2[l-1], max-prices[l-i-1])\n\t\tif prices[i] < min {\n\t\t\tmin = prices[i]\n\t\t}\n\t\tif prices[l-i-1] > max {\n\t\t\tmax = prices[l-i-1]\n\t\t}\n\t}\n\tmaxProfit := 0\n\tfor i := 0; i < l; i++ {\n\t\tmaxProfit = utils.Max(maxProfit, dp1[i]+dp2[i])\n\t}\n\treturn maxProfit\n}", "func max(x int) int {\n\treturn 40 + x\n}", "func maxArea(height []int) int {\n\treturn 0\n}", "func (rpcServer HttpServer) chooseBestOutCoinsToSpent(outCoins []*privacy.OutputCoin, amount uint64) (resultOutputCoins []*privacy.OutputCoin, remainOutputCoins []*privacy.OutputCoin, totalResultOutputCoinAmount uint64, err error) {\n\tresultOutputCoins = make([]*privacy.OutputCoin, 0)\n\tremainOutputCoins = make([]*privacy.OutputCoin, 0)\n\ttotalResultOutputCoinAmount = uint64(0)\n\n\t// either take the smallest coins, or a single largest one\n\tvar outCoinOverLimit *privacy.OutputCoin\n\toutCoinsUnderLimit := make([]*privacy.OutputCoin, 0)\n\n\tfor _, outCoin := range outCoins {\n\t\tif outCoin.CoinDetails.GetValue() < amount {\n\t\t\toutCoinsUnderLimit = append(outCoinsUnderLimit, outCoin)\n\t\t} else if outCoinOverLimit == nil {\n\t\t\toutCoinOverLimit = outCoin\n\t\t} else if outCoinOverLimit.CoinDetails.GetValue() > outCoin.CoinDetails.GetValue() {\n\t\t\tremainOutputCoins = append(remainOutputCoins, outCoin)\n\t\t} else {\n\t\t\tremainOutputCoins = append(remainOutputCoins, outCoinOverLimit)\n\t\t\toutCoinOverLimit = outCoin\n\t\t}\n\t}\n\n\tsort.Slice(outCoinsUnderLimit, func(i, j int) bool {\n\t\treturn outCoinsUnderLimit[i].CoinDetails.GetValue() < outCoinsUnderLimit[j].CoinDetails.GetValue()\n\t})\n\n\tfor _, outCoin := range outCoinsUnderLimit {\n\t\tif totalResultOutputCoinAmount < amount {\n\t\t\ttotalResultOutputCoinAmount += outCoin.CoinDetails.GetValue()\n\t\t\tresultOutputCoins = append(resultOutputCoins, outCoin)\n\t\t} else {\n\t\t\tremainOutputCoins = append(remainOutputCoins, outCoin)\n\t\t}\n\t}\n\n\tif outCoinOverLimit != nil && (outCoinOverLimit.CoinDetails.GetValue() > 2*amount || totalResultOutputCoinAmount < amount) {\n\t\tremainOutputCoins = append(remainOutputCoins, resultOutputCoins...)\n\t\tresultOutputCoins = []*privacy.OutputCoin{outCoinOverLimit}\n\t\ttotalResultOutputCoinAmount = outCoinOverLimit.CoinDetails.GetValue()\n\t} else if outCoinOverLimit != nil {\n\t\tremainOutputCoins = append(remainOutputCoins, outCoinOverLimit)\n\t}\n\n\tif totalResultOutputCoinAmount < amount {\n\t\treturn resultOutputCoins, remainOutputCoins, totalResultOutputCoinAmount, errors.New(\"Not enough coin\")\n\t} else {\n\t\treturn resultOutputCoins, remainOutputCoins, totalResultOutputCoinAmount, nil\n\t}\n}", "func run(input string) (interface{}, interface{}) {\n\tlist := pkg.ParseIntList(puzzle, \"\\n\")\n\n\tpart1, part2 := 0, 0\npart1:\n\tfor i, number := range list {\n\t\tif i < 25 {\n\t\t\tcontinue\n\t\t}\n\t\tpreviousNumbers := []int(nil)\n\t\tfor j := i - 1; i-j <= 25; j-- {\n\t\t\tpreviousNumbers = append(previousNumbers, list[j])\n\t\t}\n\t\tfor k, n1 := range previousNumbers {\n\t\t\tfor j, n2 := range previousNumbers {\n\t\t\t\tif k == j {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif n1+n2 == number {\n\t\t\t\t\tcontinue part1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpart1 = number\n\t\tbreak\n\t}\n\ndance:\n\tfor i := 0; i < len(list); i++ {\n\t\tcontiguous := []int(nil)\n\t\tsum := 0\n\t\tfor j := i; j < len(list); j++ {\n\t\t\tif sum == part1 {\n\t\t\t\tpart2 = pkg.Min(contiguous...) + pkg.Max(contiguous...)\n\t\t\t\tbreak dance\n\t\t\t}\n\t\t\tif sum > part1 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tsum += list[j]\n\t\t\tcontiguous = append(contiguous, list[j])\n\t\t}\n\t}\n\n\treturn part1, part2\n}", "func solution(knows func(a int, b int) bool) func(n int) int {\n\treturn func(n int) int {\n\t\ts := &stack{}\n\t\tfor i := 0; i< n; i++ {\n\t\t\ts.push(i)\n\t\t}\n\n\t\t//push them all on stack.\n\t\t//Selectively knock off one by one using one comparision.\n\t\t//if a knows b -> a cant be celebrity but b potentially is.\n\t\t//push b or a accordingly.\n\n\t\t//At the end - have on element left over due eleminations, this may\n\t\t//maynot be the celeb. Do one round of validation before declaring.\n\t\tfor len(*s) > 1 {\n\t\t\ta := s.pop()\n\t\t\tb := s.pop()\n\n\t\t\tif knows(a, b) {\n\t\t\t\ts.push(b)\n\t\t\t} else {\n\t\t\t\ts.push(a)\n\t\t\t}\n\t\t}\n\n\t\tfmt.Printf(\"length: %v\\n\", len(*s))\n\t\t//at this point we expect only one element in stack.\n\t\tc := s.pop()\n\n\n\n\t\t//double check if c is the celebrity.\n\t\tfor i:=0; i< n;i++ {\n\t\t\tif i != c && (knows(c, i) || !knows(i, c)) {\n\t\t\t\treturn -1\n\t\t\t}\n\t\t}\n\t\treturn c\n\t}\n}", "func twoPluses(grid []string) int32 {\n\n\tlargestMultipliedArea := int32(-1)\n\tfor firstPlusRow := 0; firstPlusRow < len(grid); firstPlusRow++ {\n\t\tfor firstPlusColumn := 0; firstPlusColumn < len(grid[firstPlusRow]); firstPlusColumn++ {\n\n\t\t\tfirstPlus := plus{\n\t\t\t\trow: firstPlusRow,\n\t\t\t\tcolumn: firstPlusColumn,\n\t\t\t\tsize: 1,\n\t\t\t}\n\n\t\t\tfor firstPlus.isValid(grid) {\n\t\t\t\tlargestMultipliedArea = analizeSecondPluses(grid, firstPlus, largestMultipliedArea)\n\t\t\t\tfirstPlus.size++\n\t\t\t}\n\t\t}\n\t}\n\treturn largestMultipliedArea\n}", "func main() {\n\tstones := []int{2,7,4,1,8,1}\n\tfmt.Println(lastStoneWeight(stones))\n}", "func distributeCoins(root *TreeNode) int {\n\tres := 0\n\tif root.Left != nil {\n\t\tres += distributeCoins(root.Left)\n\t\troot.Val += root.Left.Val - 1\n\t\tres += int(math.Abs(float64(root.Left.Val - 1)))\n\t}\n\tif root.Right != nil {\n\t\tres += distributeCoins(root.Right)\n\t\troot.Val += root.Right.Val - 1\n\t\tres += int(math.Abs(float64(root.Right.Val - 1)))\n\t}\n\treturn res\n}", "func getMaximumGold(grid [][]int) int {\n m := len(grid)\n n := len(grid[0])\n var ans int\n for i := 0; i<m;i++ {\n for j := 0;j < n; j++ {\n ans = max(ans, dfsGold(grid, m, n, i, j, 0))\n }\n }\n return ans\n}", "func Solution(A []int) int {\n\t// write your code in Go 1.4\n\tif len(A) < 2 {\n\t\treturn 0\n\t}\n\tminPrice := A[0]\n\tmaxProfit := 0\n\tfor i := 1; i < len(A); i++ {\n\t\tcurProfit := A[i] - minPrice\n\t\tif curProfit > 0 {\n\t\t\tif curProfit > maxProfit {\n\t\t\t\tmaxProfit = curProfit\n\t\t\t}\n\t\t} else {\n\t\t\tminPrice = A[i]\n\t\t}\n\t}\n\treturn maxProfit\n}", "func findMax(sum map[int64]int64) int64 {\n\tdx := int64(0)\n\n\tfor _, v := range sum {\n\t\tdx = int64(math.Max(float64(dx), float64(v)))\n\t}\n\treturn dx\n}", "func final(player int, game Game) float32 {\n\tgame.calcScore()\n\tvar MAX float32\n\tMAX = 10000\n\n\tif player == 1 {\n\t\tif game.WhiteCount > game.BlackCount {\n\t\t\treturn MAX\n\t\t} else if game.BlackCount > game.WhiteCount {\n\t\t\treturn -MAX\n\t\t} else {\n\t\t\treturn 0\n\t\t}\n\t} else {\n\t\tif game.WhiteCount > game.BlackCount {\n\t\t\treturn -MAX\n\t\t} else if game.BlackCount > game.WhiteCount {\n\t\t\treturn MAX\n\t\t} else {\n\t\t\treturn 0\n\t\t}\n\t}\n}", "func anneal() board {\n\tb := randomboard()\n\tbbest := make(board, len(b))\n\te, ebest := 100., 100. // unattainably high\n\tfor i := 0; i < n; i++ {\n\t\tx, y := swappair(b)\n\t\tb[x], b[y] = b[y], b[x]\n\t\tif enew := energy(b); enew < e || rand.Float64() < math.Exp((e-enew)/temp(i)) {\n\t\t\tif e = enew; e < ebest {\n\t\t\t\tcopy(bbest, b)\n\t\t\t\tebest = e\n\t\t\t}\n\t\t} else {\n\t\t\tb[x], b[y] = b[y], b[x]\n\t\t}\n\t\tif i%10000 == 0 {\n\t\t\tfmt.Println()\n\t\t\tfmt.Println(i, temp(i), ebest, e)\n\t\t\tfmt.Println(distance(bbest), penalty(bbest), path(bbest))\n\t\t\tfmt.Println(standarddist(bbest), standardpen(bbest), standardpath(bbest))\n\t\t\tdisplay(bbest)\n\t\t}\n\t}\n\treturn bbest\n}", "func hourglassSum(arr [][]int32) int32 {\n\tmax := math.MinInt32\n\tfor i := 0; i < 4; i++ {\n\t\tfor j := 0; j < 4; j++ {\n\t\t\thv := calcHourglass(i, j, arr)\n\t\t\tif max < hv {\n\t\t\t\tmax = hv\n\t\t\t}\n\t\t}\n\t}\n\treturn int32(max)\n}", "func Hailstone(hailNum uint) uint {\n if hailNum % 2 == 0 {\n\t\treturn hailNum / 2\n\t} else {\n\t\treturn 3 * hailNum + 1\n\t}\n}", "func main() {\n\tvar n int\n\tfmt.Scanf(\"%d\", &n)\n\tvar emp []int\n\tempNum := make(map[int]int, 0)\n\tfor i := 0; i < n; i++ {\n\t\tvar num, value int\n\t\tfmt.Scanf(\"%d %d\", &num, &value)\n\t\temp = append(emp, value)\n\t\tempNum[value] = num\n\t}\n\tsort.Ints(emp)\n\t//fmt.Println(emp)\n\t//fmt.Println(empNum)\n\t//fmt.Println(empNum[2])\n\ti := 0\n\tj := len(emp) - 1\n\tmax := 0\n\tfor {\n\t\tif i == j && empNum[emp[i]] == 0 {\n\t\t\tbreak\n\t\t}\n\t\tif empNum[emp[i]] != 0 {\n\t\t\tif empNum[emp[j]] != 0 {\n\t\t\t\ttemp := emp[i] + emp[j]\n\t\t\t\tif temp > max {\n\t\t\t\t\tmax = temp\n\t\t\t\t}\n\t\t\t\tempNum[emp[i]] -= 1\n\t\t\t\tempNum[emp[j]] -= 1\n\t\t\t} else {\n\t\t\t\tj -= 1\n\t\t\t}\n\t\t} else {\n\t\t\ti += 1\n\t\t}\n\t}\n\tfmt.Println(max)\n}", "func scoreACell(x int, y int, myX int, myY int, bombsOnTheFloor []Bomb, myReach int, floor [WIDTH][HEIGHT]int) Cell {\n if (myX != x || myY != y) { // I'm not already standing here\n if !canIBeHere(x, y, 1, bombsOnTheFloor, floor) {return Cell{score: WALL_SCORE, distance: TOO_FAR}} // cannot move to here next turn\n }\n moves, maybe := canIGoToThere(myX, myY, myX, myY, x, y, SEARCH_DEPTH_LIMIT, bombsOnTheFloor, floor)\n if !maybe {return Cell{score: WALL_SCORE, distance: TOO_FAR}} // cannot get here, even after multiple turns\n if willIDieHere(x, y, bombsOnTheFloor, floor) {return Cell{score: DANGER_SCORE, distance: TOO_FAR}} // does not account for time left on the bomb, could optimize here rather than walling it off\n score := 0\n for i := 0; i < myReach; i++ {\n if x+i < WIDTH && floor[x+i][y] >= BOX {score++}\n if x-i > 0 && floor[x-i][y] >= BOX {score++}\n if y+i < HEIGHT && floor[x][y+i] >= BOX {score++}\n if y-i > 0 && floor[x][y-i] >= BOX {score++}\n }\n if floor[x][y] > BOX {score++} // there's an item in the box\n return Cell{score: score, distance: moves}\n}", "func main() {\n\tvar highest int\n\tflag.IntVar(&highest, \"highest\", 1000000, \"highest starting number to test\")\n\tflag.Parse()\n\n\tmaxl, maxn := 1, 1\n\tfor n := highest; n > 1; n-- {\n\t\tl := lenCollatz(n)\n\t\tif l > maxl {\n\t\t\tmaxl = l\n\t\t\tmaxn = n\n\t\t}\n\t}\n\tfmt.Println(maxn)\n}", "func run(input string) (interface{}, interface{}) {\n\telveWeights := parse(input)\n\n\tpart1 := 0\n\tallSums := []int(nil)\n\tfor _, weights := range elveWeights {\n\t\tsum := pkg.Sum(weights...)\n\t\tpart1 = pkg.Max(part1, sum)\n\t\tallSums = append(allSums, sum)\n\t}\n\tsort.Ints(allSums)\n\tlastIndex := len(allSums) - 1\n\tpart2 := allSums[lastIndex] + allSums[lastIndex-1] + allSums[lastIndex-2]\n\n\treturn part1, part2\n}", "func main() {\n\tvar N int\n\tfmt.Scan(&N)\n\n\thorses := make([]int, N)\n\tfor i := 0; i < N; i++ {\n\t\tfmt.Scan(&(horses[i]))\n\t}\n\n\tsort.Ints(horses)\n\n\tminD := 10*1000*1000\n\tfor i := 0; i < N-1; i++ {\n\t\tif dist := horses[i+1]-horses[i]; dist < minD {\n\t\t\tminD = dist\n\t\t}\n\t}\n\t// fmt.Fprintln(os.Stderr, \"Debug messages...\")\n\tfmt.Println(minD)// Write answer to stdout\n}", "func candy(ratings []int) int {\n\tcount := make([]int, len(ratings))\n\tfor i := 0; i < len(ratings); i++ {\n\t\tcount[i] = 1\n\t}\n\tfor i := 1; i < len(ratings); i++ {\n\t\tif ratings[i] > ratings[i-1] {\n\t\t\tcount[i] = count[i-1] + 1\n\t\t}\n\t}\n\tfor i := len(ratings) - 1; i > 0; i-- {\n\t\tif ratings[i] < ratings[i-1] {\n\t\t\tcount[i-1] = max(count[i-1], count[i]+1)\n\t\t}\n\t}\n\ttotal := 0\n\tfor i := 0; i < len(ratings); i++ {\n\t\ttotal += count[i]\n\t}\n\treturn total\n}", "func numWaterBottles(num int, div int) int {\r\n ans := num\r\n for num >= div {\r\n quo := num / div\r\n rem := num % div\r\n num = quo + rem\r\n ans += quo\r\n }\r\n return ans\r\n}", "func sum(m int) int {\n\tn := int(maxNumber / m)\n\tsum := (2*m + m*(n-1)) * n / 2\n\n\treturn sum\n}" ]
[ "0.7070159", "0.67680085", "0.66695875", "0.59136283", "0.58412707", "0.5839606", "0.5818655", "0.578436", "0.57372403", "0.5655534", "0.56279695", "0.55743253", "0.5572545", "0.55705416", "0.55077547", "0.5506742", "0.54897684", "0.5483888", "0.5447041", "0.54136544", "0.54012984", "0.5388288", "0.5359922", "0.53530204", "0.5352912", "0.53373533", "0.53135604", "0.52886885", "0.5281462", "0.52785087", "0.5270073", "0.5259385", "0.524097", "0.5238683", "0.5223895", "0.5222006", "0.5209063", "0.5194026", "0.5186433", "0.51778454", "0.5176494", "0.5111173", "0.5084599", "0.50710857", "0.50696665", "0.50643694", "0.5060695", "0.5045048", "0.50424224", "0.5008615", "0.4980576", "0.49758977", "0.49748215", "0.49499467", "0.49428645", "0.4941764", "0.49381736", "0.49238813", "0.4921079", "0.49205944", "0.49128857", "0.49109784", "0.4902834", "0.4882338", "0.4871921", "0.48719192", "0.48707542", "0.4852386", "0.48420808", "0.48419696", "0.48402366", "0.48368058", "0.4827451", "0.481817", "0.48140097", "0.48130217", "0.48077843", "0.48074174", "0.4807355", "0.48071727", "0.48056787", "0.47977316", "0.47965097", "0.4790729", "0.47845298", "0.47793883", "0.4768581", "0.47678834", "0.4765244", "0.4764703", "0.47627026", "0.47477797", "0.4741359", "0.4740544", "0.4739488", "0.47383574", "0.47371292", "0.47301924", "0.47278786", "0.47205344" ]
0.5534484
14
The token for which to mint tokens. If token does not exist, transaction results in INVALID_TOKEN_ID
func (transaction *TokenMintTransaction) SetTokenID(tokenID TokenID) *TokenMintTransaction { transaction.requireNotFrozen() transaction.pb.Token = tokenID.toProtobuf() return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (_ERC20HecoManager *ERC20HecoManagerTransactor) MintToken(opts *bind.TransactOpts, heco20Token common.Address, amount *big.Int, recipient common.Address, receiptId [32]byte) (*types.Transaction, error) {\n\treturn _ERC20HecoManager.contract.Transact(opts, \"mintToken\", heco20Token, amount, recipient, receiptId)\n}", "func (_ERC20HecoManager *ERC20HecoManagerSession) MintToken(heco20Token common.Address, amount *big.Int, recipient common.Address, receiptId [32]byte) (*types.Transaction, error) {\n\treturn _ERC20HecoManager.Contract.MintToken(&_ERC20HecoManager.TransactOpts, heco20Token, amount, recipient, receiptId)\n}", "func (_ERC20HecoManager *ERC20HecoManagerTransactorSession) MintToken(heco20Token common.Address, amount *big.Int, recipient common.Address, receiptId [32]byte) (*types.Transaction, error) {\n\treturn _ERC20HecoManager.Contract.MintToken(&_ERC20HecoManager.TransactOpts, heco20Token, amount, recipient, receiptId)\n}", "func (a *Client) MintToken(params *MintTokenParams) (*MintTokenOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewMintTokenParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"mintToken\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/asset/tokens/{symbol}/mints\",\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: &MintTokenReader{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.(*MintTokenOK)\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 mintToken: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (p gceTokenProvider) mintIDToken(ctx context.Context) (*Token, error) {\n\tv := url.Values{\n\t\t\"audience\": []string{p.audience},\n\t\t\"format\": []string{\"full\"}, // include VM instance info into claims\n\t}\n\turlSuffix := fmt.Sprintf(\"instance/service-accounts/%s/identity?%s\", p.account, v.Encode())\n\ttoken, err := metadataClient.Get(urlSuffix)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"auth/gce: metadata server call failed\").Tag(transient.Tag).Err()\n\t}\n\n\tclaims, err := ParseIDTokenClaims(token)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"auth/gce: metadata server returned invalid ID token\").Err()\n\t}\n\n\treturn &Token{\n\t\tToken: oauth2.Token{\n\t\t\tTokenType: \"Bearer\",\n\t\t\tAccessToken: NoAccessToken,\n\t\t\tExpiry: time.Unix(claims.Exp, 0),\n\t\t},\n\t\tIDToken: token,\n\t\tEmail: p.Email(),\n\t}, nil\n}", "func (s *Service) Token(ctx context.Context, phone string, password string) (token string, err error) {\n\n\tvar id int64\n\tvar hash string\n\n\tsql1 := `SELECT id, password FROM managers WHERE phone = $1;`\n\terr = s.pool.QueryRow(ctx, sql1, phone).Scan(&id, &hash)\n\n\tif err == pgx.ErrNoRows {\n\t\treturn \"\", ErrNoSuchUser\n\t}\n\n\tif err != nil {\n\t\treturn \"\", ErrInternal\n\t}\n\n\terr = bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))\n\tif err != nil {\n\t\treturn \"\", ErrInvalidPassword\n\t}\n\n\tbuffer := make([]byte, 256)\n\tn, err := rand.Read(buffer)\n\tif n != len(buffer) || err != nil {\n\t\treturn \"\", ErrInternal\n\t}\n\n\ttoken = hex.EncodeToString(buffer)\n\tsql2 := `INSERT INTO managers_tokens (token, manager_id) VALUES($1, $2);`\n\t_, err = s.pool.Exec(ctx, sql2, token, id)\n\tif err != nil {\n\t\treturn \"\", ErrInternal\n\t}\n\treturn token, nil\n}", "func (r SlpMint) TokenID() []byte {\n\treturn r.tokenID\n}", "func CheckTheValidityOfTheToken(token string) (newToken string, err error) {\n\n err = checkInit()\n if err != nil {\n return\n }\n\n err = createError(011)\n\n if v, ok := tokens[token]; ok {\n var expires = v.(map[string]interface{})[\"expires\"].(time.Time)\n var userID = v.(map[string]interface{})[\"id\"].(string)\n\n if expires.Sub(time.Now().Local()) < 0 {\n return\n }\n\n newToken = setToken(userID, token)\n\n err = nil\n\n } else {\n return\n }\n\n return\n}", "func (r SlpGenesis) TokenID() []byte {\n\treturn nil\n}", "func (transaction *TokenUpdateTransaction) GetTokenID() TokenID {\n\tif transaction.tokenID == nil {\n\t\treturn TokenID{}\n\t}\n\n\treturn *transaction.tokenID\n}", "func (m *TokenBase) Token() *token32 {\n\treturn m.token\n}", "func Token(g *gin.Context) {\n\tlog.Println(\"token\")\n\tclientIdStr, ok := g.GetQuery(\"client_id\")\n\tif !ok {\n\t\tg.JSON(400, \"error\")\n\t\treturn\n\t}\n\n\tclientId, err := strconv.Atoi(clientIdStr)\n\tif err != nil {\n\t\tg.JSON(400, \"error\")\n\t\treturn\n\t}\n\n\t// 需要验证 secret id\n\t// ...\n\n\tauthCode := g.Query(\"auth\")\n\tif store[clientId].AuthCode != authCode {\n\t\tg.JSON(400, \"error\")\n\t\treturn\n\t}\n\n\ttoken := \"this.\" + authCode + \".test\"\n\n\tg.JSON(200, token)\n}", "func (_Token *TokenSession) Token() (common.Address, error) {\n\treturn _Token.Contract.Token(&_Token.CallOpts)\n}", "func NewTokenTransaction(tx *EthereumTx, tShortcut, tRecipient string, tValue *big.Int) *TokenTx {\n\ttokenTx := &TokenTx{\n\t\tEthereumTx: tx,\n\t\tTokenShortcut: tShortcut,\n\t\tTokenTo: tRecipient,\n\t\tTokenValue: tValue,\n\t}\n\treturn tokenTx\n}", "func (s *Service) IDByToken(ctx context.Context, token string) (int64, error) {\n\n\tvar id int64\n\tsql := `SELECT manager_id FROM managers_tokens WHERE token = $1;`\n\terr := s.pool.QueryRow(ctx, sql, token).Scan(&id)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tif err == pgx.ErrNoRows {\n\t\t\treturn 0, nil\n\t\t}\n\t\treturn 0, nil\n\t}\n\treturn id, nil\n}", "func Token(config *config.SubmitConfig) (string, error) {\n\ttokenbytes, err := ioutil.ReadFile(filepath.Join(pathutil.UserHomeDir(), \".paddle\", \"token_cache\"))\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"previous token not found, fetching a new one...\\n\")\n\t\t// Authenticate to the cloud endpoint\n\t\tauthJSON := map[string]string{}\n\t\tauthJSON[\"username\"] = config.ActiveConfig.Username\n\t\tauthJSON[\"password\"] = config.ActiveConfig.Password\n\t\tauthStr, _ := json.Marshal(authJSON)\n\t\tbody, err := getToken(config.ActiveConfig.Endpoint+\"/api-token-auth/\", authStr)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tvar respObj interface{}\n\t\tif errJSON := json.Unmarshal(body, &respObj); errJSON != nil {\n\t\t\treturn \"\", errJSON\n\t\t}\n\t\ttokenStr := respObj.(map[string]interface{})[\"token\"].(string)\n\t\terr = ioutil.WriteFile(filepath.Join(pathutil.UserHomeDir(), \".paddle\", \"token_cache\"), []byte(tokenStr), 0600)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"write cache token file error: %v\", err)\n\t\t}\n\t\t// Ignore write token error, fetch a new one next time\n\t\treturn tokenStr, nil\n\t}\n\treturn string(tokenbytes), nil\n}", "func (_MintableToken *MintableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_Token *TokenTransactor) Mint(opts *bind.TransactOpts, account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"mint\", account, amount)\n}", "func (s *reuseTokenSource) Token() (*Token, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.t.Valid() {\n\t\treturn s.t, nil\n\t}\n\tt, err := s.new.Token()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.t = t\n\treturn t, nil\n}", "func (tm *IAMTokenManager) requestToken() (*IAMTokenInfo, error) {\n\tbuilder := NewRequestBuilder(POST).\n\t\tConstructHTTPURL(tm.iamURL, nil, nil)\n\n\tbuilder.AddHeader(CONTENT_TYPE, DEFAULT_CONTENT_TYPE).\n\t\tAddHeader(Accept, APPLICATION_JSON)\n\n\tbuilder.AddFormData(\"grant_type\", \"\", \"\", REQUEST_TOKEN_GRANT_TYPE).\n\t\tAddFormData(\"apikey\", \"\", \"\", tm.iamAPIkey).\n\t\tAddFormData(\"response_type\", \"\", \"\", REQUEST_TOKEN_RESPONSE_TYPE)\n\n\treq, err := builder.Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.SetBasicAuth(tm.iamClientId, tm.iamClientSecret)\n\n\tresp, err := tm.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\tif resp != nil {\n\t\t\tbuff := new(bytes.Buffer)\n\t\t\tbuff.ReadFrom(resp.Body)\n\t\t\treturn nil, fmt.Errorf(buff.String())\n\t\t}\n\t}\n\n\ttokenInfo := IAMTokenInfo{}\n\tjson.NewDecoder(resp.Body).Decode(&tokenInfo)\n\tdefer resp.Body.Close()\n\treturn &tokenInfo, nil\n}", "func (ts *Source) Token() (*oauth2.Token, error) {\n\tif !ts.token.Valid() {\n\t\tts.Log(ts.mask, \"[TKN] token is not valid, it has probably expired\")\n\t\tif err := ts.refreshToken(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := ts.saveToken(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn ts.token, nil\n}", "func (p *gceTokenProvider) mintAccessToken(ctx context.Context) (*Token, error) {\n\ttokenJSON, err := metadataClient.Get(\"instance/service-accounts/\" + p.account + \"/token\")\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"auth/gce: metadata server call failed\").Tag(transient.Tag).Err()\n\t}\n\n\tvar res struct {\n\t\tAccessToken string `json:\"access_token\"`\n\t\tExpiresInSec int `json:\"expires_in\"`\n\t\tTokenType string `json:\"token_type\"`\n\t}\n\tswitch err = json.NewDecoder(strings.NewReader(tokenJSON)).Decode(&res); {\n\tcase err != nil:\n\t\treturn nil, errors.Annotate(err, \"auth/gce: invalid token JSON from metadata\").Tag(transient.Tag).Err()\n\tcase res.ExpiresInSec == 0 || res.AccessToken == \"\":\n\t\treturn nil, errors.Reason(\"auth/gce: incomplete token received from metadata\").Tag(transient.Tag).Err()\n\t}\n\n\ttok := oauth2.Token{\n\t\tAccessToken: res.AccessToken,\n\t\tTokenType: res.TokenType,\n\t\tExpiry: clock.Now(ctx).Add(time.Duration(res.ExpiresInSec) * time.Second),\n\t}\n\n\treturn &Token{\n\t\t// Replicate the hidden magic state added by computeSource.Token().\n\t\tToken: *tok.WithExtra(map[string]any{\n\t\t\t\"oauth2.google.tokenSource\": \"compute-metadata\",\n\t\t\t\"oauth2.google.serviceAccount\": p.account,\n\t\t}),\n\t\tIDToken: NoIDToken,\n\t\tEmail: p.Email(),\n\t}, nil\n}", "func (_Token *TokenCaller) Token(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"token\")\n\treturn *ret0, err\n}", "func (fts ErroringTokenSource) Token() (*oauth2.Token, error) {\n\treturn nil, errors.New(\"intentional error\")\n}", "func Token() (string, error) {\n\treturn generate(32)\n}", "func (k Keeper) EditToken(ctx sdk.Context, msg types.MsgEditToken) (sdk.Tags, sdk.Error) {\n\t// get the destination token\n\ttoken, exist := k.getToken(ctx, msg.TokenId)\n\tif !exist {\n\t\treturn nil, types.ErrAssetNotExists(k.codespace, fmt.Sprintf(\"token %s does not exist\", msg.TokenId))\n\t}\n\n\tif token.Source == types.GATEWAY {\n\t\tgateway, _ := k.GetGateway(ctx, token.Gateway)\n\t\ttoken.Owner = gateway.Owner\n\t}\n\n\tif !msg.Owner.Equals(token.Owner) {\n\t\treturn nil, types.ErrInvalidOwner(k.codespace, fmt.Sprintf(\"the address %d is not the owner of the token %s\", msg.Owner, msg.TokenId))\n\t}\n\n\thasIssuedAmt, found := k.bk.GetTotalSupply(ctx, token.GetDenom())\n\tif !found {\n\t\treturn nil, types.ErrAssetNotExists(k.codespace, fmt.Sprintf(\"token denom %s does not exist\", token.GetDenom()))\n\t}\n\n\tmaxSupply := sdk.NewIntWithDecimal(int64(msg.MaxSupply), int(token.Decimal))\n\tif maxSupply.GT(sdk.ZeroInt()) && (maxSupply.LT(hasIssuedAmt.Amount) || maxSupply.GT(token.MaxSupply)) {\n\t\treturn nil, types.ErrInvalidAssetMaxSupply(k.codespace, fmt.Sprintf(\"max supply must not be less than %s and greater than %s\", hasIssuedAmt.Amount.String(), token.MaxSupply.String()))\n\t}\n\n\tif msg.Name != types.DoNotModify {\n\t\ttoken.Name = msg.Name\n\t}\n\n\tif msg.CanonicalSymbol != types.DoNotModify && token.Source != types.NATIVE {\n\t\ttoken.CanonicalSymbol = msg.CanonicalSymbol\n\t}\n\tif msg.MinUnitAlias != types.DoNotModify {\n\t\ttoken.MinUnitAlias = msg.MinUnitAlias\n\t}\n\tif maxSupply.GT(sdk.ZeroInt()) {\n\t\ttoken.MaxSupply = maxSupply\n\t}\n\tif msg.Mintable != types.Nil {\n\t\ttoken.Mintable = msg.Mintable.ToBool()\n\t}\n\n\tif err := k.SetToken(ctx, token); err != nil {\n\t\treturn nil, err\n\t}\n\n\teditTags := sdk.NewTags(\n\t\ttypes.TagId, []byte(msg.TokenId),\n\t)\n\n\treturn editTags, nil\n}", "func (k Keeper) IssueToken(ctx sdk.Context, token types.FungibleToken) (sdk.Tags, sdk.Error) {\n\tif token.GetSource() == types.GATEWAY {\n\t\tgateway, err := k.GetGateway(ctx, token.GetGateway())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif !gateway.Owner.Equals(token.GetOwner()) {\n\t\t\treturn nil, types.ErrUnauthorizedIssueGatewayAsset(k.codespace,\n\t\t\t\tfmt.Sprintf(\"Gateway %s token can only be created by %s, unauthorized creator %s\",\n\t\t\t\t\tgateway.Moniker, gateway.Owner, token.GetOwner()))\n\t\t}\n\t}\n\ttoken, owner, err := k.AddToken(ctx, token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinitialSupply := sdk.NewCoin(token.GetDenom(), token.GetInitSupply())\n\t// for native and gateway tokens\n\tif owner != nil {\n\t\t// Add coins into owner's account\n\t\t_, _, err := k.bk.AddCoins(ctx, owner, sdk.Coins{initialSupply})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Set total supply\n\tk.bk.SetTotalSupply(ctx, initialSupply)\n\tif initialSupply.Amount.GT(sdk.ZeroInt()) {\n\t\tctx.CoinFlowTags().AppendCoinFlowTag(ctx, owner.String(), owner.String(), initialSupply.String(), sdk.IssueTokenFlow, \"\")\n\t}\n\n\tcreateTags := sdk.NewTags(\n\t\ttypes.TagId, []byte(token.GetUniqueID()),\n\t\ttypes.TagDenom, []byte(token.GetDenom()),\n\t\ttypes.TagSource, []byte(token.GetSource().String()),\n\t\ttypes.TagGateway, []byte(token.GetGateway()),\n\t\ttypes.TagOwner, []byte(token.GetOwner().String()),\n\t)\n\n\treturn createTags, nil\n}", "func (_IncreasingPriceCrowdsaleImpl *IncreasingPriceCrowdsaleImplSession) Token() (common.Address, error) {\n\treturn _IncreasingPriceCrowdsaleImpl.Contract.Token(&_IncreasingPriceCrowdsaleImpl.CallOpts)\n}", "func (r SlpSend) TokenID() []byte {\n\treturn r.tokenID\n}", "func (_LifToken *LifTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LifToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_IndividuallyCappedCrowdsaleImpl *IndividuallyCappedCrowdsaleImplCaller) Token(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IndividuallyCappedCrowdsaleImpl.contract.Call(opts, out, \"token\")\n\treturn *ret0, err\n}", "func (_ERC721 *ERC721Session) TokenByIndex(index *big.Int) (*big.Int, error) {\n\treturn _ERC721.Contract.TokenByIndex(&_ERC721.CallOpts, index)\n}", "func (_Token *TokenCallerSession) Token() (common.Address, error) {\n\treturn _Token.Contract.Token(&_Token.CallOpts)\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken, err := t.TokenGenerator.GetWithSTS(context.Background(), t.ClusterID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating token: %w\", err)\n\t}\n\treturn &oauth2.Token{\n\t\tAccessToken: token.Token,\n\t\tExpiry: token.Expiration.Add(-t.Leeway),\n\t}, nil\n}", "func (t *tokenSource) Token() (*oauth2.Token, error) {\n\treturn t.token, nil\n}", "func (t *tokenSource) Token() (*oauth2.Token, error) {\n\treturn t.token, nil\n}", "func (_IndividuallyCappedCrowdsaleImpl *IndividuallyCappedCrowdsaleImplSession) Token() (common.Address, error) {\n\treturn _IndividuallyCappedCrowdsaleImpl.Contract.Token(&_IndividuallyCappedCrowdsaleImpl.CallOpts)\n}", "func ValidateTransactionToken(tokenTransactionObj transaction.DigitalwalletTransaction) (string, bool) {\n\n\tvar errorfound string\n\n\tif len(tokenTransactionObj.TokenID) != globalPkg.GlobalObj.TokenIDStringFixedLength {\n\t\terrorfound = fmt.Sprintf(\"token ID must be equal to %v characters\", globalPkg.GlobalObj.TokenIDStringFixedLength)\n\t\treturn errorfound, false\n\t}\n\tif tokenTransactionObj.Amount < 1 {\n\t\treturn \"please make sure amount is more than zero\", false\n\t}\n\t//validate fields not fields\n\tif tokenTransactionObj.Receiver == \"\" || tokenTransactionObj.TokenID == \"\" ||\n\t\ttokenTransactionObj.Amount == 0.0 || tokenTransactionObj.Signature == \"\" || tokenTransactionObj.Time.IsZero() {\n\t\terrorfound = \"please enter required data Sender PK, Receiver PK, TokenID,Amount , Sender, Signature\"\n\t\treturn errorfound, false\n\t}\n\n\tfirstaccount := accountdb.GetFirstAccount()\n\tif tokenTransactionObj.Sender == \"\" && firstaccount.AccountPublicKey != tokenTransactionObj.Receiver {\n\t\treturn \"Please check the sender address\", false\n\t}\n\n\tif tokenTransactionObj.Receiver == tokenTransactionObj.Sender {\n\t\terrorfound = \"Sender public key can't be the same as Receiver public key\"\n\t\treturn errorfound, false\n\t}\n\t//validate send signature < 200\n\tif len(tokenTransactionObj.Signature) < 100 && len(tokenTransactionObj.Signature) >= 200 {\n\t\terrorfound = \"Sender sign must be more than 100 and less than 200 characters\"\n\t\treturn errorfound, false\n\t}\n\n\ttokenObj := token.FindTokenByid(tokenTransactionObj.TokenID)\n\treceiverExist := false // check for reciver exist in list of user PK\n\n\t//check on token type is private type that reciever pk allowed to use it and exist in userPKs array.\n\tif tokenObj.TokenType == \"private\" {\n\t\tfor _, uPK := range tokenObj.UserPublicKey {\n\t\t\tif tokenTransactionObj.Receiver == uPK {\n\t\t\t\treceiverExist = true\n\t\t\t}\n\t\t}\n\t} else {\n\t\treceiverExist = true\n\t}\n\tif receiverExist == false {\n\t\terrorfound = \"the receiver is not allowed to use this token\"\n\t\treturn errorfound, false\n\t}\n\tdecimals := strings.Split(fmt.Sprintf(\"%f\", tokenTransactionObj.Amount), \".\")[1]\n\tif len(decimals) > 6 {\n\t\treturn \"Please check the transaction's amount decimals, maximum number of decimals is 6.\", false\n\t}\n\n\terrorfound = ValidateTransaction(tokenTransactionObj)\n\tif errorfound != \"\" {\n\t\treturn errorfound, false\n\t}\n\n\treturn \"\", true\n}", "func (src *tokenProvider) token() (string, error) {\n\ttoken, err := src.tokenSource.Token()\n\tif err != nil {\n\t\treturn \"\", errors.New(\"fcm: failed to generate Bearer token\")\n\t}\n\treturn token.AccessToken, nil\n}", "func (_IncreasingPriceCrowdsaleImpl *IncreasingPriceCrowdsaleImplCaller) Token(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IncreasingPriceCrowdsaleImpl.contract.Call(opts, out, \"token\")\n\treturn *ret0, err\n}", "func (c *contract) mint(ctx sdk.Context, address []byte, value uint64) error {\n\t// TODO: add logic only the owner can call this method\n\t// TODO: add logic if all tokens were minted already\n\n\t// Mint the value number of tokens to the given address\n\treturn c.State.WriteUint64ByAddress(ctx, address, value)\n}", "func (_MintableToken *MintableTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.Contract.Mint(&_MintableToken.TransactOpts, _to, _amount)\n}", "func ValidateToken(accessToken string) (userID string, err error) {\n\n if accessToken == \"\" {\n return \"\", errors.New(\"invalid accessToken\")\n }\n\n db, err := bolt.Open(DB_NAME, 0600, nil)\n if err != nil {\n panic(err)\n }\n defer db.Close()\n\n err = db.View(func(tx *bolt.Tx) error {\n b := tx.Bucket([]byte(TOKEN_BUCKET))\n\n v := b.Get([]byte(accessToken))\n if v == nil {\n return errors.New(\"invalid accessToken\")\n }\n\n var token Token\n if err := json.Unmarshal(v, &token); err != nil {\n return errors.New(\"invalid accessToken (failed parsing JSON from database)\")\n }\n\n //TODO: validate TTL of token\n\n userID = token.UserID\n\n return nil\n })\n\n if err != nil {\n userID = \"\"\n }\n\n return userID, err\n}", "func (_IncreasingPriceCrowdsale *IncreasingPriceCrowdsaleSession) Token() (common.Address, error) {\n\treturn _IncreasingPriceCrowdsale.Contract.Token(&_IncreasingPriceCrowdsale.CallOpts)\n}", "func (_CraftingI *CraftingISession) TokenByIndex(index *big.Int) (*big.Int, error) {\n\treturn _CraftingI.Contract.TokenByIndex(&_CraftingI.CallOpts, index)\n}", "func (_Token *TokenSession) Mint(account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Mint(&_Token.TransactOpts, account, amount)\n}", "func (_ElvToken *ElvTokenTransactor) Mint(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ElvToken.contract.Transact(opts, \"mint\", to, value)\n}", "func (_Contract *ContractSession) TokenByIndex(_index *big.Int) (*big.Int, error) {\n\treturn _Contract.Contract.TokenByIndex(&_Contract.CallOpts, _index)\n}", "func (_CraftingI *CraftingICallerSession) TokenByIndex(index *big.Int) (*big.Int, error) {\n\treturn _CraftingI.Contract.TokenByIndex(&_CraftingI.CallOpts, index)\n}", "func (c *Client) Token(ctx context.Context, r TokenRequest) (*TokenReply, error) {\r\n\treq, err := http.NewRequestWithContext(\r\n\t\tctx,\r\n\t\thttp.MethodGet,\r\n\t\tfmt.Sprintf(\"%s/%s\", c.getTokenBaseEndpoint(r.AccountID, r.ChannelID), r.TokenID),\r\n\t\tnil,\r\n\t)\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tres := TokenReply{}\r\n\tif err := c.sendRequest(req, &res); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn &res, nil\r\n}", "func (s *notifyRefreshTokenSource) Token() (*oauth2.Token, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.t.Valid() {\n\t\treturn s.t, nil\n\t}\n\tt, err := s.new.Token()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.t = t\n\treturn t, s.f(t)\n}", "func (_CrToken *CrTokenSession) Mint(mintAmount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.Contract.Mint(&_CrToken.TransactOpts, mintAmount)\n}", "func (_IncreasingPriceCrowdsaleImpl *IncreasingPriceCrowdsaleImplCallerSession) Token() (common.Address, error) {\n\treturn _IncreasingPriceCrowdsaleImpl.Contract.Token(&_IncreasingPriceCrowdsaleImpl.CallOpts)\n}", "func GetToken(parentDin string) string {\n key := genTokenKey(parentDin, GateWayTokenKey)\n token, err := model.RedisClient.Get(key).Result()\n log.WithFields(log.Fields{\n \"key\": key,\n \"parendDin\": parentDin,\n \"token\": token,\n }).Info(\"get token by parentDin\")\n if token == \"\" || parentDin == \"\" {\n // get a new token\n data := TxLogin()\n if data[\"token\"] == nil {\n log.Error(\"[TXAPI] Get token error\")\n }\n token = data[\"token\"].(string)\n saveToken(data[\"token\"].(string), data[\"expiryTime\"].(int64), parentDin)\n }else if err != nil {\n log.Error(\"Get redis value error\", err)\n }else{\n }\n return token\n}", "func (_FinalizableCrowdsaleImpl *FinalizableCrowdsaleImplSession) Token() (common.Address, error) {\n\treturn _FinalizableCrowdsaleImpl.Contract.Token(&_FinalizableCrowdsaleImpl.CallOpts)\n}", "func (a *Client) Token(params *TokenParams) (*TokenOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewTokenParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Token\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/v1/oauth2/token\",\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: &TokenReader{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.(*TokenOK), nil\n\n}", "func (apnian Apnian) Token() (*token.Token, error) {\n\tauthKey, err := apnian.AuthKey()\n\tif err != nil {\n\t\treturn &token.Token{}, err\n\t}\n\treturn &token.Token{\n\t\tAuthKey: authKey,\n\t\tKeyID: apnian.APNSKeyID,\n\t\tTeamID: apnian.TeamID,\n\t}, nil\n}", "func (_Token *TokenTransactor) TokenToTokenTransferInput(opts *bind.TransactOpts, tokens_sold *big.Int, min_tokens_bought *big.Int, min_eth_bought *big.Int, deadline *big.Int, recipient common.Address, token_addr common.Address) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"tokenToTokenTransferInput\", tokens_sold, min_tokens_bought, min_eth_bought, deadline, recipient, token_addr)\n}", "func (_MintableToken *MintableTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.Contract.Mint(&_MintableToken.TransactOpts, _to, _amount)\n}", "func SimulateMintToken(k keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper) simtypes.Operation {\n\treturn func(\n\t\tr *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,\n\t\taccs []simtypes.Account, chainID string,\n\t) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {\n\n\t\ttoken, maxFee := selectToken(ctx, k, ak, bk, true)\n\t\tsimToAccount, _ := simtypes.RandomAcc(r, accs)\n\n\t\tmsg := types.NewMsgMintToken(token.GetSymbol(), token.GetOwnerString(), simToAccount.Address.String(), 100)\n\n\t\townerAccount, found := simtypes.FindAccount(accs, token.GetOwner())\n\t\tif !found {\n\t\t\treturn simtypes.NoOpMsg(types.ModuleName, msg.Type(), fmt.Sprintf(\"account[%s] does not found\", token.GetOwnerString())), \n\t\t\t\tnil, fmt.Errorf(\"account[%s] does not found\", token.GetOwnerString())\n\t\t}\n\n\t\towner, _ := sdk.AccAddressFromBech32(msg.Owner)\n\t\taccount := ak.GetAccount(ctx, owner)\n\t\tfees, err := simtypes.RandomFees(r, ctx, maxFee)\n\t\tif err != nil {\n\t\t\treturn simtypes.NoOpMsg(types.ModuleName, msg.Type(), \"unable to generate fees\"), nil, err\n\t\t}\n\n\t\ttxGen := simappparams.MakeTestEncodingConfig().TxConfig\n\t\ttx, err := helpers.GenTx(\n\t\t\ttxGen,\n\t\t\t[]sdk.Msg{msg},\n\t\t\tfees,\n\t\t\thelpers.DefaultGenTxGas,\n\t\t\tchainID,\n\t\t\t[]uint64{account.GetAccountNumber()},\n\t\t\t[]uint64{account.GetSequence()},\n\t\t\townerAccount.PrivKey,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn simtypes.NoOpMsg(types.ModuleName, msg.Type(), \"unable to generate mock tx\"), nil, err\n\t\t}\n\n\t\tif _, _, err = app.Deliver(txGen.TxEncoder(), tx); err != nil {\n\t\t\treturn simtypes.NoOpMsg(types.ModuleName, msg.Type(), \"unable to deliver tx\"), nil, err\n\t\t}\n\n\t\treturn simtypes.NewOperationMsg(msg, true, \"simulate mint token\"), nil, nil\n\t}\n}", "func Token() (token string, err error) {\n\ttokenFile, err := ioutil.ReadFile(\"API/models/telegram/token.txt\")\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(tokenFile), nil\n}", "func (_Token *TokenTransactorSession) TokenToTokenTransferInput(tokens_sold *big.Int, min_tokens_bought *big.Int, min_eth_bought *big.Int, deadline *big.Int, recipient common.Address, token_addr common.Address) (*types.Transaction, error) {\n\treturn _Token.Contract.TokenToTokenTransferInput(&_Token.TransactOpts, tokens_sold, min_tokens_bought, min_eth_bought, deadline, recipient, token_addr)\n}", "func (k Keeper) GetToken(ctx sdk.Context, denom string) (types.TokenI, error) {\n\t// query token by symbol\n\tif token, err := k.getTokenBySymbol(ctx, denom); err == nil {\n\t\treturn &token, nil\n\t}\n\n\t// query token by min unit\n\tif token, err := k.getTokenByMinUnit(ctx, denom); err == nil {\n\t\treturn &token, nil\n\t}\n\n\treturn nil, sdkerrors.Wrapf(types.ErrTokenNotExists, \"token: %s does not exist\", denom)\n}", "func (s *StoreNotifyingSource) Token() (*oauth2.Token, error) {\n\tt, err := s.src.Token()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = s.store.Save(t)\n\treturn t, err\n}", "func (m *SessionMutation) Token() (r string, exists bool) {\n\tv := m.token\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (_BurnableToken *BurnableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_Token *TokenTransactorSession) Mint(account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Mint(&_Token.TransactOpts, account, amount)\n}", "func (_Token *TokenSession) TokenToTokenTransferInput(tokens_sold *big.Int, min_tokens_bought *big.Int, min_eth_bought *big.Int, deadline *big.Int, recipient common.Address, token_addr common.Address) (*types.Transaction, error) {\n\treturn _Token.Contract.TokenToTokenTransferInput(&_Token.TransactOpts, tokens_sold, min_tokens_bought, min_eth_bought, deadline, recipient, token_addr)\n}", "func (_IndividuallyCappedCrowdsaleImpl *IndividuallyCappedCrowdsaleImplCallerSession) Token() (common.Address, error) {\n\treturn _IndividuallyCappedCrowdsaleImpl.Contract.Token(&_IndividuallyCappedCrowdsaleImpl.CallOpts)\n}", "func (this *TokenClient) TransferToken(keyjson []byte, pwd string, toAddress string, val *big.Int) (txHash string, err error) {\n\tif this.invalidAddress(toAddress) {\n\t\treturn \"\", invalidAddrErr\n\t}\n\topts, err := bind.NewTransactor(strings.NewReader(string(keyjson)), pwd)\n\tif err != nil {\n\t\treturn\n\t}\n\topts.GasLimit = GAS_LIMIT\n\ttx, err := this.token.Transfer(opts, common.HexToAddress(toAddress), val)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn fmt.Sprintf(\"%x\", tx.Hash()), nil\n}", "func (_ElvTradableLocal *ElvTradableLocalTransactor) MintWithTokenURI(opts *bind.TransactOpts, to common.Address, tokenId *big.Int, tokenURI string) (*types.Transaction, error) {\n\treturn _ElvTradableLocal.contract.Transact(opts, \"mintWithTokenURI\", to, tokenId, tokenURI)\n}", "func (_FinalizableCrowdsaleImpl *FinalizableCrowdsaleImplCaller) Token(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _FinalizableCrowdsaleImpl.contract.Call(opts, out, \"token\")\n\treturn *ret0, err\n}", "func (_ERC721 *ERC721CallerSession) TokenByIndex(index *big.Int) (*big.Int, error) {\n\treturn _ERC721.Contract.TokenByIndex(&_ERC721.CallOpts, index)\n}", "func (_Rootchain *RootchainTransactorSession) AddToken(_token common.Address) (*types.Transaction, error) {\n\treturn _Rootchain.Contract.AddToken(&_Rootchain.TransactOpts, _token)\n}", "func (_IncreasingPriceCrowdsale *IncreasingPriceCrowdsaleCaller) Token(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _IncreasingPriceCrowdsale.contract.Call(opts, out, \"token\")\n\treturn *ret0, err\n}", "func (_CrToken *CrTokenTransactor) Mint(opts *bind.TransactOpts, mintAmount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.contract.Transact(opts, \"mint\", mintAmount)\n}", "func (c *Client) Token() string {\n\tc.modifyLock.RLock()\n\tdefer c.modifyLock.RUnlock()\n\treturn c.token\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken := &oauth2.Token{\n\t\tAccessToken: t.AccessToken,\n\t}\n\treturn token, nil\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken := &oauth2.Token{\n\t\tAccessToken: t.AccessToken,\n\t}\n\treturn token, nil\n}", "func (_RefundableCrowdsale *RefundableCrowdsaleSession) Token() (common.Address, error) {\n\treturn _RefundableCrowdsale.Contract.Token(&_RefundableCrowdsale.CallOpts)\n}", "func (_Vault *VaultCallerSession) ETHTOKEN() (common.Address, error) {\n\treturn _Vault.Contract.ETHTOKEN(&_Vault.CallOpts)\n}", "func (k Keeper) AddToken(ctx sdk.Context, token types.FungibleToken) (types.FungibleToken, sdk.AccAddress, sdk.Error) {\n\ttoken.Sanitize()\n\ttokenId, err := types.GetTokenID(token.GetSource(), token.GetSymbol(), token.GetGateway())\n\tif err != nil {\n\t\treturn token, nil, err\n\t}\n\tif k.HasToken(ctx, tokenId) {\n\t\treturn token, nil, types.ErrAssetAlreadyExists(k.codespace, fmt.Sprintf(\"token already exists: %s\", token.GetUniqueID()))\n\t}\n\n\tvar owner sdk.AccAddress\n\tif token.GetSource() == types.GATEWAY {\n\t\tgateway, err := k.GetGateway(ctx, token.GetGateway())\n\t\tif err != nil {\n\t\t\treturn token, nil, err\n\t\t}\n\t\towner = gateway.Owner\n\t} else if token.GetSource() == types.NATIVE {\n\t\towner = token.GetOwner()\n\t\ttoken.CanonicalSymbol = \"\"\n\t\ttoken.Gateway = \"\"\n\t}\n\n\terr = k.SetToken(ctx, token)\n\tif err != nil {\n\t\treturn token, nil, err\n\t}\n\n\t// Set token to be prefixed with owner and source\n\tif token.GetSource() == types.NATIVE {\n\t\terr = k.SetTokens(ctx, owner, token)\n\t\tif err != nil {\n\t\t\treturn token, nil, err\n\t\t}\n\t}\n\n\t// Set token to be prefixed with source\n\terr = k.SetTokens(ctx, sdk.AccAddress{}, token)\n\tif err != nil {\n\t\treturn token, nil, err\n\t}\n\n\treturn token, owner, nil\n}", "func (_CrToken *CrTokenTransactorSession) Mint(mintAmount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.Contract.Mint(&_CrToken.TransactOpts, mintAmount)\n}", "func (s *Signer) identityToken(ctx context.Context) (string, error) {\n\ttok := s.options.IdentityToken\n\tif s.options.PrivateKeyPath == \"\" && s.options.IdentityToken == \"\" {\n\t\t// We only attempt to pull from the providers if the option is set\n\t\tif !s.options.EnableTokenProviders {\n\t\t\ts.log().Warn(\"No token set in options and OIDC providers are disabled\")\n\t\t\treturn \"\", nil\n\t\t}\n\n\t\ts.log().Info(\"No identity token was provided. Attempting to get one from supported providers.\")\n\t\ttoken, err := s.impl.TokenFromProviders(ctx, s.log())\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"getting identity token from providers: %w\", err)\n\t\t}\n\t\ttok = token\n\t}\n\treturn tok, nil\n}", "func (_ElvTradable *ElvTradableTransactor) MintWithTokenURI(opts *bind.TransactOpts, to common.Address, tokenId *big.Int, tokenURI string) (*types.Transaction, error) {\n\treturn _ElvTradable.contract.Transact(opts, \"mintWithTokenURI\", to, tokenId, tokenURI)\n}", "func (m *VppToken) GetToken()(*string) {\n return m.token\n}", "func (r ApiIntrospectOAuth2TokenRequest) Token(token string) ApiIntrospectOAuth2TokenRequest {\n\tr.token = &token\n\treturn r\n}", "func (ts *apiTokenSource) Token() (*oauth2.Token, error) {\n\tts.m.Lock()\n\tdefer ts.m.Unlock()\n\tif ts.token.Valid() {\n\t\treturn ts.token, nil\n\t}\n\n\tresp, err := ts.requestToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := ts.treatResponseBody(resp.Body); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ts.token, nil\n}", "func (_IncreasingPriceCrowdsale *IncreasingPriceCrowdsaleCallerSession) Token() (common.Address, error) {\n\treturn _IncreasingPriceCrowdsale.Contract.Token(&_IncreasingPriceCrowdsale.CallOpts)\n}", "func (_Cakevault *CakevaultSession) Token() (common.Address, error) {\n\treturn _Cakevault.Contract.Token(&_Cakevault.CallOpts)\n}", "func (_Vault *VaultSession) ETHTOKEN() (common.Address, error) {\n\treturn _Vault.Contract.ETHTOKEN(&_Vault.CallOpts)\n}", "func (_BREMICO *BREMICOCaller) Token(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BREMICO.contract.Call(opts, out, \"token\")\n\treturn *ret0, err\n}", "func (_Contract *ContractCallerSession) TokenByIndex(_index *big.Int) (*big.Int, error) {\n\treturn _Contract.Contract.TokenByIndex(&_Contract.CallOpts, _index)\n}", "func TokenForID(tx db.Tx, id db.ID) (string, error) {\n\tmac, err := getMac(tx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbytes := id.Bytes()\n\n\tmac.Write(bytes)\n\tbytesMac := mac.Sum(nil)\n\tbinaryToken := append(bytes, bytesMac...)\n\ttoken := base64.StdEncoding.EncodeToString(binaryToken)\n\treturn token, nil\n}", "func (_LifToken *LifTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LifToken.Contract.Mint(&_LifToken.TransactOpts, _to, _amount)\n}", "func (a *API) Token(w http.ResponseWriter, r *http.Request) error {\n\tctx := r.Context()\n\tgrantType := r.FormValue(\"grant_type\")\n\n\tswitch grantType {\n\tcase \"password\":\n\t\treturn a.ResourceOwnerPasswordGrant(ctx, w, r)\n\tcase \"refresh_token\":\n\t\treturn a.RefreshTokenGrant(ctx, w, r)\n\tcase \"id_token\":\n\t\treturn a.IdTokenGrant(ctx, w, r)\n\tdefault:\n\t\treturn oauthError(\"unsupported_grant_type\", \"\")\n\t}\n}", "func (_MainnetCryptoCardsContract *MainnetCryptoCardsContractSession) TokenByIndex(index *big.Int) (*big.Int, error) {\n\treturn _MainnetCryptoCardsContract.Contract.TokenByIndex(&_MainnetCryptoCardsContract.CallOpts, index)\n}", "func validateTransactionToken(tokenTransactionObj transaction.DigitalwalletTransaction) (string, bool) {\n\n\tvar errorfound string\n\n\t//validate token id ==100\n\t//if len(tokenTransactionObj.TokenID) != 100 {\n\t//\terrorfound = \"token ID must be 100 characters\"\n\t//\treturn errorfound, false\n\t//}\n\t//validate fields not fields\n\tif tokenTransactionObj.Sender == \"\" || tokenTransactionObj.Amount == 0.0 || tokenTransactionObj.Signature == \"\" {\n\t\terrorfound = \"please enter required data Sender PK,Receiver PK,Amount,Sender sign\"\n\t\treturn errorfound, false\n\t}\n\n\t//validate send signature ==200\n\t//if len(tokenTransactionObj.Signature) != 200 {\n\t//\terrorfound = \"Sender sign must be 200 characters\"\n\t//\treturn errorfound, false\n\t//}\n\n\terrorfound = transactionModule.ValidateTransaction(tokenTransactionObj)\n\tif errorfound != \"\" {\n\t\treturn errorfound, false\n\t}\n\n\treturn \"\", true\n}", "func (_Vault *VaultCaller) ETHTOKEN(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Vault.contract.Call(opts, out, \"ETH_TOKEN\")\n\treturn *ret0, err\n}", "func (_TTFT20 *TTFT20Transactor) MintTokens(opts *bind.TransactOpts, receiver common.Address, tokens *big.Int, txid string) (*types.Transaction, error) {\n\treturn _TTFT20.contract.Transact(opts, \"mintTokens\", receiver, tokens, txid)\n}", "func (s *Service) Token(str string) string {\n\ts.h.Reset()\n\tfmt.Fprintf(s.h, \"%s%s\", str, strconv.Itoa(time.Now().Nanosecond()))\n\treturn fmt.Sprintf(\"%x\", s.h.Sum(nil))\n}" ]
[ "0.70080817", "0.6840295", "0.6801648", "0.6758438", "0.64863616", "0.63597983", "0.6293659", "0.6266456", "0.6210955", "0.61586887", "0.6132703", "0.6062685", "0.60555106", "0.60202605", "0.60021436", "0.5972471", "0.5940508", "0.59365976", "0.5927095", "0.59081125", "0.59022415", "0.589917", "0.5880008", "0.58761775", "0.5867602", "0.58513117", "0.58492136", "0.58336705", "0.58245623", "0.5822311", "0.58188474", "0.58145237", "0.5796775", "0.57925093", "0.57901883", "0.57901883", "0.5788646", "0.57784843", "0.5777545", "0.57696766", "0.5759161", "0.57508236", "0.5749955", "0.5748817", "0.57487386", "0.57476246", "0.57445574", "0.57382876", "0.5732807", "0.57282764", "0.5726669", "0.57252145", "0.57144403", "0.571049", "0.57092506", "0.57084763", "0.5707754", "0.57039034", "0.56982607", "0.56922996", "0.5673986", "0.5673616", "0.56729746", "0.56710345", "0.5669778", "0.56677663", "0.56662", "0.5662243", "0.5654731", "0.5654289", "0.56482124", "0.5647365", "0.5646121", "0.56428295", "0.5642068", "0.5640284", "0.5628524", "0.56222075", "0.56222075", "0.56157947", "0.56142217", "0.5598938", "0.55905044", "0.5588903", "0.55870724", "0.558361", "0.5582002", "0.55806065", "0.5580588", "0.55802083", "0.5579034", "0.5577887", "0.5572018", "0.5571123", "0.55663675", "0.5564985", "0.5559625", "0.5558593", "0.5551308", "0.5550769", "0.5544839" ]
0.0
-1
The amount to mint from the Treasury Account. Amount must be a positive nonzero number, not bigger than the token balance of the treasury account (0; balance], represented in the lowest denomination.
func (transaction *TokenMintTransaction) SetAmount(amount uint64) *TokenMintTransaction { transaction.requireNotFrozen() transaction.pb.Amount = amount return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (tb *TokenBucket) Amount() uint32 {\n\ttb.mx.Lock()\n\tdefer tb.mx.Unlock()\n\n\treturn tb.currentAmount\n}", "func Mint(ctx contractapi.TransactionContextInterface, amount int) error {\n\n\t// Get ID of submitting client identity\n\tminter, err := ctx.GetClientIdentity().GetID()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get client id: %v\", err)\n\t}\n\n\tif amount <= 0 {\n\t\treturn fmt.Errorf(\"mint amount must be a positive integer\")\n\t}\n\n\tcurrentBalanceBytes, err := ctx.GetStub().GetState(minter)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read minter account %s from world state: %v\", minter, err)\n\t}\n\n\tvar currentBalance int\n\n\t// If minter current balance doesn't yet exist, we'll create it with a current balance of 0\n\tif currentBalanceBytes == nil {\n\t\tcurrentBalance = 0\n\t} else {\n\t\tcurrentBalance, _ = strconv.Atoi(string(currentBalanceBytes)) // Error handling not needed since Itoa() was used when setting the account balance, guaranteeing it was an integer.\n\t}\n\n\tupdatedBalance := currentBalance + amount\n\n\terr = ctx.GetStub().PutState(minter, []byte(strconv.Itoa(updatedBalance)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update the totalSupply\n\ttotalSupplyBytes, err := ctx.GetStub().GetState(totalSupplyKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve total token supply: %v\", err)\n\t}\n\n\tvar totalSupply int\n\n\t// If no tokens have been minted, initialize the totalSupply\n\tif totalSupplyBytes == nil {\n\t\ttotalSupply = 0\n\t} else {\n\t\ttotalSupply, _ = strconv.Atoi(string(totalSupplyBytes)) // Error handling not needed since Itoa() was used when setting the totalSupply, guaranteeing it was an integer.\n\t}\n\n\t// Add the mint amount to the total supply and update the state\n\ttotalSupply += amount\n\terr = ctx.GetStub().PutState(totalSupplyKey, []byte(strconv.Itoa(totalSupply)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Emit the Transfer event\n\ttransferEvent := event{\"0x0\", minter, amount}\n\ttransferEventJSON, err := json.Marshal(transferEvent)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to obtain JSON encoding: %v\", err)\n\t}\n\terr = ctx.GetStub().SetEvent(\"Transfer\", transferEventJSON)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to set event: %v\", err)\n\t}\n\n\tlog.Printf(\"minter account %s balance updated from %d to %d\", minter, currentBalance, updatedBalance)\n\n\treturn nil\n}", "func (_Token *TokenTransactor) Mint(opts *bind.TransactOpts, account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"mint\", account, amount)\n}", "func (r *RelayType) Amount(tx *types.Transaction) (int64, error) {\r\n\tdata, err := r.DecodePayload(tx)\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\trelay := data.(*RelayAction)\r\n\tif RelayActionCreate == relay.Ty && relay.GetCreate() != nil {\r\n\t\treturn int64(relay.GetCreate().BtyAmount), nil\r\n\t}\r\n\treturn 0, nil\r\n}", "func (_BurnableToken *BurnableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_CrToken *CrTokenTransactor) Mint(opts *bind.TransactOpts, mintAmount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.contract.Transact(opts, \"mint\", mintAmount)\n}", "func (_Token *TokenTransactorSession) Mint(account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Mint(&_Token.TransactOpts, account, amount)\n}", "func (_CrToken *CrTokenTransactorSession) Mint(mintAmount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.Contract.Mint(&_CrToken.TransactOpts, mintAmount)\n}", "func (ds *DepositToStake) Amount() *big.Int { return ds.amount }", "func (c *contract) mint(ctx sdk.Context, address []byte, value uint64) error {\n\t// TODO: add logic only the owner can call this method\n\t// TODO: add logic if all tokens were minted already\n\n\t// Mint the value number of tokens to the given address\n\treturn c.State.WriteUint64ByAddress(ctx, address, value)\n}", "func (_CrToken *CrTokenSession) Mint(mintAmount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.Contract.Mint(&_CrToken.TransactOpts, mintAmount)\n}", "func (_Token *TokenSession) Mint(account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Mint(&_Token.TransactOpts, account, amount)\n}", "func (_ElvToken *ElvTokenTransactor) Mint(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ElvToken.contract.Transact(opts, \"mint\", to, value)\n}", "func (t *TX) Amount() uint64 {\n\ts := strings.Split(t.Quantity, \" \")\n\tf, _ := strconv.ParseFloat(s[0], 64)\n\treturn uint64(f * 1e4)\n}", "func (_DetailedTestToken *DetailedTestTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _DetailedTestToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (del Delegation) Amount() (hexutil.Big, error) {\n\t// get the base amount delegated\n\tbase, err := repository.R().DelegationAmountStaked(&del.Address, del.Delegation.ToStakerId)\n\tif err != nil {\n\t\treturn hexutil.Big{}, err\n\t}\n\n\t// get the sum of all pending withdrawals\n\twd, err := del.pendingWithdrawalsValue()\n\tif err != nil {\n\t\treturn hexutil.Big{}, err\n\t}\n\tval := new(big.Int).Add(base, wd)\n\treturn (hexutil.Big)(*val), nil\n}", "func (_BurnableToken *BurnableTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Mint(&_BurnableToken.TransactOpts, _to, _amount)\n}", "func (_MintableToken *MintableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_BurnableToken *BurnableTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Mint(&_BurnableToken.TransactOpts, _to, _amount)\n}", "func (h *ATMHandler) HandleWithdrawAmount(w http.ResponseWriter, r *http.Request) {\n\ttokenString := r.Header.Get(\"token\")\n\ttoken, err := uuid.Parse(tokenString)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tvar depositRequest AmountATMRequest\n\tjson.Unmarshal(body, &depositRequest)\n\tbalance, atmErr := h.ATMClient.WithdrawMoney(r.Context(), token, depositRequest.Amount)\n\tif atmErr != nil {\n\t\tif atmErr.IsAuthenticated() {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\tresponse := BalanceResponse{\n\t\tBalance: balance,\n\t}\n\tb, _ := json.Marshal(response)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprint(w, string(b))\n}", "func (dtv *DailyTrxVolume) Amount() hexutil.Big {\n\tval := new(big.Int).Mul(new(big.Int).SetInt64(dtv.DailyTrxVolume.AmountAdjusted), types.TransactionDecimalsCorrection)\n\treturn hexutil.Big(*val)\n}", "func (_BREMToken *BREMTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BREMToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (v *Valve) AddTxCredit(n int64) int64 { return atomic.AddInt64(v.txCredit, n) }", "func (_LifToken *LifTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LifToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (del Delegation) Amount() (hexutil.Big, error) {\n\t// lazy load data\n\tif del.extendedAmount == nil {\n\t\tvar err error\n\n\t\t// try to load the data\n\t\tdel.extendedAmount, del.extendedAmountInWithdraw, err = del.repo.DelegatedAmountExtended(&del.Delegation)\n\t\tif err != nil {\n\t\t\treturn hexutil.Big{}, err\n\t\t}\n\t}\n\n\treturn (hexutil.Big)(*del.extendedAmount), nil\n}", "func (m *Money) Amount() int {\n\treturn m.amount\n}", "func (_Lelecoin *LelecoinTransactor) Mint(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Lelecoin.contract.Transact(opts, \"mint\", to, value)\n}", "func (h *ATMHandler) HandleDepositAmount(w http.ResponseWriter, r *http.Request) {\n\ttokenString := r.Header.Get(\"token\")\n\ttoken, err := uuid.Parse(tokenString)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tvar depositRequest AmountATMRequest\n\tjson.Unmarshal(body, &depositRequest)\n\tbalance, atmErr := h.ATMClient.DepositMoney(r.Context(), token, depositRequest.Amount)\n\tif atmErr != nil {\n\t\tif atmErr.IsAuthenticated() {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\tresponse := BalanceResponse{\n\t\tBalance: balance,\n\t}\n\tb, _ := json.Marshal(response)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprint(w, string(b))\n}", "func (m *Money) Gett() int64 {\n\treturn m.M / DP\n}", "func (wlt *WhitelistableToken) egMint(address, amount string) (uint64, error) {\n\t// method\n\ttransferFnSignature := []byte(\"mint(address,uint256)\")\n\thash := sha3.NewLegacyKeccak256()\n\thash.Write(transferFnSignature)\n\tmethodID := hash.Sum(nil)[:4]\n\n\t// address\n\taddr := common.HexToAddress(address)\n\tpaddedAddress := common.LeftPadBytes(addr.Bytes(), 32)\n\n\t// amount\n\tamountBN := new(big.Int)\n\tamountBN.SetString(amount, 10)\n\tpaddedAmount := common.LeftPadBytes(amountBN.Bytes(), 32)\n\n\tvar data []byte\n\tdata = append(data, methodID...)\n\tdata = append(data, paddedAddress...)\n\tdata = append(data, paddedAmount...)\n\n\tgasLimit, err := wlt.EthClient.EstimateGas(context.Background(), ethereum.CallMsg{\n\t\tFrom: *wlt.CallerAddres,\n\t\tTo: wlt.ContractAddress,\n\t\tData: data,\n\t})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn gasLimit, nil\n}", "func Burn(ctx contractapi.TransactionContextInterface, amount int) error {\n\n\t// Check minter authorization - this sample assumes Org1 is the central banker with privilege to burn new tokens\n\tclientMSPID, err := ctx.GetClientIdentity().GetMSPID()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get MSPID: %v\", err)\n\t}\n\tif clientMSPID != \"Org1MSP\" {\n\t\treturn fmt.Errorf(\"client is not authorized to mint new tokens\")\n\t}\n\n\t// Get ID of submitting client identity\n\tburner, err := ctx.GetClientIdentity().GetID()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get client id: %v\", err)\n\t}\n\n\tif amount <= 0 {\n\t\treturn errors.New(\"burn amount must be a positive integer\")\n\t}\n\n\tcurrentBalanceBytes, err := ctx.GetStub().GetState(burner)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read burner account %s from world state: %v\", burner, err)\n\t}\n\n\tvar currentBalance int\n\n\t// Check if burner current balance exists\n\tif currentBalanceBytes == nil {\n\t\treturn errors.New(\"the balance does not exist\")\n\t}\n\n\tcurrentBalance, _ = strconv.Atoi(string(currentBalanceBytes)) // Error handling not needed since Itoa() was used when setting the account balance, guaranteeing it was an integer.\n\n\tupdatedBalance := currentBalance - amount\n\n\terr = ctx.GetStub().PutState(burner, []byte(strconv.Itoa(updatedBalance)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update the totalSupply\n\ttotalSupplyBytes, err := ctx.GetStub().GetState(totalSupplyKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve total token supply: %v\", err)\n\t}\n\n\t// If no tokens have been burned, throw error\n\tif totalSupplyBytes == nil {\n\t\treturn errors.New(\"totalSupply does not exist\")\n\t}\n\n\ttotalSupply, _ := strconv.Atoi(string(totalSupplyBytes)) // Error handling not needed since Itoa() was used when setting the totalSupply, guaranteeing it was an integer.\n\n\t// Subtract the burn amount to the total supply and update the state\n\ttotalSupply -= amount\n\terr = ctx.GetStub().PutState(totalSupplyKey, []byte(strconv.Itoa(totalSupply)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Emit the Transfer event\n\ttransferEvent := event{burner, \"0x0\", amount}\n\ttransferEventJSON, err := json.Marshal(transferEvent)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to obtain JSON encoding: %v\", err)\n\t}\n\terr = ctx.GetStub().SetEvent(\"Transfer\", transferEventJSON)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to set event: %v\", err)\n\t}\n\n\tlog.Printf(\"burner account %s balance updated from %d to %d\", burner, currentBalance, updatedBalance)\n\n\treturn nil\n}", "func (b *Budget) Amount(month time.Month, year int) (float64, bool) {\n\tamt, ok := b.months[monthsKey(month, year)]\n\treturn amt, ok\n}", "func (f *HubTransactor) Mint(opts *bind.TransactOpts, iERC20TokenContract common.Address, fromCosmosAddress string, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn f.contract.Transact(opts, \"mint\", iERC20TokenContract, fromCosmosAddress, recipient, amount)\n}", "func (entry *UtxoEntry) Amount() int64 {\n\treturn entry.amount\n}", "func (_MintableToken *MintableTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.Contract.Mint(&_MintableToken.TransactOpts, _to, _amount)\n}", "func (_BREMToken *BREMTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BREMToken.Contract.Mint(&_BREMToken.TransactOpts, _to, _amount)\n}", "func (_MintableToken *MintableTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.Contract.Mint(&_MintableToken.TransactOpts, _to, _amount)\n}", "func (_Bep20 *Bep20Transactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _Bep20.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_DetailedTestToken *DetailedTestTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _DetailedTestToken.Contract.Mint(&_DetailedTestToken.TransactOpts, _to, _amount)\n}", "func (l *Loan) Amount() int64 {\n\treturn l.amount\n}", "func (acc Account) Credit(amount uint) uint {\n\t// convert incoming amount into cents and add to account balance\n\treturn (amount * 100) + acc.AvailableBalance\n}", "func transferAmount(operatorAccountID hedera.AccountID, targetAccountID hedera.AccountID, amount int64){\n\toperatorSecret, err := hedera.SecretKeyFromString(secret)\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\tclient, err := hedera.Dial(server)\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\tclient.SetNode(hedera.AccountID{Account: 3})\n\tclient.SetOperator(operatorAccountID, func() hedera.SecretKey{\n\t\treturn operatorSecret\n\t})\n\tdefer client.Close()\n\topBalance, err := client.Account(operatorAccountID).Balance().Get()\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\ttargBalance, err := client.Account(targetAccountID).Balance().Get()\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Target Balance: %v\\nOp Balance %v\\n\",targBalance, opBalance)\n\n\tnodeAccountID := hedera.AccountID{Account: 3}\n\tresponse, err := client.TransferCrypto().Transfer(operatorAccountID, (0-amount) ).Transfer(targetAccountID, amount).Operator(operatorAccountID).Node(nodeAccountID).Memo(\"Test transfer 1 to 2\").Sign(operatorSecret).Sign(operatorSecret).Execute()\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\n\ttransId := response.ID\n\tfmt.Printf(\"transferred; transaction = %v\\n\", transId)\n\n\ttime.Sleep(2* time.Second)\n\n\treceipt, err := client.Transaction(*transId).Receipt().Get()\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\n\tif receipt.Status != hedera.StatusSuccess{\n\t\tpanic(fmt.Errorf(\"Transaction was not successful: %v\", receipt.Status.String()))\n\t}\n\ttime.Sleep(2*time.Second)\n\n\ttargBalance, err = client.Account(targetAccountID).Balance().Get()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\topBalance,err = client.Account(operatorAccountID).Balance().Get()\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Target Balance: %v\\nOp Balance %v\\n\",targBalance, opBalance)\n\n\n}", "func (t *Transaction) GetAmount() float32 {\n\treturn t.amount\n}", "func (_IERC20Minter *IERC20MinterTransactor) Mint(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _IERC20Minter.contract.Transact(opts, \"mint\", to, amount)\n}", "func (_Token *TokenTransactorSession) Burn(amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Burn(&_Token.TransactOpts, amount)\n}", "func (_BREMToken *BREMTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BREMToken.Contract.Mint(&_BREMToken.TransactOpts, _to, _amount)\n}", "func (_Harberger *HarbergerTransactor) Mint(opts *bind.TransactOpts, _metaURI string, _tax *big.Int) (*types.Transaction, error) {\n\treturn _Harberger.contract.Transact(opts, \"mint\", _metaURI, _tax)\n}", "func (_Crowdsale *CrowdsaleCaller) AccountEthAmount(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Crowdsale.contract.Call(opts, out, \"accountEthAmount\", arg0)\n\treturn *ret0, err\n}", "func (_ERC20HecoManager *ERC20HecoManagerTransactor) MintToken(opts *bind.TransactOpts, heco20Token common.Address, amount *big.Int, recipient common.Address, receiptId [32]byte) (*types.Transaction, error) {\n\treturn _ERC20HecoManager.contract.Transact(opts, \"mintToken\", heco20Token, amount, recipient, receiptId)\n}", "func Credit(block consensus.Block, account []byte, delta *RTU) error {\n\tbytes, _ := block.Lookup(account)\n\tcurrVal := BytesToRtu(bytes)\n\tnewVal := currVal.Uint64() + delta.Uint64()\n\tblock.Update(account, Uint64ToRtu(newVal).Bytes())\n//\tif val, err := block.Lookup(account); err == nil && len(val) > 0 {\n//\t\tcurrVal = core.BytesToByte8(val).Uint64()\n////\t\tstrVal = string(val)\n//\t}\n////\tvar value, delta uint64\n////\tvar err error\n////\tif value, err = strconv.ParseUint(strVal, 10, 64); err != nil {\n////\t\treturn err\n////\t}\n//\tif delta, err := strconv.ParseUint(amount, 10, 64); err != nil {\n//\t\treturn err\n//\t} else {\n//\t\tcurrVal += delta\n//\t\tblock.Update(account, core.Uint64ToByte8(currVal).Bytes())\n//\t}\n////\tvalue += delta\n////\tstrVal = strconv.FormatUint(value, 10)\n////\tblock.Update(account, []byte(strVal))\n\treturn nil\n}", "func (m Money) Amount() decimal.Decimal {\n\treturn m.amount\n}", "func (_DetailedTestToken *DetailedTestTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _DetailedTestToken.Contract.Mint(&_DetailedTestToken.TransactOpts, _to, _amount)\n}", "func (otu *OutboundTransactionUpdate) AddAmount(u uint) *OutboundTransactionUpdate {\n\totu.mutation.AddAmount(u)\n\treturn otu\n}", "func (_LifToken *LifTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LifToken.Contract.Mint(&_LifToken.TransactOpts, _to, _amount)\n}", "func (p *Params) ConvertAmount(value float64) int64 {\n\tsign := int64(1)\n\tif value < 0 {\n\t\tsign = -1\n\t}\n\tf := value * float64(p.Token)\n\ti := int64(f)\n\trem := (f - float64(i)) * float64(sign)\n\tif rem > 0.5 || rem == 0.5 && i*sign%2 == 1 {\n\t\ti += sign\n\t}\n\treturn i\n}", "func (_ERC721Contract *ERC721ContractTransactor) Mint(opts *bind.TransactOpts, _owner common.Address, _tokenId *big.Int, _approvedAddress common.Address, _metadata string) (*types.Transaction, error) {\n\treturn _ERC721Contract.contract.Transact(opts, \"mint\", _owner, _tokenId, _approvedAddress, _metadata)\n}", "func (_Erc20Mock *Erc20MockTransactor) Mint(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Erc20Mock.contract.Transact(opts, \"mint\", to, value)\n}", "func (otu *OutboundTransactionUpdate) SetAmount(u uint) *OutboundTransactionUpdate {\n\totu.mutation.ResetAmount()\n\totu.mutation.SetAmount(u)\n\treturn otu\n}", "func (_Token *TokenTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Transfer(&_Token.TransactOpts, recipient, amount)\n}", "func (m *ProviderTerms) GetAmount() (amount int64) {\n\tprice := m.GetPrice()\n\tif price > 0 {\n\t\tamount = price * m.GetVolume()\n\t\tif minCost := m.GetMinCost(); amount < minCost {\n\t\t\tamount = minCost\n\t\t}\n\t}\n\n\treturn amount\n}", "func (_Token *TokenSession) Burn(amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Burn(&_Token.TransactOpts, amount)\n}", "func (op *GenericOperation) TransactionAmount() *big.Int {\n\tif op.Kind() != opKindTransaction {\n\t\treturn nil\n\t}\n\treturn op.parseSerializedNumberOffset(4)\n}", "func (_Bindings *BindingsTransactor) Mint(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Bindings.contract.Transact(opts, \"mint\")\n}", "func (_Crowdsale *CrowdsaleCallerSession) AccountEthAmount(arg0 common.Address) (*big.Int, error) {\n\treturn _Crowdsale.Contract.AccountEthAmount(&_Crowdsale.CallOpts, arg0)\n}", "func (_ERC20Mintable *ERC20MintableTransactor) Mint(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Mintable.contract.Transact(opts, \"mint\", to, value)\n}", "func Transfer(\n\tnonce uint64, contract, to common.Address,\n\tamount, gasLimit, gasPrice *big.Int) *types.Transaction {\n\n\tpayload, err := PackParams(\"transfer\", to, amount)\n\tif err != nil {\n\t\tlog.Errorf(\"Token.PackParams error %+v\", err)\n\t\treturn nil\n\t}\n\treturn types.NewTransaction(nonce, contract, big.NewInt(0), gasLimit, gasPrice, payload)\n}", "func (otuo *OutboundTransactionUpdateOne) AddAmount(u uint) *OutboundTransactionUpdateOne {\n\totuo.mutation.AddAmount(u)\n\treturn otuo\n}", "func (_ERC20Capped *ERC20CappedTransactor) Mint(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Capped.contract.Transact(opts, \"mint\", to, value)\n}", "func (_CrToken *CrTokenTransactorSession) Transfer(dst common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.Contract.Transfer(&_CrToken.TransactOpts, dst, amount)\n}", "func (_Crowdsale *CrowdsaleSession) AccountEthAmount(arg0 common.Address) (*big.Int, error) {\n\treturn _Crowdsale.Contract.AccountEthAmount(&_Crowdsale.CallOpts, arg0)\n}", "func (_Token *TokenTransactor) Burn(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"burn\", amount)\n}", "func (m *AgedAccountsPayable) GetCurrentAmount()(*float64) {\n val, err := m.GetBackingStore().Get(\"currentAmount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*float64)\n }\n return nil\n}", "func (_IERC721Minter *IERC721MinterTransactor) Mint(opts *bind.TransactOpts, to common.Address, tokenURI string) (*types.Transaction, error) {\n\treturn _IERC721Minter.contract.Transact(opts, \"mint\", to, tokenURI)\n}", "func (_LifToken *LifTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LifToken.Contract.Mint(&_LifToken.TransactOpts, _to, _amount)\n}", "func (wallet *Wallet) Transfer(nonce, to, amount, gasPrice, gasLimits string) (string, error) {\n\n\tamountBigInt, err := readBigint(amount)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn wallet.createTxData(to, nonce, gasPrice, gasLimits, (*ethgo.Value)(amountBigInt), nil)\n}", "func (p *Pinger) SetAmt(amt int) int {\r\n\tp.amt = amt\r\n\treturn amt\r\n}", "func (app *specificTokenCodeBuilder) WithAmount(amount string) SpecificTokenCodeBuilder {\n\tapp.amount = amount\n\treturn app\n}", "func (_Token *TokenSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Transfer(&_Token.TransactOpts, recipient, amount)\n}", "func (s *stateObject) SetAmount(amount *big.Int) {\n\ts.account.Amount = amount\n\ts.dirty = true\n}", "func getMoneyAmount(n int) int {\n \n}", "func PaymentAmount(response http.ResponseWriter, request *http.Request) {\n\tif assertMethod(response, request, http.MethodGet) {\n\t\tparams := request.URL.Query()\n\t\tprincipal, err := currency.Parse(params.Get(\"askingPrice\"))\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(response, \"Invalid asking price %v (reason: %v)\", params.Get(\"askingPrice\"), err)\n\t\t}\n\t\tpaymentYears, err := currency.Parse(params.Get(\"paymentSchedule\"))\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(response, \"Invalid payment schedule %v (reason: %v)\", params.Get(\"paymentSchedule\"), err)\n\t\t}\n\n\t\tvar yearlyInterest float32 = 0.05\n\t\t// yearDuration := time.Hour * 24 * 365\n\t\tperiods := 12 * uint32(paymentYears)\n\t\tresponse.Header().Add(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tfmt.Fprintf(response, \"<tt>mortgage.CalculatePayments(%v, %v, %v)</tt>\", currency.UAmount(principal), yearlyInterest/float32(periods), periods)\n\t\tpayment := mortgage.CalculatePayments(currency.UAmount(principal), yearlyInterest/12, periods)\n\t\tfmt.Fprintf(response, \"You are paying <tt>%v</tt> over <tt>%v</tt> periods.\", payment, periods)\n\t}\n\n}", "func (_BurnableToken *BurnableTokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Transfer(&_BurnableToken.TransactOpts, _to, _value)\n}", "func (_BurnableToken *BurnableTokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Transfer(&_BurnableToken.TransactOpts, _to, _value)\n}", "func InputTreeBurntFunds(ctx context.Context, store cbor.IpldStore, stateRootIn cid.Cid) (abi.TokenAmount, error) {\n\tadtStore := adt.WrapStore(ctx, store)\n\tactorsIn, err := states0.LoadTree(adtStore, stateRootIn)\n\tif err != nil {\n\t\treturn big.Zero(), err\n\t}\n\tbf, found, err := actorsIn.GetActor(builtin0.BurntFundsActorAddr)\n\tif err != nil {\n\t\treturn big.Zero(), err\n\t}\n\tif !found {\n\t\treturn big.Zero(), xerrors.Errorf(\"burnt funds actor not found\")\n\t}\n\treturn bf.Balance, nil\n}", "func (_ERC721 *ERC721Transactor) Mint(opts *bind.TransactOpts, _to common.Address, _tokenId *big.Int) (*types.Transaction, error) {\n\treturn _ERC721.contract.Transact(opts, \"mint\", _to, _tokenId)\n}", "func (_StakingToken *StakingTokenTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _StakingToken.Contract.Transfer(&_StakingToken.TransactOpts, recipient, amount)\n}", "func (m *Money) Value() int64 {\n\treturn m.M\n}", "func (_BurnableToken *BurnableTokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.contract.Transact(opts, \"transfer\", _to, _value)\n}", "func (_BurnableToken *BurnableTokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.contract.Transact(opts, \"transfer\", _to, _value)\n}", "func (otuo *OutboundTransactionUpdateOne) SetAmount(u uint) *OutboundTransactionUpdateOne {\n\totuo.mutation.ResetAmount()\n\totuo.mutation.SetAmount(u)\n\treturn otuo\n}", "func (_BurnableToken *BurnableTokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Transfer(&_BurnableToken.TransactOpts, _to, _value)\n}", "func (_BurnableToken *BurnableTokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Transfer(&_BurnableToken.TransactOpts, _to, _value)\n}", "func (f *HubTransactorSession) Mint(iERC20TokenContract common.Address, fromCosmosAddress string, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn f.Contract.Mint(&f.TransactOpts, iERC20TokenContract, fromCosmosAddress, recipient, amount)\n}", "func (_ProjectWalletAuthoriser *ProjectWalletAuthoriserTransactorSession) Transfer(_sender common.Address, _receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _ProjectWalletAuthoriser.Contract.Transfer(&_ProjectWalletAuthoriser.TransactOpts, _sender, _receiver, _amt)\n}", "func (_Token *TokenTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "func (b *Budget) SetAmount(month time.Month, year int, amount float64) {\n\tb.months[monthsKey(month, year)] = amount\n}", "func (walletAPI *WalletAPI) WalletBalance(ctx context.Context, addr address.Address) (abi.TokenAmount, error) {\n\tact, err := walletAPI.wallet.Chain.API().GetActor(ctx, addr)\n\tif err == types.ErrActorNotFound {\n\t\treturn abi.NewTokenAmount(0), nil\n\t} else if err != nil {\n\t\treturn abi.NewTokenAmount(0), err\n\t}\n\n\treturn act.Balance, nil\n}", "func (s *stateObject) AddAmount(amount *big.Int) {\n\ts.SetAmount(new(big.Int).Add(s.account.Amount, amount))\n}", "func (_CrToken *CrTokenTransactor) Transfer(opts *bind.TransactOpts, dst common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.contract.Transact(opts, \"transfer\", dst, amount)\n}", "func (_StandardToken *StandardTokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.contract.Transact(opts, \"transfer\", _to, _value)\n}" ]
[ "0.602031", "0.58581996", "0.58447534", "0.55948335", "0.55635864", "0.55031914", "0.5486012", "0.5418654", "0.5404682", "0.5378797", "0.5365908", "0.5362456", "0.5295995", "0.5291535", "0.52895516", "0.52391547", "0.5229281", "0.5226986", "0.5210907", "0.5185936", "0.51845944", "0.51835036", "0.5167353", "0.51591396", "0.51332194", "0.51240146", "0.5110079", "0.51097494", "0.5099178", "0.5084446", "0.5048301", "0.5018287", "0.5000204", "0.4996151", "0.49673498", "0.49393132", "0.49353346", "0.4927698", "0.49235055", "0.4905252", "0.48972622", "0.48970836", "0.4877941", "0.48655447", "0.4864771", "0.48561946", "0.48519918", "0.48308152", "0.48271975", "0.48142695", "0.4813635", "0.48131222", "0.48070383", "0.4803116", "0.47870937", "0.47831142", "0.47795385", "0.47789103", "0.47746956", "0.47654602", "0.47629687", "0.47557998", "0.47452185", "0.47426626", "0.47368354", "0.47353333", "0.47320655", "0.4731777", "0.472963", "0.4726955", "0.47185427", "0.47103775", "0.4706956", "0.46988824", "0.46973836", "0.46886843", "0.46842086", "0.46784198", "0.4675302", "0.46729627", "0.4664207", "0.4660775", "0.4660775", "0.46355963", "0.46340102", "0.46266836", "0.46248332", "0.4623425", "0.4623425", "0.461827", "0.46098828", "0.46098828", "0.46094227", "0.46057633", "0.46057528", "0.45966595", "0.45930275", "0.45922825", "0.45895928", "0.45879114" ]
0.5202871
19
The following methods must be copypasted/overriden at the bottom of every _transaction.go file We override the embedded fluent setter methods to return the outer type
func tokenMintTransaction_getMethod(request request, channel *channel) method { return method{ transaction: channel.getToken().MintToken, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (obj *transaction) Set() sets.Transaction {\n\treturn obj.set\n}", "func (obj *transaction) Set() selectors.Selector {\n\treturn obj.set\n}", "func (obj *transaction) Set() selectors.Selector {\n\treturn obj.set\n}", "func (_GovernmentContract *GovernmentContractTransactor) Set(opts *bind.TransactOpts, name string, value *big.Int) (*types.Transaction, error) {\n\treturn _GovernmentContract.contract.Transact(opts, \"set\", name, value)\n}", "func (_HelloWorld *HelloWorldTransactor) Set(opts *bind.TransactOpts, v string) (*types.Transaction, *types.Receipt, error) {\n\treturn _HelloWorld.contract.Transact(opts, \"set\", v)\n}", "func (tx *tX) Transaction() (*tX, error) {\n\treturn tx, nil\n}", "func (db *goLevelDBTx) Set(key []byte, value []byte) error {\n\terr := db.tx.Put(key, value, nil)\n\tif err != nil {\n\t\tllog.Error(\"tx Set\", \"error\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (_GovernmentContract *GovernmentContractTransactorSession) Set(name string, value *big.Int) (*types.Transaction, error) {\n\treturn _GovernmentContract.Contract.Set(&_GovernmentContract.TransactOpts, name, value)\n}", "func (obj *transaction) Table() tables.Transaction {\n\treturn obj.table\n}", "func (o *Customer) SetTransaction(exec boil.Executor, insert bool, related *Transaction) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"customers\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"transaction_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, customerPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.TransactionID = related.ID\n\tif o.R == nil {\n\t\to.R = &customerR{\n\t\t\tTransaction: related,\n\t\t}\n\t} else {\n\t\to.R.Transaction = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &transactionR{\n\t\t\tCustomers: CustomerSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.Customers = append(related.R.Customers, o)\n\t}\n\n\treturn nil\n}", "func (self Accessor) Set(expr ...interface{}) *UpdateManager {\n\treturn Modification(self.Relation()).Set(expr...)\n}", "func (v *Txn) Set(json string) (resp *api.Assigned, err error) {\n\treturn v.Mutate(&api.Mutation{\n\t\tSetJson: []byte(json),\n\t})\n}", "func treeSet(ctx context.Context, t tree, store bs.Store, keyHash []byte, mutate func(tree, int32, bool) Outcome) (bs.Ref, Outcome, error) {\n\ttn := t.treenode()\n\tif tn.Left != nil {\n\t\tvar subnode *SubNode\n\t\tif nthbit(keyHash, tn.Depth) {\n\t\t\tsubnode = tn.Right\n\t\t} else {\n\t\t\tsubnode = tn.Left\n\t\t}\n\t\tsubref := subnode.Ref\n\n\t\tsub := t.newAt(0)\n\t\terr := bs.GetProto(ctx, store, bs.RefFromBytes(subref), sub)\n\t\tif err != nil {\n\t\t\treturn bs.Ref{}, ONone, errors.Wrapf(err, \"getting child %x at depth %d\", subref, tn.Depth+1)\n\t\t}\n\n\t\tnewSubref, outcome, err := treeSet(ctx, sub, store, keyHash, mutate)\n\t\tif err != nil {\n\t\t\treturn bs.Ref{}, ONone, errors.Wrapf(err, \"updating child %x at depth %d\", subref, tn.Depth+1)\n\t\t}\n\t\tif outcome == ONone {\n\t\t\tselfRef, err := bs.ProtoRef(t)\n\t\t\treturn selfRef, ONone, errors.Wrap(err, \"computing self ref\")\n\t\t}\n\n\t\tsubnode.Ref = newSubref[:]\n\t\tif outcome == OAdded {\n\t\t\tsubnode.Size++\n\t\t\ttn.Size++\n\t\t}\n\n\t\tselfRef, _, err := bs.PutProto(ctx, store, t)\n\t\treturn selfRef, outcome, errors.Wrap(err, \"storing updated object\")\n\t}\n\n\tindex := treeSearch(t, keyHash)\n\tif index < t.numMembers() && bytes.Equal(t.keyHash(index), keyHash) {\n\t\toutcome := mutate(t, index, false)\n\t\tif outcome == ONone {\n\t\t\tselfRef, err := bs.ProtoRef(t)\n\t\t\treturn selfRef, ONone, errors.Wrap(err, \"computing self ref\")\n\t\t}\n\t\tselfRef, _, err := bs.PutProto(ctx, store, t)\n\t\treturn selfRef, OUpdated, errors.Wrap(err, \"storing updated tree node\")\n\t}\n\n\tmutate(t, index, true)\n\n\tif t.numMembers() > maxNode {\n\t\tvar (\n\t\t\tleftChild = t.newAt(tn.Depth + 1)\n\t\t\trightChild = t.newAt(tn.Depth + 1)\n\t\t)\n\t\tfor i := int32(0); i < t.numMembers(); i++ {\n\t\t\tif nthbit(t.keyHash(i), tn.Depth) {\n\t\t\t\trightChild.copyMember(t, i)\n\t\t\t} else {\n\t\t\t\tleftChild.copyMember(t, i)\n\t\t\t}\n\t\t}\n\t\tleftRef, _, err := bs.PutProto(ctx, store, leftChild)\n\t\tif err != nil {\n\t\t\treturn bs.Ref{}, ONone, errors.Wrap(err, \"storing new left child after split\")\n\t\t}\n\t\trightRef, _, err := bs.PutProto(ctx, store, rightChild)\n\t\tif err != nil {\n\t\t\treturn bs.Ref{}, ONone, errors.Wrap(err, \"storing new right child after split\")\n\t\t}\n\t\ttn.Left = &SubNode{\n\t\t\tRef: leftRef[:],\n\t\t\tSize: leftChild.numMembers(),\n\t\t}\n\t\ttn.Right = &SubNode{\n\t\t\tRef: rightRef[:],\n\t\t\tSize: rightChild.numMembers(),\n\t\t}\n\t\tt.zeroMembers()\n\t}\n\ttn.Size++\n\n\tselfRef, _, err := bs.PutProto(ctx, store, t)\n\treturn selfRef, OAdded, errors.Wrap(err, \"storing updated tree node\")\n}", "func withSettlement(node *Settlement) settlementOption {\n\treturn func(m *SettlementMutation) {\n\t\tm.oldValue = func(context.Context) (*Settlement, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "func (t *Transaction) Unwrap() *Transaction {\n\ttx, ok := t.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Transaction is not a transactional entity\")\n\t}\n\tt.config.driver = tx.drv\n\treturn t\n}", "func SetWithTx(ctx context.Context, dr *firestore.DocumentRef, data interface{}, opts ...firestore.SetOption) error {\n\ttx, ok := GetTx(ctx)\n\tif ok {\n\t\treturn tx.Set(dr, data, opts...)\n\t} else {\n\t\t_, err := dr.Set(ctx, data, opts...)\n\t\treturn err\n\t}\n}", "func (_GovernmentContract *GovernmentContractSession) Set(name string, value *big.Int) (*types.Transaction, error) {\n\treturn _GovernmentContract.Contract.Set(&_GovernmentContract.TransactOpts, name, value)\n}", "func (p *planner) SetTransaction(n *parser.SetTransaction) (planNode, error) {\n\tif err := p.setIsolationLevel(n.Isolation); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := p.setUserPriority(n.UserPriority); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptyNode{}, nil\n}", "func (_Hello *HelloTransactorSession) Set(name string) (*types.Transaction, error) {\n\treturn _Hello.Contract.Set(&_Hello.TransactOpts, name)\n}", "func setRecord(txn *badger.Txn, key store.Key, record record.Material) error {\n\tdata, err := record.Marshal()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfullKey := append(key.Scope().Bytes(), key.ID()...)\n\n\t_, err = txn.Get(fullKey)\n\tif err != nil && err != badger.ErrKeyNotFound {\n\t\treturn err\n\t}\n\tif err == nil {\n\t\treturn ErrOverride\n\t}\n\n\treturn txn.Set(fullKey, data)\n}", "func (db *DB) set(ctx context.Context, key, value []byte) error {\n\treturn db.Update(ctx, func(tx *TransactionManager) error {\n\t\treturn tx.set(ctx, key, value)\n\t})\n}", "func (c *TransactionFirestore) Set(ctx context.Context, obj db.Object) error {\n\tif err := db.AssertObject(ctx, obj, false); err != nil {\n\t\treturn err\n\t}\n\tc.client.BaseClient.BeforeSet(ctx, obj)\n\tdocRef := c.client.refFromObj(ctx, obj)\n\terr := c.tx.Set(docRef, obj)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"tx set doc %v-%v\", obj.Collection(), obj.ID())\n\t}\n\treturn nil\n}", "func (k Keeper) SetExtTransaction(ctx sdk.Context, extTransaction types.ExtTransaction) {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ExtTransactionKey))\n\tb := k.cdc.MustMarshalBinaryBare(&extTransaction)\n\tstore.Set(GetExtTransactionIDBytes(extTransaction.Id), b)\n}", "func (tangle *Tangle) Transaction(transactionID transaction.ID) *transaction.CachedTransaction {\n\treturn &transaction.CachedTransaction{CachedObject: tangle.transactionStorage.Load(transactionID.Bytes())}\n}", "func (tb *transactionBuilder) View() (types.Transaction, []types.Transaction) {\n\treturn tb.transaction, tb.parents\n}", "func (tb *transactionBuilder) View() (types.Transaction, []types.Transaction) {\n\treturn tb.transaction, tb.parents\n}", "func (_Votes *VotesTransactor) SetLevel(opts *bind.TransactOpts, level uint8) (*types.Transaction, error) {\n\treturn _Votes.contract.Transact(opts, \"setLevel\", level)\n}", "func TransactionMiddleware() middleware.TransactionMiddleware {\n\tdb := gormer.GetDB()\n\ttxnDataSQL := gormrepo.NewTxnDataSQL(db)\n\ttransactionMiddleware := middleware.NewTransactionMiddleware(txnDataSQL)\n\treturn transactionMiddleware\n}", "func (_SushiV2Factory *SushiV2FactoryTransactorSession) SetFeeToSetter(_feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.SetFeeToSetter(&_SushiV2Factory.TransactOpts, _feeToSetter)\n}", "func CloneRefOfSetTransaction(n *SetTransaction) *SetTransaction {\n\tif n == nil {\n\t\treturn nil\n\t}\n\tout := *n\n\tout.SQLNode = CloneSQLNode(n.SQLNode)\n\tout.Comments = CloneComments(n.Comments)\n\tout.Characteristics = CloneSliceOfCharacteristic(n.Characteristics)\n\treturn &out\n}", "func withTradeRecord(node *TradeRecord) traderecordOption {\n\treturn func(m *TradeRecordMutation) {\n\t\tm.oldValue = func(context.Context) (*TradeRecord, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "func MarshalResTransaction(data []byte)*ResTransaction{\n var objmap map[string]json.RawMessage\n json.Unmarshal(data, &objmap)\n tr := new(ResTransaction)\n json.Unmarshal(objmap[\"Timestamp\"],&tr.Timestamp)\n json.Unmarshal(objmap[\"Output\"],&tr.Output)\n json.Unmarshal(objmap[\"Inputs\"],&tr.Inputs)\n json.Unmarshal(objmap[\"Creator\"],&tr.Creator)\n json.Unmarshal(objmap[\"JobBlock\"],&tr.JobBlock)\n json.Unmarshal(objmap[\"JobTrans\"],&tr.JobTrans)\n json.Unmarshal(objmap[\"HashSol\"],&tr.HashSol)\n json.Unmarshal(objmap[\"Evaluation\"],&tr.Evaluation)\n json.Unmarshal(objmap[\"IsMin\"],&tr.IsMin)\n json.Unmarshal(objmap[\"Hash\"],&tr.Hash)\n json.Unmarshal(objmap[\"Signature\"],&tr.Signature)\n return tr\n}", "func (_f34 *FakeContext) SetWithParentStub(ident2 Context) {\n\t_f34.WithParentHook = func(context.Context) Context {\n\t\treturn ident2\n\t}\n}", "func (_EnumerableSet *EnumerableSetRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _EnumerableSet.Contract.EnumerableSetTransactor.contract.Transfer(opts)\n}", "func setupTX(t testing.TB) (*reform.DB, *reform.TX) {\n\tt.Helper()\n\n\tdb := setupDB(t)\n\n\ttx, err := db.Begin()\n\trequire.NoError(t, err)\n\treturn db, tx\n}", "func setWriteFlag(tx *bolt.Tx) {\n}", "func setRecord_tx(tx pgx.Tx, relationId uuid.UUID, presetId uuid.UUID, recordId int64,\n\tvalues []types.PresetValue, modName string, relName string) error {\n\n\tsqlRefs := make([]string, 0)\n\tsqlNames := make([]string, 0)\n\tsqlValues := make([]interface{}, 0)\n\tisNew := recordId == 0\n\n\t// collect preset record values\n\tfor _, value := range values {\n\n\t\t// only update existing values if they are protected\n\t\t// unprotected values can be overwritten by customer\n\t\t// in effect, unprotected values work as one-time-only values (pre-filled data)\n\t\tif !isNew && !value.Protected {\n\t\t\tcontinue\n\t\t}\n\n\t\tatrName, err := lookups.GetAttributeNameById_tx(tx, value.AttributeId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// check for fixed value\n\t\tif value.PresetIdRefer.Status != pgtype.Present {\n\n\t\t\tif value.Value == \"\" {\n\t\t\t\t// no value set, ignore\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsqlNames = append(sqlNames, fmt.Sprintf(`\"%s\"`, atrName))\n\t\t\tsqlValues = append(sqlValues, value.Value)\n\t\t\tcontinue\n\t\t}\n\n\t\t// use refered preset record ID as value\n\t\trecordId, exists, err := getRecordIdByReferal_tx(tx, value.PresetIdRefer.Bytes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// if refered record does not exist, do not set record\n\t\t// otherwise potential NOT NULL constraint would be breached\n\t\tif !exists {\n\t\t\treturn fmt.Errorf(\"referenced preset '%s' does not exist\", value.PresetIdRefer.Bytes)\n\t\t}\n\t\tsqlNames = append(sqlNames, fmt.Sprintf(`\"%s\"`, atrName))\n\t\tsqlValues = append(sqlValues, recordId)\n\t}\n\n\tif isNew {\n\t\tfor i, _ := range sqlNames {\n\t\t\tsqlRefs = append(sqlRefs, fmt.Sprintf(`$%d`, i+1))\n\t\t}\n\n\t\tif err := tx.QueryRow(db.Ctx, fmt.Sprintf(`\n\t\t\tINSERT INTO \"%s\".\"%s\" (%s)\n\t\t\tVALUES (%s)\n\t\t\tRETURNING id\n\t\t`, modName, relName, strings.Join(sqlNames, \",\"), strings.Join(sqlRefs, \",\")),\n\t\t\tsqlValues...).Scan(&recordId); err != nil {\n\n\t\t\treturn err\n\t\t}\n\n\t\t// connect instance record ID to preset\n\t\tif _, err := tx.Exec(db.Ctx, `\n\t\t\tUPDATE instance.preset_record\n\t\t\tSET record_id_wofk = $1\n\t\t\tWHERE preset_id = $2\n\t\t`, recordId, presetId); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// update only if any values are to be updated\n\t\tif len(sqlNames) != 0 {\n\t\t\tfor i, sqlName := range sqlNames {\n\t\t\t\tsqlRefs = append(sqlRefs, fmt.Sprintf(`%s = $%d`, sqlName, i+1))\n\t\t\t}\n\t\t\trefId := fmt.Sprintf(\"$%d\", len(sqlRefs)+1)\n\t\t\tsqlValues = append(sqlValues, recordId)\n\n\t\t\tif _, err := tx.Exec(db.Ctx, fmt.Sprintf(`\n\t\t\t\tUPDATE \"%s\".\"%s\"\n\t\t\t\tSET %s\n\t\t\t\tWHERE id = %s\n\t\t\t`, modName, relName, strings.Join(sqlRefs, \",\"), refId), sqlValues...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (_HelloWorld *HelloWorldTransactorSession) Set(v string) (*types.Transaction, *types.Receipt, error) {\n\treturn _HelloWorld.Contract.Set(&_HelloWorld.TransactOpts, v)\n}", "func (_EnumerableSet *EnumerableSetTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _EnumerableSet.Contract.contract.Transfer(opts)\n}", "func (d *Datastore) Begin() (Transaction, Object, error) {\n\tid := uuid.New().String()\n\tlog.Debugf(\"Transaction %s begins\", id)\n\tremoteLock, err := d.kv.NewLock(d.lockKey, &store.LockOptions{TTL: 20 * time.Second, Value: []byte(id)})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tstopCh := make(chan struct{})\n\tctx, cancel := context.WithCancel(d.ctx)\n\tvar errLock error\n\tgo func() {\n\t\t_, errLock = remoteLock.Lock(stopCh)\n\t\tcancel()\n\t}()\n\tselect {\n\tcase <-ctx.Done():\n\t\tif errLock != nil {\n\t\t\treturn nil, nil, errLock\n\t\t}\n\tcase <-d.ctx.Done():\n\t\tstopCh <- struct{}{}\n\t\treturn nil, nil, d.ctx.Err()\n\t}\n\n\t// we got the lock! Now make sure we are synced with KV store\n\toperation := func() error {\n\t\tmeta := d.get()\n\t\tif meta.Lock != id {\n\t\t\treturn fmt.Errorf(\"object lock value: expected %s, got %s\", id, meta.Lock)\n\t\t}\n\t\treturn nil\n\t}\n\tnotify := func(err error, time time.Duration) {\n\t\tlog.Errorf(\"Datastore sync error: %v, retrying in %s\", err, time)\n\t\terr = d.reload()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error reloading: %+v\", err)\n\t\t}\n\t}\n\tebo := backoff.NewExponentialBackOff()\n\tebo.MaxElapsedTime = 60 * time.Second\n\terr = backoff.RetryNotify(safe.OperationWithRecover(operation), ebo, notify)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"datastore cannot sync: %v\", err)\n\t}\n\n\t// we synced with KV store, we can now return Setter\n\treturn &datastoreTransaction{\n\t\tDatastore: d,\n\t\tremoteLock: remoteLock,\n\t\tid: id,\n\t}, d.meta.object, nil\n}", "func (tangle *Tangle) setTransactionFinalized(transactionID transaction.ID, eventSource EventSource) (modified bool, err error) {\n\t// retrieve metadata and consume\n\tcachedTransactionMetadata := tangle.TransactionMetadata(transactionID)\n\tcachedTransactionMetadata.Consume(func(metadata *TransactionMetadata) {\n\t\t// update the finalized flag of the transaction\n\t\tmodified = metadata.SetFinalized(true)\n\n\t\t// only propagate the changes if the flag was modified\n\t\tif modified {\n\t\t\t// retrieve transaction from the database (for the events)\n\t\t\tcachedTransaction := tangle.Transaction(transactionID)\n\t\t\tdefer cachedTransaction.Release()\n\t\t\tif !cachedTransaction.Exists() {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// trigger the corresponding event\n\t\t\ttangle.Events.TransactionFinalized.Trigger(cachedTransaction, cachedTransactionMetadata)\n\n\t\t\t// propagate changes to value tangle and branch DAG if we were called from the tangle\n\t\t\t// Note: if the update was triggered by a change in the branch DAG then we do not propagate the confirmed\n\t\t\t// and rejected changes yet as those require the branch to be liked before (we instead do it in the\n\t\t\t// BranchLiked event)\n\t\t\tif eventSource == EventSourceTangle {\n\t\t\t\t// propagate changes to the branches (UTXO DAG)\n\t\t\t\tif metadata.Conflicting() {\n\t\t\t\t\t_, err = tangle.branchManager.SetBranchFinalized(metadata.BranchID())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\ttangle.Events.Error.Trigger(err)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// propagate changes to future cone of transaction (value tangle)\n\t\t\t\ttangle.propagateValuePayloadConfirmedRejectedUpdates(transactionID)\n\t\t\t}\n\t\t}\n\t})\n\n\treturn\n}", "func (m *Merchant) Unwrap() *Merchant {\n\ttx, ok := m.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Merchant is not a transactional entity\")\n\t}\n\tm.config.driver = tx.drv\n\treturn m\n}", "func (me *TxsdTransactionType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (r *InMemorySourceReader) Transaction() *Transaction {\n\treturn NewTransaction(r)\n}", "func (cctx *MinterDefinitionTransaction) Transaction() types.Transaction {\n\treturn types.Transaction{\n\t\tVersion: TransactionVersionMinterDefinition,\n\t\tMinerFees: cctx.MinerFees,\n\t\tArbitraryData: cctx.ArbitraryData,\n\t\tExtension: &MinterDefinitionTransactionExtension{\n\t\t\tNonce: cctx.Nonce,\n\t\t\tMintFulfillment: cctx.MintFulfillment,\n\t\t\tMintCondition: cctx.MintCondition,\n\t\t},\n\t}\n}", "func (cctx *MinterDefinitionTransaction) Transaction() types.Transaction {\n\treturn types.Transaction{\n\t\tVersion: TransactionVersionMinterDefinition,\n\t\tMinerFees: cctx.MinerFees,\n\t\tArbitraryData: cctx.ArbitraryData,\n\t\tExtension: &MinterDefinitionTransactionExtension{\n\t\t\tNonce: cctx.Nonce,\n\t\t\tMintFulfillment: cctx.MintFulfillment,\n\t\t\tMintCondition: cctx.MintCondition,\n\t\t},\n\t}\n}", "func PutTransaction(_db *gorm.DB, _tx *types.Transaction, _txReceipt *types.Receipt, _sender common.Address) bool {\n\tvar _pTx *Transactions\n\tstatus := true\n\n\t// If tx creates contract, then we hold created contract address\n\tif _tx.To() == nil {\n\t\t_pTx = &Transactions{\n\t\t\tHash: _tx.Hash().Hex(),\n\t\t\tFrom: _sender.Hex(),\n\t\t\tContract: _txReceipt.ContractAddress.Hex(),\n\t\t\tValue: _tx.Value().String(),\n\t\t\tData: _tx.Data(),\n\t\t\tGas: _tx.Gas(),\n\t\t\tGasPrice: _tx.GasPrice().String(),\n\t\t\tCost: _tx.Cost().String(),\n\t\t\tNonce: _tx.Nonce(),\n\t\t\tState: _txReceipt.Status,\n\t\t\tBlockHash: _txReceipt.BlockHash.Hex(),\n\t\t}\n\t} else {\n\t\t// This is a normal tx, so we keep contract field empty\n\t\t_pTx = &Transactions{\n\t\t\tHash: _tx.Hash().Hex(),\n\t\t\tFrom: _sender.Hex(),\n\t\t\tTo: _tx.To().Hex(),\n\t\t\tValue: _tx.Value().String(),\n\t\t\tData: _tx.Data(),\n\t\t\tGas: _tx.Gas(),\n\t\t\tGasPrice: _tx.GasPrice().String(),\n\t\t\tCost: _tx.Cost().String(),\n\t\t\tNonce: _tx.Nonce(),\n\t\t\tState: _txReceipt.Status,\n\t\t\tBlockHash: _txReceipt.BlockHash.Hex(),\n\t\t}\n\t}\n\n\tif err := _db.Create(_pTx).Error; err != nil {\n\t\tstatus = false\n\t\tlog.Printf(\"[!] Failed to persist tx [ block : %s ] : %s\\n\", _txReceipt.BlockNumber.String(), err.Error())\n\t}\n\n\treturn status\n}", "func (obj *transaction) Database() databases.Transaction {\n\treturn obj.database\n}", "func (_SushiV2Factory *SushiV2FactorySession) SetFeeToSetter(_feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.SetFeeToSetter(&_SushiV2Factory.TransactOpts, _feeToSetter)\n}", "func (tx *Tx) Set(key string, value string) error {\n\te := newRecord([]byte(key), []byte(value), StringRecord, StringSet)\n\ttx.addRecord(e)\n\n\treturn nil\n}", "func (dm *Snapshotter) withTransaction(ctx context.Context, writable bool, fn func(ctx context.Context) error) error {\n\tctx, trans, err := dm.store.TransactionContext(ctx, writable)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar result *multierror.Error\n\n\terr = fn(ctx)\n\tif err != nil {\n\t\tresult = multierror.Append(result, err)\n\t}\n\n\t// Always rollback if transaction is not writable\n\tif err != nil || !writable {\n\t\tif terr := trans.Rollback(); terr != nil {\n\t\t\tlog.G(ctx).WithError(terr).Error(\"failed to rollback transaction\")\n\t\t\tresult = multierror.Append(result, errors.Wrap(terr, \"rollback failed\"))\n\t\t}\n\t} else {\n\t\tif terr := trans.Commit(); terr != nil {\n\t\t\tlog.G(ctx).WithError(terr).Error(\"failed to commit transaction\")\n\t\t\tresult = multierror.Append(result, errors.Wrap(terr, \"commit failed\"))\n\t\t}\n\t}\n\n\tif err := result.ErrorOrNil(); err != nil {\n\t\tlog.G(ctx).WithError(err).Debug(\"snapshotter error\")\n\n\t\t// Unwrap if just one error\n\t\tif result.Len() == 1 {\n\t\t\treturn result.Errors[0]\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func withEntity(node *Entity) entityOption {\n\treturn func(m *EntityMutation) {\n\t\tm.oldValue = func(context.Context) (*Entity, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "func (_Harberger *HarbergerTransactor) SetPrice(opts *bind.TransactOpts, _tokenId *big.Int, _price *big.Int) (*types.Transaction, error) {\n\treturn _Harberger.contract.Transact(opts, \"setPrice\", _tokenId, _price)\n}", "func (d DB) Transaction(f func(DB) error) error {\n\tif _, ok := d.dbProxy.(*sql.Tx); ok {\n\t\t// Already in a nested transaction\n\t\treturn f(d)\n\t}\n\n\ttx, err := d.dbProxy.(*sql.DB).Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = f(DB{\n\t\tdbProxy: tx,\n\t\tStatementBuilderType: statementBuilder(tx),\n\t})\n\tif err != nil {\n\t\t// Rollback error is ignored as we already have one in progress\n\t\tif err2 := tx.Rollback(); err2 != nil {\n\t\t\tlevel.Warn(util_log.Logger).Log(\"msg\", \"transaction rollback error (ignored)\", \"err\", err2)\n\t\t}\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "func (v *Txn) Setb(json []byte) (resp *api.Assigned, err error) {\n\treturn v.Mutate(&api.Mutation{\n\t\tSetJson: json,\n\t})\n}", "func TransactionUpdate(c *gin.Context) {\n\tvar t models.Transaction\n\tvar newT models.Transaction\n\n\tif database.DBCon.First(&t, c.Param(\"id\")).RecordNotFound() {\n\t\tc.AbortWithError(http.StatusNotFound, appError.RecordNotFound).\n\t\t\tSetMeta(appError.RecordNotFound)\n\t\treturn\n\t}\n\n\t// Ensure current user is creator of transaction\n\tif t.CreatorID != c.Keys[\"CurrentUserID\"].(uint) {\n\t\tc.AbortWithError(appError.InsufficientPermission.Status, appError.InsufficientPermission).\n\t\t\tSetMeta(appError.InsufficientPermission)\n\t\treturn\n\t}\n\n\tbuffer, err := ioutil.ReadAll(c.Request.Body)\n\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusNotAcceptable, err)\n\t}\n\n\terr2 := jsonapi.Unmarshal(buffer, &newT)\n\n\tif err2 != nil {\n\t\tc.AbortWithError(http.StatusInternalServerError, err).\n\t\t\tSetMeta(appError.JSONParseFailure)\n\t\treturn\n\t}\n\n\tt.Type = newT.Type\n\tt.Amount = newT.Amount\n\tt.Memo = newT.Memo\n\tt.RecipientID = newT.RecipientID\n\tt.SenderID = newT.SenderID\n\n\t// Validate our new transaction\n\tisValid, errApp := t.Validate()\n\n\tif isValid == false {\n\t\tc.AbortWithError(errApp.Status, errApp).\n\t\t\tSetMeta(errApp)\n\t\treturn\n\t}\n\n\tdatabase.DBCon.Save(&t)\n\n\tdatabase.DBCon.First(&t.Recipient, t.RecipientID)\n\tdatabase.DBCon.First(&t.Sender, t.SenderID)\n\tdatabase.DBCon.First(&t.Creator, t.CreatorID)\n\n\tdata, err := jsonapi.Marshal(&t)\n\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusInternalServerError, err).\n\t\t\tSetMeta(appError.JSONParseFailure)\n\t\treturn\n\t}\n\n\tc.Data(http.StatusOK, \"application/vnd.api+json\", data)\n}", "func setWrapper(key string, value interface{}, target getterSetter) {\n\terr := target.Set(key, value)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t}\n}", "func (brutx *BotRecordUpdateTransaction) Transaction(oneCoin types.Currency) types.Transaction {\n\ttx := types.Transaction{\n\t\tVersion: TransactionVersionBotRecordUpdate,\n\t\tCoinInputs: brutx.CoinInputs,\n\t\tMinerFees: []types.Currency{brutx.TransactionFee},\n\t\tExtension: &BotRecordUpdateTransactionExtension{\n\t\t\tIdentifier: brutx.Identifier,\n\t\t\tSignature: brutx.Signature,\n\t\t\tAddressUpdate: brutx.Addresses,\n\t\t\tNameUpdate: brutx.Names,\n\t\t\tNrOfMonths: brutx.NrOfMonths,\n\t\t},\n\t}\n\tif brutx.RefundCoinOutput != nil {\n\t\ttx.CoinOutputs = append(tx.CoinOutputs, *brutx.RefundCoinOutput)\n\t}\n\treturn tx\n}", "func BuildTransaction(b Builder) error {\n\treturn b.BuildTransaction()\n}", "func (n *SuccessfulPaymentNotification) setTransactionFields(id string, invoiceNumber int) {\n\tn.Transaction.UUID = id\n\tn.Transaction.InvoiceNumber = invoiceNumber\n}", "func (o *Other) Unwrap() *Other {\n\t_tx, ok := o.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Other is not a transactional entity\")\n\t}\n\to.config.driver = _tx.drv\n\treturn o\n}", "func (_SushiV2Factory *SushiV2FactoryTransactor) SetFeeToSetter(opts *bind.TransactOpts, _feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.contract.Transact(opts, \"setFeeToSetter\", _feeToSetter)\n}", "func (a *Agentkyc) Unwrap() *Agentkyc {\n\ttx, ok := a.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Agentkyc is not a transactional entity\")\n\t}\n\ta.config.driver = tx.drv\n\treturn a\n}", "func (m OrderFieldMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func (_Aicumen *AicumenTransactor) SetEntity(opts *bind.TransactOpts, addr string, name string) (*types.Transaction, error) {\n\treturn _Aicumen.contract.Transact(opts, \"setEntity\", addr, name)\n}", "func TestTransactionSuperset(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\t// Create a transaction pool tester.\n\ttpt, err := createTpoolTester(t.Name())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer tpt.Close()\n\n\t// Fund a partial transaction.\n\tfund := types.NewCurrency64(30e6)\n\ttxnBuilder, err := tpt.wallet.StartTransaction()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = txnBuilder.FundSiacoins(fund)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttxnBuilder.AddMinerFee(fund)\n\t// wholeTransaction is set to false so that we can use the same signature\n\t// to create a double spend.\n\ttxnSet, err := txnBuilder.Sign(false)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(txnSet) <= 1 {\n\t\tt.Fatal(\"test is invalid unless the transaction set has two or more transactions\")\n\t}\n\t// Check that the second transaction is dependent on the first.\n\terr = tpt.tpool.AcceptTransactionSet(txnSet[1:])\n\tif err == nil {\n\t\tt.Fatal(\"transaction set must have dependent transactions\")\n\t}\n\n\t// Submit the first transaction in the set to the transaction pool, and\n\t// then the superset.\n\terr = tpt.tpool.AcceptTransactionSet(txnSet[:1])\n\tif err != nil {\n\t\tt.Fatal(\"first transaction in the transaction set was not valid?\")\n\t}\n\terr = tpt.tpool.AcceptTransactionSet(txnSet)\n\tif err != nil {\n\t\tt.Fatal(\"super setting is not working:\", err)\n\t}\n\n\t// Try resubmitting the individual transaction and the superset, a\n\t// duplication error should be returned for each case.\n\terr = tpt.tpool.AcceptTransactionSet(txnSet[:1])\n\tif err != modules.ErrDuplicateTransactionSet {\n\t\tt.Fatal(err)\n\t}\n\terr = tpt.tpool.AcceptTransactionSet(txnSet)\n\tif err != modules.ErrDuplicateTransactionSet {\n\t\tt.Fatal(\"super setting is not working:\", err)\n\t}\n}", "func (_EnumerableSet *EnumerableSetRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _EnumerableSet.Contract.EnumerableSetTransactor.contract.Transact(opts, method, params...)\n}", "func (field *Field) Set(value interface{}) (err error) {\n if !field.Field.IsValid() {\n return errors.New(\"field value not valid\")\n }\n\n if !field.Field.CanAddr() {\n return ErrUnaddressable\n }\n\n reflectValue, ok := value.(reflect.Value)\n if !ok {\n reflectValue = reflect.ValueOf(value)\n }\n\n fieldValue := field.Field\n if reflectValue.IsValid() {\n if reflectValue.Type().ConvertibleTo(fieldValue.Type()) {\n fieldValue.Set(reflectValue.Convert(fieldValue.Type()))\n } else {\n if fieldValue.Kind() == reflect.Ptr {\n if fieldValue.IsNil() {\n fieldValue.Set(reflect.New(field.Struct.Type.Elem()))\n }\n fieldValue = fieldValue.Elem()\n }\n\n if reflectValue.Type().ConvertibleTo(fieldValue.Type()) {\n fieldValue.Set(reflectValue.Convert(fieldValue.Type()))\n } else if scanner, ok := fieldValue.Addr().Interface().(sql.Scanner); ok {\n v := reflectValue.Interface()\n if valuer, ok := v.(driver.Valuer); ok {\n if v, err = valuer.Value(); err == nil {\n err = scanner.Scan(v)\n }\n } else {\n err = scanner.Scan(v)\n }\n } else {\n err = fmt.Errorf(\"could not convert argument of field %s from %s to %s\", field.Name, reflectValue.Type(), fieldValue.Type())\n }\n }\n } else {\n field.Field.Set(reflect.Zero(field.Field.Type()))\n }\n\n field.IsBlank = isBlank(field.Field)\n return err\n}", "func (p ByName) Setter() Setter { return p.setter }", "func (db *DBDriver) Set(ctx context.Context, member, key string, value []byte) ([]byte, error) {\n\tctx, tx, err := dbtx.BeginTx(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer db.reapTx(tx)\n\n\tbuf, err := db.set(ctx, tx, member, key, value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf, tx.Commit()\n}", "func (s *Flaky) Set(k, v []byte) error {\n\tif s.fail() {\n\t\treturn s.err\n\t}\n\treturn s.Txn.Set(k, v)\n}", "func withTenant(node *Tenant) tenantOption {\n\treturn func(m *TenantMutation) {\n\t\tm.oldValue = func(context.Context) (*Tenant, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "func (_EnumerableSet *EnumerableSetTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _EnumerableSet.Contract.contract.Transact(opts, method, params...)\n}", "func (_Hello *HelloSession) Set(name string) (*types.Transaction, error) {\n\treturn _Hello.Contract.Set(&_Hello.TransactOpts, name)\n}", "func (tbl DbCompoundTable) Using(tx *sql.Tx) DbCompoundTable {\n\ttbl.db = tx\n\treturn tbl\n}", "func (c *Chain) GiveTxBackFromBlock() {\n\n}", "func MockTx() *Transaction {\n\treturn RandTx()\n}", "func (m TenantMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func (m TenantMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func (self *ResTransaction)Serialize()[]byte{\n data, err := json.Marshal(self)\n if err != nil {\n fmt.Println(err)\n }\n return data\n}", "func (_Value *ValueRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Value.Contract.ValueTransactor.contract.Transact(opts, method, params...)\n}", "func (m TradeRecordMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func newTransaction(kvScheduler scheduler_api.KVScheduler) *kvSchedulerTxn {\n\treturn &kvSchedulerTxn{\n\t\tkvScheduler: kvScheduler,\n\t\tvalues: make(api.KeyValuePairs),\n\t\tmerged: make(api.KeyValuePairs),\n\t}\n}", "func (r *Repository) Transaction() (middleware.Transaction, error) {\n\treturn r.Database.Transaction()\n}", "func (_Value *ValueRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Value.Contract.ValueTransactor.contract.Transfer(opts)\n}", "func (txn *Txn) Set(key, val []byte) error {\n\treturn txn.SetEntry(NewEntry(key, val))\n}", "func (c *Cassandra) Set(ctx context.Context, req *state.SetRequest) error {\n\tvar bt []byte\n\tb, ok := req.Value.([]byte)\n\tif ok {\n\t\tbt = b\n\t} else {\n\t\tbt, _ = jsoniter.ConfigFastest.Marshal(req.Value)\n\t}\n\n\tsession := c.session\n\n\tif req.Options.Consistency == state.Strong {\n\t\tsess, err := c.createSession(gocql.Quorum)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer sess.Close()\n\t\tsession = sess\n\t} else if req.Options.Consistency == state.Eventual {\n\t\tsess, err := c.createSession(gocql.Any)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer sess.Close()\n\t\tsession = sess\n\t}\n\n\tttl, err := stateutils.ParseTTL(req.Metadata)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing TTL from Metadata: %s\", err)\n\t}\n\n\tif ttl != nil {\n\t\treturn session.Query(fmt.Sprintf(\"INSERT INTO %s (key, value) VALUES (?, ?) USING TTL ?\", c.table), req.Key, bt, *ttl).WithContext(ctx).Exec()\n\t}\n\n\treturn session.Query(fmt.Sprintf(\"INSERT INTO %s (key, value) VALUES (?, ?)\", c.table), req.Key, bt).WithContext(ctx).Exec()\n}", "func (me *TSAFPTTransactionID) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (pa *Patientrecord) Unwrap() *Patientrecord {\n\ttx, ok := pa.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Patientrecord is not a transactional entity\")\n\t}\n\tpa.config.driver = tx.drv\n\treturn pa\n}", "func newSet(txn *Transaction, key []byte) *Set {\n\tnow := Now()\n\treturn &Set{\n\t\ttxn: txn,\n\t\tkey: key,\n\t\tmeta: &SetMeta{\n\t\t\tObject: Object{\n\t\t\t\tID: UUID(),\n\t\t\t\tCreatedAt: now,\n\t\t\t\tUpdatedAt: now,\n\t\t\t\tExpireAt: 0,\n\t\t\t\tType: ObjectSet,\n\t\t\t\tEncoding: ObjectEncodingHT,\n\t\t\t},\n\t\t\tLen: 0,\n\t\t},\n\t}\n}", "func (m MemberMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func (pd *pymtData) Set(p *payment.PymtUpsert) {\n\tp.Type = pd.Type\n\tp.Attributes = pd.Attrs\n}", "func (m OperativerecordMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func (this *EntityManager) createEntity(parent Entity, attributeName string, entity Entity) (Entity, *CargoEntities.Error) {\r\n\r\n\t// Set the entity values here.\r\n\ttypeName := entity.GetTypeName() // Set the type name if not already set...\r\n\tentity.SetParentLnk(attributeName)\r\n\tentity.SetParentUuid(parent.GetUuid())\r\n\r\n\t// Here I will set the entity on the cache...\r\n\tthis.setEntity(entity)\r\n\r\n\tstoreId := typeName[0:strings.Index(typeName, \".\")]\r\n\tprototype, _ := GetServer().GetEntityManager().getEntityPrototype(typeName, storeId)\r\n\r\n\t// Now entity are quadify I will save it in the graph store.\r\n\tstore := GetServer().GetDataManager().getDataStore(storeId)\r\n\r\n\t// I will create the entity.\r\n\t_, err := store.Create(\"\", []interface{}{entity})\r\n\tif err != nil {\r\n\t\tcargoError := NewError(Utility.FileLine(), ENTITY_CREATION_ERROR, SERVER_ERROR_CODE, err)\r\n\t\treturn nil, cargoError\r\n\t}\r\n\r\n\t//LogInfo(\"---> create entity \", entity.GetUuid())\r\n\tentity.SetNeedSave(false)\r\n\r\n\t// also save it parent.\r\n\tif parent != nil {\r\n\t\t// Now I will save it in the datastore.\r\n\t\t// I will set the entity parent.\r\n\t\tcargoError := this.setParent(parent, entity)\r\n\t\tif cargoError != nil {\r\n\t\t\treturn nil, cargoError\r\n\t\t}\r\n\t} else {\r\n\t\tcargoError := NewError(Utility.FileLine(), ENTITY_CREATION_ERROR, SERVER_ERROR_CODE, errors.New(\"parent must not be nil when createEntity is call.\"))\r\n\t\treturn nil, cargoError\r\n\t}\r\n\r\n\t// The event data...\r\n\teventData := make([]*MessageData, 2)\r\n\tmsgData0 := new(MessageData)\r\n\tmsgData0.Name = \"entity\"\r\n\tif reflect.TypeOf(entity).String() == \"*Server.DynamicEntity\" {\r\n\t\tmsgData0.Value = entity.(*DynamicEntity).getValues()\r\n\t} else {\r\n\t\tmsgData0.Value = entity\r\n\t}\r\n\teventData[0] = msgData0\r\n\r\n\tmsgData1 := new(MessageData)\r\n\tmsgData1.Name = \"prototype\"\r\n\tmsgData1.Value = prototype\r\n\teventData[1] = msgData1\r\n\r\n\tevt, _ := NewEvent(NewEntityEvent, EntityEvent, eventData)\r\n\tGetServer().GetEventManager().BroadcastEvent(evt)\r\n\r\n\t// Set it childs...\r\n\tthis.saveChilds(entity, prototype)\r\n\r\n\treturn entity, nil\r\n}", "func (m MedicalrecordstaffMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func (_Casper *CasperTransactor) SetTrusted(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) {\n\treturn _Casper.contract.Transact(opts, \"setTrusted\", addr)\n}", "func (_Votes *VotesTransactorSession) SetLevel(level uint8) (*types.Transaction, error) {\n\treturn _Votes.Contract.SetLevel(&_Votes.TransactOpts, level)\n}", "func (m OrgUnitMemberMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "func (tangle *Tangle) TransactionMetadata(transactionID transaction.ID) *CachedTransactionMetadata {\n\treturn &CachedTransactionMetadata{CachedObject: tangle.transactionMetadataStorage.Load(transactionID.Bytes())}\n}", "func (tangle *Tangle) setTransactionPreferred(transactionID transaction.ID, preferred bool, eventSource EventSource) (modified bool, err error) {\n\t// retrieve metadata and consume\n\tcachedTransactionMetadata := tangle.TransactionMetadata(transactionID)\n\tcachedTransactionMetadata.Consume(func(metadata *TransactionMetadata) {\n\t\t// update the preferred flag of the transaction\n\t\tmodified = metadata.setPreferred(preferred)\n\n\t\t// only do something if the flag was modified\n\t\tif modified {\n\t\t\t// retrieve transaction from the database (for the events)\n\t\t\tcachedTransaction := tangle.Transaction(transactionID)\n\t\t\tdefer cachedTransaction.Release()\n\t\t\tif !cachedTransaction.Exists() {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// trigger the correct event\n\t\t\tif preferred {\n\t\t\t\ttangle.Events.TransactionPreferred.Trigger(cachedTransaction, cachedTransactionMetadata)\n\t\t\t} else {\n\t\t\t\ttangle.Events.TransactionUnpreferred.Trigger(cachedTransaction, cachedTransactionMetadata)\n\t\t\t}\n\n\t\t\t// propagate changes to value tangle and branch DAG if we were called from the tangle\n\t\t\t// Note: if the update was triggered by a change in the branch DAG then we do not propagate the value\n\t\t\t// payload changes yet as those require the branch to be liked before (we instead do it in the\n\t\t\t// BranchLiked event)\n\t\t\tif eventSource == EventSourceTangle {\n\t\t\t\t// propagate changes to the branches (UTXO DAG)\n\t\t\t\tif metadata.Conflicting() {\n\t\t\t\t\t_, err = tangle.branchManager.SetBranchPreferred(metadata.BranchID(), preferred)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\ttangle.Events.Error.Trigger(err)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// propagate changes to future cone of transaction (value tangle)\n\t\t\t\ttangle.propagateValuePayloadLikeUpdates(transactionID, preferred)\n\t\t\t}\n\t\t}\n\t})\n\n\treturn\n}", "func (m InviteePartyMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}" ]
[ "0.5809109", "0.5747888", "0.5747888", "0.5543872", "0.546426", "0.5234016", "0.5137317", "0.50583917", "0.50024784", "0.49440292", "0.4930833", "0.4904905", "0.48943907", "0.4892473", "0.4885492", "0.4882994", "0.48726937", "0.48656663", "0.47784543", "0.47774166", "0.47744626", "0.4769638", "0.47593552", "0.47524914", "0.4733793", "0.4733793", "0.4682408", "0.46782592", "0.46749517", "0.4666227", "0.46609762", "0.4656521", "0.46482745", "0.46452653", "0.46408597", "0.46314636", "0.4619507", "0.46192592", "0.46162295", "0.46116143", "0.46086362", "0.46057367", "0.4605524", "0.45977935", "0.459719", "0.459719", "0.45925716", "0.45910305", "0.4584071", "0.4583371", "0.4570099", "0.4557929", "0.45555452", "0.4550667", "0.45436078", "0.4543587", "0.45381355", "0.4535947", "0.453385", "0.45308164", "0.45283794", "0.4524595", "0.4523928", "0.45237547", "0.4521825", "0.45182487", "0.45173088", "0.45136875", "0.4511088", "0.45100898", "0.45060313", "0.45043695", "0.44997945", "0.44941604", "0.44898576", "0.4489531", "0.4486246", "0.4485731", "0.4485731", "0.44815338", "0.44802657", "0.4477243", "0.44766477", "0.44758117", "0.4464405", "0.44612896", "0.44521484", "0.44469425", "0.4444965", "0.44435725", "0.4441312", "0.4439392", "0.44379383", "0.44371396", "0.44370085", "0.4436316", "0.44358695", "0.44357827", "0.44329932", "0.4430278", "0.44250345" ]
0.0
-1
Sign uses the provided privateKey to sign the transaction.
func (transaction *TokenMintTransaction) Sign( privateKey PrivateKey, ) *TokenMintTransaction { return transaction.SignWith(privateKey.PublicKey(), privateKey.Sign) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *ContractUpdateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *ContractUpdateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (transaction *TokenUpdateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *TokenUpdateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (transaction *ScheduleSignTransaction) Sign(\n\tprivateKey PrivateKey,\n) *ScheduleSignTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (transaction *FileCreateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *FileCreateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (transaction *AccountUpdateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *AccountUpdateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (transaction *AccountCreateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *AccountCreateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func Sign(hash, privateKey []byte) (sig []byte, err error) {\n\tif len(hash) != 32 {\n\t\treturn nil, fmt.Errorf(\"hash is required to be exactly 32 bytes (%d)\", len(hash))\n\t}\n\tif len(privateKey) != 32 {\n\t\treturn nil, fmt.Errorf(\"hex private key is required to be exactly 64 bytes (%d)\", len(privateKey))\n\t}\n\tkey, err := ToSM2(privateKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpubBytes := SM2PubBytes(&key.PublicKey)\n\n\tr, s, err := SM2Sign(hash, key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsig = make([]byte, 128)\n\tcopy(sig[32-len(r.Bytes()):], r.Bytes())\n\tcopy(sig[64-len(s.Bytes()):], s.Bytes())\n\tcopy(sig[128-len(pubBytes):], pubBytes)\n\n\treturn sig, nil\n}", "func (_Ethdkg *EthdkgSession) Sign(message []byte, privK *big.Int) ([2]*big.Int, error) {\n\treturn _Ethdkg.Contract.Sign(&_Ethdkg.CallOpts, message, privK)\n}", "func Sign(data []byte, privateKey *rsa.PrivateKey) ([]byte, error) {\n\tdigest := sha256.Sum256(data)\n\treturn rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, digest[:])\n}", "func SignWithPrivateKey(src []byte, hash crypto.Hash) (signed []byte, e error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tswitch x := r.(type) {\n\t\t\tcase string:\n\t\t\t\te = errors.New(x)\n\t\t\tcase error:\n\t\t\t\te = x\n\t\t\tdefault:\n\t\t\t\te = errors.New(\"Unknown panic\")\n\t\t\t}\n\t\t}\n\t}()\n\th := hash.New()\n\th.Write(src)\n\thashed := h.Sum(nil)\n\tsigned, err := rsa.SignPKCS1v15(rand.Reader, privateKey, hash, hashed)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\treturn signed, nil\n}", "func sign(privateKey *rsa.PrivateKey, data []byte) ([]byte, error) {\n\th := sha256.New()\n\th.Write(data)\n\td := h.Sum(nil)\n\treturn rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, d)\n}", "func (k *PrivateKey) Sign(hash []byte) ([]byte, error) {\n\treturn Sign(hash, k.seckey)\n}", "func PrivateKeySign(priv *rsa.PrivateKey, rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)", "func (_Ethdkg *EthdkgCallerSession) Sign(message []byte, privK *big.Int) ([2]*big.Int, error) {\n\treturn _Ethdkg.Contract.Sign(&_Ethdkg.CallOpts, message, privK)\n}", "func (k *Ed25519PrivateKey) Sign(msg []byte) ([]byte, error) {\n\treturn ed25519.Sign(k.k, msg), nil\n}", "func (pv2 *ProtoV2Public) Sign(privateKey ed25519.PrivateKey, claims Claims, footer interface{}) (string, error) {\n\tpayload, optionalFooter, err := encode(claims, footer)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn pv2.sign(privateKey, payload, optionalFooter)\n}", "func TmSign(publicKey PublicKey, privateKey PrivateKey, digest Digest) Seal { panic(\"\") }", "func (m *Message) Sign(privateKey *ecdsa.PrivateKey) error {\n\tif m == nil {\n\t\treturn errors.New(\"nil message\")\n\t}\n\trawData := getRawMessageBody(&m.Body)\n\tsignature, err := gw_common.SignData(privateKey, rawData...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.Signature = utils.StringToHex(string(signature))\n\tm.Body.Sender = strings.ToLower(crypto.PubkeyToAddress(privateKey.PublicKey).Hex())\n\treturn nil\n}", "func (p *privateKey) Sign(data []byte) ([]byte, error) {\n\treturn p.PrivateKey.Sign(data), nil\n}", "func Sign(message []byte, privateKey PrivateKey) []byte {\n\tsig := ed25519.Sign(ed25519.PrivateKey(privateKey), message)\n\tresponse := make([]byte, SignatureSize+len(message))\n\tcopy(response[:SignatureSize], sig)\n\tcopy(response[SignatureSize:], message)\n\treturn response\n}", "func Sign(message string, privateKeyString string, signature *Signed) error {\n\tprivateKey, err := PemDecodePrivate([]byte(privateKeyString))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch privateKey.(type) {\n\tcase *rsa.PrivateKey:\n\t\tsignature.Mode = SignatureModeSha256Rsa\n\tcase *ecdsa.PrivateKey:\n\t\tsignature.Mode = SignatureModeSha256Ecdsa\n\t}\n\tsig, err := SignMessage([]byte(message), privateKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsignature.Message = message\n\tsignature.Signature = string(Base64Encode(sig))\n\treturn nil\n}", "func (sk PrivateKey) Sign(message []byte, hasher Hasher) ([]byte, error) {\n\treturn sk.privateKey.Sign(message, hasher)\n}", "func (p *PrivateKey) Sign(hash []byte) (*Signature, error) {\n\treturn signRFC6979(p, hash)\n}", "func (k *onChainPrivateKey) Sign(msg []byte) (signature []byte, err error) {\n\tsig, err := crypto.Sign(onChainHash(msg), (*ecdsa.PrivateKey)(k))\n\treturn sig, err\n}", "func (addr *Address) Sign(privKey *id.PrivKey) error {\n\tbuf := make([]byte, surge.SizeHintU8+surge.SizeHintString(addr.Value)+surge.SizeHintU64)\n\treturn addr.SignWithBuffer(privKey, buf)\n}", "func Sign(r *rsa.PrivateKey, data []byte) ([]byte, error) {\n\th := sha256.New()\n\th.Write(data)\n\td := h.Sum(nil)\n\treturn rsa.SignPKCS1v15(rand.Reader, r, crypto.SHA256, d)\n}", "func Sign(m string, kp *Keypair) *Signature {\n\treturn genSignature(m, kp.private)\n}", "func (bbs *BBSG2Pub) Sign(messages [][]byte, privKeyBytes []byte) ([]byte, error) {\n\tprivKey, err := UnmarshalPrivateKey(privKeyBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal private key: %w\", err)\n\t}\n\n\tif len(messages) == 0 {\n\t\treturn nil, errors.New(\"messages are not defined\")\n\t}\n\n\treturn bbs.SignWithKey(messages, privKey)\n}", "func (k *OnchainPrivateKey) Sign(msg []byte) (signature []byte, err error) {\n\tsig, err := crypto.Sign(onChainHash(msg), (*ecdsa.PrivateKey)(k))\n\treturn sig, err\n}", "func (k *KeyPairEd25519) Sign(message []byte) ([]byte, error) {\n\tres, err := k.privateKey.Sign(nil, message, crypto.Hash(0))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"calling sign: %v\", err)\n\t}\n\treturn res, nil\n}", "func (r *rsaPrivateKey) Sign(data []byte) ([]byte, error) {\n\th := sha256.New()\n\th.Write(data)\n\td := h.Sum(nil)\n\treturn rsa.SignPKCS1v15(rand.Reader, r.PrivateKey, crypto.SHA256, d)\n}", "func (_Ethdkg *EthdkgCaller) Sign(opts *bind.CallOpts, message []byte, privK *big.Int) ([2]*big.Int, error) {\n\tvar (\n\t\tret0 = new([2]*big.Int)\n\t)\n\tout := ret0\n\terr := _Ethdkg.contract.Call(opts, out, \"Sign\", message, privK)\n\treturn *ret0, err\n}", "func (pk PrivateKey) Sign(message []byte) Signature {\n\tvar signature Signature\n\tcopy(signature[:], ed25519.Sign(pk[:], message)[:])\n\treturn signature\n}", "func (r *rsaPrivateKey) Sign(data []byte) ([]byte, error) {\n\th := sha1.New()\n\th.Write(data)\n\td := h.Sum(nil)\n\treturn rsa.SignPKCS1v15(rand.Reader, r.PrivateKey, crypto.SHA1, d)\n}", "func (k *EdX25519Key) Sign(b []byte) []byte {\n\treturn sign.Sign(nil, b, k.privateKey)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactor) Sign(opts *bind.TransactOpts, _digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.contract.Transact(opts, \"sign\", _digest)\n}", "func (k *Keypair) Sign(hash []byte) ([]byte, error) {\n\n\tprKeyDecoded, err := base58.DecodeToBig(k.Private)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpuKeyDecoded, _ := base58.DecodeToBig(k.Public)\n\n\tpub := splitBig(puKeyDecoded, 2)\n\tx, y := pub[0], pub[1]\n\n\tkey := ecdsa.PrivateKey{\n\t\tecdsa.PublicKey{\n\t\t\telliptic.P224(),\n\t\t\tx,\n\t\t\ty,\n\t\t},\n\t\tprKeyDecoded,\n\t}\n\n\tr, s, _ := ecdsa.Sign(rand.Reader, &key, hash)\n\n\treturn base58.EncodeBig([]byte{}, bigJoin(KEY_SIZE, r, s)), nil\n}", "func (p *PrivateKey) Sign(mesg string) string {\n\tvar enc, m big.Int\n\tsetBytesReverse(&m, []byte(mesg))\n\tenc.Exp(&m, p.keyD, p.keyN)\n\treturn intToBase64(&enc)\n}", "func (l LocalIdentity) Sign(message []byte) ed25519.Signature {\n\treturn l.privateKey.Sign(message)\n}", "func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error)", "func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error)", "func (sk *PrivKey) Sign(msg []byte) ([]byte, error) {\n\tdigest := sha256.Sum256(msg)\n\treturn sk.PrivateKey.Sign(rand.Reader, digest[:], nil)\n}", "func (pk *PrivateKey) Sign(message []byte) *Signature {\n var signature Signature\n copy(signature[:], ed25519.Sign(pk[:], message)[:])\n return &signature\n}", "func (tx *Transaction) Sign(privKey ecdsa.PrivateKey) {\n\tif tx.IsGenesisTx() {\n\t\treturn\n\t}\n\n\t// TODO not complete copy\n\ttxCopy := *tx\n\n\ttxCopy.Hash = [32]byte{}\n\ttxCopy.Signature = [64]byte{}\n\n\t//dataToSign := fmt.Sprintf(\"%x\\n\", txCopy)\n\n\tdataToSign := \"\"\n\n\tr, s, err := ecdsa.Sign(rand.Reader, &privKey, []byte(dataToSign))\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\tvar sign64 [64]byte\n\tcopy(sign64[:], signature)\n\n\ttx.Signature = sign64\n}", "func (tx *Transaction) Sign(privkey *ecdsa.PrivateKey) (*Transaction, error) {\n\n\tsigHash := tx.SigHash()\n\n\tsig, err := crypto.Sign(sigHash.Bytes(), privkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx.Data.Sign = hex.EncodeToString(sig)\n\n\treturn tx, nil\n}", "func (obj *RawCardSigner) Sign(rawCard *RawCard, signerId string, privateKey foundation.PrivateKey) error {\n\tsignerIdChar := C.CString(signerId)\n\tdefer C.free(unsafe.Pointer(signerIdChar))\n\tsignerIdStr := C.vsc_str_from_str(signerIdChar)\n\n\tproxyResult := /*pr4*/ C.vssc_raw_card_signer_sign(obj.cCtx, (*C.vssc_raw_card_t)(unsafe.Pointer(rawCard.Ctx())), signerIdStr, (*C.vscf_impl_t)(unsafe.Pointer(privateKey.Ctx())))\n\n\terr := CoreSdkErrorHandleStatus(proxyResult)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\truntime.KeepAlive(obj)\n\n\truntime.KeepAlive(rawCard)\n\n\truntime.KeepAlive(signerId)\n\n\truntime.KeepAlive(privateKey)\n\n\treturn nil\n}", "func Sign(s *big.Int, params *Params, key *PrivateKey, attrs AttributeList, message *big.Int) (*Signature, error) {\n\treturn SignPrecomputed(s, params, key, attrs, PrepareAttributeSet(params, attrs), message)\n}", "func (s *SigningIdentity) Sign(reader io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) {\n\tswitch pk := s.PrivateKey.(type) {\n\tcase *ecdsa.PrivateKey:\n\t\trr, ss, err := ecdsa.Sign(reader, pk, digest)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// ensure Low S signatures\n\t\tsig := toLowS(\n\t\t\tpk.PublicKey,\n\t\t\tecdsaSignature{\n\t\t\t\tR: rr,\n\t\t\t\tS: ss,\n\t\t\t},\n\t\t)\n\n\t\treturn asn1.Marshal(sig)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"signing with private key of type %T not supported\", pk)\n\t}\n}", "func (tx *Tx) Sign(privateKey ecdsa.PrivateKey, prevTXs map[string]Tx) {\n\tif tx.IsCoinBase() {\n\t\treturn\n\t}\n\n\tfor _, vin := range tx.Vin {\n\t\tif prevTXs[hex.EncodeToString(vin.TxID)].ID == nil {\n\t\t\tlog.Panic(\"ERROR: Previous transaction is not correct\")\n\t\t}\n\t}\n\n\ttxCopy := tx.TrimmedCopy()\n\n\tfor inID, vin := range txCopy.Vin {\n\t\tprevTx := prevTXs[hex.EncodeToString(vin.TxID)]\n\t\ttxCopy.Vin[inID].Signature = nil\n\t\ttxCopy.Vin[inID].PubKey = prevTx.Vout[vin.Vout].PubHashKey\n\t\ttxCopy.ID = txCopy.Hash()\n\t\ttxCopy.Vin[inID].PubKey = nil\n\n\t\tr, s, err := ecdsa.Sign(rand.Reader, &privateKey, txCopy.ID)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\t\ttx.Vin[inID].Signature = signature\n\t}\n}", "func (sk *opensslPrivateKey) Sign(message []byte) ([]byte, error) {\n\treturn sk.key.SignPKCS1v15(openssl.SHA256_Method, message)\n}", "func (s *signer) Sign(data []byte) ([]byte, error) {\n\tkh, err := s.km.Get(s.keyID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s.cr.Sign(data, kh)\n}", "func (tx *Transaction) Sign(privateKey ecdsa.PrivateKey, prevTXs map[string]Transaction) {\n\tif tx.IsCoinbase() {\n\t\treturn\n\t}\n\n\tfor _, in := range tx.Inputs {\n\t\tif prevTXs[hex.EncodeToString(in.ID)].ID == nil {\n\t\t\tlog.Panic(\"ERROR: Previous transaction is not correct\")\n\t\t}\n\t}\n\n\ttxCopy := tx.TrimmedCopy()\n\n\tfor inID, in := range txCopy.Inputs {\n\t\tprevTX := prevTXs[hex.EncodeToString(in.ID)]\n\t\ttxCopy.Inputs[inID].Signature = nil\n\t\ttxCopy.Inputs[inID].PubKey = prevTX.Outputs[in.Out].PubKeyHash\n\n\t\tdataToSign := fmt.Sprintf(\"%x\\n\", txCopy)\n\t\tr, s, err := ecdsa.Sign(rand.Reader, &privateKey, []byte(dataToSign))\n\n\t\tHandle(err)\n\t\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\t\ttx.Inputs[inID].Signature = signature\n\n\t\ttxCopy.Inputs[inID].PubKey = nil\n\t}\n}", "func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error) {\n\t// r, s, err := Sign(priv, msg)\n\tr, s, err := SM2Sign(priv, msg, nil)\n\tfmt.Println(\"msg:\",msg)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn asn1.Marshal(sm2Signature{r, s})\n}", "func (tx *Transaction) Sign(privateKey ecdsa.PrivateKey, prevTXs map[string]Transaction) {\n\tif tx.IsCoinbase() {\n\t\treturn\n\t}\n\n\tfor _, in := range tx.Inputs {\n\t\tif prevTXs[hex.EncodeToString(in.ID)].ID == nil {\n\t\t\tlog.Panic(\"ERROR: Previous transaction is not correct\")\n\t\t}\n\t}\n\n\ttxCopy := tx.TrimmedCopy()\n\n\tfor inID, in := range txCopy.Inputs {\n\t\tprevTX := prevTXs[hex.EncodeToString(in.ID)]\n\t\ttxCopy.Inputs[inID].Signature = nil\n\t\ttxCopy.Inputs[inID].PubKey = prevTX.Outputs[in.Out].PubKeyHash\n\t\ttxCopy.ID = txCopy.Hash()\n\t\ttxCopy.Inputs[inID].PubKey = nil\n\n\t\tr, s, err := ecdsa.Sign(rand.Reader, &privateKey, txCopy.ID)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\t\ttx.Inputs[inID].Signature = signature\n\t}\n}", "func Sign(msg []byte, prv *ecdsa.PrivateKey) ([]byte, error) {\n\treturn crypto.Sign(msg, prv)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepSession) Sign(_digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.Sign(&_BondedECDSAKeep.TransactOpts, _digest)\n}", "func SignHash(privateKey *dsa.PrivateKey, hash *[32]byte) (sig *Signature) {\n\n\tr := big.NewInt(0)\n\ts := big.NewInt(0)\n\n\tr, s, err := dsa.Sign(rand.Reader, privateKey, hash[:])\n\tif err != nil {\n\t\tlog.Println(\"Error signing the hash\")\n\t\tlog.Fatalln(err)\n\t}\n\n\tsig = &Signature{\n\t\tR: r,\n\t\tS: s,\n\t}\n\n\treturn sig\n}", "func (lic *LicenseData) Sign(pkey *rsa.PrivateKey) error {\n\tjsonLicInfo, err := json.Marshal(lic.Info)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsignedData, err := Sign(pkey, jsonLicInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlic.Key = encodeKey(signedData)\n\n\treturn nil\n}", "func (c *Certificate) Sign(pkey ed25519.PrivateKey) {\n\t// (<resolver-pk> <client-magic> <serial> <ts-start> <ts-end> <extensions>)\n\tvar b []byte\n\tscratch := make([]byte, 4)\n\n\tb = append(b, c.PublicKey[:]...)\n\tb = append(b, c.ClientMagic...)\n\n\tbinary.BigEndian.PutUint32(scratch, c.Serial)\n\tb = append(b, scratch...)\n\n\tbinary.BigEndian.PutUint32(scratch, uint32(c.Start.Unix()))\n\tb = append(b, scratch...)\n\n\tbinary.BigEndian.PutUint32(scratch, uint32(c.End.Unix()))\n\tb = append(b, scratch...)\n\n\tb = append(b, c.Extensions...)\n\tc.Signature = ed25519.Sign(pkey, b)\n}", "func (r *rsaPrivateKey) Sign(data []byte) ([]byte, error) {\n return r.signDataWithHash(data, crypto.SHA256)\n}", "func Sign(opriv, rpriv *btcec.PrivateKey, m []byte) []byte {\n\tR := rpriv.PubKey()\n\tk := rpriv.D\n\tv := opriv.D\n\n\t// h(R,m) * v\n\thv := new(big.Int).Mul(hash(R, m), v)\n\n\t// k - h(R,m) * v\n\ts := new(big.Int).Sub(k, hv)\n\n\t// s mod N\n\ts = new(big.Int).Mod(s, btcec.S256().N)\n\n\treturn s.Bytes()\n}", "func (id *Identity) Sign(data []byte) []byte {\n\treturn ed25519.Sign(id.PrivateKey, data)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactorSession) Sign(_digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.Sign(&_BondedECDSAKeep.TransactOpts, _digest)\n}", "func (signer *Signer) Sign(msg []byte) ([]byte, error) {\n\tif signer.privateKey == nil {\n\t\treturn nil, errors.New(\"private key not provided\")\n\t}\n\n\thasher := getHasher(signer.privateKey.Curve).New()\n\n\t_, err := hasher.Write(msg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thashed := hasher.Sum(nil)\n\n\tr, s, err := ecdsa.Sign(rand.Reader, signer.privateKey, hashed)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcurveBits := signer.privateKey.Curve.Params().BitSize\n\n\tconst bitsInByte = 8\n\tkeyBytes := curveBits / bitsInByte\n\tif curveBits%bitsInByte > 0 {\n\t\tkeyBytes++\n\t}\n\n\treturn append(copyPadded(r.Bytes(), keyBytes), copyPadded(s.Bytes(), keyBytes)...), nil\n}", "func (adr *Address) Sign(tr *tx.Transaction) error {\n\treturn tr.Sign(adr.Address)\n}", "func (d *identityManager) Sign(message []byte) ([]byte, error) {\n\treturn Sign(d.key.PrivateKey, message)\n}", "func (asap *ASAP) Sign(audience string, privateKey cr.PrivateKey) (token []byte, err error) {\n\treturn asap.SignCustomClaims(audience, jws.Claims{}, privateKey)\n}", "func (k *PrivateKeySECP256K1R) Sign(msg []byte) ([]byte, error) {\n\treturn k.SignHash(hashing.ComputeHash256(msg))\n}", "func Sign(priv *ecdsa.PrivateKey, hash []byte) (r, s *big.Int, err error) {\n\treturn ecdsa.Sign(rand.Reader, priv, hash)\n}", "func Sign(hashedMessage []byte) ([]byte, error) {\n\tpk, err := privateKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Checking message signature.\n\tvar signature []byte\n\tif signature, err = rsa.SignPKCS1v15(rand.Reader, pk, crypto.SHA256, hashedMessage); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn signature, nil\n}", "func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error)", "func (privKey PrivKeyEd25519) Sign(msg []byte) ([]byte, error) {\n\tprivKeyBytes := [64]byte(privKey)\n\tsignatureBytes := Sign(&privKeyBytes, msg)\n\treturn signatureBytes[:], nil\n}", "func (p *KeyPair) Sign(message []byte) ([]byte, error) {\n\tprivateKey := p.ToEcdsa()\n\thash := sha256.Sum256(message)\n\tr, s, err := ecdsa.Sign(rand.Reader, privateKey, hash[:])\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tparams := privateKey.Curve.Params()\n\tcurveOrderByteSize := params.P.BitLen() / 8\n\trBytes, sBytes := r.Bytes(), s.Bytes()\n\tsignature := make([]byte, curveOrderByteSize*2)\n\tcopy(signature[curveOrderByteSize-len(rBytes):], rBytes)\n\tcopy(signature[curveOrderByteSize*2-len(sBytes):], sBytes)\n\n\treturn signature, nil\n}", "func (kb *Keybase) Sign(name, passphrase string, msg []byte) ([]byte, crypto.PubKey, error) {\n\thash := sha256.Sum256([]byte(name + \":\" + passphrase))\n\tkb.mx.Lock()\n\tpriv, ok := kb.privKeysCache[hash]\n\tif !ok {\n\t\tvar err error\n\t\tif priv, err = kb.kb.ExportPrivateKeyObject(name, passphrase); err != nil {\n\t\t\tkb.mx.Unlock()\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tkb.privKeysCache[hash] = priv\n\t}\n\tkb.mx.Unlock()\n\tsig, err := priv.Sign(msg)\n\treturn sig, priv.PubKey(), err\n}", "func Sign(key *rsa.PrivateKey, message []byte) ([]byte, error) {\n\t// sha256 hash the message\n\thashed := sha256.Sum256(message)\n\t// sign the hash\n\tsignature, err := rsa.SignPKCS1v15(\n\t\trand.Reader, key, crypto.SHA256, hashed[:],\n\t)\n\t// handle error\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to sign message: \")\n\t}\n\treturn signature, nil\n}", "func (_BondedECDSAKeep *BondedECDSAKeepSession) SubmitSignature(_r [32]byte, _s [32]byte, _recoveryID uint8) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.SubmitSignature(&_BondedECDSAKeep.TransactOpts, _r, _s, _recoveryID)\n}", "func Sign(privateKey PrivateKey, message []byte) []byte {\n\tif l := len(privateKey); l != PrivateKeySize {\n\t\tpanic(\"ed25519: bad private key length: \" + strconv.Itoa(l))\n\t}\n\n\th := sha512.New()\n\th.Write(privateKey[:32])\n\n\tvar digest1, messageDigest, hramDigest [64]byte\n\tvar expandedSecretKey [32]byte\n\th.Sum(digest1[:0])\n\tcopy(expandedSecretKey[:], digest1[:])\n\texpandedSecretKey[0] &= 248\n\texpandedSecretKey[31] &= 63\n\texpandedSecretKey[31] |= 64\n\n\th.Reset()\n\th.Write(digest1[32:])\n\th.Write(message)\n\th.Sum(messageDigest[:0])\n\n\tvar messageDigestReduced [32]byte\n\tedwards25519.ScReduce(&messageDigestReduced, &messageDigest)\n\tvar R edwards25519.ExtendedGroupElement\n\tedwards25519.GeScalarMultBase(&R, &messageDigestReduced)\n\n\tvar encodedR [32]byte\n\tR.ToBytes(&encodedR)\n\n\th.Reset()\n\th.Write(encodedR[:])\n\th.Write(privateKey[32:])\n\th.Write(message)\n\th.Sum(hramDigest[:0])\n\tvar hramDigestReduced [32]byte\n\tedwards25519.ScReduce(&hramDigestReduced, &hramDigest)\n\n\tvar s [32]byte\n\tedwards25519.ScMulAdd(&s, &hramDigestReduced, &expandedSecretKey, &messageDigestReduced)\n\n\tsignature := make([]byte, SignatureSize)\n\tcopy(signature[:], encodedR[:])\n\tcopy(signature[32:], s[:])\n\n\treturn signature\n}", "func Sign(sk *ecdsa.PrivateKey, h []byte) (string, error) {\n\tsigB, err := ecdsa.SignASN1(rand.Reader, sk, h)\n\treturn hex.EncodeToString(sigB), err\n}", "func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {\n\tvar rsaKey *rsa.PrivateKey\n\tvar ok bool\n\n\t// Validate type of key\n\tif rsaKey, ok = key.(*rsa.PrivateKey); !ok {\n\t\treturn \"\", ErrInvalidKey\n\t}\n\n\t// Create the hasher\n\tif !m.Hash.Available() {\n\t\treturn \"\", ErrHashUnavailable\n\t}\n\n\thasher := m.Hash.New()\n\thasher.Write([]byte(signingString))\n\n\t// Sign the string and return the encoded bytes\n\tif sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil {\n\t\treturn EncodeSegment(sigBytes), nil\n\t} else {\n\t\treturn \"\", err\n\t}\n}", "func (priv *PKCS11PrivateKeyRSA) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) {\n\terr = priv.lib.withSession(priv.lib.Slot.id, func(session pkcs11.SessionHandle) error {\n\t\tswitch opts.(type) {\n\t\tcase *rsa.PSSOptions:\n\t\t\tsignature, err = priv.lib.signPSS(session, priv, digest, opts.(*rsa.PSSOptions))\n\t\tdefault: /* PKCS1-v1_5 */\n\t\t\tsignature, err = priv.lib.signPKCS1v15(session, priv, digest, opts.HashFunc())\n\t\t}\n\t\treturn err\n\t})\n\treturn signature, err\n}", "func (s *SendTx) Sign(pubkey crypto.PubKey, sig crypto.Signature) error {\n\taddr := pubkey.Address()\n\tset := s.Tx.SetSignature(addr, sig)\n\tif !set {\n\t\treturn errors.Errorf(\"Cannot add signature for address %X\", addr)\n\t}\n\ts.signers = append(s.signers, pubkey)\n\treturn nil\n}", "func Sign(operation []byte, privKey ecdsa.PrivateKey) (signedR, signedS *big.Int, err error) {\n\tr, s, err := ecdsa.Sign(rand.Reader, &privKey, operation)\n\tif err != nil {\n\t\treturn big.NewInt(0), big.NewInt(0), err\n\t}\n\n\tsignedR = r\n\tsignedS = s\n\treturn\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactorSession) SubmitSignature(_r [32]byte, _s [32]byte, _recoveryID uint8) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.SubmitSignature(&_BondedECDSAKeep.TransactOpts, _r, _s, _recoveryID)\n}", "func Sign(h hash.Hashable) []byte {\n\tbuf := io.NewBufBinWriter()\n\tfor i := 0; i < 3; i++ {\n\t\tpKey := PrivateKey(i)\n\t\tsig := pKey.SignHashable(uint32(Network()), h)\n\t\tif len(sig) != 64 {\n\t\t\tpanic(\"wrong signature length\")\n\t\t}\n\t\temit.Bytes(buf.BinWriter, sig)\n\t}\n\treturn buf.Bytes()\n}", "func (sig *Signature) SignData(privateKey interface{}, encoding string) error {\n\tif privateKey == nil {\n\t\tlog.Warn(\"PrivateKey is nil\")\n\t\treturn errors.New(\"privateKey is nil\")\n\t}\n\tencoding += sig.GetSignatureMetaData().String()\n\tdata := []byte(encoding)\n\tswitch sig.Algorithm {\n\tcase Ed25519:\n\t\tif pkey, ok := privateKey.(ed25519.PrivateKey); ok {\n\t\t\tlog.Debug(\"Sign data\", \"signature\", sig, \"privateKey\", hex.EncodeToString(privateKey.(ed25519.PrivateKey)), \"encoding\", encoding)\n\t\t\tsig.Data = ed25519.Sign(pkey, data)\n\t\t\treturn nil\n\t\t}\n\t\tlog.Warn(\"Could not assert type ed25519.PrivateKey\", \"privateKeyType\", fmt.Sprintf(\"%T\", privateKey))\n\t\treturn errors.New(\"could not assert type ed25519.PrivateKey\")\n\tcase Ed448:\n\t\treturn errors.New(\"ed448 not yet supported in SignData()\")\n\tcase Ecdsa256:\n\t\tif pkey, ok := privateKey.(*ecdsa.PrivateKey); ok {\n\t\t\thash := sha256.Sum256(data)\n\t\t\tr, s, err := ecdsa.Sign(rand.Reader, pkey, hash[:])\n\t\t\tif err != nil {\n\t\t\t\tlog.Warn(\"Could not sign data\", \"error\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tsig.Data = []*big.Int{r, s}\n\t\t\treturn nil\n\t\t}\n\t\tlog.Warn(\"Could not assert type ecdsa.PrivateKey\", \"privateKeyType\", fmt.Sprintf(\"%T\", privateKey))\n\t\treturn errors.New(\"could not assert type ecdsa.PrivateKey\")\n\tcase Ecdsa384:\n\t\tif pkey, ok := privateKey.(*ecdsa.PrivateKey); ok {\n\t\t\thash := sha512.Sum384(data)\n\t\t\tr, s, err := ecdsa.Sign(rand.Reader, pkey, hash[:])\n\t\t\tif err != nil {\n\t\t\t\tlog.Warn(\"Could not sign data\", \"error\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tsig.Data = []*big.Int{r, s}\n\t\t\treturn nil\n\t\t}\n\t\tlog.Warn(\"Could not cast key to ecdsa.PrivateKey\", \"privateKeyType\", fmt.Sprintf(\"%T\", privateKey))\n\t\treturn errors.New(\"could not assert type ecdsa.PrivateKey\")\n\tdefault:\n\t\tlog.Warn(\"Signature algorithm type not supported\", \"type\", sig.Algorithm)\n\t\treturn errors.New(\"signature algorithm type not supported\")\n\t}\n}", "func (p *PrivateKey) Sign(data []byte) []byte {\n\tvar digest = sha256.Sum256(data)\n\n\treturn p.SignHash(digest)\n}", "func Sign(privateKey, publicKey, message []byte) []byte {\n\n\tvar privateKeyA [32]byte\n\tcopy(privateKeyA[:], privateKey) // we need this in an array later\n\tvar messageDigest, hramDigest [64]byte\n\n\th := sha512.New()\n\th.Write(privateKey[32:])\n\th.Write(message)\n\th.Sum(messageDigest[:0])\n\n\tvar messageDigestReduced [32]byte\n\tedwards25519.ScReduce(&messageDigestReduced, &messageDigest)\n\tvar R edwards25519.ExtendedGroupElement\n\tedwards25519.GeScalarMultBase(&R, &messageDigestReduced)\n\n\tvar encodedR [32]byte\n\tR.ToBytes(&encodedR)\n\n\th.Reset()\n\th.Write(encodedR[:])\n\th.Write(publicKey)\n\th.Write(message)\n\th.Sum(hramDigest[:0])\n\tvar hramDigestReduced [32]byte\n\tedwards25519.ScReduce(&hramDigestReduced, &hramDigest)\n\n\tvar s [32]byte\n\tedwards25519.ScMulAdd(&s, &hramDigestReduced, &privateKeyA, &messageDigestReduced)\n\n\tsignature := make([]byte, 64)\n\tcopy(signature[:], encodedR[:])\n\tcopy(signature[32:], s[:])\n\n\treturn signature\n}", "func (ra *RestrictedAgent) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {\n\treturn nil, ErrForbidden\n}", "func sign(key *rsa.PrivateKey, blob []byte) ([]byte, error) {\n\th := sha1.New()\n\th.Write(blob)\n\tdigest := h.Sum(nil)\n\treturn rsa.SignPKCS1v15(nil, key, crypto.SHA1, digest)\n}", "func (sk *PrivateKey) Sign(\n\trand io.Reader, msg []byte, opts crypto.SignerOpts,\n) (signature []byte, err error) {\n\tvar sig [SignatureSize]byte\n\n\tif opts.HashFunc() != crypto.Hash(0) {\n\t\treturn nil, errors.New(\"eddilithium2: cannot sign hashed message\")\n\t}\n\n\tSignTo(sk, msg, sig[:])\n\treturn sig[:], nil\n}", "func (p PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error) {\n\tif opts.HashFunc() != crypto.Hash(0) {\n\t\treturn nil, errors.New(\"x25519: cannot sign hashed message\")\n\t}\n\n\treturn Sign(rand, p, message)\n}", "func RsaPrivateKeySign(data string, privateKeyHexOrPem string) (string, error) {\n\t// data is required\n\tif len(data) == 0 {\n\t\treturn \"\", errors.New(\"Data To Sign is Required\")\n\t}\n\n\t// get private key\n\tvar privateKey *rsa.PrivateKey\n\tvar err error\n\n\tif util.Left(privateKeyHexOrPem, 27) == \"-----BEGIN PRIVATE KEY-----\" && util.Right(privateKeyHexOrPem, 25) == \"-----END PRIVATE KEY-----\" {\n\t\t// get private key from pem text\n\t\tprivateKey, err = rsaPrivateKeyFromPem(privateKeyHexOrPem)\n\t} else {\n\t\tprivateKey, err = rsaPrivateKeyFromHex(privateKeyHexOrPem)\n\t}\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// convert data to byte array\n\tmsg := []byte(data)\n\n\t// define hash\n\th := sha256.New()\n\th.Write(msg)\n\td := h.Sum(nil)\n\n\tsignature, err1 := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, d)\n\n\tif err1 != nil {\n\t\treturn \"\", err1\n\t}\n\n\t// return signature\n\treturn util.ByteToHex(signature), nil\n}", "func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {\n\tvar rsaKey *rsa.PrivateKey\n\tvar ok bool\n\n\t// Validate type of key\n\tif rsaKey, ok = key.(*rsa.PrivateKey); !ok {\n\t\treturn \"\", ErrInvalidKey\n\t}\n\n\t// Create the hasher\n\tif !m.Hash.Available() {\n\t\treturn \"\", ex.New(ErrHashUnavailable)\n\t}\n\n\thasher := m.Hash.New()\n\tif _, err := hasher.Write([]byte(signingString)); err != nil {\n\t\treturn \"\", ex.New(err)\n\t}\n\n\t// Sign the string and return the encoded bytes\n\tsigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil))\n\tif err != nil {\n\t\treturn \"\", ex.New(err)\n\t}\n\treturn EncodeSegment(sigBytes), nil\n}", "func (c *CIDOffer) Sign(privKey *fcrcrypto.KeyPair, keyVer *fcrcrypto.KeyVersion) error {\n\traw, err := c.MarshalToSign()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsig, err := fcrcrypto.SignMessage(privKey, keyVer, raw)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.signature = sig\n\treturn nil\n}", "func Sign(privateKey *[PrivateKeySize]byte, message []byte) *[SignatureSize]byte {\n\th := sha512.New()\n\th.Write(privateKey[:32])\n\n\tvar digest1, messageDigest, hramDigest [64]byte\n\tvar expandedSecretKey [32]byte\n\th.Sum(digest1[:0])\n\tcopy(expandedSecretKey[:], digest1[:])\n\texpandedSecretKey[0] &= 248\n\texpandedSecretKey[31] &= 63\n\texpandedSecretKey[31] |= 64\n\n\th.Reset()\n\th.Write(digest1[32:])\n\th.Write(message)\n\th.Sum(messageDigest[:0])\n\n\tvar messageDigestReduced [32]byte\n\tedwards25519.ScReduce(&messageDigestReduced, &messageDigest)\n\tvar R edwards25519.ExtendedGroupElement\n\tedwards25519.GeScalarMultBase(&R, &messageDigestReduced)\n\n\tvar encodedR [32]byte\n\tR.ToBytes(&encodedR)\n\n\th.Reset()\n\th.Write(encodedR[:])\n\th.Write(privateKey[32:])\n\th.Write(message)\n\th.Sum(hramDigest[:0])\n\tvar hramDigestReduced [32]byte\n\tedwards25519.ScReduce(&hramDigestReduced, &hramDigest)\n\n\tvar s [32]byte\n\tedwards25519.ScMulAdd(&s, &hramDigestReduced, &expandedSecretKey, &messageDigestReduced)\n\n\tsignature := new([64]byte)\n\tcopy(signature[:], encodedR[:])\n\tcopy(signature[32:], s[:])\n\treturn signature\n}", "func Sign(agent *MerkleAgent, hash []byte) (*wots.PrivateKey, *MerkleSig, error) {\n\tmerkleSig := new(MerkleSig)\n\tmerkleSig.Leaf = agent.keyItr.Offset()\n\n\t// TODO: adapt for *WtnOpts\n\toffset := agent.keyItr.Offset()\n\tif offset >= (1 << agent.H){\n\t\treturn nil, nil, errors.New(\"key pairs on the tree are totally used\")\n\t}\n\n\tsk, err := agent.keyItr.Next()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tmerkleSig.WtnSig, err = wots.Sign(sk, hash)\n\tif nil != err {\n\t\treturn nil, nil, errors.New(\"unexpected error occurs during signing\")\n\t}\n\n\t// fill in the public key deriving leaf\n\t//merkleSig.LeafPk = &sk.PublicKey\n\tmerkleSig.LeafPk = (&sk.PublicKey).Clone()\n\n\t// copy the auth path\n\tmerkleSig.Auth = make([][]byte, len(agent.auth))\n\tfor i := range agent.auth {\n\t\tmerkleSig.Auth[i] = make([]byte, len(agent.auth[i]))\n\t\tcopy(merkleSig.Auth[i], agent.auth[i])\n\t}\n\n\t// update auth path\n\tagent.Traverse()\n\toffset = agent.keyItr.Offset()\n\terr = nil\n\tif offset == (1 << agent.H) - 1{\n\t\terr = errors.New(\"Warning: this is the last signature\")\n\t}\n\n\treturn sk, merkleSig, err\n}", "func (kp *FromAddress) Sign(input []byte) ([]byte, error) {\n\treturn nil, ErrCannotSign\n}", "func (m EncMessage) Sign(k []byte) error {\n\treturn errors.New(\"Sign method must be overridden\")\n}", "func (lic *LicenseData) SignWithKey(privKey string) error {\n\trsaPrivKey, err := ReadPrivateKeyFromFile(privKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn lic.Sign(rsaPrivKey)\n}", "func (p *Payload) Sign(key []byte) (signature [32]byte) {\n\tsignature = sha256.Sum256(append(p.message[:], key[:]...))\n\tp.signature = signature\n\treturn\n}" ]
[ "0.767177", "0.76705706", "0.7640929", "0.75531304", "0.75048906", "0.7454987", "0.70666057", "0.66788435", "0.66478306", "0.6604549", "0.65936244", "0.6574449", "0.6571988", "0.6559472", "0.6513406", "0.6512841", "0.6502778", "0.6479652", "0.6473044", "0.6447695", "0.6413036", "0.6323164", "0.6290929", "0.6284954", "0.61604184", "0.6159564", "0.61491424", "0.6092417", "0.60763115", "0.6063337", "0.6056201", "0.6004924", "0.59941006", "0.59624624", "0.59544927", "0.592656", "0.5910264", "0.5882161", "0.5870923", "0.58675534", "0.58675534", "0.58401376", "0.58376455", "0.58160526", "0.58078766", "0.5804299", "0.57877964", "0.57834715", "0.5783079", "0.57720876", "0.57434195", "0.57423264", "0.5737813", "0.57375723", "0.5729916", "0.571222", "0.5696102", "0.56869227", "0.5669052", "0.566478", "0.5634399", "0.562622", "0.5624219", "0.56116474", "0.5593609", "0.55931467", "0.55784833", "0.55776715", "0.55647594", "0.5562604", "0.553349", "0.55177265", "0.5512358", "0.5506884", "0.5487002", "0.5485707", "0.5475554", "0.5468481", "0.54558873", "0.5454306", "0.5431744", "0.5428131", "0.5424111", "0.5394293", "0.53892124", "0.5388956", "0.5352593", "0.5342742", "0.5337778", "0.5336723", "0.5329252", "0.53201956", "0.5316413", "0.527135", "0.5228489", "0.52235717", "0.5221529", "0.52149963", "0.52132255", "0.51986825" ]
0.76867986
0
SignWith executes the TransactionSigner and adds the resulting signature data to the Transaction's signature map with the publicKey as the map key.
func (transaction *TokenMintTransaction) SignWith( publicKey PublicKey, signer TransactionSigner, ) *TokenMintTransaction { if !transaction.IsFrozen() { _, _ = transaction.Freeze() } else { transaction.transactions = make([]*proto.Transaction, 0) } if transaction.keyAlreadySigned(publicKey) { return transaction } for index := 0; index < len(transaction.signedTransactions); index++ { signature := signer(transaction.signedTransactions[index].GetBodyBytes()) transaction.signedTransactions[index].SigMap.SigPair = append( transaction.signedTransactions[index].SigMap.SigPair, publicKey.toSignaturePairProtobuf(signature), ) } return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *ScheduleSignTransaction) SignWith(\n\tpublicKey PublicKey,\n\tsigner TransactionSigner,\n) *ScheduleSignTransaction {\n\tif !transaction._KeyAlreadySigned(publicKey) {\n\t\ttransaction._SignWith(publicKey, signer)\n\t}\n\n\treturn transaction\n}", "func (transaction *ContractUpdateTransaction) SignWith(\n\tpublicKey PublicKey,\n\tsigner TransactionSigner,\n) *ContractUpdateTransaction {\n\tif !transaction.IsFrozen() {\n\t\t_, _ = transaction.Freeze()\n\t} else {\n\t\ttransaction.transactions = make([]*proto.Transaction, 0)\n\t}\n\n\tif transaction.keyAlreadySigned(publicKey) {\n\t\treturn transaction\n\t}\n\n\tfor index := 0; index < len(transaction.signedTransactions); index++ {\n\t\tsignature := signer(transaction.signedTransactions[index].GetBodyBytes())\n\n\t\ttransaction.signedTransactions[index].SigMap.SigPair = append(\n\t\t\ttransaction.signedTransactions[index].SigMap.SigPair,\n\t\t\tpublicKey.toSignaturePairProtobuf(signature),\n\t\t)\n\t}\n\n\treturn transaction\n}", "func (transaction *TokenUpdateTransaction) SignWith(\n\tpublicKey PublicKey,\n\tsigner TransactionSigner,\n) *TokenUpdateTransaction {\n\tif !transaction._KeyAlreadySigned(publicKey) {\n\t\ttransaction._SignWith(publicKey, signer)\n\t}\n\n\treturn transaction\n}", "func (transaction *FileCreateTransaction) SignWith(\n\tpublicKey PublicKey,\n\tsigner TransactionSigner,\n) *FileCreateTransaction {\n\tif !transaction._KeyAlreadySigned(publicKey) {\n\t\ttransaction._SignWith(publicKey, signer)\n\t}\n\n\treturn transaction\n}", "func (transaction *AccountUpdateTransaction) SignWith(\n\tpublicKey PublicKey,\n\tsigner TransactionSigner,\n) *AccountUpdateTransaction {\n\tif !transaction._KeyAlreadySigned(publicKey) {\n\t\ttransaction._SignWith(publicKey, signer)\n\t}\n\n\treturn transaction\n}", "func (transaction *AccountCreateTransaction) SignWith(\n\tpublicKey PublicKey,\n\tsigner TransactionSigner,\n) *AccountCreateTransaction {\n\tif !transaction._KeyAlreadySigned(publicKey) {\n\t\ttransaction._SignWith(publicKey, signer)\n\t}\n\n\treturn transaction\n}", "func (tx *Transaction) Sign(privkey *ecdsa.PrivateKey) (*Transaction, error) {\n\n\tsigHash := tx.SigHash()\n\n\tsig, err := crypto.Sign(sigHash.Bytes(), privkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx.Data.Sign = hex.EncodeToString(sig)\n\n\treturn tx, nil\n}", "func (s *SendTx) Sign(pubkey crypto.PubKey, sig crypto.Signature) error {\n\taddr := pubkey.Address()\n\tset := s.Tx.SetSignature(addr, sig)\n\tif !set {\n\t\treturn errors.Errorf(\"Cannot add signature for address %X\", addr)\n\t}\n\ts.signers = append(s.signers, pubkey)\n\treturn nil\n}", "func (transaction *FileCreateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *FileCreateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (w Wallet) Sign(tx TransactionPayload, chainID, accountNumber, sequenceNumber string) (SignedTransactionPayload, error) {\n\tsignBytes := signBytes(tx, chainID, accountNumber, sequenceNumber)\n\n\tpk, err := w.keyPair.ECPrivKey()\n\tif err != nil {\n\t\treturn SignedTransactionPayload{}, err\n\t}\n\n\thashSb := sha256.Sum256(signBytes)\n\tsignatureRaw, err := pk.Sign(hashSb[:])\n\tif err != nil {\n\t\treturn SignedTransactionPayload{}, err\n\t}\n\n\tsignatureRaw.Serialize()\n\trBytes := signatureRaw.R.Bytes()\n\tsBytes := signatureRaw.S.Bytes()\n\n\tpubKey, err := w.publicKey.ECPubKey()\n\tif err != nil {\n\t\treturn SignedTransactionPayload{}, err\n\t}\n\n\tr := []byte{}\n\tr = append(r, rBytes...)\n\tr = append(r, sBytes...)\n\tsignature := base64.StdEncoding.EncodeToString(r)\n\tcompressedPubKey := base64.StdEncoding.EncodeToString(pubKey.SerializeCompressed())\n\n\ttx.Signatures = []Signature{\n\t\t{\n\t\t\tSignature: signature,\n\t\t\tSigPubKey: SigPubKey{\n\t\t\t\tType: \"tendermint/PubKeySecp256k1\",\n\t\t\t\tValue: compressedPubKey,\n\t\t\t},\n\t\t},\n\t}\n\n\treturn SignedTransactionPayload(tx), nil\n}", "func (tx *Transaction) Sign(privKey ecdsa.PrivateKey) {\n\tif tx.IsGenesisTx() {\n\t\treturn\n\t}\n\n\t// TODO not complete copy\n\ttxCopy := *tx\n\n\ttxCopy.Hash = [32]byte{}\n\ttxCopy.Signature = [64]byte{}\n\n\t//dataToSign := fmt.Sprintf(\"%x\\n\", txCopy)\n\n\tdataToSign := \"\"\n\n\tr, s, err := ecdsa.Sign(rand.Reader, &privKey, []byte(dataToSign))\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\tvar sign64 [64]byte\n\tcopy(sign64[:], signature)\n\n\ttx.Signature = sign64\n}", "func (transaction *AccountCreateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *AccountCreateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (transaction *ScheduleSignTransaction) Sign(\n\tprivateKey PrivateKey,\n) *ScheduleSignTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (transaction *ContractUpdateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *ContractUpdateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (t *Transaction) Sign(w arweave.WalletSigner) (*Transaction, error) {\n\t// format the message\n\tpayload, err := t.FormatMsgBytes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmsg := sha256.Sum256(payload)\n\n\tsig, err := w.Sign(msg[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = w.Verify(msg[:], sig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tid := sha256.Sum256((sig))\n\n\tidB := make([]byte, len(id))\n\tcopy(idB, id[:])\n\tt.SetID(idB)\n\n\t// we copy t into tx\n\ttx := Transaction(*t)\n\t// add the signature and ID to our new signature struct\n\ttx.signature = sig\n\n\treturn &tx, nil\n}", "func (bc *Blockchain) SignTransaction(tx *Transaction, privKey ecdsa.PrivateKey) {\n\tprevTXs := make(map[string]Transaction)\n\t//遍历当前交易的输入集\n\tfor _, vin := range tx.Vin {\n\t\t//找到之前的交易ID\n\t\tprevTX, err := bc.FindTransaction(vin.Txid)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\t//之前的交易集\n\t\tprevTXs[hex.EncodeToString(prevTX.ID)] = prevTX\n\t}\n\ttx.Sign(privKey, prevTXs)\n}", "func (s *AppTx) Sign(pubkey crypto.PubKey, sig crypto.Signature) error {\n\tif len(s.signers) > 0 {\n\t\treturn errors.New(\"AppTx already signed..\")\n\t}\n\n\ts.Tx.SetSignature(sig)\n\ts.signers = []crypto.PubKey{pubkey}\n\n\treturn nil\n}", "func (transaction *TokenMintTransaction) Sign(\n\tprivateKey PrivateKey,\n) *TokenMintTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (tx *Transaction) Sign(privateKey ecdsa.PrivateKey, prevTXs map[string]Transaction) {\n\tif tx.IsCoinbase() {\n\t\treturn\n\t}\n\n\tfor _, in := range tx.Inputs {\n\t\tif prevTXs[hex.EncodeToString(in.ID)].ID == nil {\n\t\t\tlog.Panic(\"ERROR: Previous transaction is not correct\")\n\t\t}\n\t}\n\n\ttxCopy := tx.TrimmedCopy()\n\n\tfor inID, in := range txCopy.Inputs {\n\t\tprevTX := prevTXs[hex.EncodeToString(in.ID)]\n\t\ttxCopy.Inputs[inID].Signature = nil\n\t\ttxCopy.Inputs[inID].PubKey = prevTX.Outputs[in.Out].PubKeyHash\n\n\t\tdataToSign := fmt.Sprintf(\"%x\\n\", txCopy)\n\t\tr, s, err := ecdsa.Sign(rand.Reader, &privateKey, []byte(dataToSign))\n\n\t\tHandle(err)\n\t\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\t\ttx.Inputs[inID].Signature = signature\n\n\t\ttxCopy.Inputs[inID].PubKey = nil\n\t}\n}", "func (transaction *TokenUpdateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *TokenUpdateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func (tx *Transaction) Sign(privateKey ecdsa.PrivateKey, prevTXs map[string]Transaction) {\n\tif tx.IsCoinbase() {\n\t\treturn\n\t}\n\n\tfor _, in := range tx.Inputs {\n\t\tif prevTXs[hex.EncodeToString(in.ID)].ID == nil {\n\t\t\tlog.Panic(\"ERROR: Previous transaction is not correct\")\n\t\t}\n\t}\n\n\ttxCopy := tx.TrimmedCopy()\n\n\tfor inID, in := range txCopy.Inputs {\n\t\tprevTX := prevTXs[hex.EncodeToString(in.ID)]\n\t\ttxCopy.Inputs[inID].Signature = nil\n\t\ttxCopy.Inputs[inID].PubKey = prevTX.Outputs[in.Out].PubKeyHash\n\t\ttxCopy.ID = txCopy.Hash()\n\t\ttxCopy.Inputs[inID].PubKey = nil\n\n\t\tr, s, err := ecdsa.Sign(rand.Reader, &privateKey, txCopy.ID)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\t\ttx.Inputs[inID].Signature = signature\n\t}\n}", "func (transaction *AccountUpdateTransaction) Sign(\n\tprivateKey PrivateKey,\n) *AccountUpdateTransaction {\n\treturn transaction.SignWith(privateKey.PublicKey(), privateKey.Sign)\n}", "func SignTx(tx *types.Transaction, privKey *crypto.PrivateKey, pubKey *crypto.PublicKey) error {\n\n\taddr, _ := types.NewAddressFromPubKey(pubKey)\n\tscriptPubKey := script.PayToPubKeyHashScript(addr.Hash())\n\t// sign it\n\tfor txInIdx, txIn := range tx.Vin {\n\t\tsigHash, err := script.CalcTxHashForSig(*scriptPubKey, tx, txInIdx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsig, err := crypto.Sign(privKey, sigHash)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tscriptSig := script.SignatureScript(sig, pubKey.Serialize())\n\t\ttxIn.ScriptSig = *scriptSig\n\n\t\t// test to ensure\n\t\tif err = script.Validate(scriptSig, scriptPubKey, tx, txInIdx); err != nil {\n\t\t\tlogger.Errorf(\"failed to validate tx. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (tx *Tx) Sign(privateKey ecdsa.PrivateKey, prevTXs map[string]Tx) {\n\tif tx.IsCoinBase() {\n\t\treturn\n\t}\n\n\tfor _, vin := range tx.Vin {\n\t\tif prevTXs[hex.EncodeToString(vin.TxID)].ID == nil {\n\t\t\tlog.Panic(\"ERROR: Previous transaction is not correct\")\n\t\t}\n\t}\n\n\ttxCopy := tx.TrimmedCopy()\n\n\tfor inID, vin := range txCopy.Vin {\n\t\tprevTx := prevTXs[hex.EncodeToString(vin.TxID)]\n\t\ttxCopy.Vin[inID].Signature = nil\n\t\ttxCopy.Vin[inID].PubKey = prevTx.Vout[vin.Vout].PubHashKey\n\t\ttxCopy.ID = txCopy.Hash()\n\t\ttxCopy.Vin[inID].PubKey = nil\n\n\t\tr, s, err := ecdsa.Sign(rand.Reader, &privateKey, txCopy.ID)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\tsignature := append(r.Bytes(), s.Bytes()...)\n\n\t\ttx.Vin[inID].Signature = signature\n\t}\n}", "func Sign(ctx context.Context, txf Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error {\n\tif txf.keybase == nil {\n\t\treturn errors.New(\"keybase must be set prior to signing a transaction\")\n\t}\n\n\tvar err error\n\tsignMode := txf.signMode\n\tif signMode == signing.SignMode_SIGN_MODE_UNSPECIFIED {\n\t\t// use the SignModeHandler's default mode if unspecified\n\t\tsignMode, err = authsigning.APISignModeToInternal(txf.txConfig.SignModeHandler().DefaultMode())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tk, err := txf.keybase.Key(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpubKey, err := k.GetPubKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsignerData := authsigning.SignerData{\n\t\tChainID: txf.chainID,\n\t\tAccountNumber: txf.accountNumber,\n\t\tSequence: txf.sequence,\n\t\tPubKey: pubKey,\n\t\tAddress: sdk.AccAddress(pubKey.Address()).String(),\n\t}\n\n\t// For SIGN_MODE_DIRECT, calling SetSignatures calls setSignerInfos on\n\t// TxBuilder under the hood, and SignerInfos is needed to generated the\n\t// sign bytes. This is the reason for setting SetSignatures here, with a\n\t// nil signature.\n\t//\n\t// Note: this line is not needed for SIGN_MODE_LEGACY_AMINO, but putting it\n\t// also doesn't affect its generated sign bytes, so for code's simplicity\n\t// sake, we put it here.\n\tsigData := signing.SingleSignatureData{\n\t\tSignMode: signMode,\n\t\tSignature: nil,\n\t}\n\tsig := signing.SignatureV2{\n\t\tPubKey: pubKey,\n\t\tData: &sigData,\n\t\tSequence: txf.Sequence(),\n\t}\n\n\tvar prevSignatures []signing.SignatureV2\n\tif !overwriteSig {\n\t\tprevSignatures, err = txBuilder.GetTx().GetSignaturesV2()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Overwrite or append signer infos.\n\tvar sigs []signing.SignatureV2\n\tif overwriteSig {\n\t\tsigs = []signing.SignatureV2{sig}\n\t} else {\n\t\tsigs = append(sigs, prevSignatures...)\n\t\tsigs = append(sigs, sig)\n\t}\n\tif err := txBuilder.SetSignatures(sigs...); err != nil {\n\t\treturn err\n\t}\n\n\tif err := checkMultipleSigners(txBuilder.GetTx()); err != nil {\n\t\treturn err\n\t}\n\n\tbytesToSign, err := authsigning.GetSignBytesAdapter(\n\t\tctx, txf.txConfig.SignModeHandler(),\n\t\tsignMode, signerData, txBuilder.GetTx())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sign those bytes\n\tsigBytes, _, err := txf.keybase.Sign(name, bytesToSign, signMode)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Construct the SignatureV2 struct\n\tsigData = signing.SingleSignatureData{\n\t\tSignMode: signMode,\n\t\tSignature: sigBytes,\n\t}\n\tsig = signing.SignatureV2{\n\t\tPubKey: pubKey,\n\t\tData: &sigData,\n\t\tSequence: txf.Sequence(),\n\t}\n\n\tif overwriteSig {\n\t\terr = txBuilder.SetSignatures(sig)\n\t} else {\n\t\tprevSignatures = append(prevSignatures, sig)\n\t\terr = txBuilder.SetSignatures(prevSignatures...)\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to set signatures on payload: %w\", err)\n\t}\n\n\t// Run optional preprocessing if specified. By default, this is unset\n\t// and will return nil.\n\treturn txf.PreprocessTx(name, txBuilder)\n}", "func (adr *Address) Sign(tr *tx.Transaction) error {\n\treturn tr.Sign(adr.Address)\n}", "func SignTx(tx *EvmTransaction, prv *ecdsa.PrivateKey) (*EvmTransaction, error) {\n\th := tx.getUnsignedHash()\n\tsig, err := crypto.Sign(h[:], prv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tx.WithSignature(sig)\n}", "func (ks *KeyStore) SignTx(key *ecdsa.PrivateKey, tx types.Transaction, chainID *uint256.Int) (types.Transaction, error) {\n\t// Depending on the presence of the chain ID, sign with 2718 or homestead\n\tsigner := types.LatestSignerForChainID(chainID.ToBig())\n\treturn types.SignTx(tx, *signer, key)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactor) Sign(opts *bind.TransactOpts, _digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.contract.Transact(opts, \"sign\", _digest)\n}", "func (m multiSigner) SignTx(magic netmode.Magic, tx *transaction.Transaction) error {\n\tinvoc := m.SignHashable(uint32(magic), tx)\n\tverif := m.Script()\n\tfor i := range tx.Scripts {\n\t\tif bytes.Equal(tx.Scripts[i].VerificationScript, verif) {\n\t\t\ttx.Scripts[i].InvocationScript = invoc\n\t\t\treturn nil\n\t\t}\n\t}\n\ttx.Scripts = append(tx.Scripts, transaction.Witness{\n\t\tInvocationScript: invoc,\n\t\tVerificationScript: verif,\n\t})\n\treturn nil\n}", "func SignTx(signedBytes []byte, addr []byte, privKey crypto.PrivKey) (crypto.Signature, error) {\n\tif !bytes.Equal(privKey.PubKey().Address(), addr) {\n\t\treturn nil, errors.New(common.Fmt(\"SignTx: addresses mismatch: %x != %x\",\n\t\t\tprivKey.PubKey().Address(), addr))\n\t}\n\treturn privKey.Sign(signedBytes), nil\n}", "func (ac *Account) Sign(transaction []byte) []byte {\n\tlabel := []byte(\"\")\n\tsha1hash := sha1.New()\n\tencryptedmsg, err := rsa.EncryptOAEP(sha1hash, rand.Reader, ac.privateKey.Public().(*rsa.PublicKey), transaction, label)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn encryptedmsg\n}", "func (w *KeystoreWallet) SignTx(tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {\n\treturn w.Keystore.SignTx(w.Account, tx, chainID)\n}", "func (t *Tx) sign() {\n\tfor _, txIn := range t.TxIns {\n\t\t// sign transaction id, which is a hash of the transaction\n\t\ttxIn.Signature = wallet.Sign(t.Id, wallet.Wallet())\n\t}\n}", "func (s *PublicTransactionPoolAPI) sign(addr common.Address, tx types.Tx) (types.Tx, error) {\n\t// Look up the wallet containing the requested signer\n\taccount := accounts.Account{Address: addr}\n\n\twallet, err := s.b.AccountManager().Find(account)\n\tif err != nil {\n\t\treturn nil, wtypes.ErrAccountNotFound\n\t}\n\t// Request the wallet to sign the transaction\n\ttx1, err := wallet.SignTx(account, tx, types.SignParam)\n\tif err != nil {\n\t\treturn nil, wtypes.ErrSignTx\n\t}\n\treturn tx1, nil\n}", "func (s *signer) Sign(data []byte) ([]byte, error) {\n\tkh, err := s.km.Get(s.keyID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s.cr.Sign(data, kh)\n}", "func (t *Transactions) Send(\n\ttransactionFilename string,\n\tsignerName string,\n\targs []string,\n\targsJSON string,\n) (*flow.Transaction, *flow.TransactionResult, error) {\n\tif t.project == nil {\n\t\treturn nil, nil, fmt.Errorf(\"missing configuration, initialize it: flow init\")\n\t}\n\n\tsigner := t.project.AccountByName(signerName)\n\tif signer == nil {\n\t\treturn nil, nil, fmt.Errorf(\"signer account: [%s] doesn't exists in configuration\", signerName)\n\t}\n\n\tcode, err := util.LoadFile(transactionFilename)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn t.send(code, signer, args, argsJSON)\n}", "func (tx *Payment) Sign(scheme Scheme, secretKey crypto.SecretKey) error {\n\tif IsProtobufTx(tx) {\n\t\tb, err := MarshalTxBody(scheme, tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts, err := crypto.Sign(secretKey, b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttx.ID = &s\n\t\ttx.Signature = &s\n\t\treturn nil\n\t}\n\tb := tx.bodyMarshalBinaryBuffer()\n\terr := tx.bodyMarshalBinary(b)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to sign Payment transaction\")\n\t}\n\td := make([]byte, len(b)+3)\n\tcopy(d[3:], b)\n\ts, err := crypto.Sign(secretKey, d)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to sign Payment transaction\")\n\t}\n\ttx.ID = &s\n\ttx.Signature = &s\n\treturn nil\n}", "func (tx *CreateLegalEntityTx) SignTx(privateKey crypto.PrivKey, chainID string) error {\n\tsig, err := SignTx(tx.SignBytes(chainID), tx.Address, privateKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttx.Signature = sig\n\treturn nil\n}", "func SignTx(tx *Transaction, signer Signer, prv *ecdsa.PrivateKey) (*Transaction, error) {\n\tvar h common.Hash\n\tif signer.ChainID() == nil {\n\t\th = tx.UnprotectedHash()\n\t} else {\n\t\th = tx.ProtectedHash(signer.ChainID())\n\t}\n\n\tsig, err := crypto.Sign(h.Bytes(), prv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn tx.WithSignature(signer, sig)\n}", "func (w *KeystoreWallet) SignTxWithPassphrase(passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {\n\t// Account seems valid, request the keystore to sign\n\treturn w.Keystore.SignTxWithPassphrase(w.Account, passphrase, tx, chainID)\n}", "func (e *Entity) SignWith(parent *Entity) error {\n\tparentTemplate := parent.Template\n\tif parent.Certificate != nil && parent.Certificate.Leaf != nil {\n\t\tparentTemplate = parent.Certificate.Leaf\n\t}\n\tif parentTemplate == nil {\n\t\treturn fmt.Errorf(\"no template found for signing the certificate\")\n\t}\n\n\te.Template.Issuer = parentTemplate.Subject\n\te.Template.AuthorityKeyId = parentTemplate.SubjectKeyId\n\tif len(e.Template.DNSNames) == 0 {\n\t\te.Template.DNSNames = []string{e.Template.Subject.CommonName}\n\t}\n\n\tderCert, err := x509.CreateCertificate(randReader, e.Template, parentTemplate, e.PublicKey, parent.PrivateKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create certificate: %v\", err)\n\t}\n\n\ttlsCert := &tls.Certificate{}\n\ttlsCert.Leaf, err = x509.ParseCertificate(derCert)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse the certificate: %v\", err)\n\t}\n\ttlsCert.Certificate = [][]byte{tlsCert.Leaf.Raw}\n\ttlsCert.PrivateKey = e.PrivateKey\n\te.Certificate = tlsCert\n\n\treturn nil\n}", "func (sw *SignatureWitness) sign(ctx context.Context, tpl *Template, index uint32, auth string, signFn SignFunc) error {\n\t// Compute the predicate to sign. This is either a\n\t// txsighash program if tpl.AllowAdditional is false (i.e., the tx is complete\n\t// and no further changes are allowed) or a program enforcing\n\t// constraints derived from the existing outputs and current input.\n\tif len(sw.Program) == 0 {\n\t\tvar err error\n\t\tsw.Program, err = buildSigProgram(tpl, tpl.SigningInstructions[index].Position)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(sw.Program) == 0 {\n\t\t\treturn ErrEmptyProgram\n\t\t}\n\t}\n\tif len(sw.Sigs) < len(sw.Keys) {\n\t\t// Each key in sw.Keys may produce a signature in sw.Sigs. Make\n\t\t// sure there are enough slots in sw.Sigs and that we preserve any\n\t\t// sigs already present.\n\t\tnewSigs := make([]chainjson.HexBytes, len(sw.Keys))\n\t\tcopy(newSigs, sw.Sigs)\n\t\tsw.Sigs = newSigs\n\t}\n\tvar h [32]byte\n\tsha3pool.Sum256(h[:], sw.Program)\n\tfor i, keyID := range sw.Keys {\n\t\tif len(sw.Sigs[i]) > 0 {\n\t\t\t// Already have a signature for this key\n\t\t\tcontinue\n\t\t}\n\t\tpath := make([][]byte, len(keyID.DerivationPath))\n\t\tfor i, p := range keyID.DerivationPath {\n\t\t\tpath[i] = p\n\t\t}\n\t\tsigBytes, err := signFn(ctx, keyID.XPub, path, h, auth)\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\"module\": logModule, \"err\": err}).Warningf(\"computing signature %d\", i)\n\t\t\tcontinue\n\t\t}\n\n\t\t// This break is ordered to avoid signing transaction successfully only once for a multiple-sign account\n\t\t// that consist of different keys by the same password. Exit immediately when the signature is success,\n\t\t// it means that only one signature will be successful in the loop for this multiple-sign account.\n\t\tsw.Sigs[i] = sigBytes\n\t\tbreak\n\t}\n\treturn nil\n}", "func (s *SkyСoinService) SignTransaction(secKey, rawTx string) (response *TransactionSignResponse, err error) {\n\tresponse = &TransactionSignResponse{}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"error signing transaction %s\", r)\n\t\t}\n\t}()\n\n\tb, err := hex.DecodeString(rawTx)\n\tif err != nil {\n\t\tfmt.Printf(\"invalid raw transaction: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\n\ttx, err := coin.TransactionDeserialize(b)\n\n\tcipherSecKey, err := cipher.SecKeyFromHex(secKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkeys := []cipher.SecKey{cipherSecKey}\n\ttx.SignInputs(keys)\n\ttx.UpdateHeader()\n\n\t// Return raw transaction(hex of signed transaction)\n\tresponse.Transaction = tx.TxIDHex()\n\n\treturn response, nil\n}", "func (transaction *AccountCreateTransaction) AddSignature(publicKey PublicKey, signature []byte) *AccountCreateTransaction {\n\ttransaction._RequireOneNodeAccountID()\n\n\tif transaction._KeyAlreadySigned(publicKey) {\n\t\treturn transaction\n\t}\n\n\tif transaction.signedTransactions._Length() == 0 {\n\t\treturn transaction\n\t}\n\n\ttransaction.transactions = _NewLockableSlice()\n\ttransaction.publicKeys = append(transaction.publicKeys, publicKey)\n\ttransaction.transactionSigners = append(transaction.transactionSigners, nil)\n\ttransaction.transactionIDs.locked = true\n\n\tfor index := 0; index < transaction.signedTransactions._Length(); index++ {\n\t\tvar temp *services.SignedTransaction\n\t\tswitch t := transaction.signedTransactions._Get(index).(type) { //nolint\n\t\tcase *services.SignedTransaction:\n\t\t\ttemp = t\n\t\t}\n\t\ttemp.SigMap.SigPair = append(\n\t\t\ttemp.SigMap.SigPair,\n\t\t\tpublicKey._ToSignaturePairProtobuf(signature),\n\t\t)\n\t\ttransaction.signedTransactions._Set(index, temp)\n\t}\n\n\treturn transaction\n}", "func (lic *LicenseData) SignWithKey(privKey string) error {\n\trsaPrivKey, err := ReadPrivateKeyFromFile(privKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn lic.Sign(rsaPrivKey)\n}", "func signTransaction(tx *transaction, nanos *ledger.NanoS) error {\n\ttoSign, err := json.Marshal(tx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(\"Signing transaction. Please confirm on your Ledger\")\n\tsignature, err := nanos.SignTx(toSign)\n\tif err != nil {\n\t\tlog.Println(errSigningTx)\n\t\treturn err\n\t}\n\n\tsigHex := hex.EncodeToString(signature)\n\ttx.Signature = sigHex\n\treturn nil\n}", "func SignTransaction(s Signer, sf SignerFunc) ([][]byte, error) {\n\treturn s.SignTransaction(sf)\n}", "func (tb *transactionBuilder) Sign(wholeTransaction bool) ([]types.Transaction, error) {\n\tif tb.signed {\n\t\treturn nil, errBuilderAlreadySigned\n\t}\n\n\t// Create the coveredfields struct.\n\tvar coveredFields types.CoveredFields\n\tif wholeTransaction {\n\t\tcoveredFields = types.CoveredFields{WholeTransaction: true}\n\t} else {\n\t\tfor i := range tb.transaction.MinerFees {\n\t\t\tcoveredFields.MinerFees = append(coveredFields.MinerFees, uint64(i))\n\t\t}\n\t\tfor i := range tb.transaction.SiacoinInputs {\n\t\t\tcoveredFields.SiacoinInputs = append(coveredFields.SiacoinInputs, uint64(i))\n\t\t}\n\t\tfor i := range tb.transaction.SiacoinOutputs {\n\t\t\tcoveredFields.SiacoinOutputs = append(coveredFields.SiacoinOutputs, uint64(i))\n\t\t}\n\t\tfor i := range tb.transaction.FileContracts {\n\t\t\tcoveredFields.FileContracts = append(coveredFields.FileContracts, uint64(i))\n\t\t}\n\t\tfor i := range tb.transaction.FileContractRevisions {\n\t\t\tcoveredFields.FileContractRevisions = append(coveredFields.FileContractRevisions, uint64(i))\n\t\t}\n\t\tfor i := range tb.transaction.StorageProofs {\n\t\t\tcoveredFields.StorageProofs = append(coveredFields.StorageProofs, uint64(i))\n\t\t}\n\t\tfor i := range tb.transaction.ArbitraryData {\n\t\t\tcoveredFields.ArbitraryData = append(coveredFields.ArbitraryData, uint64(i))\n\t\t}\n\t}\n\t// TransactionSignatures don't get covered by the 'WholeTransaction' flag,\n\t// and must be covered manually.\n\tfor i := range tb.transaction.TransactionSignatures {\n\t\tcoveredFields.TransactionSignatures = append(coveredFields.TransactionSignatures, uint64(i))\n\t}\n\n\t// For each siacoin input in the transaction that we added, provide a\n\t// signature.\n\ttb.wallet.mu.RLock()\n\tdefer tb.wallet.mu.RUnlock()\n\tfor _, inputIndex := range tb.siacoinInputs {\n\t\tinput := tb.transaction.SiacoinInputs[inputIndex]\n\t\tkey, ok := tb.wallet.keys[input.UnlockConditions.UnlockHash()]\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"transaction builder added an input that it cannot sign\")\n\t\t}\n\t\tnewSigIndices := addSignatures(&tb.transaction, coveredFields, input.UnlockConditions, crypto.Hash(input.ParentID), key)\n\t\ttb.transactionSignatures = append(tb.transactionSignatures, newSigIndices...)\n\t\ttb.signed = true // Signed is set to true after one successful signature to indicate that future signings can cause issues.\n\t}\n\n\t// Get the transaction set and delete the transaction from the registry.\n\ttxnSet := append(tb.parents, tb.transaction)\n\treturn txnSet, nil\n}", "func (s *Store) SignWithPassphrase(address, passphrase string, data []byte) ([]byte, error) {\n\tacc := accounts.Account{\n\t\tAddress: ethcmn.Address(ethcmn.HexToAddress(address)),\n\t}\n\treturn s.ks.SignHashWithPassphrase(acc, passphrase, data)\n}", "func (lic *LicenseData) Sign(pkey *rsa.PrivateKey) error {\n\tjsonLicInfo, err := json.Marshal(lic.Info)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsignedData, err := Sign(pkey, jsonLicInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlic.Key = encodeKey(signedData)\n\n\treturn nil\n}", "func Sign(output io.Writer, signed *Entity, hints *FileHints, config *packet.Config) (input io.WriteCloser, err error) {\n\tif signed == nil {\n\t\treturn nil, errors.InvalidArgumentError(\"no signer provided\")\n\t}\n\n\t// These are the possible hash functions that we'll use for the signature.\n\tcandidateHashes := []uint8{\n\t\thashToHashId(crypto.SHA256),\n\t\thashToHashId(crypto.SHA384),\n\t\thashToHashId(crypto.SHA512),\n\t\thashToHashId(crypto.SHA1),\n\t\thashToHashId(crypto.RIPEMD160),\n\t}\n\tdefaultHashes := candidateHashes[len(candidateHashes)-1:]\n\tpreferredHashes := signed.primaryIdentity().SelfSignature.PreferredHash\n\tif len(preferredHashes) == 0 {\n\t\tpreferredHashes = defaultHashes\n\t}\n\tcandidateHashes = intersectPreferences(candidateHashes, preferredHashes)\n\treturn writeAndSign(noOpCloser{output}, candidateHashes, signed, hints, config)\n}", "func SignRawTransaction(cmd *SignRawTransactionCmd, chainCfg *chaincfg.Params) (*btcjson.SignRawTransactionResult, error) {\n\tserializedTx, err := DecodeHexStr(cmd.RawTx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar tx wire.MsgTx\n\terr = tx.Deserialize(bytes.NewBuffer(serializedTx))\n\tif err != nil {\n\t\te := errors.New(\"TX decode failed\")\n\t\treturn nil, e\n\t}\n\n\tvar hashType txscript.SigHashType\n\tswitch *cmd.Flags {\n\tcase \"ALL\":\n\t\thashType = txscript.SigHashAll\n\tcase \"NONE\":\n\t\thashType = txscript.SigHashNone\n\tcase \"SINGLE\":\n\t\thashType = txscript.SigHashSingle\n\tcase \"ALL|ANYONECANPAY\":\n\t\thashType = txscript.SigHashAll | txscript.SigHashAnyOneCanPay\n\tcase \"NONE|ANYONECANPAY\":\n\t\thashType = txscript.SigHashNone | txscript.SigHashAnyOneCanPay\n\tcase \"SINGLE|ANYONECANPAY\":\n\t\thashType = txscript.SigHashSingle | txscript.SigHashAnyOneCanPay\n\tdefault:\n\t\te := errors.New(\"Invalid sighash parameter\")\n\t\treturn nil, e\n\t}\n\n\t// TODO: really we probably should look these up with btcd anyway to\n\t// make sure that they match the blockchain if present.\n\tinputs := make(map[wire.OutPoint][]byte)\n\tscripts := make(map[string][]byte)\n\tvar cmdInputs []RawTxInput\n\tif cmd.Inputs != nil {\n\t\tcmdInputs = *cmd.Inputs\n\t}\n\tfor _, rti := range cmdInputs {\n\t\tinputHash, err := chainhash.NewHashFromStr(rti.Txid)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tscript, err := DecodeHexStr(rti.ScriptPubKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// redeemScript is only actually used iff the user provided\n\t\t// private keys. In which case, it is used to get the scripts\n\t\t// for signing. If the user did not provide keys then we always\n\t\t// get scripts from the wallet.\n\t\t// Empty strings are ok for this one and hex.DecodeString will\n\t\t// DTRT.\n\t\tif cmd.PrivKeys != nil && len(*cmd.PrivKeys) != 0 {\n\t\t\tredeemScript, err := DecodeHexStr(rti.RedeemScript)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\taddr, err := btcutil.NewAddressScriptHash(redeemScript, chainCfg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tscripts[addr.String()] = redeemScript\n\t\t}\n\t\tinputs[wire.OutPoint{\n\t\t\tHash: *inputHash,\n\t\t\tIndex: rti.Vout,\n\t\t}] = script\n\t}\n\n\t// Parse list of private keys, if present. If there are any keys here\n\t// they are the keys that we may use for signing. If empty we will\n\t// use any keys known to us already.\n\tvar keys map[string]*btcutil.WIF\n\tif cmd.PrivKeys != nil {\n\t\tkeys = make(map[string]*btcutil.WIF)\n\n\t\tfor _, key := range *cmd.PrivKeys {\n\t\t\twif, err := btcutil.DecodeWIF(key)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif !wif.IsForNet(chainCfg) {\n\t\t\t\ts := \"key network doesn't match wallet's\"\n\t\t\t\treturn nil, errors.New(s)\n\t\t\t}\n\n\t\t\taddr, err := btcutil.NewAddressPubKey(wif.SerializePubKey(), chainCfg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tkeys[addr.EncodeAddress()] = wif\n\n\t\t\tbechAddr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()), chainCfg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"new bech addr err\")\n\t\t\t}\n\t\t\tkeys[bechAddr.EncodeAddress()] = wif\n\n\t\t\tfor _, rti := range cmdInputs {\n\t\t\t\tredeemScript, err := DecodeHexStr(rti.RedeemScript)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\taddr, err := btcutil.NewAddressScriptHash(redeemScript, chainCfg)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tkeys[addr.EncodeAddress()] = wif\n\t\t\t}\n\t\t}\n\n\t}\n\n\tgetScriptPubKey := func(txID string) (scriptPubKey []byte, err error) {\n\t\tfor i := range *cmd.Inputs {\n\t\t\tif (*cmd.Inputs)[i].Txid == txID {\n\t\t\t\treturn hex.DecodeString((*cmd.Inputs)[i].ScriptPubKey)\n\t\t\t}\n\t\t}\n\t\terr = errors.Errorf(\"not fund scriptPubKey: %s\", txID)\n\t\treturn\n\t}\n\tfor i := range tx.TxIn {\n\t\tvar scriptPubKey []byte\n\t\tscriptPubKey, err = getScriptPubKey(tx.TxIn[i].PreviousOutPoint.Hash.String())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinputs[tx.TxIn[i].PreviousOutPoint] = scriptPubKey\n\t}\n\n\tfnFindTxInAmount := func(op wire.OutPoint) int64 {\n\t\tfor _, in := range *cmd.Inputs {\n\t\t\tif in.Txid == op.Hash.String() && in.Vout == op.Index {\n\t\t\t\treturn decimal.NewFromFloat(in.Amount).Shift(8).IntPart()\n\t\t\t}\n\t\t}\n\t\treturn -1\n\t}\n\n\t// All args collected. Now we can sign all the inputs that we can.\n\t// `complete' denotes that we successfully signed all outputs and that\n\t// all scripts will run to completion. This is returned as part of the\n\t// reply.\n\tsignErrs, err := signTransaction(&tx, hashType, inputs, keys, scripts, chainCfg, fnFindTxInAmount)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(signErrs) > 0 {\n\t\terrMsgs := []string{}\n\t\tfor _, e := range signErrs {\n\t\t\tif !strings.Contains(e.Error.Error(), \"not all signatures empty on failed checkmultisig\") { //忽略多重签名未完成的错误\n\t\t\t\terrMsgs = append(errMsgs, e.Error.Error())\n\t\t\t}\n\t\t}\n\t\tif len(errMsgs) > 0 {\n\t\t\treturn nil, errors.New(strings.Join(errMsgs, \",\"))\n\t\t}\n\t}\n\n\tvar buf bytes.Buffer\n\tbuf.Grow(tx.SerializeSize())\n\n\t// All returned errors (not OOM, which panics) encounted during\n\t// bytes.Buffer writes are unexpected.\n\tif err = tx.Serialize(&buf); err != nil {\n\t\treturn nil, err\n\t}\n\n\tsignErrors := make([]btcjson.SignRawTransactionError, 0, len(signErrs))\n\tfor _, e := range signErrs {\n\t\tinput := tx.TxIn[e.InputIndex]\n\t\tsignErrors = append(signErrors, btcjson.SignRawTransactionError{\n\t\t\tTxID: input.PreviousOutPoint.Hash.String(),\n\t\t\tVout: input.PreviousOutPoint.Index,\n\t\t\tScriptSig: hex.EncodeToString(input.SignatureScript),\n\t\t\tSequence: input.Sequence,\n\t\t\tError: e.Error.Error(),\n\t\t})\n\t}\n\n\treturn &btcjson.SignRawTransactionResult{\n\t\tHex: hex.EncodeToString(buf.Bytes()),\n\t\tComplete: len(signErrors) == 0,\n\t\tErrors: signErrors,\n\t}, nil\n}", "func (s *SendTx) AddSigner(pk crypto.PubKey) {\n\t// get addr if available\n\tvar addr []byte\n\tif !pk.Empty() {\n\t\taddr = pk.Address()\n\t}\n\n\t// set the send address, and pubkey if needed\n\tin := s.Tx.Inputs\n\tin[0].Address = addr\n\tif in[0].Sequence == 1 {\n\t\tin[0].PubKey = pk\n\t}\n}", "func (k *EdX25519Key) Sign(b []byte) []byte {\n\treturn sign.Sign(nil, b, k.privateKey)\n}", "func (transaction *FileCreateTransaction) AddSignature(publicKey PublicKey, signature []byte) *FileCreateTransaction {\n\ttransaction._RequireOneNodeAccountID()\n\n\tif transaction._KeyAlreadySigned(publicKey) {\n\t\treturn transaction\n\t}\n\n\tif transaction.signedTransactions._Length() == 0 {\n\t\treturn transaction\n\t}\n\n\ttransaction.transactions = _NewLockableSlice()\n\ttransaction.publicKeys = append(transaction.publicKeys, publicKey)\n\ttransaction.transactionSigners = append(transaction.transactionSigners, nil)\n\ttransaction.transactionIDs.locked = true\n\n\tfor index := 0; index < transaction.signedTransactions._Length(); index++ {\n\t\tvar temp *services.SignedTransaction\n\t\tswitch t := transaction.signedTransactions._Get(index).(type) { //nolint\n\t\tcase *services.SignedTransaction:\n\t\t\ttemp = t\n\t\t}\n\t\ttemp.SigMap.SigPair = append(\n\t\t\ttemp.SigMap.SigPair,\n\t\t\tpublicKey._ToSignaturePairProtobuf(signature),\n\t\t)\n\t\ttransaction.signedTransactions._Set(index, temp)\n\t}\n\n\treturn transaction\n}", "func (l LocalIdentity) Sign(message []byte) ed25519.Signature {\n\treturn l.privateKey.Sign(message)\n}", "func (input *InputSigner) Sign(hashType txscript.SigHashType, signer SignatureProvider) ([]*TxSignature, error) {\n\tinput.Lock()\n\tdefer input.Unlock()\n\t_, sigs, err := input.sign(hashType, signer)\n\treturn sigs, err\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactorSession) Sign(_digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.Sign(&_BondedECDSAKeep.TransactOpts, _digest)\n}", "func (addr *Address) Sign(privKey *id.PrivKey) error {\n\tbuf := make([]byte, surge.SizeHintU8+surge.SizeHintString(addr.Value)+surge.SizeHintU64)\n\treturn addr.SignWithBuffer(privKey, buf)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepSession) Sign(_digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.Sign(&_BondedECDSAKeep.TransactOpts, _digest)\n}", "func (s *wrappedSigner) Sign(data []byte) ([]byte, error) {\n\tprimary := s.ps.Primary\n\tsigner, ok := (primary.Primitive).(tink.Signer)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"public_key_sign_factory: not a Signer primitive\")\n\t}\n\n\tvar signedData []byte\n\tif primary.PrefixType == tinkpb.OutputPrefixType_LEGACY {\n\t\tsignedData = append(signedData, data...)\n\t\tsignedData = append(signedData, cryptofmt.LegacyStartByte)\n\t} else {\n\t\tsignedData = data\n\t}\n\n\tsignature, err := signer.Sign(signedData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append([]byte(primary.Prefix), signature...), nil\n}", "func (c CryptoServiceTester) TestSignWithKey(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\tcontent := []byte(\"this is a secret\")\n\n\ttufKey, err := cryptoService.Create(c.role, c.gun, c.keyAlgo)\n\trequire.NoError(t, err, c.errorMsg(\"error creating key\"))\n\n\t// Test Sign\n\tprivKey, role, err := cryptoService.GetPrivateKey(tufKey.ID())\n\trequire.NoError(t, err, c.errorMsg(\"failed to get private key\"))\n\trequire.Equal(t, c.role, role)\n\n\tsignature, err := privKey.Sign(rand.Reader, content, nil)\n\trequire.NoError(t, err, c.errorMsg(\"signing failed\"))\n\n\tverifier, ok := signed.Verifiers[algoToSigType[c.keyAlgo]]\n\trequire.True(t, ok, c.errorMsg(\"Unknown verifier for algorithm\"))\n\n\terr = verifier.Verify(tufKey, signature, content)\n\trequire.NoError(t, err,\n\t\tc.errorMsg(\"verification failed for %s key type\", c.keyAlgo))\n}", "func (s *Sudt) SignTx(keys map[string]crypto.Key) (*types.Transaction, error) {\n\tfor lockHash, group := range s.groups {\n\t\terr := transaction.SingleSignTransaction(s.tx, group, transaction.EmptyWitnessArg, keys[lockHash])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"sign transaction error: %v\", err)\n\t\t}\n\t}\n\n\treturn s.tx, nil\n}", "func (bbs *BBSG2Pub) SignWithKey(messages [][]byte, privKey *PrivateKey) ([]byte, error) {\n\tvar err error\n\n\tpubKey := privKey.PublicKey()\n\n\tmessagesFr := make([]*SignatureMessage, len(messages))\n\tfor i := range messages {\n\t\tmessagesFr[i], err = ParseSignatureMessage(messages[i])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parse signature message %d: %w\", i+1, err)\n\t\t}\n\t}\n\n\te, err := bls.RandFR(rand.Reader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create signature.E: %w\", err)\n\t}\n\n\ts, err := bls.RandFR(rand.Reader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create signature.S: %w\", err)\n\t}\n\n\tb, err := computeB(s, messagesFr, pubKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"compute B point: %w\", err)\n\t}\n\n\texp := privKey.GetFRElement().Copy()\n\texp.AddAssign(e)\n\tsig := b.MulFR(exp.Inverse().ToRepr())\n\n\tsignature := &Signature{\n\t\tSignature: g2pubs.NewSignatureFromG1(sig.ToAffine()),\n\t\tE: e,\n\t\tS: s,\n\t}\n\n\treturn signature.ToBytes()\n}", "func (key *Key) SignTransactionSigRequest(request *TransactionSigReq) error {\n\thash := HashTransactionSigRequest(key.Mode, *request)\n\n\t// When signing a transaction sig request, use EdDSA only, even if the default mode is Merkle\n\tvar sig *Signature\n\tif key.Mode == ModeEdDSA || key.Mode == ModeMerkle {\n\t\tsig = key.signHashWithMode(hash, ModeEdDSA)\n\t} else if key.Mode == ModeBLS {\n\t\tpanic(\"I have to work on this, should sign with EdDSA here as well.\")\n\t} else {\n\t\tpanic(\"unrecognized mode\")\n\t}\n\n\trequest.Signature = *sig\n\n\treturn nil\n}", "func ExampleSignTxOutput() {\n\t// Ordinarily the private key would come from whatever storage mechanism\n\t// is being used, but for this example just hard code it.\n\tprivKeyBytes, err := hex.DecodeString(\"22a47fa09a223f2aa079edf85a7c2\" +\n\t\t\"d4f8720ee63e502ee2869afab7de234b80c\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tprivKey, pubKey := btcec.PrivKeyFromBytes(privKeyBytes)\n\tpubKeyHash := btcutil.Hash160(pubKey.SerializeCompressed())\n\taddr, err := btcutil.NewAddressPubKeyHash(pubKeyHash,\n\t\t&chaincfg.MainNetParams)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// For this example, create a fake transaction that represents what\n\t// would ordinarily be the real transaction that is being spent. It\n\t// contains a single output that pays to address in the amount of 1 BTC.\n\toriginTx := wire.NewMsgTx(wire.TxVersion)\n\tprevOut := wire.NewOutPoint(&chainhash.Hash{}, ^uint32(0))\n\ttxIn := wire.NewTxIn(prevOut, []byte{txscript.OP_0, txscript.OP_0}, nil)\n\toriginTx.AddTxIn(txIn)\n\tpkScript, err := txscript.PayToAddrScript(addr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\ttxOut := wire.NewTxOut(100000000, pkScript)\n\toriginTx.AddTxOut(txOut)\n\toriginTxHash := originTx.TxHash()\n\n\t// Create the transaction to redeem the fake transaction.\n\tredeemTx := wire.NewMsgTx(wire.TxVersion)\n\n\t// Add the input(s) the redeeming transaction will spend. There is no\n\t// signature script at this point since it hasn't been created or signed\n\t// yet, hence nil is provided for it.\n\tprevOut = wire.NewOutPoint(&originTxHash, 0)\n\ttxIn = wire.NewTxIn(prevOut, nil, nil)\n\tredeemTx.AddTxIn(txIn)\n\n\t// Ordinarily this would contain that actual destination of the funds,\n\t// but for this example don't bother.\n\ttxOut = wire.NewTxOut(0, nil)\n\tredeemTx.AddTxOut(txOut)\n\n\t// Sign the redeeming transaction.\n\tlookupKey := func(a btcutil.Address) (*btcec.PrivateKey, bool, error) {\n\t\t// Ordinarily this function would involve looking up the private\n\t\t// key for the provided address, but since the only thing being\n\t\t// signed in this example uses the address associated with the\n\t\t// private key from above, simply return it with the compressed\n\t\t// flag set since the address is using the associated compressed\n\t\t// public key.\n\t\t//\n\t\t// NOTE: If you want to prove the code is actually signing the\n\t\t// transaction properly, uncomment the following line which\n\t\t// intentionally returns an invalid key to sign with, which in\n\t\t// turn will result in a failure during the script execution\n\t\t// when verifying the signature.\n\t\t//\n\t\t// privKey.D.SetInt64(12345)\n\t\t//\n\t\treturn privKey, true, nil\n\t}\n\t// Notice that the script database parameter is nil here since it isn't\n\t// used. It must be specified when pay-to-script-hash transactions are\n\t// being signed.\n\tsigScript, err := txscript.SignTxOutput(&chaincfg.MainNetParams,\n\t\tredeemTx, 0, originTx.TxOut[0].PkScript, txscript.SigHashAll,\n\t\ttxscript.KeyClosure(lookupKey), nil, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tredeemTx.TxIn[0].SignatureScript = sigScript\n\n\t// Prove that the transaction has been validly signed by executing the\n\t// script pair.\n\tflags := txscript.ScriptBip16 | txscript.ScriptVerifyDERSignatures |\n\t\ttxscript.ScriptStrictMultiSig |\n\t\ttxscript.ScriptDiscourageUpgradableNops\n\tvm, err := txscript.NewEngine(originTx.TxOut[0].PkScript, redeemTx, 0,\n\t\tflags, nil, nil, -1, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tif err := vm.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(\"Transaction successfully signed\")\n\n\t// Output:\n\t// Transaction successfully signed\n}", "func Sign(s *big.Int, params *Params, key *PrivateKey, attrs AttributeList, message *big.Int) (*Signature, error) {\n\treturn SignPrecomputed(s, params, key, attrs, PrepareAttributeSet(params, attrs), message)\n}", "func (e *SaltpackSign) Run(m libkb.MetaContext) error {\n\tif err := e.loadKey(m); err != nil {\n\t\treturn err\n\t}\n\n\tsaltpackVersion, err := libkb.SaltpackVersionFromArg(e.arg.Opts.SaltpackVersion)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif e.arg.Opts.Detached {\n\t\treturn libkb.SaltpackSignDetached(e.G(), e.arg.Source, e.arg.Sink, e.key, e.arg.Opts.Binary, saltpackVersion)\n\t}\n\n\treturn libkb.SaltpackSign(e.G(), e.arg.Source, e.arg.Sink, e.key, e.arg.Opts.Binary, saltpackVersion)\n}", "func (p *privateKey) Sign(data []byte) ([]byte, error) {\n\treturn p.PrivateKey.Sign(data), nil\n}", "func Sign(m string, kp *Keypair) *Signature {\n\treturn genSignature(m, kp.private)\n}", "func (c BitcoinCoreChain) SignedTx(rawTxHex, wif string, options *ChainsOptions) (string, error) {\n // https://www.experts-exchange.com/questions/29108851/How-to-correctly-create-and-sign-a-Bitcoin-raw-transaction-using-Btcutil-library.html\n tx, err := DecodeBtcTxHex(rawTxHex)\n if err != nil {\n return \"\", fmt.Errorf(\"Fail to decode raw tx %s\", err)\n }\n\n ecPriv, err := btcutil.DecodeWIF(wif)\n if err != nil {\n return \"\", fmt.Errorf(\"Fail to decode wif %s\", err)\n }\n fromAddress, _ := btcutil.DecodeAddress(options.From, c.Mode)\n subscript, _ := txscript.PayToAddrScript(fromAddress)\n for i, txIn := range tx.MsgTx().TxIn {\n if txIn.SignatureScript, err = txscript.SignatureScript(tx.MsgTx(), i, subscript, txscript.SigHashAll, ecPriv.PrivKey, true); err != nil{\n return \"\", fmt.Errorf(\"SignatureScript %s\", err)\n }\n }\n\n //Validate signature\n flags := txscript.StandardVerifyFlags\n vm, err := txscript.NewEngine(subscript, tx.MsgTx(), 0, flags, nil, nil, options.VinAmount)\n if err != nil {\n return \"\", fmt.Errorf(\"Txscript.NewEngine %s\", err)\n }\n if err := vm.Execute(); err != nil {\n return \"\", fmt.Errorf(\"Fail to sign tx %s\", err)\n }\n\n // txToHex\n buf := bytes.NewBuffer(make([]byte, 0, tx.MsgTx().SerializeSize()))\n tx.MsgTx().Serialize(buf)\n txHex := hex.EncodeToString(buf.Bytes())\n return txHex, nil\n}", "func (p *Payload) Sign(key []byte) (signature [32]byte) {\n\tsignature = sha256.Sum256(append(p.message[:], key[:]...))\n\tp.signature = signature\n\treturn\n}", "func (_Ethdkg *EthdkgSession) Sign(message []byte, privK *big.Int) ([2]*big.Int, error) {\n\treturn _Ethdkg.Contract.Sign(&_Ethdkg.CallOpts, message, privK)\n}", "func (pk PrivateKey) Sign(message []byte) Signature {\n\tvar signature Signature\n\tcopy(signature[:], ed25519.Sign(pk[:], message)[:])\n\treturn signature\n}", "func TmSign(publicKey PublicKey, privateKey PrivateKey, digest Digest) Seal { panic(\"\") }", "func (tb *transactionBuilder) Sign() ([]types.Transaction, error) {\n\tif tb.signed {\n\t\treturn nil, errBuilderAlreadySigned\n\t}\n\n\t// For each siacoin input in the transaction that we added, provide a\n\t// signature.\n\ttb.wallet.mu.Lock()\n\tdefer tb.wallet.mu.Unlock()\n\n\tif !tb.wallet.unlocked {\n\t\treturn nil, modules.ErrLockedWallet\n\t}\n\n\tfor _, ctx := range tb.coinInputs {\n\t\tinput := tb.transaction.CoinInputs[ctx.InputIndex]\n\t\t_, sk, err := tb.wallet.getKey(ctx.UnlockHash)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = input.Fulfillment.Sign(types.FulfillmentSignContext{\n\t\t\tExtraObjects: []interface{}{uint64(ctx.InputIndex)},\n\t\t\tTransaction: tb.transaction,\n\t\t\tKey: sk,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttb.signed = true // Signed is set to true after one successful signature to indicate that future signings can cause issues.\n\t}\n\tfor _, ctx := range tb.blockstakeInputs {\n\t\tinput := tb.transaction.BlockStakeInputs[ctx.InputIndex]\n\t\t_, sk, err := tb.wallet.getKey(ctx.UnlockHash)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = input.Fulfillment.Sign(types.FulfillmentSignContext{\n\t\t\tExtraObjects: []interface{}{uint64(ctx.InputIndex)},\n\t\t\tTransaction: tb.transaction,\n\t\t\tKey: sk,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttb.signed = true // Signed is set to true after one successful signature to indicate that future signings can cause issues.\n\t}\n\n\t// Get the transaction set and delete the transaction from the registry.\n\ttxnSet := append(tb.parents, tb.transaction)\n\treturn txnSet, nil\n}", "func SignTx(tx xdr.TransactionEnvelope, seed memguard.LockedBuffer) (*string, error) {\n\n\t// Sign the transaction\n\ttxBuilder := &build.TransactionEnvelopeBuilder{E: &tx}\n\ttxBuilder.Init()\n\terr := txBuilder.MutateTX(build.PublicNetwork)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO: This basically voids our use of memguard to protect the key in memory. Unfortunately the Stellar SDK uses\n\t// the golang string type which is immutable and can't be wiped from memory. But for the purposes of demonstrating\n\t// best practices we still use memguard to lower our threat profile.\n\terr = txBuilder.Mutate(build.Sign{Seed: string(seed.Buffer())})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert to base64\n\tsignedTxBase64, err := xdr.MarshalBase64(txBuilder.E)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn &signedTxBase64, nil\n}", "func (w *rpcWallet) SignRawTransaction(ctx context.Context, inTx *wire.MsgTx) (*wire.MsgTx, error) {\n\tbaseTx := inTx.Copy()\n\ttxHex, err := msgTxToHex(baseTx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode MsgTx: %w\", err)\n\t}\n\tvar res walletjson.SignRawTransactionResult\n\terr = w.rpcClientRawRequest(ctx, methodSignRawTransaction, anylist{txHex}, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i := range res.Errors {\n\t\tsigErr := &res.Errors[i]\n\t\treturn nil, fmt.Errorf(\"signing %v:%d, seq = %d, sigScript = %v, failed: %v (is wallet locked?)\",\n\t\t\tsigErr.TxID, sigErr.Vout, sigErr.Sequence, sigErr.ScriptSig, sigErr.Error)\n\t\t// Will be incomplete below, so log each SignRawTransactionError and move on.\n\t}\n\n\tif !res.Complete {\n\t\tbaseTxB, _ := baseTx.Bytes()\n\t\tw.log.Errorf(\"Incomplete raw transaction signatures (input tx: %x / incomplete signed tx: %s)\",\n\t\t\tbaseTxB, res.Hex)\n\t\treturn nil, fmt.Errorf(\"incomplete raw tx signatures (is wallet locked?)\")\n\t}\n\n\treturn msgTxFromHex(res.Hex)\n}", "func (sk PrivateKey) Sign(message []byte, hasher Hasher) ([]byte, error) {\n\treturn sk.privateKey.Sign(message, hasher)\n}", "func (transaction *ScheduleSignTransaction) Execute(\n\tclient *Client,\n) (TransactionResponse, error) {\n\tif client == nil {\n\t\treturn TransactionResponse{}, errNoClientProvided\n\t}\n\n\tif transaction.freezeError != nil {\n\t\treturn TransactionResponse{}, transaction.freezeError\n\t}\n\n\tif !transaction.IsFrozen() {\n\t\t_, err := transaction.FreezeWith(client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\t}\n\n\ttransactionID := transaction.transactionIDs._GetCurrent().(TransactionID)\n\n\tif !client.GetOperatorAccountID()._IsZero() && client.GetOperatorAccountID()._Equals(*transactionID.AccountID) {\n\t\ttransaction.SignWith(\n\t\t\tclient.GetOperatorPublicKey(),\n\t\t\tclient.operator.signer,\n\t\t)\n\t}\n\n\tresp, err := _Execute(\n\t\tclient,\n\t\t&transaction.Transaction,\n\t\t_TransactionShouldRetry,\n\t\t_TransactionMakeRequest,\n\t\t_TransactionAdvanceRequest,\n\t\t_TransactionGetNodeAccountID,\n\t\t_ScheduleSignTransactionGetMethod,\n\t\t_TransactionMapStatusError,\n\t\t_TransactionMapResponse,\n\t\ttransaction._GetLogID(),\n\t\ttransaction.grpcDeadline,\n\t\ttransaction.maxBackoff,\n\t\ttransaction.minBackoff,\n\t\ttransaction.maxRetry,\n\t)\n\n\tif err != nil {\n\t\treturn TransactionResponse{\n\t\t\tTransactionID: transaction.GetTransactionID(),\n\t\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\t\tValidateStatus: true,\n\t\t}, err\n\t}\n\n\treturn TransactionResponse{\n\t\tTransactionID: transaction.GetTransactionID(),\n\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\tHash: resp.(TransactionResponse).Hash,\n\t\tValidateStatus: true,\n\t}, nil\n}", "func (transaction *TokenUpdateTransaction) AddSignature(publicKey PublicKey, signature []byte) *TokenUpdateTransaction {\n\ttransaction._RequireOneNodeAccountID()\n\n\tif transaction._KeyAlreadySigned(publicKey) {\n\t\treturn transaction\n\t}\n\n\tif transaction.signedTransactions._Length() == 0 {\n\t\treturn transaction\n\t}\n\n\ttransaction.transactions = _NewLockableSlice()\n\ttransaction.publicKeys = append(transaction.publicKeys, publicKey)\n\ttransaction.transactionSigners = append(transaction.transactionSigners, nil)\n\ttransaction.transactionIDs.locked = true\n\n\tfor index := 0; index < transaction.signedTransactions._Length(); index++ {\n\t\tvar temp *services.SignedTransaction\n\t\tswitch t := transaction.signedTransactions._Get(index).(type) { //nolint\n\t\tcase *services.SignedTransaction:\n\t\t\ttemp = t\n\t\t}\n\t\ttemp.SigMap.SigPair = append(\n\t\t\ttemp.SigMap.SigPair,\n\t\t\tpublicKey._ToSignaturePairProtobuf(signature),\n\t\t)\n\t\ttransaction.signedTransactions._Set(index, temp)\n\t}\n\n\treturn transaction\n}", "func (_Ethdkg *EthdkgCallerSession) Sign(message []byte, privK *big.Int) ([2]*big.Int, error) {\n\treturn _Ethdkg.Contract.Sign(&_Ethdkg.CallOpts, message, privK)\n}", "func (id *Identity) Sign(data []byte) []byte {\n\treturn ed25519.Sign(id.PrivateKey, data)\n}", "func (mr *MockTransactionApiMockRecorder) SignWithPrivkey(tx, outpoint, privkey, sighashType, utxoList interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SignWithPrivkey\", reflect.TypeOf((*MockTransactionApi)(nil).SignWithPrivkey), tx, outpoint, privkey, sighashType, utxoList)\n}", "func SignTx(driver stellar.Driver, rawTx string, seeds ...string) (string, error) {\n\ttxEnvelope, err := txvalidation.ReadEnvelopeBuilder(rawTx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfor _, seed := range seeds {\n\t\tparsed, err := secretkey.Parse(seed)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\ttxEnvelope, err = driver.SignEnvelope(txEnvelope, *parsed)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn txEnvelope.Base64()\n}", "func (f *Factory) Sign(name string, txBuilder sdk.TxBuilder) error {\n\tsignMode := f.signMode\n\tif signMode == signing.SignMode_SIGN_MODE_UNSPECIFIED {\n\t\t// use the SignModeHandler's default mode if unspecified\n\t\tsignMode = f.txConfig.SignModeHandler().DefaultMode()\n\t}\n\tsignerData := sdk.SignerData{\n\t\tChainID: f.chainID,\n\t\tAccountNumber: f.accountNumber,\n\t\tSequence: f.sequence,\n\t}\n\n\tpubkey, _, err := f.keyManager.Find(name, f.password)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// For SIGN_MODE_DIRECT, calling SetSignatures calls setSignerInfos on\n\t// Factory under the hood, and SignerInfos is needed to generated the\n\t// sign bytes. This is the reason for setting SetSignatures here, with a\n\t// nil signature.\n\t//\n\t// Note: this line is not needed for SIGN_MODE_LEGACY_AMINO, but putting it\n\t// also doesn't affect its generated sign bytes, so for code's simplicity\n\t// sake, we put it here.\n\tsigData := signing.SingleSignatureData{\n\t\tSignMode: signMode,\n\t\tSignature: nil,\n\t}\n\tsig := signing.SignatureV2{\n\t\tPubKey: pubkey,\n\t\tData: &sigData,\n\t\tSequence: f.Sequence(),\n\t}\n\tif err := txBuilder.SetSignatures(sig); err != nil {\n\t\treturn err\n\t}\n\n\t// Generate the bytes to be signed.\n\tsignBytes, err := f.signModeHandler.GetSignBytes(signMode, signerData, txBuilder.GetTx())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sign those bytes\n\tsigBytes, _, err := f.keyManager.Sign(name, f.password, signBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Construct the SignatureV2 struct\n\tsigData = signing.SingleSignatureData{\n\t\tSignMode: signMode,\n\t\tSignature: sigBytes,\n\t}\n\tsig = signing.SignatureV2{\n\t\tPubKey: pubkey,\n\t\tData: &sigData,\n\t\tSequence: f.Sequence(),\n\t}\n\n\t// And here the tx is populated with the signature\n\treturn txBuilder.SetSignatures(sig)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepSession) SubmitSignature(_r [32]byte, _s [32]byte, _recoveryID uint8) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.SubmitSignature(&_BondedECDSAKeep.TransactOpts, _r, _s, _recoveryID)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactorSession) SubmitSignature(_r [32]byte, _s [32]byte, _recoveryID uint8) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.Contract.SubmitSignature(&_BondedECDSAKeep.TransactOpts, _r, _s, _recoveryID)\n}", "func (kb *Keybase) Sign(name, passphrase string, msg []byte) ([]byte, crypto.PubKey, error) {\n\thash := sha256.Sum256([]byte(name + \":\" + passphrase))\n\tkb.mx.Lock()\n\tpriv, ok := kb.privKeysCache[hash]\n\tif !ok {\n\t\tvar err error\n\t\tif priv, err = kb.kb.ExportPrivateKeyObject(name, passphrase); err != nil {\n\t\t\tkb.mx.Unlock()\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tkb.privKeysCache[hash] = priv\n\t}\n\tkb.mx.Unlock()\n\tsig, err := priv.Sign(msg)\n\treturn sig, priv.PubKey(), err\n}", "func WithSignature(signKey *openpgp.Entity) GitCommitOptionsFunc {\n\treturn func(c *CreateCommit) error {\n\t\tif signKey != nil {\n\t\t\tc.SignKey = signKey\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.New(\"SignKey required\")\n\t}\n}", "func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {\n\tvar rsaKey *rsa.PrivateKey\n\tvar ok bool\n\n\t// Validate type of key\n\tif rsaKey, ok = key.(*rsa.PrivateKey); !ok {\n\t\treturn \"\", ErrInvalidKey\n\t}\n\n\t// Create the hasher\n\tif !m.Hash.Available() {\n\t\treturn \"\", ErrHashUnavailable\n\t}\n\n\thasher := m.Hash.New()\n\thasher.Write([]byte(signingString))\n\n\t// Sign the string and return the encoded bytes\n\tif sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil {\n\t\treturn EncodeSegment(sigBytes), nil\n\t} else {\n\t\treturn \"\", err\n\t}\n}", "func (wc *WalletClient) SignTxn(addr *WalletPublicKey, amt, fee uint64) (*Txn, error) {\n\tsignMsg := SignMsg{\n\t\tAddress: *addr,\n\t\tAmount: amt,\n\t\tFee: fee,\n\t}\n\tb, err := json.Marshal(signMsg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbytes, err := wc.POST(\"/sign\", b)\n\tif err != nil {\n\t\tlog.Println(\"Sign RPC failed\", err)\n\t\treturn nil, err\n\t}\n\n\tlog.Println(\"Bytes:\", string(bytes))\n\n\ttxn := &Txn{}\n\terr = json.Unmarshal(bytes, txn)\n\tif err != nil {\n\t\tlog.Println(\"Json marhsalling failed\", err)\n\t\treturn nil, err\n\t}\n\n\treturn txn, nil\n}", "func (lb *LinkBuilder) SignWithKey(priv crypto.PrivateKey) *LinkBuilder {\n\tlb.Link.Signatures = append(lb.Link.Signatures, SignatureWithKey(lb.Link, priv))\n\treturn lb\n}", "func (s *signer) SignTx(magic netmode.Magic, tx *transaction.Transaction) error {\n\treturn (*wallet.Account)(s).SignTx(magic, tx)\n}", "func (s *Signer) Sign(data []byte) (*sigpb.DigitallySigned, error) {\n\th := s.Hash.New()\n\th.Write(data)\n\tdigest := h.Sum(nil)\n\n\tsig, err := s.Signer.Sign(rand.Reader, digest, s.Hash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &sigpb.DigitallySigned{\n\t\tSignatureAlgorithm: keys.SignatureAlgorithm(s.Public()),\n\t\tHashAlgorithm: sigpbHashLookup[s.Hash],\n\t\tSignature: sig,\n\t}, nil\n}", "func Sign(params Params, key string) string {\n\tsort.Sort(params)\n\tpreSignWithKey := params.ToQueryString() + \"&key=\" + key\n\treturn fmt.Sprintf(\"%X\", md5.Sum([]byte(preSignWithKey)))\n}", "func Sign(params Params, key string) string {\n\tsort.Sort(params)\n\tpreSignWithKey := params.ToQueryString() + \"&key=\" + key\n\treturn fmt.Sprintf(\"%X\", md5.Sum([]byte(preSignWithKey)))\n}", "func (ra *RestrictedAgent) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {\n\treturn nil, ErrForbidden\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactor) SubmitSignature(opts *bind.TransactOpts, _r [32]byte, _s [32]byte, _recoveryID uint8) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.contract.Transact(opts, \"submitSignature\", _r, _s, _recoveryID)\n}" ]
[ "0.76645845", "0.765482", "0.763251", "0.7587133", "0.74123144", "0.73893803", "0.64945716", "0.6398928", "0.6390391", "0.63736427", "0.63308996", "0.6318031", "0.6304985", "0.627335", "0.6239748", "0.62324935", "0.6213082", "0.6187037", "0.61609566", "0.6154351", "0.61384803", "0.61383015", "0.6042029", "0.6033765", "0.6005862", "0.5920544", "0.5833118", "0.5807175", "0.58069867", "0.5750635", "0.5717046", "0.5695423", "0.56489486", "0.56364083", "0.56347746", "0.56063217", "0.5596523", "0.559311", "0.5586385", "0.55718887", "0.55649054", "0.5554772", "0.5531436", "0.55307704", "0.5504904", "0.54975206", "0.548004", "0.54647166", "0.54133934", "0.5406082", "0.5395019", "0.5377589", "0.5366924", "0.53480494", "0.5341907", "0.53364146", "0.533633", "0.5333118", "0.5322088", "0.5320687", "0.5305856", "0.5278269", "0.5267646", "0.5250847", "0.52501386", "0.52461815", "0.5236", "0.5231823", "0.52300495", "0.5227764", "0.5220865", "0.5220128", "0.5209632", "0.5203203", "0.51910675", "0.51893467", "0.5187618", "0.51791734", "0.51777774", "0.51704216", "0.5168159", "0.5167231", "0.51617324", "0.5155864", "0.5138606", "0.51373005", "0.5134872", "0.51277506", "0.51228553", "0.51171416", "0.5105773", "0.50978863", "0.5089999", "0.5088575", "0.5088021", "0.5085709", "0.50823367", "0.50823367", "0.5073306", "0.50704116" ]
0.770583
0
Execute executes the Transaction with the provided client
func (transaction *TokenMintTransaction) Execute( client *Client, ) (TransactionResponse, error) { if client == nil { return TransactionResponse{}, errNoClientProvided } if transaction.freezeError != nil { return TransactionResponse{}, transaction.freezeError } if !transaction.IsFrozen() { _, err := transaction.FreezeWith(client) if err != nil { return TransactionResponse{}, err } } transactionID := transaction.GetTransactionID() if !client.GetOperatorAccountID().isZero() && client.GetOperatorAccountID().equals(*transactionID.AccountID) { transaction.SignWith( client.GetOperatorPublicKey(), client.operator.signer, ) } resp, err := execute( client, request{ transaction: &transaction.Transaction, }, transaction_shouldRetry, transaction_makeRequest, transaction_advanceRequest, transaction_getNodeAccountID, tokenMintTransaction_getMethod, transaction_mapStatusError, transaction_mapResponse, ) if err != nil { return TransactionResponse{ TransactionID: transaction.GetTransactionID(), NodeID: resp.transaction.NodeID, }, err } hash, err := transaction.GetTransactionHash() return TransactionResponse{ TransactionID: transaction.GetTransactionID(), NodeID: resp.transaction.NodeID, Hash: hash, }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *ContractUpdateTransaction) Execute(\n\tclient *Client,\n) (TransactionResponse, error) {\n\tif client == nil {\n\t\treturn TransactionResponse{}, errNoClientProvided\n\t}\n\n\tif transaction.freezeError != nil {\n\t\treturn TransactionResponse{}, transaction.freezeError\n\t}\n\n\tif !transaction.IsFrozen() {\n\t\t_, err := transaction.FreezeWith(client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\t}\n\n\ttransactionID := transaction.GetTransactionID()\n\n\tif !client.GetOperatorAccountID().isZero() && client.GetOperatorAccountID().equals(*transactionID.AccountID) {\n\t\ttransaction.SignWith(\n\t\t\tclient.GetOperatorPublicKey(),\n\t\t\tclient.operator.signer,\n\t\t)\n\t}\n\n\tresp, err := execute(\n\t\tclient,\n\t\trequest{\n\t\t\ttransaction: &transaction.Transaction,\n\t\t},\n\t\ttransaction_shouldRetry,\n\t\ttransaction_makeRequest,\n\t\ttransaction_advanceRequest,\n\t\ttransaction_getNodeAccountID,\n\t\tcontractUpdateTransaction_getMethod,\n\t\ttransaction_mapStatusError,\n\t\ttransaction_mapResponse,\n\t)\n\n\tif err != nil {\n\t\treturn TransactionResponse{\n\t\t\tTransactionID: transaction.GetTransactionID(),\n\t\t\tNodeID: resp.transaction.NodeID,\n\t\t}, err\n\t}\n\n\thash, err := transaction.GetTransactionHash()\n\n\treturn TransactionResponse{\n\t\tTransactionID: transaction.GetTransactionID(),\n\t\tNodeID: resp.transaction.NodeID,\n\t\tHash: hash,\n\t}, nil\n}", "func (transaction *AccountCreateTransaction) Execute(\n\tclient *Client,\n) (TransactionResponse, error) {\n\tif client == nil {\n\t\treturn TransactionResponse{}, errNoClientProvided\n\t}\n\n\tif transaction.freezeError != nil {\n\t\treturn TransactionResponse{}, transaction.freezeError\n\t}\n\n\tif !transaction.IsFrozen() {\n\t\t_, err := transaction.FreezeWith(client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\t}\n\n\ttransactionID := transaction.transactionIDs._GetCurrent().(TransactionID)\n\n\tif !client.GetOperatorAccountID()._IsZero() && client.GetOperatorAccountID()._Equals(*transactionID.AccountID) {\n\t\ttransaction.SignWith(\n\t\t\tclient.GetOperatorPublicKey(),\n\t\t\tclient.operator.signer,\n\t\t)\n\t}\n\n\tif transaction.grpcDeadline == nil {\n\t\ttransaction.grpcDeadline = client.requestTimeout\n\t}\n\n\tresp, err := _Execute(\n\t\tclient,\n\t\t&transaction.Transaction,\n\t\t_TransactionShouldRetry,\n\t\t_TransactionMakeRequest,\n\t\t_TransactionAdvanceRequest,\n\t\t_TransactionGetNodeAccountID,\n\t\t_AccountCreateTransactionGetMethod,\n\t\t_TransactionMapStatusError,\n\t\t_TransactionMapResponse,\n\t\ttransaction._GetLogID(),\n\t\ttransaction.grpcDeadline,\n\t\ttransaction.maxBackoff,\n\t\ttransaction.minBackoff,\n\t\ttransaction.maxRetry,\n\t)\n\n\tif err != nil {\n\t\treturn TransactionResponse{\n\t\t\tTransactionID: transaction.GetTransactionID(),\n\t\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\t\tValidateStatus: true,\n\t\t}, err\n\t}\n\n\treturn TransactionResponse{\n\t\tTransactionID: transaction.GetTransactionID(),\n\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\tHash: resp.(TransactionResponse).Hash,\n\t\tValidateStatus: true,\n\t}, nil\n}", "func (transaction *FileCreateTransaction) Execute(\n\tclient *Client,\n) (TransactionResponse, error) {\n\tif client == nil {\n\t\treturn TransactionResponse{}, errNoClientProvided\n\t}\n\n\tif transaction.freezeError != nil {\n\t\treturn TransactionResponse{}, transaction.freezeError\n\t}\n\n\tif !transaction.IsFrozen() {\n\t\t_, err := transaction.FreezeWith(client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\t}\n\n\ttransactionID := transaction.transactionIDs._GetCurrent().(TransactionID)\n\n\tif !client.GetOperatorAccountID()._IsZero() && client.GetOperatorAccountID()._Equals(*transactionID.AccountID) {\n\t\ttransaction.SignWith(\n\t\t\tclient.GetOperatorPublicKey(),\n\t\t\tclient.operator.signer,\n\t\t)\n\t}\n\n\tresp, err := _Execute(\n\t\tclient,\n\t\t&transaction.Transaction,\n\t\t_TransactionShouldRetry,\n\t\t_TransactionMakeRequest,\n\t\t_TransactionAdvanceRequest,\n\t\t_TransactionGetNodeAccountID,\n\t\t_FileCreateTransactionGetMethod,\n\t\t_TransactionMapStatusError,\n\t\t_TransactionMapResponse,\n\t\ttransaction._GetLogID(),\n\t\ttransaction.grpcDeadline,\n\t\ttransaction.maxBackoff,\n\t\ttransaction.minBackoff,\n\t\ttransaction.maxRetry,\n\t)\n\n\tif err != nil {\n\t\treturn TransactionResponse{\n\t\t\tTransactionID: transaction.GetTransactionID(),\n\t\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\t\tValidateStatus: true,\n\t\t}, err\n\t}\n\n\treturn TransactionResponse{\n\t\tTransactionID: transaction.GetTransactionID(),\n\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\tHash: resp.(TransactionResponse).Hash,\n\t\tValidateStatus: true,\n\t}, nil\n}", "func (transaction *AccountUpdateTransaction) Execute(\n\tclient *Client,\n) (TransactionResponse, error) {\n\tif client == nil {\n\t\treturn TransactionResponse{}, errNoClientProvided\n\t}\n\n\tif transaction.freezeError != nil {\n\t\treturn TransactionResponse{}, transaction.freezeError\n\t}\n\n\tif !transaction.IsFrozen() {\n\t\t_, err := transaction.FreezeWith(client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\t}\n\n\ttransactionID := transaction.GetTransactionID()\n\n\tif !client.GetOperatorAccountID()._IsZero() && client.GetOperatorAccountID()._Equals(*transactionID.AccountID) {\n\t\ttransaction.SignWith(\n\t\t\tclient.GetOperatorPublicKey(),\n\t\t\tclient.operator.signer,\n\t\t)\n\t}\n\n\tresp, err := _Execute(\n\t\tclient,\n\t\t_Request{\n\t\t\ttransaction: &transaction.Transaction,\n\t\t},\n\t\t_TransactionShouldRetry,\n\t\t_TransactionMakeRequest(_Request{\n\t\t\ttransaction: &transaction.Transaction,\n\t\t}),\n\t\t_TransactionAdvanceRequest,\n\t\t_TransactionGetNodeAccountID,\n\t\t_AccountUpdateTransactionGetMethod,\n\t\t_TransactionMapStatusError,\n\t\t_TransactionMapResponse,\n\t)\n\n\tif err != nil {\n\t\treturn TransactionResponse{\n\t\t\tTransactionID: transaction.GetTransactionID(),\n\t\t\tNodeID: resp.transaction.NodeID,\n\t\t}, err\n\t}\n\n\thash, err := transaction.GetTransactionHash()\n\tif err != nil {\n\t\treturn TransactionResponse{}, err\n\t}\n\n\treturn TransactionResponse{\n\t\tTransactionID: transaction.GetTransactionID(),\n\t\tNodeID: resp.transaction.NodeID,\n\t\tHash: hash,\n\t}, nil\n}", "func (transaction *TokenUpdateTransaction) Execute(\n\tclient *Client,\n) (TransactionResponse, error) {\n\tif client == nil {\n\t\treturn TransactionResponse{}, errNoClientProvided\n\t}\n\n\tif transaction.freezeError != nil {\n\t\treturn TransactionResponse{}, transaction.freezeError\n\t}\n\n\tif !transaction.IsFrozen() {\n\t\t_, err := transaction.FreezeWith(client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\t}\n\n\ttransactionID := transaction.transactionIDs._GetCurrent().(TransactionID)\n\n\tif !client.GetOperatorAccountID()._IsZero() && client.GetOperatorAccountID()._Equals(*transactionID.AccountID) {\n\t\ttransaction.SignWith(\n\t\t\tclient.GetOperatorPublicKey(),\n\t\t\tclient.operator.signer,\n\t\t)\n\t}\n\n\tresp, err := _Execute(\n\t\tclient,\n\t\t&transaction.Transaction,\n\t\t_TransactionShouldRetry,\n\t\t_TransactionMakeRequest,\n\t\t_TransactionAdvanceRequest,\n\t\t_TransactionGetNodeAccountID,\n\t\t_TokenUpdateTransactionGetMethod,\n\t\t_TransactionMapStatusError,\n\t\t_TransactionMapResponse,\n\t\ttransaction._GetLogID(),\n\t\ttransaction.grpcDeadline,\n\t\ttransaction.maxBackoff,\n\t\ttransaction.minBackoff,\n\t\ttransaction.maxRetry,\n\t)\n\n\tif err != nil {\n\t\treturn TransactionResponse{\n\t\t\tTransactionID: transaction.GetTransactionID(),\n\t\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\t\tValidateStatus: true,\n\t\t}, err\n\t}\n\n\treturn TransactionResponse{\n\t\tTransactionID: transaction.GetTransactionID(),\n\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\tHash: resp.(TransactionResponse).Hash,\n\t\tValidateStatus: true,\n\t}, nil\n}", "func (_Transactable *TransactableTransactor) Execute(opts *bind.TransactOpts, _guarantor common.Address, _v uint8, _r [32]byte, _s [32]byte, _dest common.Address, _value *big.Int, _ts *big.Int) (*types.Transaction, error) {\n\treturn _Transactable.contract.Transact(opts, \"execute\", _guarantor, _v, _r, _s, _dest, _value, _ts)\n}", "func (transaction *ScheduleSignTransaction) Execute(\n\tclient *Client,\n) (TransactionResponse, error) {\n\tif client == nil {\n\t\treturn TransactionResponse{}, errNoClientProvided\n\t}\n\n\tif transaction.freezeError != nil {\n\t\treturn TransactionResponse{}, transaction.freezeError\n\t}\n\n\tif !transaction.IsFrozen() {\n\t\t_, err := transaction.FreezeWith(client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\t}\n\n\ttransactionID := transaction.transactionIDs._GetCurrent().(TransactionID)\n\n\tif !client.GetOperatorAccountID()._IsZero() && client.GetOperatorAccountID()._Equals(*transactionID.AccountID) {\n\t\ttransaction.SignWith(\n\t\t\tclient.GetOperatorPublicKey(),\n\t\t\tclient.operator.signer,\n\t\t)\n\t}\n\n\tresp, err := _Execute(\n\t\tclient,\n\t\t&transaction.Transaction,\n\t\t_TransactionShouldRetry,\n\t\t_TransactionMakeRequest,\n\t\t_TransactionAdvanceRequest,\n\t\t_TransactionGetNodeAccountID,\n\t\t_ScheduleSignTransactionGetMethod,\n\t\t_TransactionMapStatusError,\n\t\t_TransactionMapResponse,\n\t\ttransaction._GetLogID(),\n\t\ttransaction.grpcDeadline,\n\t\ttransaction.maxBackoff,\n\t\ttransaction.minBackoff,\n\t\ttransaction.maxRetry,\n\t)\n\n\tif err != nil {\n\t\treturn TransactionResponse{\n\t\t\tTransactionID: transaction.GetTransactionID(),\n\t\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\t\tValidateStatus: true,\n\t\t}, err\n\t}\n\n\treturn TransactionResponse{\n\t\tTransactionID: transaction.GetTransactionID(),\n\t\tNodeID: resp.(TransactionResponse).NodeID,\n\t\tHash: resp.(TransactionResponse).Hash,\n\t\tValidateStatus: true,\n\t}, nil\n}", "func (_Trebuchet *TrebuchetTransactor) Execute(opts *bind.TransactOpts, _data [][]byte) (*types.Transaction, error) {\n\treturn _Trebuchet.contract.Transact(opts, \"execute\", _data)\n}", "func (_Vault *VaultTransactor) Execute(opts *bind.TransactOpts, token common.Address, amount *big.Int, recipientToken common.Address, exchangeAddress common.Address, callData []byte, timestamp []byte, signData []byte) (*types.Transaction, error) {\n\treturn _Vault.contract.Transact(opts, \"execute\", token, amount, recipientToken, exchangeAddress, callData, timestamp, signData)\n}", "func (_ERC725 *ERC725Transactor) Execute(opts *bind.TransactOpts, _data []byte) (*types.Transaction, error) {\n\treturn _ERC725.contract.Transact(opts, \"execute\", _data)\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) Execute(opts *bind.TransactOpts, _guarantor common.Address, _v uint8, _r [32]byte, _s [32]byte, _dest common.Address, _value *big.Int, _ts *big.Int) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"execute\", _guarantor, _v, _r, _s, _dest, _value, _ts)\n}", "func (e *CancelTransaction) Execute(\n\tctx context.Context,\n) (*int, *svc.Resp, error) {\n\tswitch authentication.Get(ctx).Status {\n\tcase authentication.AutStSkipped:\n\t\treturn e.ExecutePropagated(ctx)\n\tcase authentication.AutStSucceeded:\n\t\treturn e.ExecuteAuthenticated(ctx)\n\t}\n\treturn nil, nil, errors.Trace(errors.Newf(\n\t\t\"Authentication status not expected: %s\",\n\t\tauthentication.Get(ctx).Status))\n}", "func (c *Client) ExecuteTransaction(dst *network.ServerIdentity,\n\tgasLimit uint64, gasPrice uint64, amount uint64,\n\tcontractAddress []byte, nonce uint64, abi string,\n\tmethod string, args ...string) (*proto.TransactionHashResponse, error) {\n\trequest := &proto.TransactionRequest{\n\t\tGasLimit: gasLimit,\n\t\tGasPrice: gasPrice,\n\t\tAmount: amount,\n\t\tContractAddress: contractAddress,\n\t\tNonce: nonce,\n\t\tAbi: abi,\n\t\tMethod: method,\n\t\tArgs: args,\n\t}\n\tresponse := &proto.TransactionHashResponse{}\n\n\terr := c.SendProtobuf(dst, request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, err\n}", "func (p *BeeswaxServiceClient) ExecuteAndWait(query *Query, clientCtx LogContextId) (r *QueryHandle, err error) {\n\tif err = p.sendExecuteAndWait(query, clientCtx); err != nil {\n\t\treturn\n\t}\n\treturn p.recvExecuteAndWait()\n}", "func (_Validator *ValidatorTransactor) ExecuteTransaction(opts *bind.TransactOpts, data []byte, destination common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Validator.contract.Transact(opts, \"executeTransaction\", data, destination, amount)\n}", "func (_Vault *VaultTransactorSession) Execute(token common.Address, amount *big.Int, recipientToken common.Address, exchangeAddress common.Address, callData []byte, timestamp []byte, signData []byte) (*types.Transaction, error) {\n\treturn _Vault.Contract.Execute(&_Vault.TransactOpts, token, amount, recipientToken, exchangeAddress, callData, timestamp, signData)\n}", "func (_Vault *VaultSession) Execute(token common.Address, amount *big.Int, recipientToken common.Address, exchangeAddress common.Address, callData []byte, timestamp []byte, signData []byte) (*types.Transaction, error) {\n\treturn _Vault.Contract.Execute(&_Vault.TransactOpts, token, amount, recipientToken, exchangeAddress, callData, timestamp, signData)\n}", "func (_Trebuchet *TrebuchetTransactorSession) Execute(_data [][]byte) (*types.Transaction, error) {\n\treturn _Trebuchet.Contract.Execute(&_Trebuchet.TransactOpts, _data)\n}", "func (_Validator *ValidatorTransactorSession) ExecuteTransaction(data []byte, destination common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Validator.Contract.ExecuteTransaction(&_Validator.TransactOpts, data, destination, amount)\n}", "func (_ReserveSpenderMultiSig *ReserveSpenderMultiSigTransactor) ExecuteTransaction(opts *bind.TransactOpts, transactionId *big.Int) (*types.Transaction, error) {\n\treturn _ReserveSpenderMultiSig.contract.Transact(opts, \"executeTransaction\", transactionId)\n}", "func (_ERC725 *ERC725TransactorSession) Execute(_data []byte) (*types.Transaction, error) {\n\treturn _ERC725.Contract.Execute(&_ERC725.TransactOpts, _data)\n}", "func (_Validator *ValidatorSession) ExecuteTransaction(data []byte, destination common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Validator.Contract.ExecuteTransaction(&_Validator.TransactOpts, data, destination, amount)\n}", "func (c *Client) ExecuteTransaction(ctx context.Context, params *ExecuteTransactionInput, optFns ...func(*Options)) (*ExecuteTransactionOutput, error) {\n\tif params == nil {\n\t\tparams = &ExecuteTransactionInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ExecuteTransaction\", params, optFns, addOperationExecuteTransactionMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ExecuteTransactionOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (_Trebuchet *TrebuchetSession) Execute(_data [][]byte) (*types.Transaction, error) {\n\treturn _Trebuchet.Contract.Execute(&_Trebuchet.TransactOpts, _data)\n}", "func (t *Tx) Execute(q *neoism.CypherQuery) error {\n\tqs := []*neoism.CypherQuery{q}\n\treturn t.ExecuteMany(qs)\n}", "func (_SimpleMultiSig *SimpleMultiSigTransactor) Execute(opts *bind.TransactOpts, bucketIdx uint16, expireTime *big.Int, sigV []uint8, sigR [][32]byte, sigS [][32]byte, destination common.Address, value *big.Int, data []byte, executor common.Address, gasLimit *big.Int) (*types.Transaction, error) {\n\treturn _SimpleMultiSig.contract.Transact(opts, \"execute\", bucketIdx, expireTime, sigV, sigR, sigS, destination, value, data, executor, gasLimit)\n}", "func (trs *Transactions) Execute() {\n\n\t//start the agent:\n\tgo trs.agent.Execute()\n\n\tfor {\n\t\tselect {\n\t\tcase oneAggregatedTrs := <-trs.newAggregatedTrs:\n\n\t\t\t//retrieve the next leader server:\n\t\t\tlead, leadErr := trs.servSDK.RetrieveNextLeader()\n\t\t\tif leadErr != nil {\n\t\t\t\tlog.Fatalf(\"there was an error while retrieving the next leader server: %s\", leadErr.Error())\n\t\t\t}\n\n\t\t\tidAsString := oneAggregatedTrs.GetMetaData().GetID().String()\n\t\t\tsignedAggregatedTrs, signedAggregatedTrsErr := trs.leadSDK.SaveTrs(lead, oneAggregatedTrs)\n\t\t\tif signedAggregatedTrsErr != nil {\n\t\t\t\tlog.Fatalf(\"there was an error while saving the aggregated transaction (ID: %s) to server: %s\", idAsString, lead.String())\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tsignedIDAsString := signedAggregatedTrs.GetMetaData().GetID().String()\n\t\t\tlog.Printf(\"successfully pushed aggregated transaction (ID: %s) to server: %s. Received signed aggregated transaction (ID: %s)\", idAsString, lead.String(), signedIDAsString)\n\t\t\tbreak\n\t\t}\n\n\t}\n\n}", "func (_ERC725 *ERC725Session) Execute(_data []byte) (*types.Transaction, error) {\n\treturn _ERC725.Contract.Execute(&_ERC725.TransactOpts, _data)\n}", "func (t *Transaction) Execute(db *pg.DB) error {\n\t// We need to ensure that both the sender and recipient exist\n\tsender, err1 := account.GetAccountByID(t.FromID, db)\n\trecipient, err2 := account.GetAccountByID(t.ToID, db)\n\tif err1 != nil || err2 != nil {\n\t\tt.Delete(db)\n\t\treturn errors.New(\"Failed to validate transaction actors\")\n\t}\n\t// Withdraw funds from the sender\n\terr := sender.Withdraw(t.Amount, db)\n\tif err != nil {\n\t\tt.Delete(db)\n\t\treturn errors.New(\"Could not withdraw funds\")\n\t}\n\t// Release blocked funds\n\terr = sender.Release(t.Amount, db)\n\tif err != nil {\n\t\tt.Delete(db)\n\t\tsender.Deposit(t.Amount, db) // Rollback withdrawn funds\n\t\treturn errors.New(\"Could not release funds\")\n\t}\n\t// Send funds to the target\n\terr = recipient.Deposit(t.Amount, db)\n\tif err != nil {\n\t\tt.Delete(db)\n\t\tsender.Deposit(t.Amount, db) // Rollback withdrawn funds\n\t\treturn errors.New(\"Could not deposit funds\")\n\t}\n\t// Mark transaction as complete\n\tt.Status = \"completed\"\n\t_, err = db.Model(t).WherePK().Update()\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn err\n}", "func (_Outbox *OutboxTransactor) ExecuteTransaction(opts *bind.TransactOpts, outboxIndex *big.Int, proof [][32]byte, index *big.Int, l2Sender common.Address, destAddr common.Address, l2Block *big.Int, l1Block *big.Int, l2Timestamp *big.Int, amount *big.Int, calldataForL1 []byte) (*types.Transaction, error) {\n\treturn _Outbox.contract.Transact(opts, \"executeTransaction\", outboxIndex, proof, index, l2Sender, destAddr, l2Block, l1Block, l2Timestamp, amount, calldataForL1)\n}", "func (service *Stainless) ExecuteTransaction(\n\treq *proto.TransactionRequest) (network.Message, error) {\n\tabi, err := abi.JSON(strings.NewReader(req.Abi))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\targs, err := bevm.DecodeEvmArgs(req.Args, abi.Methods[req.Method].Inputs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcallData, err := abi.Pack(req.Method, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx := types.NewTransaction(req.Nonce,\n\t\tcommon.BytesToAddress(req.ContractAddress),\n\t\tbig.NewInt(int64(req.Amount)),\n\t\treq.GasLimit, big.NewInt(int64(req.GasPrice)), callData)\n\n\tsigner := types.HomesteadSigner{}\n\thashedTx := signer.Hash(tx)\n\n\tunsignedBuffer, err := tx.MarshalJSON()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Lvl4(\"Returning\", unsignedBuffer, hashedTx)\n\n\treturn &proto.TransactionHashResponse{Transaction: unsignedBuffer,\n\t\tTransactionHash: hashedTx[:]}, nil\n}", "func (_ReserveSpenderMultiSig *ReserveSpenderMultiSigTransactorSession) ExecuteTransaction(transactionId *big.Int) (*types.Transaction, error) {\n\treturn _ReserveSpenderMultiSig.Contract.ExecuteTransaction(&_ReserveSpenderMultiSig.TransactOpts, transactionId)\n}", "func (_ReserveSpenderMultiSig *ReserveSpenderMultiSigSession) ExecuteTransaction(transactionId *big.Int) (*types.Transaction, error) {\n\treturn _ReserveSpenderMultiSig.Contract.ExecuteTransaction(&_ReserveSpenderMultiSig.TransactOpts, transactionId)\n}", "func (atc *AtomicTransactionComposer) Execute(client *algod.Client, ctx context.Context, waitRounds uint64) (ExecuteResult, error) { //nolint:revive // Ignore Context order for backwards compatibility\n\tif atc.status == COMMITTED {\n\t\treturn ExecuteResult{}, errors.New(\"status is already committed\")\n\t}\n\n\t_, err := atc.Submit(client, ctx)\n\tif err != nil {\n\t\treturn ExecuteResult{}, err\n\t}\n\tatc.status = SUBMITTED\n\n\tindexToWaitFor := 0\n\tnumMethodCalls := 0\n\tfor i, txContext := range atc.txContexts {\n\t\tif txContext.isMethodCallTx() {\n\t\t\t// if there is a method call in the group, we need to query the\n\t\t\t// pending tranaction endpoint for it anyway, so as an optimization\n\t\t\t// we should wait for its TxID\n\t\t\tif numMethodCalls == 0 {\n\t\t\t\tindexToWaitFor = i\n\t\t\t}\n\t\t\tnumMethodCalls++\n\t\t}\n\t}\n\n\tgroupInfo, err := WaitForConfirmation(client, atc.txContexts[indexToWaitFor].txID(), waitRounds, ctx)\n\tif err != nil {\n\t\treturn ExecuteResult{}, err\n\t}\n\tatc.status = COMMITTED\n\n\texecuteResponse := ExecuteResult{\n\t\tConfirmedRound: groupInfo.ConfirmedRound,\n\t\tTxIDs: atc.getTxIDs(),\n\t\tMethodResults: make([]ABIMethodResult, 0, numMethodCalls),\n\t}\n\n\tfor i, txContext := range atc.txContexts {\n\t\t// Verify method call is available. This may not be the case if the App Call Tx wasn't created\n\t\t// by AddMethodCall().\n\t\tif !txContext.isMethodCallTx() {\n\t\t\tcontinue\n\t\t}\n\n\t\tresult := ABIMethodResult{TxID: txContext.txID(), Method: *txContext.method}\n\n\t\tif i == indexToWaitFor {\n\t\t\tresult.TransactionInfo = groupInfo\n\t\t} else {\n\t\t\tmethodCallInfo, _, err := client.PendingTransactionInformation(result.TxID).Do(ctx)\n\t\t\tif err != nil {\n\t\t\t\tresult.DecodeError = err\n\t\t\t\texecuteResponse.MethodResults = append(executeResponse.MethodResults, result)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresult.TransactionInfo = methodCallInfo\n\t\t}\n\n\t\tif txContext.method.Returns.IsVoid() {\n\t\t\tresult.RawReturnValue = []byte{}\n\t\t\texecuteResponse.MethodResults = append(executeResponse.MethodResults, result)\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(result.TransactionInfo.Logs) == 0 {\n\t\t\tresult.DecodeError = errors.New(\"method call did not log a return value\")\n\t\t\texecuteResponse.MethodResults = append(executeResponse.MethodResults, result)\n\t\t\tcontinue\n\t\t}\n\n\t\tlastLog := result.TransactionInfo.Logs[len(result.TransactionInfo.Logs)-1]\n\t\tif !bytes.HasPrefix(lastLog, abiReturnHash) {\n\t\t\tresult.DecodeError = errors.New(\"method call did not log a return value\")\n\t\t\texecuteResponse.MethodResults = append(executeResponse.MethodResults, result)\n\t\t\tcontinue\n\t\t}\n\n\t\tresult.RawReturnValue = lastLog[len(abiReturnHash):]\n\n\t\tabiType, err := txContext.method.Returns.GetTypeObject()\n\t\tif err != nil {\n\t\t\tresult.DecodeError = err\n\t\t\texecuteResponse.MethodResults = append(executeResponse.MethodResults, result)\n\t\t\tbreak\n\t\t}\n\n\t\tresult.ReturnValue, result.DecodeError = abiType.Decode(result.RawReturnValue)\n\t\texecuteResponse.MethodResults = append(executeResponse.MethodResults, result)\n\t}\n\n\treturn executeResponse, nil\n}", "func (vc *vdbClient) Execute(query string) (*sqltypes.Result, error) {\n\t// Number of rows should never exceed relayLogMaxItems.\n\treturn vc.ExecuteFetch(query, relayLogMaxItems)\n}", "func (tx *Transaction) Execute() (result Result, err error) {\n\ttx.Times = 1\n\ttx.RetryAt = tx.timer().CalcRetryTime(0, tx.timeout())\n\ttx.Timeout = tx.timeout()\n\tif tx.ID, err = tx.storage().SaveTransaction(tx); err != nil {\n\t\treturn Fail, fmt.Errorf(\"save transaction failed: %v\", err)\n\t}\n\n\treturn tx.execute()\n}", "func (_Outbox *OutboxTransactorSession) ExecuteTransaction(outboxIndex *big.Int, proof [][32]byte, index *big.Int, l2Sender common.Address, destAddr common.Address, l2Block *big.Int, l1Block *big.Int, l2Timestamp *big.Int, amount *big.Int, calldataForL1 []byte) (*types.Transaction, error) {\n\treturn _Outbox.Contract.ExecuteTransaction(&_Outbox.TransactOpts, outboxIndex, proof, index, l2Sender, destAddr, l2Block, l1Block, l2Timestamp, amount, calldataForL1)\n}", "func (r *Client) Execute(s ...string) {\n\n\tout := r.ExecuteAndReturn(s...)\n\n\tprint(out)\n}", "func (a *action) ExecuteTx(chaincodeID, fctn string, args [][]byte) error {\n\tchannelClient, err := a.ChannelClient()\n\tif err != nil {\n\t\treturn errors.Errorf(errors.GeneralError, \"Error getting channel client: %s\", err)\n\t}\n\t_, err = channelClient.Execute(\n\t\tchannel.Request{\n\t\t\tChaincodeID: chaincodeID,\n\t\t\tFcn: fctn,\n\t\t\tArgs: args,\n\t\t},\n\t\tchannel.WithTargets(a.peers...),\n\t\tchannel.WithRetry(retry.DefaultChannelOpts),\n\t)\n\n\treturn err\n}", "func (a *MockAction) ExecuteTx(chaincodeID, fctn string, args [][]byte) error {\n\t_, err := a.Invoker(chaincodeID, fctn, args)\n\treturn err\n}", "func (vtc *VTConn) Execute(query string, bindVars map[string]interface{}, keyspace string, shards []string) (*mproto.QueryResult, error) {\n\tvtc.mu.Lock()\n\tdefer vtc.mu.Unlock()\n\n\tqr := new(mproto.QueryResult)\n\tallErrors := new(concurrency.AllErrorRecorder)\n\tswitch len(shards) {\n\tcase 0:\n\t\treturn new(mproto.QueryResult), nil\n\tcase 1:\n\t\t// Fast-path for single shard execution\n\t\tvar err error\n\t\tqr, err = vtc.execOnShard(query, bindVars, keyspace, shards[0])\n\t\tallErrors.RecordError(err)\n\tdefault:\n\t\tresults := make(chan *mproto.QueryResult, len(shards))\n\t\tvar wg sync.WaitGroup\n\t\tfor shard := range unique(shards) {\n\t\t\twg.Add(1)\n\t\t\tgo func(shard string) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tinnerqr, err := vtc.execOnShard(query, bindVars, keyspace, shard)\n\t\t\t\tif err != nil {\n\t\t\t\t\tallErrors.RecordError(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tresults <- innerqr\n\t\t\t}(shard)\n\t\t}\n\t\tgo func() {\n\t\t\twg.Wait()\n\t\t\tclose(results)\n\t\t}()\n\t\tfor innerqr := range results {\n\t\t\tappendResult(qr, innerqr)\n\t\t}\n\t}\n\tif allErrors.HasErrors() {\n\t\tif vtc.transactionId != 0 {\n\t\t\terrstr := allErrors.Error().Error()\n\t\t\t// We cannot recover from these errors\n\t\t\tif strings.Contains(errstr, \"tx_pool_full\") || strings.Contains(errstr, \"not_in_tx\") {\n\t\t\t\tvtc.rollback()\n\t\t\t}\n\t\t}\n\t\treturn nil, allErrors.Error()\n\t}\n\treturn qr, nil\n}", "func (_Outbox *OutboxSession) ExecuteTransaction(outboxIndex *big.Int, proof [][32]byte, index *big.Int, l2Sender common.Address, destAddr common.Address, l2Block *big.Int, l1Block *big.Int, l2Timestamp *big.Int, amount *big.Int, calldataForL1 []byte) (*types.Transaction, error) {\n\treturn _Outbox.Contract.ExecuteTransaction(&_Outbox.TransactOpts, outboxIndex, proof, index, l2Sender, destAddr, l2Block, l1Block, l2Timestamp, amount, calldataForL1)\n}", "func (p *Pool) Execute(query string) (resp []Response, err error) {\n\tpc, err := p.Get()\n\tif err != nil {\n\t\tfmt.Printf(\"Error aquiring connection from pool: %s\", err)\n\t\treturn nil, err\n\t}\n\tdefer pc.Close()\n\treturn pc.Client.Execute(query)\n}", "func (e *RetrieveBalance) Execute(\n\tctx context.Context,\n) (*int, *svc.Resp, error) {\n\tctx = db.Begin(ctx, \"mint\")\n\tdefer db.LoggedRollback(ctx)\n\n\tbalance, err := model.LoadCanonicalBalanceByOwnerToken(ctx,\n\t\te.Owner, e.Token)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(err) // 500\n\t} else if balance == nil {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(nil,\n\t\t\t404, \"balance_not_found\",\n\t\t\t\"The balance you are trying to retrieve does not exist: %s.\",\n\t\t\te.ID,\n\t\t))\n\t}\n\n\tdb.Commit(ctx)\n\n\treturn ptr.Int(http.StatusOK), &svc.Resp{\n\t\t\"balance\": format.JSONPtr(model.NewBalanceResource(ctx, balance)),\n\t}, nil\n}", "func (c *cmdSendFaucetTx) Execute(args []string) error {\n\taddress := c.Args.Address\n\tatoms := c.Args.Amount\n\tdcr := float64(atoms) / 1e8\n\n\ttxID, err := util.PayWithTestnetFaucet(context.Background(),\n\t\tcfg.FaucetHost, address, atoms, c.Args.OverrideToken)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch {\n\tcase cfg.Silent:\n\t\t// Keep quite\n\tcase cfg.RawJSON:\n\t\tfmt.Printf(`{\"txid\":\"%v\"}`, txID)\n\t\tfmt.Printf(\"\\n\")\n\tdefault:\n\t\tfmt.Printf(\"Paid %v DCR to %v with tx %v\\n\", dcr, address, txID)\n\t}\n\n\treturn nil\n}", "func Execute(client ioctl.Client,\n\tcmd *cobra.Command,\n\tcontract string,\n\tamount *big.Int,\n\tbytecode []byte,\n\tgasPrice, signer, password string,\n\tnonce, gasLimit uint64,\n\tassumeYes bool,\n) error {\n\tif len(contract) == 0 && len(bytecode) == 0 {\n\t\treturn errors.New(\"failed to deploy contract with empty bytecode\")\n\t}\n\tgasPriceRau, err := gasPriceInRau(client, gasPrice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get gas price\")\n\t}\n\tsender, err := Signer(client, signer)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get signer address\")\n\t}\n\tnonce, err = checkNonce(client, nonce, sender)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get nonce\")\n\t}\n\ttx, err := action.NewExecution(contract, nonce, amount, gasLimit, gasPriceRau, bytecode)\n\tif err != nil || tx == nil {\n\t\treturn errors.Wrap(err, \"failed to make a Execution instance\")\n\t}\n\tif gasLimit == 0 {\n\t\ttx, err = fixGasLimit(client, sender, tx)\n\t\tif err != nil || tx == nil {\n\t\t\treturn errors.Wrap(err, \"failed to fix Execution gas limit\")\n\t\t}\n\t\tgasLimit = tx.GasLimit()\n\t}\n\treturn SendAction(\n\t\tclient,\n\t\tcmd,\n\t\t(&action.EnvelopeBuilder{}).\n\t\t\tSetNonce(nonce).\n\t\t\tSetGasPrice(gasPriceRau).\n\t\t\tSetGasLimit(gasLimit).\n\t\t\tSetAction(tx).Build(),\n\t\tsender,\n\t\tpassword,\n\t\tnonce,\n\t\tassumeYes,\n\t)\n}", "func (_Validator *ValidatorTransactorSession) ExecuteTransactions(data [][]byte, destination []common.Address, amount []*big.Int) (*types.Transaction, error) {\n\treturn _Validator.Contract.ExecuteTransactions(&_Validator.TransactOpts, data, destination, amount)\n}", "func (_Validator *ValidatorTransactor) ExecuteTransactions(opts *bind.TransactOpts, data [][]byte, destination []common.Address, amount []*big.Int) (*types.Transaction, error) {\n\treturn _Validator.contract.Transact(opts, \"executeTransactions\", data, destination, amount)\n}", "func (_SimpleMultiSig *SimpleMultiSigTransactorSession) Execute(bucketIdx uint16, expireTime *big.Int, sigV []uint8, sigR [][32]byte, sigS [][32]byte, destination common.Address, value *big.Int, data []byte, executor common.Address, gasLimit *big.Int) (*types.Transaction, error) {\n\treturn _SimpleMultiSig.Contract.Execute(&_SimpleMultiSig.TransactOpts, bucketIdx, expireTime, sigV, sigR, sigS, destination, value, data, executor, gasLimit)\n}", "func (client *Client) Execute(command string) {\n\tclient.SendResponse(command)\n}", "func (c *Client) ExecuteStatement(ctx context.Context, params *ExecuteStatementInput, optFns ...func(*Options)) (*ExecuteStatementOutput, error) {\n\tif params == nil {\n\t\tparams = &ExecuteStatementInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ExecuteStatement\", params, optFns, c.addOperationExecuteStatementMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ExecuteStatementOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (_SimpleMultiSig *SimpleMultiSigSession) Execute(bucketIdx uint16, expireTime *big.Int, sigV []uint8, sigR [][32]byte, sigS [][32]byte, destination common.Address, value *big.Int, data []byte, executor common.Address, gasLimit *big.Int) (*types.Transaction, error) {\n\treturn _SimpleMultiSig.Contract.Execute(&_SimpleMultiSig.TransactOpts, bucketIdx, expireTime, sigV, sigR, sigS, destination, value, data, executor, gasLimit)\n}", "func (_PBridge *PBridgeTransactorSession) ExecuteUpgrade(txKey string, upgradeContract common.Address, signatures []byte) (*types.Transaction, error) {\n\treturn _PBridge.Contract.ExecuteUpgrade(&_PBridge.TransactOpts, txKey, upgradeContract, signatures)\n}", "func (_Validator *ValidatorSession) ExecuteTransactions(data [][]byte, destination []common.Address, amount []*big.Int) (*types.Transaction, error) {\n\treturn _Validator.Contract.ExecuteTransactions(&_Validator.TransactOpts, data, destination, amount)\n}", "func (e *Execute) Execute(args []string) error {\n\tfmt.Println(\"args: \", args)\n\tif len(args) <= 0 {\n\t\treturn fmt.Errorf(\"no args passed to echo\")\n\t}\n\n\tcli := client.NewClient(e.ClientOpts)\n\terr := cli.Init()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cli.Close()\n\n\tresp, err := cli.Execute(request.Request{Query: string(args[0])})\n\tfmt.Println(\"ERROR: \", err, \" RESP: \", resp)\n\n\treturn nil\n}", "func (_PBridge *PBridgeTransactorSession) ExecuteWithdrawTx(txKey string, to common.Address, amount *big.Int, isERC20 bool, ERC20 common.Address, signatures []byte) (*types.Transaction, error) {\n\treturn _PBridge.Contract.ExecuteWithdrawTx(&_PBridge.TransactOpts, txKey, to, amount, isERC20, ERC20, signatures)\n}", "func (t createTransferInteractor) Execute(ctx context.Context, input CreateTransferInput) (CreateTransferOutput, error) {\n\tctx, cancel := context.WithTimeout(ctx, t.ctxTimeout)\n\tdefer cancel()\n\n\tvar (\n\t\ttransfer domain.Transfer\n\t\terr error\n\t)\n\n\terr = t.transferRepo.WithTransaction(ctx, func(ctxTx context.Context) error {\n\t\tif err = t.process(ctxTx, input); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ttransfer = domain.NewTransfer(\n\t\t\tdomain.TransferID(domain.NewUUID()),\n\t\t\tdomain.AccountID(input.AccountOriginID),\n\t\t\tdomain.AccountID(input.AccountDestinationID),\n\t\t\tdomain.Money(input.Amount),\n\t\t\ttime.Now(),\n\t\t)\n\n\t\ttransfer, err = t.transferRepo.Create(ctxTx, transfer)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn t.presenter.Output(domain.Transfer{}), err\n\t}\n\n\treturn t.presenter.Output(transfer), nil\n}", "func (c *client) Execute(relativeURL string, params map[string]string) (*http.Response, error) {\n\tparams[\"appkey\"] = c.appKey\n\tparams[\"sid\"] = c.sid\n\tparams[\"timestamp\"] = fmt.Sprint(time.Now().Unix())\n\tparams[\"sign\"] = signRequest(params, c.appSecret)\n\n\treturn c.post(c.baseURL+relativeURL, params)\n}", "func (_PBridge *PBridgeSession) ExecuteWithdrawTx(txKey string, to common.Address, amount *big.Int, isERC20 bool, ERC20 common.Address, signatures []byte) (*types.Transaction, error) {\n\treturn _PBridge.Contract.ExecuteWithdrawTx(&_PBridge.TransactOpts, txKey, to, amount, isERC20, ERC20, signatures)\n}", "func (_PBridge *PBridgeTransactor) ExecuteWithdrawTx(opts *bind.TransactOpts, txKey string, to common.Address, amount *big.Int, isERC20 bool, ERC20 common.Address, signatures []byte) (*types.Transaction, error) {\n\treturn _PBridge.contract.Transact(opts, \"executeWithdrawTx\", txKey, to, amount, isERC20, ERC20, signatures)\n}", "func (_PBridge *PBridgeTransactor) ExecuteUpgrade(opts *bind.TransactOpts, txKey string, upgradeContract common.Address, signatures []byte) (*types.Transaction, error) {\n\treturn _PBridge.contract.Transact(opts, \"executeUpgrade\", txKey, upgradeContract, signatures)\n}", "func (c CreateTransactionService) Execute(newTransaction entities.Transaction) (*entities.Transaction, error) {\n\ttransactType := newTransaction.Type\n\tif transactType != \"income\" && transactType != \"outcome\" {\n\t\treturn nil, errors.New(\"Cannot create transaction type different fom income or outcome\")\n\t}\n\n\tif transactType == \"outcome\" && !c.checksValidBalance(newTransaction) {\n\t\treturn nil, errors.New(\"Cannot create transaction with invalid balance\")\n\t}\n\n\tcreatedTransaction, err := c.Repo.Create(&newTransaction)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn createdTransaction, nil\n}", "func (_Token *TokenTransactor) ExecuteWithdrawal(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"executeWithdrawal\")\n}", "func ExecuteQuery(c *clientv1.Client, query string) (*clientv1.Response, error) {\n\tlog.Infof(\"action=ExecuteQuery q=%s client=%+v\", query, c)\n\tq := clientv1.Query{\n\t\tCommand: query,\n\t\tDatabase: Settings.Database,\n\t\tChunked: true,\n\t}\n\tresponse, err := c.Query(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "func (_PBridge *PBridgeSession) ExecuteUpgrade(txKey string, upgradeContract common.Address, signatures []byte) (*types.Transaction, error) {\n\treturn _PBridge.Contract.ExecuteUpgrade(&_PBridge.TransactOpts, txKey, upgradeContract, signatures)\n}", "func (_Token *TokenSession) ExecuteWithdrawal() (*types.Transaction, error) {\n\treturn _Token.Contract.ExecuteWithdrawal(&_Token.TransactOpts)\n}", "func (e *CancelTransaction) ExecutePropagated(\n\tctx context.Context,\n) (*int, *svc.Resp, error) {\n\tctx = db.Begin(ctx, \"mint\")\n\tdefer db.LoggedRollback(ctx)\n\n\ttx, err := model.LoadTransactionByID(ctx, e.ID)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(err) // 500\n\t} else if tx == nil {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(nil,\n\t\t\t404, \"transaction_not_found\",\n\t\t\t\"The transaction you are trying to settle does not exist: %s.\",\n\t\t\te.ID,\n\t\t))\n\t}\n\te.Tx = tx\n\n\t// Transaction can be either pending, reserved or already canceled.\n\tswitch e.Tx.Status {\n\tcase mint.TxStSettled:\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(nil,\n\t\t\t402, \"cancellation_failed\",\n\t\t\t\"The transaction you are trying to cancel is settled: %s.\",\n\t\t\te.ID,\n\t\t))\n\t}\n\n\tpl, err := plan.Compute(ctx, e.Client, e.Tx, false)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(err,\n\t\t\t402, \"cancellation_failed\",\n\t\t\t\"The plan computation for the transaction failed: %s\", e.ID,\n\t\t))\n\t}\n\te.Plan = pl\n\n\tminHop, _, err := e.Plan.MinMaxHop(ctx)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(err,\n\t\t\t402, \"cancellation_failed\",\n\t\t\t\"This node is not part of the transaction plan for %s\", e.ID,\n\t\t))\n\t}\n\n\tif int(e.Hop) >= len(e.Plan.Hops) ||\n\t\te.Plan.Hops[e.Hop].Mint != mint.GetHost(ctx) {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(nil,\n\t\t\t402, \"cancellation_failed\",\n\t\t\t\"The hop provided (%d) does not match the current mint (%s) for \"+\n\t\t\t\t\"transaction: %s\", e.Hop, mint.GetHost(ctx), e.ID,\n\t\t))\n\t}\n\n\t// Check cancelation can be performed (either we're the last node, or the\n\t// node after us has already canceled the transaction, or the node after us\n\t// does not know about the transaction).\n\tif !e.Plan.CheckCanCancel(ctx, e.Client, e.Hop) {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(nil,\n\t\t\t402, \"cancellation_failed\",\n\t\t\t\"This transaction has not been cancelled by the next node on the \"+\n\t\t\t\t\"transaction plan: %s\",\n\t\t\te.Plan.Hops[e.Hop+1].Mint,\n\t\t))\n\t}\n\n\t// Cancel will idempotently cancel the transaction on all hops that are\n\t// involving this mint.\n\terr = e.Cancel(ctx)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(err,\n\t\t\t402, \"cancellation_failed\",\n\t\t\t\"The cancellation execution failed for the transaction: %s\", e.ID,\n\t\t))\n\t}\n\n\t// We mark the transaction as cancelled if the hop of this is the minimal\n\t// one for this mint. Cancelation checks only use operations and crossings\n\t// so the status of a transaction is mostly indicative, but we want to mark\n\t// it as cancelled only after it is cancelled at all hops.\n\tif e.Hop == *minHop {\n\t\te.Tx.Status = mint.TxStCanceled\n\t\terr = e.Tx.Save(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, nil, errors.Trace(err) // 500\n\t\t}\n\t}\n\n\tops, err := model.LoadCanonicalOperationsByTransaction(ctx, e.ID)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(err) // 500\n\t}\n\n\tcrs, err := model.LoadCanonicalCrossingsByTransaction(ctx, e.ID)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(err) // 500\n\t}\n\n\t// Commit the transaction as well as operations and crossings as canceled..\n\tdb.Commit(ctx)\n\n\terr = e.Propagate(ctx)\n\tif err != nil {\n\t\t// If cancellation propagation failed we log it and trigger an\n\t\t// asyncrhonous one. In any case the node before us will check on us\n\t\t// before attempting to settle as well.\n\t\tmint.Logf(ctx,\n\t\t\t\"Cancellation propagation failed: transaction=%s hop=%d error=%s\",\n\t\t\te.ID, e.Hop, err.Error())\n\t\terr = async.Queue(ctx,\n\t\t\ttask.NewPropagateCancellation(ctx,\n\t\t\t\ttime.Now(), fmt.Sprintf(\"%s|%d\", e.ID, e.Hop)))\n\t\tif err != nil {\n\t\t\treturn nil, nil, errors.Trace(err) // 500\n\t\t}\n\t}\n\n\treturn ptr.Int(http.StatusOK), &svc.Resp{\n\t\t\"transaction\": format.JSONPtr(model.NewTransactionResource(ctx,\n\t\t\ttx, ops, crs,\n\t\t)),\n\t}, nil\n}", "func (_Token *TokenTransactorSession) ExecuteWithdrawal() (*types.Transaction, error) {\n\treturn _Token.Contract.ExecuteWithdrawal(&_Token.TransactOpts)\n}", "func (_TestClient *TestClientRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _TestClient.Contract.TestClientTransactor.contract.Transact(opts, method, params...)\n}", "func (transaction *EthereumFlow) Execute(client *Client) (TransactionResponse, error) {\n\tif transaction.ethereumData == nil {\n\t\treturn TransactionResponse{}, errors.New(\"cannot submit ethereum transaction with no ethereum data\")\n\t}\n\n\tethereumTransaction := NewEthereumTransaction()\n\tif len(transaction.nodeAccountIDs) > 0 {\n\t\tethereumTransaction.SetNodeAccountIDs(transaction.nodeAccountIDs)\n\t}\n\tdataBytes, err := transaction.ethereumData.ToBytes()\n\tif err != nil {\n\t\treturn TransactionResponse{}, err\n\t}\n\n\tif transaction.maxGasAllowance != nil {\n\t\tethereumTransaction.SetMaxGasAllowanceHbar(*transaction.maxGasAllowance)\n\t}\n\n\tif transaction.callDataFileID != nil { //nolint\n\t\tif len(transaction.ethereumData._GetData()) != 0 {\n\t\t\treturn TransactionResponse{}, errors.New(\"call data file ID provided, but ethereum data already contains call data\")\n\t\t}\n\n\t\tethereumTransaction.\n\t\t\tSetEthereumData(dataBytes).\n\t\t\tSetCallDataFileID(*transaction.callDataFileID)\n\t} else if len(dataBytes) <= 5120 {\n\t\tethereumTransaction.\n\t\t\tSetEthereumData(dataBytes)\n\t} else {\n\t\tfileID, err := transaction.\n\t\t\t_CreateFile(dataBytes, client)\n\t\tif err != nil {\n\t\t\treturn TransactionResponse{}, err\n\t\t}\n\n\t\ttransaction.ethereumData._SetData([]byte{})\n\n\t\tethereumTransaction.\n\t\t\tSetEthereumData(dataBytes).\n\t\t\tSetCallDataFileID(fileID)\n\t}\n\n\tresp, err := ethereumTransaction.\n\t\tExecute(client)\n\tif err != nil {\n\t\treturn TransactionResponse{}, err\n\t}\n\n\t_, err = resp.GetReceipt(client)\n\tif err != nil {\n\t\treturn TransactionResponse{}, err\n\t}\n\n\treturn resp, nil\n}", "func (vtc *VTConn) StreamExecute(query string, bindVars map[string]interface{}, keyspace string, shards []string, sendReply func(reply interface{}) error) error {\n\tvtc.mu.Lock()\n\tdefer vtc.mu.Unlock()\n\n\tif vtc.transactionId != 0 {\n\t\treturn fmt.Errorf(\"cannot stream in a transaction\")\n\t}\n\tresults := make(chan *mproto.QueryResult, len(shards))\n\tallErrors := new(concurrency.AllErrorRecorder)\n\tvar wg sync.WaitGroup\n\tfor shard := range unique(shards) {\n\t\twg.Add(1)\n\t\tgo func(shard string) {\n\t\t\tdefer wg.Done()\n\t\t\tsdc, _ := vtc.getConnection(keyspace, shard)\n\t\t\tsr, errFunc := sdc.StreamExecute(query, bindVars)\n\t\t\tfor qr := range sr {\n\t\t\t\tresults <- qr\n\t\t\t}\n\t\t\terr := errFunc()\n\t\t\tif err != nil {\n\t\t\t\tallErrors.RecordError(err)\n\t\t\t}\n\t\t}(shard)\n\t}\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(results)\n\t}()\n\tvar replyErr error\n\tfor innerqr := range results {\n\t\t// We still need to finish pumping\n\t\tif replyErr != nil {\n\t\t\tcontinue\n\t\t}\n\t\treplyErr = sendReply(innerqr)\n\t}\n\tif replyErr != nil {\n\t\tallErrors.RecordError(replyErr)\n\t}\n\treturn allErrors.Error()\n}", "func (i service) RawExecute(ctx context.Context, to common.Address, data []byte) error {\n\tDID, err := NewDIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcontract, opts, err := i.prepareTransaction(ctx, DID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// default: no ether should be send\n\tvalue := big.NewInt(0)\n\n\ttxID, done, err := i.txManager.ExecuteWithinTX(context.Background(), DID, transactions.NilTxID(), \"Check TX for execute\", i.ethereumTX(opts, contract.Execute, to, value, data))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tisDone := <-done\n\t// non async task\n\tif !isDone {\n\t\treturn errors.New(\"raw execute TX failed: txID:%s\", txID.String())\n\n\t}\n\treturn nil\n\n}", "func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {\n\tspan := opentracing.SpanFromContext(ctx)\n\tif span != nil {\n\t\tnewSpan := tx.tracer.StartSpan(\n\t\t\tfmt.Sprintf(\"txn.execute\"),\n\t\t\topentracing.ChildOf(span.Context()),\n\t\t)\n\t\text.Component.Set(newSpan, \"database/sql\")\n\t\text.SpanKind.Set(newSpan, \"client\")\n\t\text.DBStatement.Set(newSpan, query)\n\t\tctx = opentracing.ContextWithSpan(ctx, newSpan)\n\t\tdefer newSpan.Finish()\n\t}\n\treturn tx.Tx.ExecContext(ctx, query, args...)\n}", "func (_TestClient *TestClientTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _TestClient.Contract.contract.Transact(opts, method, params...)\n}", "func (builder QueryBuilder) Execute(ctx context.Context, options ...OperationExecutorOptionFn) (*Response, error) {\n\texecutor := NewDGoExecutor(builder.client)\n\n\tfor _, option := range options {\n\t\toption(executor)\n\t}\n\treturn executor.ExecuteQueries(ctx, builder)\n}", "func (c *bankCase) Execute(ctx context.Context, db *sql.DB) error {\n\tlog.Infof(\"[%s] start to test...\", c)\n\tdefer func() {\n\t\tlog.Infof(\"[%s] test end...\", c)\n\t}()\n\tvar wg sync.WaitGroup\n\n\trun := func(f func()) {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t\tif atomic.LoadInt32(&c.stopped) != 0 {\n\t\t\t\t\t// too many log print in here if return error\n\t\t\t\t\tlog.Errorf(\"[%s] bank stopped\", c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tc.wg.Add(1)\n\t\t\t\tf()\n\t\t\t\tc.wg.Done()\n\t\t\t}\n\t\t}()\n\t}\n\n\tfor i := 0; i < c.cfg.Concurrency; i++ {\n\t\trun(func() { c.moveMoney(ctx, db, noDelay) })\n\t}\n\tif c.cfg.EnableLongTxn {\n\t\trun(func() { c.moveMoney(ctx, db, delayRead) })\n\t\trun(func() { c.moveMoney(ctx, db, delayCommit) })\n\t}\n\n\twg.Wait()\n\treturn nil\n}", "func (committer *subNsCommitter) execute() error {\n\treturn commitUpdates(committer.db, committer.batchUpdateMap)\n}", "func (l *Lock) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, _ bool) (*sqltypes.Result, error) {\n\trss, _, err := vcursor.ResolveDestinations(l.Keyspace.Name, nil, []key.Destination{l.TargetDestination})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(rss) != 1 {\n\t\treturn nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, \"lock query can be routed to single shard only: %v\", rss)\n\t}\n\n\tquery := &querypb.BoundQuery{\n\t\tSql: l.Query,\n\t\tBindVariables: bindVars,\n\t}\n\treturn vcursor.ExecuteLock(rss[0], query)\n}", "func (command *ClientCommand) Execute() error {\n\tlog.Debug(\"Generating a rest client for \", command.Language)\n\tapiDef := new(raml.APIDefinition)\n\terr := raml.ParseFile(command.RamlFile, apiDef)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn codegen.GenerateClient(apiDef, command.Dir, command.PackageName, command.Language, command.ImportPath, command.Kind)\n}", "func (db *DB) Execute(ctx context.Context, do func(internal.Storage) error) error {\n\ttx, commit, rollback := db.repo.NewTx(ctx)\n\tif err := do(tx); err != nil {\n\t\treturn errors.Join(err, rollback())\n\t}\n\treturn commit()\n}", "func (e *RawExecutor) Execute(closing <-chan struct{}) <-chan *models.Row {\n\tout := make(chan *models.Row, 0)\n\tgo e.execute(out, closing)\n\treturn out\n}", "func (e *sqlExecutor) Execute(ctx context.Context, c *sqlconf.Config) error {\n\tif err := c.Validate(); err != nil {\n\t\treturn err\n\t}\n\tdb, err := c.DB()\n\tif err != nil {\n\t\treturn nil\n\t}\n\tif err := setupDB(db, c); err != nil {\n\t\treturn err\n\t}\n\tif c.Concurrent {\n\t\treturn e.execParallel(ctx, db, c)\n\t}\n\tfor _, payload := range c.Payloads {\n\t\t_, err := db.ExecContext(ctx, payload.Exec)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (s *SSHClient) Execute(host, cmd string) (string, error) {\n\thostname := fmt.Sprintf(\"%s.%s.%s:%d\", host, s.projectID, DropletDomain, defaultSSHPort)\n\n\tpemBytes, err := s.repo.GetKey(s.projectID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsigner, err := ssh.ParsePrivateKey(pemBytes)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"parse key failed: %v\", err)\n\t}\n\n\tconfig := &ssh.ClientConfig{\n\t\tUser: \"workshop\",\n\t\tAuth: []ssh.AuthMethod{ssh.PublicKeys(signer)},\n\t}\n\n\ts.log.WithField(\"hostname\", hostname).Info(\"dialing\")\n\tconn, err := ssh.Dial(\"tcp\", hostname, config)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ts.log.WithField(\"hostname\", hostname).Info(\"creating session\")\n\tsession, err := conn.NewSession()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdefer session.Close()\n\n\tvar buf bytes.Buffer\n\tsession.Stdout = &buf\n\n\ts.log.WithFields(logrus.Fields{\n\t\t\"hostname\": hostname,\n\t\t\"cmd\": cmd}).\n\t\tInfo(\"running command\")\n\terr = session.Run(cmd)\n\tif err != nil {\n\t\ts.log.WithField(\"output\", buf.String()).WithError(err).Error(\"ssh client run returned non zero result\")\n\t\treturn \"\", fmt.Errorf(\"%s\\n%s\", err, buf.String())\n\t}\n\n\treturn buf.String(), nil\n}", "func (stc *ScatterConn) Execute(query string, bindVars map[string]interface{}, keyspace string, shards []string) (*mproto.QueryResult, error) {\n\tstc.mu.Lock()\n\tdefer stc.mu.Unlock()\n\n\tqr := new(mproto.QueryResult)\n\tallErrors := new(concurrency.AllErrorRecorder)\n\tswitch len(shards) {\n\tcase 0:\n\t\treturn qr, nil\n\tcase 1:\n\t\t// Fast-path for single shard execution\n\t\tvar err error\n\t\tqr, err = stc.execOnShard(query, bindVars, keyspace, shards[0])\n\t\tallErrors.RecordError(err)\n\tdefault:\n\t\tresults := make(chan *mproto.QueryResult, len(shards))\n\t\tvar wg sync.WaitGroup\n\t\tfor shard := range unique(shards) {\n\t\t\twg.Add(1)\n\t\t\tgo func(shard string) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tinnerqr, err := stc.execOnShard(query, bindVars, keyspace, shard)\n\t\t\t\tif err != nil {\n\t\t\t\t\tallErrors.RecordError(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tresults <- innerqr\n\t\t\t}(shard)\n\t\t}\n\t\tgo func() {\n\t\t\twg.Wait()\n\t\t\tclose(results)\n\t\t}()\n\t\tfor innerqr := range results {\n\t\t\tappendResult(qr, innerqr)\n\t\t}\n\t}\n\tif allErrors.HasErrors() {\n\t\tif stc.transactionId != 0 {\n\t\t\terrstr := allErrors.Error().Error()\n\t\t\t// We cannot recover from these errors\n\t\t\tif strings.Contains(errstr, \"tx_pool_full\") || strings.Contains(errstr, \"not_in_tx\") {\n\t\t\t\tstc.rollback()\n\t\t\t}\n\t\t}\n\t\treturn nil, allErrors.Error()\n\t}\n\treturn qr, nil\n}", "func (test *RestTest) Execute(testcase *TestCase, ctx *TestContext) error {\n\ttestData := testcase.Data\n\n\tswitch testcase.Method {\n\tcase METHOD_CREATE_SERVICE, METHOD_CREATE_POLICY, METHOD_CREATE_ROLEPOLICY,\n\t\tMETHOD_IS_ALLOWED, METHOD_GET_GRANTED_ROLES, METHOD_GET_GRANTED_PERMISSIONS:\n\t\treturn test.Client.Post(testData)\n\tcase METHOD_GET_SERVICE, METHOD_QUERY_SERVICE, METHOD_GET_POLICY, METHOD_QUERY_POLICY,\n\t\tMETHOD_GET_ROLEPOLICY, METHOD_QUERY_ROLEPOLICY:\n\t\treturn test.Client.Get(testData)\n\tcase METHOD_DELETE_SERVICE, METHOD_DELETE_POLICY, METHOD_DELETE_ROLEPOLICY:\n\t\treturn test.Client.Delete(testData)\n\tdefault:\n\t\treturn errors.New(ERROR_SPEEDLE_NOT_SUPPORTED)\n\t}\n}", "func (g *GuaranteeExecutor) Execute(ctx context.Context) (err error) {\n\tdefer func() {\n\t\tif rc := recover(); rc != nil {\n\t\t\tswitch rv := rc.(type) {\n\t\t\tcase error:\n\t\t\t\terr = rv.(error)\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\terr = errors.Errorf(\"%v\", rv)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\terr = g.exec.Execute(ctx)\n\treturn\n}", "func (s *Server) handleTransaction(client string, req *pb.Command) (err error) {\n\t// Get the transfer from the original command, will panic if nil\n\ttransfer := req.GetTransfer()\n\tmsg := fmt.Sprintf(\"starting transaction of %0.2f from %s to %s\", transfer.Amount, transfer.Account, transfer.Beneficiary)\n\ts.updates.Broadcast(req.Id, msg, pb.MessageCategory_LEDGER)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// Handle Demo UI errors before the account lookup\n\tif transfer.OriginatingVasp != \"\" && transfer.OriginatingVasp != s.vasp.Name {\n\t\tlog.Info().Str(\"requested\", transfer.OriginatingVasp).Str(\"local\", s.vasp.Name).Msg(\"requested originator does not match local VASP\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrWrongVASP, \"message sent to the wrong originator VASP\"),\n\t\t)\n\t}\n\n\t// Lookup the account associated with the transfer originator\n\tvar account Account\n\tif err = LookupAccount(s.db, transfer.Account).First(&account).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\tlog.Info().Str(\"account\", transfer.Account).Msg(\"not found\")\n\t\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\t\tpb.Errorf(pb.ErrNotFound, \"account not found\"),\n\t\t\t)\n\t\t}\n\t\treturn fmt.Errorf(\"could not fetch account: %s\", err)\n\t}\n\ts.updates.Broadcast(req.Id, fmt.Sprintf(\"account %04d accessed successfully\", account.ID), pb.MessageCategory_LEDGER)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// Lookup the wallet of the beneficiary\n\tvar beneficiary Wallet\n\tif err = LookupBeneficiary(s.db, transfer.Beneficiary).First(&beneficiary).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\tlog.Info().Str(\"beneficiary\", transfer.Beneficiary).Msg(\"not found\")\n\t\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\t\tpb.Errorf(pb.ErrNotFound, \"beneficiary wallet not found\"),\n\t\t\t)\n\t\t}\n\t\treturn fmt.Errorf(\"could not fetch beneficiary wallet: %s\", err)\n\t}\n\n\tif transfer.CheckBeneficiary {\n\t\tif transfer.BeneficiaryVasp != beneficiary.Provider.Name {\n\t\t\tlog.Info().\n\t\t\t\tStr(\"expected\", transfer.BeneficiaryVasp).\n\t\t\t\tStr(\"actual\", beneficiary.Provider.Name).\n\t\t\t\tMsg(\"check beneficiary failed\")\n\t\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\t\tpb.Errorf(pb.ErrWrongVASP, \"beneficiary wallet does not match beneficiary vasp\"),\n\t\t\t)\n\t\t}\n\t}\n\ts.updates.Broadcast(req.Id, fmt.Sprintf(\"wallet %s provided by %s\", beneficiary.Address, beneficiary.Provider.Name), pb.MessageCategory_BLOCKCHAIN)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// TODO: lookup peer from cache rather than always doing a directory service lookup\n\tvar peer *peers.Peer\n\ts.updates.Broadcast(req.Id, fmt.Sprintf(\"search for %s in directory service\", beneficiary.Provider.Name), pb.MessageCategory_TRISADS)\n\tif peer, err = s.peers.Search(beneficiary.Provider.Name); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not search peer from directory service\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not search peer from directory service\"),\n\t\t)\n\t}\n\tinfo := peer.Info()\n\ts.updates.Broadcast(req.Id, fmt.Sprintf(\"identified TRISA remote peer %s at %s via directory service\", info.ID, info.Endpoint), pb.MessageCategory_TRISADS)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\tvar signKey *rsa.PublicKey\n\ts.updates.Broadcast(req.Id, \"exchanging peer signing keys\", pb.MessageCategory_TRISAP2P)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\tif signKey, err = peer.ExchangeKeys(true); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not exchange keys with remote peer\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not exchange keyrs with remote peer\"),\n\t\t)\n\t}\n\n\t// Prepare the transaction\n\t// Save the pending transaction and increment the accounts pending field\n\txfer := Transaction{\n\t\tEnvelope: uuid.New().String(),\n\t\tAccount: account,\n\t\tAmount: decimal.NewFromFloat32(transfer.Amount),\n\t\tDebit: true,\n\t\tCompleted: false,\n\t}\n\n\tif err = s.db.Save(&xfer).Error; err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not save transaction\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not save transaction\"),\n\t\t)\n\t}\n\n\t// Save the pending transaction on the account\n\t// TODO: remove pending transactions\n\taccount.Pending++\n\tif err = s.db.Save(&account).Error; err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not save originator account\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not save originator account\"),\n\t\t)\n\t}\n\n\ts.updates.Broadcast(req.Id, \"ready to execute transaction\", pb.MessageCategory_BLOCKCHAIN)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// Create an identity and transaction payload for TRISA exchange\n\ttransaction := &generic.Transaction{\n\t\tTxid: fmt.Sprintf(\"%d\", xfer.ID),\n\t\tOriginator: account.WalletAddress,\n\t\tBeneficiary: beneficiary.Address,\n\t\tAmount: float64(transfer.Amount),\n\t\tNetwork: \"TestNet\",\n\t\tTimestamp: xfer.Timestamp.Format(time.RFC3339),\n\t}\n\tidentity := &ivms101.IdentityPayload{\n\t\tOriginator: &ivms101.Originator{},\n\t\tOriginatingVasp: &ivms101.OriginatingVasp{},\n\t}\n\tif identity.OriginatingVasp.OriginatingVasp, err = s.vasp.LoadIdentity(); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not load originator vasp\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not load originator vasp\"),\n\t\t)\n\t}\n\n\tidentity.Originator = &ivms101.Originator{\n\t\tOriginatorPersons: make([]*ivms101.Person, 0, 1),\n\t\tAccountNumbers: []string{account.WalletAddress},\n\t}\n\tvar originator *ivms101.Person\n\tif originator, err = account.LoadIdentity(); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not load originator identity\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not load originator identity\"),\n\t\t)\n\t}\n\tidentity.Originator.OriginatorPersons = append(identity.Originator.OriginatorPersons, originator)\n\n\tpayload := &protocol.Payload{}\n\tif payload.Transaction, err = anypb.New(transaction); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not serialize transaction payload\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not serialize transaction payload\"),\n\t\t)\n\t}\n\tif payload.Identity, err = anypb.New(identity); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not serialize identity payload\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not serialize identity payload\"),\n\t\t)\n\t}\n\n\ts.updates.Broadcast(req.Id, \"transaction and identity payload constructed\", pb.MessageCategory_TRISAP2P)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// Secure the envelope with the remote beneficiary's signing keys\n\tvar envelope *protocol.SecureEnvelope\n\tif envelope, err = handler.New(xfer.Envelope, payload, nil).Seal(signKey); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not create or sign secure envelope\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not create or sign secure envelope\"),\n\t\t)\n\t}\n\n\ts.updates.Broadcast(req.Id, fmt.Sprintf(\"secure envelope %s sealed: encrypted with AES-GCM and RSA - sending ...\", envelope.Id), pb.MessageCategory_TRISAP2P)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// Conduct the TRISA transaction, handle errors and send back to user\n\tif envelope, err = peer.Transfer(envelope); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not perform TRISA exchange\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, err.Error()),\n\t\t)\n\t}\n\n\ts.updates.Broadcast(req.Id, fmt.Sprintf(\"received %s information exchange reply from %s\", envelope.Id, peer.String()), pb.MessageCategory_TRISAP2P)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// Open the response envelope with local private keys\n\tvar opened *handler.Envelope\n\tif opened, err = handler.Open(envelope, s.trisa.sign); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not unseal TRISA response\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, err.Error()),\n\t\t)\n\t}\n\n\t// Verify the contents of the response\n\tpayload = opened.Payload\n\tif payload.Identity.TypeUrl != \"type.googleapis.com/ivms101.IdentityPayload\" {\n\t\tlog.Warn().Str(\"type\", payload.Identity.TypeUrl).Msg(\"unsupported identity type\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"unsupported identity type\", payload.Identity.TypeUrl),\n\t\t)\n\t}\n\n\tif payload.Transaction.TypeUrl != \"type.googleapis.com/trisa.data.generic.v1beta1.Transaction\" {\n\t\tlog.Warn().Str(\"type\", payload.Transaction.TypeUrl).Msg(\"unsupported transaction type\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"unsupported transaction type\", payload.Transaction.TypeUrl),\n\t\t)\n\t}\n\n\tidentity = &ivms101.IdentityPayload{}\n\ttransaction = &generic.Transaction{}\n\tif err = payload.Identity.UnmarshalTo(identity); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not unmarshal identity\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, err.Error()),\n\t\t)\n\t}\n\tif err = payload.Transaction.UnmarshalTo(transaction); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not unmarshal transaction\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, err.Error()),\n\t\t)\n\t}\n\n\ts.updates.Broadcast(req.Id, \"successfully decrypted and parsed secure envelope\", pb.MessageCategory_TRISAP2P)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\t// Update the completed transaction and save to disk\n\txfer.Beneficiary = Identity{\n\t\tWalletAddress: transaction.Beneficiary,\n\t}\n\txfer.Completed = true\n\txfer.Timestamp, _ = time.Parse(time.RFC3339, transaction.Timestamp)\n\n\t// Serialize the identity information as JSON data\n\tvar data []byte\n\tif data, err = json.Marshal(identity); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not save transaction\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, \"could not marshal IVMS 101 identity\"),\n\t\t)\n\t}\n\txfer.Identity = string(data)\n\n\tif err = s.db.Save(&xfer).Error; err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not save transaction\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, err.Error()),\n\t\t)\n\t}\n\n\t// Save the pending transaction on the account\n\t// TODO: remove pending transactions\n\taccount.Pending--\n\taccount.Completed++\n\taccount.Balance.Sub(xfer.Amount)\n\tif err = s.db.Save(&account).Error; err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not save transaction\")\n\t\treturn s.updates.SendTransferError(client, req.Id,\n\t\t\tpb.Errorf(pb.ErrInternal, err.Error()),\n\t\t)\n\t}\n\n\tmsg = fmt.Sprintf(\"transaction %04d complete: %s transfered from %s to %s\", xfer.ID, xfer.Amount.String(), xfer.Originator.WalletAddress, xfer.Beneficiary.WalletAddress)\n\ts.updates.Broadcast(req.Id, msg, pb.MessageCategory_BLOCKCHAIN)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\ts.updates.Broadcast(req.Id, fmt.Sprintf(\"%04d new account balance: %s\", account.ID, account.Balance), pb.MessageCategory_LEDGER)\n\ttime.Sleep(time.Duration(rand.Int63n(1000)) * time.Millisecond)\n\n\trep := &pb.Message{\n\t\tType: pb.RPC_TRANSFER,\n\t\tId: req.Id,\n\t\tTimestamp: time.Now().Format(time.RFC3339),\n\t\tCategory: pb.MessageCategory_LEDGER,\n\t\tReply: &pb.Message_Transfer{Transfer: &pb.TransferReply{\n\t\t\tTransaction: xfer.Proto(),\n\t\t}},\n\t}\n\n\treturn s.updates.Send(client, rep)\n}", "func (ctrl *PGCtrl) Execute(q string) error {\n\t_, err := ctrl.conn.Exec(q)\n\treturn err\n}", "func (t *explainTablet) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, transactionID, reservedID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {\n\tt.mu.Lock()\n\tt.currentTime = t.vte.batchTime.Wait()\n\n\t// Since the query is simulated being \"sent\" over the wire we need to\n\t// copy the bindVars into the executor to avoid a data race.\n\tbindVariables = sqltypes.CopyBindVariables(bindVariables)\n\tt.tabletQueries = append(t.tabletQueries, &TabletQuery{\n\t\tTime: t.currentTime,\n\t\tSQL: sql,\n\t\tBindVars: bindVariables,\n\t})\n\tt.mu.Unlock()\n\n\treturn t.tsv.Execute(ctx, target, sql, bindVariables, transactionID, reservedID, options)\n}", "func (tx *Transaction) ExecuteAsync() (err error) {\n\ttx.RetryAt = time.Now()\n\ttx.Timeout = tx.timeout()\n\tif _, err := tx.storage().SaveTransaction(tx); err != nil {\n\t\treturn fmt.Errorf(\"save transaction failed: %v\", err)\n\t}\n\n\treturn nil\n}", "func (s *Sudt) Send(client rpc.Client) (*types.Hash, error) {\n\treturn client.SendTransaction(context.Background(), s.tx)\n}", "func (c *Client) ExecuteAndWait(ctx context.Context, req *repb.ExecuteRequest) (op *oppb.Operation, err error) {\n\treturn c.ExecuteAndWaitProgress(ctx, req, nil)\n}", "func Execute() {\n\tzk.Execute()\n}", "func (trd *trxDispatcher) execute() {\n\t// don't forget to sign off after we are done\n\tdefer func() {\n\t\tclose(trd.outAccount)\n\t\tclose(trd.outLog)\n\t\tclose(trd.outTransaction)\n\n\t\ttrd.mgr.finished(trd)\n\t}()\n\n\t// wait for transactions and process them\n\tfor {\n\t\t// try to read next transaction\n\t\tselect {\n\t\tcase <-trd.sigStop:\n\t\t\treturn\n\t\tcase <-trd.bot.C:\n\t\t\ttrd.updateLastSeenBlock()\n\t\tcase evt, ok := <-trd.inTransaction:\n\t\t\t// is the channel even available for reading\n\t\t\tif !ok {\n\t\t\t\tlog.Notice(\"trx channel closed, terminating %s\", trd.name())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif evt.blk == nil || evt.trx == nil {\n\t\t\t\tlog.Criticalf(\"dispatcher dry loop\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttrd.process(evt)\n\t\t}\n\t}\n}", "func (s *Server) Exec(c *Conn, statement string, args Args) (interface{}, error) {\n\treq := c.acquireRequest(statement, args)\n\tdefer c.releaseRequest(req)\n\treturn s.engine.handlers.exec(req)\n}", "func (c *clientRegistry) Execute(frame []byte) error {\n\theaders, err := getHeadersFromFrame(frame)\n\tif err != nil {\n\t\tlog.Warn(\"frugal: invalid protocol frame headers:\", err)\n\t\treturn err\n\t}\n\n\topid, err := strconv.ParseUint(headers[opID], 10, 64)\n\tif err != nil {\n\t\tlog.Warn(\"frugal: invalid protocol frame:\", err)\n\t\treturn err\n\t}\n\n\tc.mu.RLock()\n\thandler, ok := c.handlers[opid]\n\tif !ok {\n\t\tc.mu.RUnlock()\n\t\treturn nil\n\t}\n\tc.mu.RUnlock()\n\n\treturn handler(&thrift.TMemoryBuffer{Buffer: bytes.NewBuffer(frame)})\n}", "func (mr *MockMachineClientMockRecorder) Execute(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, \"Execute\", reflect.TypeOf((*MockMachineClient)(nil).Execute), varargs...)\n}", "func (m *MSSQLTx) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {\n\treturn m.ExecWithMetrics(ctx, &metrics.NoOp{}, query, args...)\n}", "func (c *BlockWriterCase) Execute(db *sql.DB, index int) error {\n\tc.bws[index].batchExecute(db, c.cfg.TableNum)\n\treturn nil\n}", "func TestClientRunTransaction(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\ts, _, _ := serverutils.StartServer(t, base.TestServerArgs{})\n\tdefer s.Stopper().Stop()\n\tdbCtx := client.DefaultDBContext()\n\tdbCtx.TxnRetryOptions.InitialBackoff = 1 * time.Millisecond\n\tdb := createTestClientForUser(t, s.Stopper(), s.ServingAddr(), security.NodeUser, dbCtx)\n\n\tfor _, commit := range []bool{true, false} {\n\t\tvalue := []byte(\"value\")\n\t\tkey := []byte(fmt.Sprintf(\"%s/key-%t\", testUser, commit))\n\n\t\t// Use snapshot isolation so non-transactional read can always push.\n\t\terr := db.Txn(context.TODO(), func(txn *client.Txn) error {\n\t\t\tif err := txn.SetIsolation(enginepb.SNAPSHOT); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Put transactional value.\n\t\t\tif err := txn.Put(key, value); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Attempt to read outside of txn.\n\t\t\tif gr, err := db.Get(key); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if gr.Value != nil {\n\t\t\t\treturn errors.Errorf(\"expected nil value; got %+v\", gr.Value)\n\t\t\t}\n\t\t\t// Read within the transaction.\n\t\t\tif gr, err := txn.Get(key); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if gr.Value == nil || !bytes.Equal(gr.ValueBytes(), value) {\n\t\t\t\treturn errors.Errorf(\"expected value %q; got %q\", value, gr.ValueBytes())\n\t\t\t}\n\t\t\tif !commit {\n\t\t\t\treturn errors.Errorf(\"purposefully failing transaction\")\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif commit != (err == nil) {\n\t\t\tt.Errorf(\"expected success? %t; got %s\", commit, err)\n\t\t} else if !commit && !testutils.IsError(err, \"purposefully failing transaction\") {\n\t\t\tt.Errorf(\"unexpected failure with !commit: %s\", err)\n\t\t}\n\n\t\t// Verify the value is now visible on commit == true, and not visible otherwise.\n\t\tgr, err := db.Get(key)\n\t\tif commit {\n\t\t\tif err != nil || gr.Value == nil || !bytes.Equal(gr.ValueBytes(), value) {\n\t\t\t\tt.Errorf(\"expected success reading value: %+v, %s\", gr.Value, err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err != nil || gr.Value != nil {\n\t\t\t\tt.Errorf(\"expected success and nil value: %+v, %s\", gr.Value, err)\n\t\t\t}\n\t\t}\n\t}\n}" ]
[ "0.70078564", "0.68464804", "0.6734575", "0.67233604", "0.670635", "0.6611637", "0.6524136", "0.6417121", "0.63418293", "0.6291228", "0.6260394", "0.6257911", "0.62457204", "0.6178231", "0.6089337", "0.60662067", "0.605121", "0.6049677", "0.6045683", "0.60286087", "0.5981053", "0.59337634", "0.5925239", "0.5921052", "0.5899777", "0.5887729", "0.58877164", "0.588308", "0.58663297", "0.5846273", "0.58399844", "0.5836217", "0.583329", "0.5833003", "0.58152676", "0.5764851", "0.57167834", "0.57110494", "0.56993467", "0.568661", "0.56494415", "0.5579032", "0.55762535", "0.55719787", "0.555974", "0.5518579", "0.5493345", "0.5487498", "0.54637486", "0.54521966", "0.5429733", "0.5414591", "0.5399263", "0.5390461", "0.539036", "0.5384664", "0.537889", "0.53774846", "0.5368916", "0.535919", "0.5350917", "0.53466314", "0.5308533", "0.52994794", "0.52904874", "0.52774745", "0.52771336", "0.5274093", "0.5261973", "0.52336705", "0.5231877", "0.5227866", "0.51984", "0.5197524", "0.51953274", "0.51932126", "0.5187553", "0.51849914", "0.51832044", "0.5180331", "0.51774836", "0.5175429", "0.5164856", "0.51569486", "0.51513976", "0.5115342", "0.51139617", "0.50969565", "0.5096589", "0.50905895", "0.5080463", "0.50788397", "0.5054981", "0.5046033", "0.5027846", "0.5004815", "0.49856314", "0.49854475", "0.4985296", "0.49712613" ]
0.70018655
1
SetMaxTransactionFee sets the max transaction fee for this TokenMintTransaction.
func (transaction *TokenMintTransaction) SetMaxTransactionFee(fee Hbar) *TokenMintTransaction { transaction.requireNotFrozen() transaction.Transaction.SetMaxTransactionFee(fee) return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *TokenUpdateTransaction) SetMaxTransactionFee(fee Hbar) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetMaxTransactionFee(fee)\n\treturn transaction\n}", "func (transaction *ContractUpdateTransaction) SetMaxTransactionFee(fee Hbar) *ContractUpdateTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.Transaction.SetMaxTransactionFee(fee)\n\treturn transaction\n}", "func (transaction *ScheduleSignTransaction) SetMaxTransactionFee(fee Hbar) *ScheduleSignTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetMaxTransactionFee(fee)\n\treturn transaction\n}", "func (transaction *AccountCreateTransaction) SetMaxTransactionFee(fee Hbar) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetMaxTransactionFee(fee)\n\treturn transaction\n}", "func (transaction *FileCreateTransaction) SetMaxTransactionFee(fee Hbar) *FileCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetMaxTransactionFee(fee)\n\treturn transaction\n}", "func (transaction *AccountUpdateTransaction) SetMaxTransactionFee(fee Hbar) *AccountUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetMaxTransactionFee(fee)\n\treturn transaction\n}", "func (builder ConsensusMessageSubmitTransaction) SetMaxTransactionFee(maxTransactionFee Hbar) ConsensusMessageSubmitTransaction {\n\treturn ConsensusMessageSubmitTransaction{builder.TransactionBuilder.SetMaxTransactionFee(maxTransactionFee), builder.pb}\n}", "func (builder ConsensusTopicDeleteTransaction) SetMaxTransactionFee(maxTransactionFee Hbar) ConsensusTopicDeleteTransaction {\n\treturn ConsensusTopicDeleteTransaction{builder.TransactionBuilder.SetMaxTransactionFee(maxTransactionFee), builder.pb}\n}", "func (tx *Transaction) MaxFee() int32 {\n\treturn int32(tx.Envelope.Tx.Fee)\n}", "func (transaction *TokenUpdateTransaction) GetMaxTransactionFee() Hbar {\n\treturn transaction.Transaction.GetMaxTransactionFee()\n}", "func (in *ActionIpAddressIndexInput) SetMaxTx(value int64) *ActionIpAddressIndexInput {\n\tin.MaxTx = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"MaxTx\"] = nil\n\treturn in\n}", "func (transaction *FileCreateTransaction) GetMaxTransactionFee() Hbar {\n\treturn transaction.Transaction.GetMaxTransactionFee()\n}", "func (transaction *ScheduleSignTransaction) GetMaxTransactionFee() Hbar {\n\treturn transaction.Transaction.GetMaxTransactionFee()\n}", "func (transaction *AccountCreateTransaction) GetMaxTransactionFee() Hbar {\n\treturn transaction.Transaction.GetMaxTransactionFee()\n}", "func (p *Policy) setMaxBlockSystemFee(ic *interop.Context, args []stackitem.Item) stackitem.Item {\n\tvalue := toBigInt(args[0]).Int64()\n\tif value <= minBlockSystemFee {\n\t\tpanic(fmt.Errorf(\"MaxBlockSystemFee cannot be less then %d\", minBlockSystemFee))\n\t}\n\tok, err := p.checkValidators(ic)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif !ok {\n\t\treturn stackitem.NewBool(false)\n\t}\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\terr = p.setInt64WithKey(ic.DAO, maxBlockSystemFeeKey, value)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tp.isValid = false\n\treturn stackitem.NewBool(true)\n}", "func (transaction *TokenUpdateTransaction) SetMaxBackoff(max time.Duration) *TokenUpdateTransaction {\n\tif max.Nanoseconds() < 0 {\n\t\tpanic(\"maxBackoff must be a positive duration\")\n\t} else if max.Nanoseconds() < transaction.minBackoff.Nanoseconds() {\n\t\tpanic(\"maxBackoff must be greater than or equal to minBackoff\")\n\t}\n\ttransaction.maxBackoff = &max\n\treturn transaction\n}", "func (b *Bitcoin) FeeRangeMax() float64 {\n\treturn b.feeRange.max\n}", "func (p *Policy) setMaxTransactionsPerBlock(ic *interop.Context, args []stackitem.Item) stackitem.Item {\n\tvalue := uint32(toBigInt(args[0]).Int64())\n\tif value > block.MaxTransactionsPerBlock {\n\t\tpanic(fmt.Errorf(\"MaxTransactionsPerBlock cannot exceed the maximum allowed transactions per block = %d\", block.MaxTransactionsPerBlock))\n\t}\n\tok, err := p.checkValidators(ic)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif !ok {\n\t\treturn stackitem.NewBool(false)\n\t}\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\terr = p.setUint32WithKey(ic.DAO, maxTransactionsPerBlockKey, value)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tp.isValid = false\n\treturn stackitem.NewBool(true)\n}", "func (i *Invoice) SetMaxTipAmount(value int64) {\n\ti.Flags.Set(8)\n\ti.MaxTipAmount = value\n}", "func (transaction *ScheduleSignTransaction) SetMaxBackoff(max time.Duration) *ScheduleSignTransaction {\n\tif max.Nanoseconds() < 0 {\n\t\tpanic(\"maxBackoff must be a positive duration\")\n\t} else if max.Nanoseconds() < transaction.minBackoff.Nanoseconds() {\n\t\tpanic(\"maxBackoff must be greater than or equal to minBackoff\")\n\t}\n\ttransaction.maxBackoff = &max\n\treturn transaction\n}", "func (transaction *FileCreateTransaction) SetMaxBackoff(max time.Duration) *FileCreateTransaction {\n\tif max.Nanoseconds() < 0 {\n\t\tpanic(\"maxBackoff must be a positive duration\")\n\t} else if max.Nanoseconds() < transaction.minBackoff.Nanoseconds() {\n\t\tpanic(\"maxBackoff must be greater than or equal to minBackoff\")\n\t}\n\ttransaction.maxBackoff = &max\n\treturn transaction\n}", "func (transaction *AccountCreateTransaction) SetMaxBackoff(max time.Duration) *AccountCreateTransaction {\n\tif max.Nanoseconds() < 0 {\n\t\tpanic(\"maxBackoff must be a positive duration\")\n\t} else if max.Nanoseconds() < transaction.minBackoff.Nanoseconds() {\n\t\tpanic(\"maxBackoff must be greater than or equal to minBackoff\")\n\t}\n\ttransaction.maxBackoff = &max\n\treturn transaction\n}", "func (_Authority *AuthorityTransactor) SetMaxTimeToUpload(opts *bind.TransactOpts, maxTime *big.Int) (*types.Transaction, error) {\n\treturn _Authority.contract.Transact(opts, \"setMaxTimeToUpload\", maxTime)\n}", "func (_Crowdsale *CrowdsaleTransactor) SetMaxFrames(opts *bind.TransactOpts, _maxFrames *big.Int) (*types.Transaction, error) {\n\treturn _Crowdsale.contract.Transact(opts, \"setMaxFrames\", _maxFrames)\n}", "func (_Authority *AuthorityTransactorSession) SetMaxTimeToUpload(maxTime *big.Int) (*types.Transaction, error) {\n\treturn _Authority.Contract.SetMaxTimeToUpload(&_Authority.TransactOpts, maxTime)\n}", "func ExampleChangeTrust_maxLimit() {\n\tseed := \"SDL6ZQL52IEX34E574CGWKYX5MVPILN7F44QESY7VLWLKUSXZNBVERDY\"\n\ttx := Transaction(\n\t\tSourceAccount{seed},\n\t\tSequence{1},\n\t\tTestNetwork,\n\t\tTrust(\"USD\", \"GCGZMI5I2SEV2DEF3477UI3PAC2UJUZECK36KK4XFY6C2YPTSCNKRDA6\"),\n\t)\n\n\ttxe := tx.Sign(seed)\n\ttxeB64, _ := txe.Base64()\n\n\tfmt.Printf(\"tx base64: %s\", txeB64)\n\t// Output: tx base64: AAAAALy+aX1ueJ5Q7EcqD543OWZszFYHG2zJdImOryX8vwQsAAAAZAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAYAAAABVVNEAAAAAACNliOo1IldDIXfP/ojbwC1RNMkErflK5cuPC1h85CaqH//////////AAAAAAAAAAH8vwQsAAAAQOQeMy29nTZc4n5PoE/OkcVNHvOqNx6T+qqoe833uB8uwLCZu3h63jCPZGeIeAwNYiImwTjaxRcUD/jPWLjxpA0=\n}", "func (m *MailTips) SetMaxMessageSize(value *int32)() {\n err := m.GetBackingStore().Set(\"maxMessageSize\", value)\n if err != nil {\n panic(err)\n }\n}", "func (p *Policy) setMaxBlockSize(ic *interop.Context, args []stackitem.Item) stackitem.Item {\n\tvalue := uint32(toBigInt(args[0]).Int64())\n\tif value > payload.MaxSize {\n\t\tpanic(fmt.Errorf(\"MaxBlockSize cannot be more than the maximum payload size = %d\", payload.MaxSize))\n\t}\n\tok, err := p.checkValidators(ic)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif !ok {\n\t\treturn stackitem.NewBool(false)\n\t}\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\terr = p.setUint32WithKey(ic.DAO, maxBlockSizeKey, value)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tp.isValid = false\n\treturn stackitem.NewBool(true)\n}", "func (_Authority *AuthorityTransactor) SetFee(opts *bind.TransactOpts, newFee *big.Int) (*types.Transaction, error) {\n\treturn _Authority.contract.Transact(opts, \"setFee\", newFee)\n}", "func (transaction *EthereumFlow) SetMaxGasAllowance(max Hbar) *EthereumFlow {\n\ttransaction._RequireNotFrozen()\n\ttransaction.maxGasAllowance = &max\n\treturn transaction\n}", "func (_Authority *AuthoritySession) SetMaxTimeToUpload(maxTime *big.Int) (*types.Transaction, error) {\n\treturn _Authority.Contract.SetMaxTimeToUpload(&_Authority.TransactOpts, maxTime)\n}", "func (_Authority *AuthorityTransactorSession) SetFee(newFee *big.Int) (*types.Transaction, error) {\n\treturn _Authority.Contract.SetFee(&_Authority.TransactOpts, newFee)\n}", "func (_Authority *AuthorityTransactor) SetMaxTimToConfirm(opts *bind.TransactOpts, maxTime *big.Int) (*types.Transaction, error) {\n\treturn _Authority.contract.Transact(opts, \"setMaxTimToConfirm\", maxTime)\n}", "func (_ElvTradable *ElvTradableTransactor) SetBaseTransferFee(opts *bind.TransactOpts, _newBaseFee *big.Int) (*types.Transaction, error) {\n\treturn _ElvTradable.contract.Transact(opts, \"setBaseTransferFee\", _newBaseFee)\n}", "func (opts *FIFOCompactionOptions) SetMaxTableFilesSize(value uint64) {\n\tC.rocksdb_fifo_compaction_options_set_max_table_files_size(opts.c, C.uint64_t(value))\n}", "func (_Cakevault *CakevaultCallerSession) MAXPERFORMANCEFEE() (*big.Int, error) {\n\treturn _Cakevault.Contract.MAXPERFORMANCEFEE(&_Cakevault.CallOpts)\n}", "func (o Opts) SetMaxTimeout(timeout time.Duration) Opts {\n\to.MaxTimeout = timeout\n\treturn o\n}", "func (m Logon) SetMaxMessageSize(v int) {\n\tm.Set(field.NewMaxMessageSize(v))\n}", "func (m *Arg) SetMax(v float64) *Arg {\n\tm.Max = &v\n\treturn m\n}", "func (s *RollingUpdatePolicy) SetMaximumBatchSize(v *CapacitySize) *RollingUpdatePolicy {\n\ts.MaximumBatchSize = v\n\treturn s\n}", "func (p Params) SetMaxTTL() {\n\tp[\"image_request[ttl]\"] = \"max\"\n}", "func (_Cakevault *CakevaultSession) MAXPERFORMANCEFEE() (*big.Int, error) {\n\treturn _Cakevault.Contract.MAXPERFORMANCEFEE(&_Cakevault.CallOpts)\n}", "func (p *Policy) getMaxTransactionsPerBlock(ic *interop.Context, _ []stackitem.Item) stackitem.Item {\n\treturn stackitem.NewBigInteger(big.NewInt(int64(p.GetMaxTransactionsPerBlockInternal(ic.DAO))))\n}", "func (tb *TransactionBuilder) SetFeeAmount(amount types.BaseUnits) *TransactionBuilder {\n\ttb.tx.AuthInfo.Fee.Amount = amount\n\treturn tb\n}", "func (p *Policy) getMaxBlockSystemFee(ic *interop.Context, _ []stackitem.Item) stackitem.Item {\n\treturn stackitem.NewBigInteger(big.NewInt(p.GetMaxBlockSystemFeeInternal(ic.DAO)))\n}", "func (_Cakevault *CakevaultCallerSession) MAXCALLFEE() (*big.Int, error) {\n\treturn _Cakevault.Contract.MAXCALLFEE(&_Cakevault.CallOpts)\n}", "func (t *threadThrottler) setMaxRate(newRate int64) {\n\tt.maxRate.Store(newRate)\n}", "func (c CommitterProbe) SetMaxCommitTS(ts uint64) {\n\tc.maxCommitTS = ts\n}", "func (_Crowdsale *CrowdsaleTransactorSession) SetMaxFrames(_maxFrames *big.Int) (*types.Transaction, error) {\n\treturn _Crowdsale.Contract.SetMaxFrames(&_Crowdsale.TransactOpts, _maxFrames)\n}", "func (w *Whisper) SetMaxMessageSize(size uint32) error {\n\tif size > MaxMessageSize {\n\t\treturn fmt.Errorf(\"message size too large [%d>%d]\", size, MaxMessageSize)\n\t}\n\tw.settings.Store(maxMsgSizeIdx, size)\n\treturn nil\n}", "func (_Authority *AuthorityTransactorSession) SetMaxTimToConfirm(maxTime *big.Int) (*types.Transaction, error) {\n\treturn _Authority.Contract.SetMaxTimToConfirm(&_Authority.TransactOpts, maxTime)\n}", "func (_Cakevault *CakevaultCallerSession) MAXWITHDRAWFEE() (*big.Int, error) {\n\treturn _Cakevault.Contract.MAXWITHDRAWFEE(&_Cakevault.CallOpts)\n}", "func (_Cakevault *CakevaultSession) MAXCALLFEE() (*big.Int, error) {\n\treturn _Cakevault.Contract.MAXCALLFEE(&_Cakevault.CallOpts)\n}", "func (_ElvTradableLocal *ElvTradableLocalTransactor) SetBaseTransferFee(opts *bind.TransactOpts, _newBaseFee *big.Int) (*types.Transaction, error) {\n\treturn _ElvTradableLocal.contract.Transact(opts, \"setBaseTransferFee\", _newBaseFee)\n}", "func (d *PerfData) SetMax(max string) {\n\tif !valueCheck.MatchString(max) {\n\t\tpanic(\"invalid value\")\n\t}\n\td.max = max\n\td.bits = d.bits | PDAT_MAX\n}", "func (fm *FakeManager) SetMaxRate(int64) []string {\n\tpanic(panicMsg)\n}", "func (_Token *TokenTransactorSession) SetupStakingLimit(maxAmount *big.Int, initialAmount *big.Int, daysInterval *big.Int, unstakingPeriod *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.SetupStakingLimit(&_Token.TransactOpts, maxAmount, initialAmount, daysInterval, unstakingPeriod)\n}", "func (c *Config) SetMinimumFees(fees types.BaseCoins) { c.MinFees = fees.String() }", "func (_Cakevault *CakevaultSession) MAXWITHDRAWFEE() (*big.Int, error) {\n\treturn _Cakevault.Contract.MAXWITHDRAWFEE(&_Cakevault.CallOpts)\n}", "func (_Token *TokenSession) SetupStakingLimit(maxAmount *big.Int, initialAmount *big.Int, daysInterval *big.Int, unstakingPeriod *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.SetupStakingLimit(&_Token.TransactOpts, maxAmount, initialAmount, daysInterval, unstakingPeriod)\n}", "func (servo *Servo) SetMax(max int) error {\n\tif max > servo.HardMax {\n\t\treturn errors.New(\"Servo.SetMax() error: given max is higher than hardMax\")\n\t}\n\tservo.Max = max\n\treturn nil\n}", "func (_Authority *AuthoritySession) SetFee(newFee *big.Int) (*types.Transaction, error) {\n\treturn _Authority.Contract.SetFee(&_Authority.TransactOpts, newFee)\n}", "func (s *Swarm64) ChangeInertiaMax(inertiamax float64) {\n\tif inertiamax > 0 {\n\t\ts.inertiamax = inertiamax\n\t}\n}", "func (_Crowdsale *CrowdsaleSession) SetMaxFrames(_maxFrames *big.Int) (*types.Transaction, error) {\n\treturn _Crowdsale.Contract.SetMaxFrames(&_Crowdsale.TransactOpts, _maxFrames)\n}", "func (o *SnapmirrorCreateRequest) SetMaxTransferRate(newValue int) *SnapmirrorCreateRequest {\n\to.MaxTransferRatePtr = &newValue\n\treturn o\n}", "func (_Authority *AuthoritySession) SetMaxTimToConfirm(maxTime *big.Int) (*types.Transaction, error) {\n\treturn _Authority.Contract.SetMaxTimToConfirm(&_Authority.TransactOpts, maxTime)\n}", "func (o *Member) SetDelegateMax(v int32) {\n\to.DelegateMax = &v\n}", "func (_Cakevault *CakevaultCaller) MAXWITHDRAWFEE(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Cakevault.contract.Call(opts, &out, \"MAX_WITHDRAW_FEE\")\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}", "func GetMaxBlockUserTx() int {\r\n\treturn converter.StrToInt(SysString(MaxBlockUserTx))\r\n}", "func (e EEPROM) SetMaxPower(v int) {\n\tC.ftdi_set_eeprom_value(e.d.ctx, C.MAX_POWER, C.int(v))\n}", "func (l *Ledger) GetMaxBlockSize() int64 {\n\tdefaultBlockSize := l.GenesisBlock.GetConfig().GetMaxBlockSizeInByte()\n\treturn defaultBlockSize\n}", "func (_Cakevault *CakevaultCaller) MAXPERFORMANCEFEE(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Cakevault.contract.Call(opts, &out, \"MAX_PERFORMANCE_FEE\")\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}", "func (t *T) SetMaxDepth(d int) {\n\tt.maxDepth = d\n}", "func (_Cakevault *CakevaultCaller) MAXCALLFEE(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Cakevault.contract.Call(opts, &out, \"MAX_CALL_FEE\")\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}", "func (s *PollForDecisionTaskInput) SetMaximumPageSize(v int64) *PollForDecisionTaskInput {\n\ts.MaximumPageSize = &v\n\treturn s\n}", "func (s *Swarm32) ChangeInertiaMax(inertiamax float32) {\n\tif inertiamax > 0 {\n\t\ts.inertiamax = inertiamax\n\t}\n}", "func (w *ScrollWidget) SetMax(max int) {\n\tw.max = max\n\tw.clampCurrent()\n}", "func (cl *Client) SetMaxAlloc(alloc int) {\n\tcl.maxAlloc = alloc\n}", "func (s *RollingUpdatePolicy) SetRollbackMaximumBatchSize(v *CapacitySize) *RollingUpdatePolicy {\n\ts.RollbackMaximumBatchSize = v\n\treturn s\n}", "func (conn *Conn) SetMaxTopics(max int) {\n\tif max < 1 {\n\t\tmax = 50\n\t}\n\tconn.length = max\n}", "func (_SushiV2Factory *SushiV2FactoryTransactorSession) SetFeeToSetter(_feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.SetFeeToSetter(&_SushiV2Factory.TransactOpts, _feeToSetter)\n}", "func (_Mevsky *MevskyTransactor) SetMinBounty(opts *bind.TransactOpts, newMinBounty *big.Int) (*types.Transaction, error) {\n\treturn _Mevsky.contract.Transact(opts, \"setMinBounty\", newMinBounty)\n}", "func MaxRequestMaxBytes(max int) ConsumerOption {\n\treturn func(o *api.ConsumerConfig) error {\n\t\to.MaxRequestMaxBytes = max\n\t\treturn nil\n\t}\n}", "func (o *ProvenanceRequestDTO) SetMaximumFileSize(v string) {\n\to.MaximumFileSize = &v\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactorSession) SetFeeToSetter(arg0 common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.SetFeeToSetter(&_IUniswapV2Factory.TransactOpts, arg0)\r\n}", "func (pool *WorkPool) SetMaxPoolSize(maxPoolSize uint64) {\n\tpool.maxPoolSize = maxPoolSize\n}", "func (_SushiV2Factory *SushiV2FactoryTransactor) SetFeeTo(opts *bind.TransactOpts, _feeTo common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.contract.Transact(opts, \"setFeeTo\", _feeTo)\n}", "func (_SushiV2Factory *SushiV2FactoryTransactor) SetFeeToSetter(opts *bind.TransactOpts, _feeToSetter common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.contract.Transact(opts, \"setFeeToSetter\", _feeToSetter)\n}", "func (_SushiV2Factory *SushiV2FactoryTransactorSession) SetFeeTo(_feeTo common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.SetFeeTo(&_SushiV2Factory.TransactOpts, _feeTo)\n}", "func (_Cakevault *CakevaultCallerSession) MAXWITHDRAWFEEPERIOD() (*big.Int, error) {\n\treturn _Cakevault.Contract.MAXWITHDRAWFEEPERIOD(&_Cakevault.CallOpts)\n}", "func (_m *PrometheusBackend) SetMaxUnconfirmedAge(_a0 *big.Int, _a1 float64) {\n\t_m.Called(_a0, _a1)\n}", "func (_Mcapscontroller *McapscontrollerTransactor) SetMaxPoolTokens(opts *bind.TransactOpts, poolAddress common.Address, maxPoolTokens *big.Int) (*types.Transaction, error) {\n\treturn _Mcapscontroller.contract.Transact(opts, \"setMaxPoolTokens\", poolAddress, maxPoolTokens)\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactorSession) SetFeeTo(arg0 common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.SetFeeTo(&_IUniswapV2Factory.TransactOpts, arg0)\r\n}", "func MaxRequestBatch(max uint) ConsumerOption {\n\treturn func(o *api.ConsumerConfig) error {\n\t\to.MaxRequestBatch = int(max)\n\t\treturn nil\n\t}\n}", "func (jbobject *ConcurrentJMXEnabledThreadPoolExecutorMBean) SetMaximumThreads(number int) {\n\terr := jbobject.CallVoid(\"setMaximumThreads\", number)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactor) SetFeeToSetter(opts *bind.TransactOpts, arg0 common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.contract.Transact(opts, \"setFeeToSetter\", arg0)\r\n}", "func (o *SnapmirrorResyncRequest) SetMaxTransferRate(newValue int) *SnapmirrorResyncRequest {\n\to.MaxTransferRatePtr = &newValue\n\treturn o\n}", "func (o AuthBackendRoleOutput) TokenMaxTtl() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *AuthBackendRole) pulumi.IntPtrOutput { return v.TokenMaxTtl }).(pulumi.IntPtrOutput)\n}", "func (s *Transaction) SetTransactionFee(v string) *Transaction {\n\ts.TransactionFee = &v\n\treturn s\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactor) SetFeeTo(opts *bind.TransactOpts, arg0 common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.contract.Transact(opts, \"setFeeTo\", arg0)\r\n}" ]
[ "0.85683465", "0.8330861", "0.82688934", "0.82593393", "0.8257401", "0.8247202", "0.76421887", "0.73076206", "0.7160458", "0.6901572", "0.6861654", "0.6634841", "0.6609036", "0.658577", "0.6386162", "0.6312288", "0.6235497", "0.6233569", "0.6219489", "0.6183514", "0.6103781", "0.6066668", "0.5927306", "0.58171135", "0.57869065", "0.5762408", "0.5756212", "0.5751838", "0.5686662", "0.5680665", "0.56369126", "0.5556377", "0.55515844", "0.5542681", "0.55046445", "0.5487466", "0.5487006", "0.5484499", "0.54797274", "0.5469914", "0.5456959", "0.54386765", "0.5432597", "0.54294634", "0.5424339", "0.53818864", "0.53791773", "0.5364238", "0.5358309", "0.53477484", "0.5343682", "0.53161097", "0.53106505", "0.5308767", "0.5293515", "0.5278387", "0.5270334", "0.5262993", "0.5260388", "0.5247783", "0.52293974", "0.5225458", "0.5210729", "0.5207557", "0.519505", "0.518344", "0.5182299", "0.51740575", "0.5170927", "0.51638967", "0.5149838", "0.514732", "0.5140033", "0.5139091", "0.5137802", "0.51359296", "0.51328063", "0.5124296", "0.5108243", "0.5103485", "0.50844", "0.50807697", "0.507968", "0.504784", "0.5047521", "0.5047019", "0.5046974", "0.50429547", "0.50268847", "0.50210524", "0.501514", "0.5014163", "0.50071526", "0.5000842", "0.49870932", "0.4985239", "0.49786407", "0.49770984", "0.4968223", "0.4967188" ]
0.8946869
0
SetTransactionMemo sets the memo for this TokenMintTransaction.
func (transaction *TokenMintTransaction) SetTransactionMemo(memo string) *TokenMintTransaction { transaction.requireNotFrozen() transaction.Transaction.SetTransactionMemo(memo) return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *TokenUpdateTransaction) SetTransactionMemo(memo string) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionMemo(memo)\n\treturn transaction\n}", "func (transaction *FileCreateTransaction) SetTransactionMemo(memo string) *FileCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionMemo(memo)\n\treturn transaction\n}", "func (transaction *ContractUpdateTransaction) SetTransactionMemo(memo string) *ContractUpdateTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.Transaction.SetTransactionMemo(memo)\n\treturn transaction\n}", "func (transaction *AccountUpdateTransaction) SetTransactionMemo(memo string) *AccountUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionMemo(memo)\n\treturn transaction\n}", "func (transaction *AccountCreateTransaction) SetTransactionMemo(memo string) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionMemo(memo)\n\treturn transaction\n}", "func (transaction *ScheduleSignTransaction) SetTransactionMemo(memo string) *ScheduleSignTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionMemo(memo)\n\treturn transaction\n}", "func (transaction *FileCreateTransaction) SetMemo(memo string) *FileCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.memo = memo\n\treturn transaction\n}", "func (transaction *TokenUpdateTransaction) SetTokenMemo(memo string) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.memo = memo\n\n\treturn transaction\n}", "func (xdc *XxxDemoCreate) SetMemo(s string) *XxxDemoCreate {\n\txdc.mutation.SetMemo(s)\n\treturn xdc\n}", "func (transaction *ContractUpdateTransaction) SetContractMemo(memo string) *ContractUpdateTransaction {\n\ttransaction.requireNotFrozen()\n\tif transaction.pb.GetMemoWrapper() != nil {\n\t\ttransaction.pb.GetMemoWrapper().Value = memo\n\t} else {\n\t\ttransaction.pb.MemoField = &proto.ContractUpdateTransactionBody_MemoWrapper{\n\t\t\tMemoWrapper: &wrappers.StringValue{Value: memo},\n\t\t}\n\t}\n\n\treturn transaction\n}", "func (transaction *AccountCreateTransaction) SetAccountMemo(memo string) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.memo = memo\n\treturn transaction\n}", "func (transaction *TokenUpdateTransaction) GetTransactionMemo() string {\n\treturn transaction.Transaction.GetTransactionMemo()\n}", "func (transaction *FileCreateTransaction) GetMemo() string {\n\treturn transaction.memo\n}", "func (transaction *AccountCreateTransaction) GetTransactionMemo() string {\n\treturn transaction.Transaction.GetTransactionMemo()\n}", "func (transaction *FileCreateTransaction) GetTransactionMemo() string {\n\treturn transaction.Transaction.GetTransactionMemo()\n}", "func (f *Factory) WithMemo(memo string) *Factory {\n\tf.memo = memo\n\treturn f\n}", "func (transaction *ScheduleSignTransaction) GetTransactionMemo() string {\n\treturn transaction.Transaction.GetTransactionMemo()\n}", "func (f Factory) WithMemo(memo string) Factory {\n\tf.memo = memo\n\treturn f\n}", "func (transaction *AccountCreateTransaction) GetAccountMemo() string {\n\treturn transaction.memo\n}", "func (tx *Transaction) Memo() null.String {\n\tvar (\n\t\tvalue string\n\t\tvalid bool\n\t)\n\tswitch tx.Envelope.Tx.Memo.Type {\n\tcase xdr.MemoTypeMemoNone:\n\t\tvalue, valid = \"\", false\n\tcase xdr.MemoTypeMemoText:\n\t\tscrubbed := utf8.Scrub(tx.Envelope.Tx.Memo.MustText())\n\t\tnotnull := strings.Join(strings.Split(scrubbed, \"\\x00\"), \"\")\n\t\tvalue, valid = notnull, true\n\tcase xdr.MemoTypeMemoId:\n\t\tvalue, valid = fmt.Sprintf(\"%d\", tx.Envelope.Tx.Memo.MustId()), true\n\tcase xdr.MemoTypeMemoHash:\n\t\thash := tx.Envelope.Tx.Memo.MustHash()\n\t\tvalue, valid =\n\t\t\tbase64.StdEncoding.EncodeToString(hash[:]),\n\t\t\ttrue\n\tcase xdr.MemoTypeMemoReturn:\n\t\thash := tx.Envelope.Tx.Memo.MustRetHash()\n\t\tvalue, valid =\n\t\t\tbase64.StdEncoding.EncodeToString(hash[:]),\n\t\t\ttrue\n\tdefault:\n\t\tpanic(fmt.Errorf(\"invalid memo type: %v\", tx.Envelope.Tx.Memo.Type))\n\t}\n\n\treturn null.NewString(value, valid)\n}", "func (o *Originator) SetMemento(m Memento) {\n\to.data = map[string]bool{}\n\tfor k, _ := range m.data {\n\t\to.data[k] = true\n\t}\n}", "func ValidateMemo(stdTx StdTx, params Params) sdk.Result {\n\tmemoLength := len(stdTx.GetMemo())\n\tif uint64(memoLength) > params.MaxMemoCharacters {\n\t\treturn sdk.ErrMemoTooLarge(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"maximum number of characters is %d but received %d characters\",\n\t\t\t\tparams.MaxMemoCharacters, memoLength,\n\t\t\t),\n\t\t).Result()\n\t}\n\n\treturn sdk.Result{}\n}", "func (_LockProxy *LockProxySession) SetManager(ethCrossChainContractAddr common.Address) (*types.Transaction, error) {\n\treturn _LockProxy.Contract.SetManager(&_LockProxy.TransactOpts, ethCrossChainContractAddr)\n}", "func (_LockProxy *LockProxyTransactorSession) SetManager(ethCrossChainContractAddr common.Address) (*types.Transaction, error) {\n\treturn _LockProxy.Contract.SetManager(&_LockProxy.TransactOpts, ethCrossChainContractAddr)\n}", "func (_LockProxy *LockProxyTransactor) SetManager(opts *bind.TransactOpts, ethCrossChainContractAddr common.Address) (*types.Transaction, error) {\n\treturn _LockProxy.contract.Transact(opts, \"setManager\", ethCrossChainContractAddr)\n}", "func (s *MempoolAPIService) MempoolTransaction(\n\tctx context.Context,\n\trequest *types.MempoolTransactionRequest,\n) (*types.MempoolTransactionResponse, *types.Error) {\n\tif s.config.Mode != configuration.Online {\n\t\treturn nil, wrapErr(ErrUnavailableOffline, nil)\n\t}\n\n\treturn nil, wrapErr(ErrUnimplemented, nil)\n}", "func (m *MempoolAPIService) MempoolTransaction(ctx context.Context, request *rTypes.MempoolTransactionRequest) (*rTypes.MempoolTransactionResponse, *rTypes.Error) {\n\treturn nil, errors.Errors[errors.TransactionNotFound]\n}", "func (m *BarRecordMutation) SetTransactions(i int32) {\n\tm.transactions = &i\n\tm.addtransactions = nil\n}", "func (tx *Transaction) MemoType() string {\n\tswitch tx.Envelope.Tx.Memo.Type {\n\tcase xdr.MemoTypeMemoNone:\n\t\treturn \"none\"\n\tcase xdr.MemoTypeMemoText:\n\t\treturn \"text\"\n\tcase xdr.MemoTypeMemoId:\n\t\treturn \"id\"\n\tcase xdr.MemoTypeMemoHash:\n\t\treturn \"hash\"\n\tcase xdr.MemoTypeMemoReturn:\n\t\treturn \"return\"\n\tdefault:\n\t\tpanic(fmt.Errorf(\"invalid memo type: %v\", tx.Envelope.Tx.Memo.Type))\n\t}\n}", "func (m *mempoolAPIService) MempoolTransaction(\n\tctx context.Context,\n\trequest *types.MempoolTransactionRequest,\n) (*types.MempoolTransactionResponse, *types.Error) {\n\tterr := common.ValidateNetworkIdentifier(ctx, m.client, request.NetworkIdentifier)\n\tif terr != nil {\n\t\treturn nil, terr\n\t}\n\n\ttx, err := m.client.GetMempoolTransaction(ctx, tomochaincommon.HexToHash(request.TransactionIdentifier.Hash))\n\tif err != nil {\n\t\treturn nil, common.ErrUnableToGetTxns\n\t}\n\treturn &types.MempoolTransactionResponse{\n\t\tTransaction: tx,\n\t}, nil\n}", "func (p *planner) SetTransaction(n *parser.SetTransaction) (planNode, error) {\n\tif err := p.setIsolationLevel(n.Isolation); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := p.setUserPriority(n.UserPriority); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptyNode{}, nil\n}", "func (c *Context) SetTx(tx interface{}) context.Context {\n\tctx := c.makeCopy()\n\tctx.tx = tx\n\treturn &ctx\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) SetMemShares(v VirtualizationVmwareVmMemoryShareInfo) {\n\to.MemShares.Set(&v)\n}", "func Memo(val string) Argument {\n\treturn func(request *requests.Request) error {\n\t\trequest.AddArgument(\"memo\", val)\n\t\treturn nil\n\t}\n}", "func (o *TransactionStore) SetTransactions(v []TransactionSplitStore) {\n\to.Transactions = v\n}", "func (o *APIServiceSendTransactionParams) SetTx(tx string) {\n\to.Tx = tx\n}", "func (s *GetTransactionOutput) SetTransaction(v *Transaction) *GetTransactionOutput {\n\ts.Transaction = v\n\treturn s\n}", "func (inst *DeprecatedCreateMasterEdition) SetMetadataMintAccount(metadataMint ag_solanago.PublicKey) *DeprecatedCreateMasterEdition {\n\tinst.AccountMetaSlice[1] = ag_solanago.Meta(metadataMint).WRITE()\n\treturn inst\n}", "func (xdc *XxxDemoCreate) SetNillableMemo(s *string) *XxxDemoCreate {\n\tif s != nil {\n\t\txdc.SetMemo(*s)\n\t}\n\treturn xdc\n}", "func (in *ActionIpAddressIndexInput) SetMaxTx(value int64) *ActionIpAddressIndexInput {\n\tin.MaxTx = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"MaxTx\"] = nil\n\treturn in\n}", "func (_MonsterOwnership *MonsterOwnershipTransactor) SetMetadataAddress(opts *bind.TransactOpts, _contractAddress common.Address) (*types.Transaction, error) {\n\treturn _MonsterOwnership.contract.Transact(opts, \"setMetadataAddress\", _contractAddress)\n}", "func (_Contract *ContractTransactorSession) SetContenthash(node [32]byte, hash []byte) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetContenthash(&_Contract.TransactOpts, node, hash)\n}", "func (s *TransactionOutputItem) SetTransactionHash(v string) *TransactionOutputItem {\n\ts.TransactionHash = &v\n\treturn s\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) SetAddressKMS(opts *bind.TransactOpts, address_KMS common.Address) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"setAddressKMS\", address_KMS)\n}", "func (g *BlockGenerator) SetTimeoutTx(tx types.Transaction) {\n\tlogger.Warn().Str(\"hash\", enc.ToString(tx.GetHash())).Msg(\"timeout tx marked for eviction\")\n\tg.bState.SetTimeoutTx(tx)\n}", "func ErrInvalidMemo(codespace sdk.CodespaceType, err error) sdk.Error {\n\treturn sdk.NewError(codespace, CodeInvalidMemo, fmt.Sprintf(\"the transaction memo is invalid: %s\", err.Error()))\n}", "func SetTxToTransferring(db *gorp.DbMap, r *TxRecord, tx hash.Hash) (err error) {\n\tr.CQLTxHash = tx.String()\n\tr.State = ExchangeStateTransferring\n\t_, err = db.Update(r)\n\treturn\n}", "func (_Token *TokenSession) Mint(account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Mint(&_Token.TransactOpts, account, amount)\n}", "func (s *Store) SetTx(txid common.Hash, tx *types.Transaction) {\n\ts.rlp.Set(s.table.Txs, txid.Bytes(), tx)\n}", "func (_Contract *ContractSession) SetContenthash(node [32]byte, hash []byte) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetContenthash(&_Contract.TransactOpts, node, hash)\n}", "func (o *LoyaltySubLedger) SetTransactions(v []LoyaltyLedgerEntry) {\n\to.Transactions = &v\n}", "func (s *ListTransactionsOutput) SetTransactions(v []*TransactionOutputItem) *ListTransactionsOutput {\n\ts.Transactions = v\n\treturn s\n}", "func (_BREMToken *BREMTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BREMToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_Token *TokenTransactor) Mint(opts *bind.TransactOpts, account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"mint\", account, amount)\n}", "func (o *CraBankIncomeHistoricalSummary) SetTransactions(v []CraBankIncomeTransaction) {\n\to.Transactions = &v\n}", "func (_BREMToken *BREMTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BREMToken.Contract.Mint(&_BREMToken.TransactOpts, _to, _amount)\n}", "func (o *Customer) SetTransaction(exec boil.Executor, insert bool, related *Transaction) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"customers\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"transaction_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, customerPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.TransactionID = related.ID\n\tif o.R == nil {\n\t\to.R = &customerR{\n\t\t\tTransaction: related,\n\t\t}\n\t} else {\n\t\to.R.Transaction = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &transactionR{\n\t\t\tCustomers: CustomerSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.Customers = append(related.R.Customers, o)\n\t}\n\n\treturn nil\n}", "func (s *ListTransactionEventsInput) SetTransactionHash(v string) *ListTransactionEventsInput {\n\ts.TransactionHash = &v\n\treturn s\n}", "func (_BaseLibrary *BaseLibraryTransactor) SetAddressKMS(opts *bind.TransactOpts, address_KMS common.Address) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"setAddressKMS\", address_KMS)\n}", "func (_m *PrometheusBackend) SetUnconfirmedTransactions(_a0 *big.Int, _a1 int64) {\n\t_m.Called(_a0, _a1)\n}", "func (_BaseContentSpace *BaseContentSpaceTransactor) SetAddressKMS(opts *bind.TransactOpts, address_KMS common.Address) (*types.Transaction, error) {\n\treturn _BaseContentSpace.contract.Transact(opts, \"setAddressKMS\", address_KMS)\n}", "func (_BaseContent *BaseContentTransactor) SetAddressKMS(opts *bind.TransactOpts, address_KMS common.Address) (*types.Transaction, error) {\n\treturn _BaseContent.contract.Transact(opts, \"setAddressKMS\", address_KMS)\n}", "func MemBytes(m int64) optionSetter {\n\treturn func(o *options) error {\n\t\tif m < 0 {\n\t\t\treturn fmt.Errorf(\"memBytes should be >= 0\")\n\t\t}\n\t\to.memBytes = m\n\t\treturn nil\n\t}\n}", "func (o *Transaction) SetTransactionHashClaims(exec boil.Executor, insert bool, related ...*Claim) error {\n\tquery := \"update `claim` set `transaction_hash_id` = null where `transaction_hash_id` = ?\"\n\tvalues := []interface{}{o.Hash}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.Exec(query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.TransactionHashClaims {\n\t\t\trel.TransactionHashID.Valid = false\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.TransactionHash = nil\n\t\t}\n\n\t\to.R.TransactionHashClaims = nil\n\t}\n\treturn o.AddTransactionHashClaims(exec, insert, related...)\n}", "func (_Crowdsale *CrowdsaleTransactor) SetWallet(opts *bind.TransactOpts, _wallet common.Address) (*types.Transaction, error) {\n\treturn _Crowdsale.contract.Transact(opts, \"setWallet\", _wallet)\n}", "func SetTransactionContext(tx *apm.Transaction, req *http.Request, resp *Response, body *apm.BodyCapturer) {\n\ttx.Result = StatusCodeResult(resp.StatusCode)\n\tif !tx.Sampled() {\n\t\treturn\n\t}\n\tSetContext(&tx.Context, req, resp, body)\n}", "func (s *TransactionEvent) SetTransactionHash(v string) *TransactionEvent {\n\ts.TransactionHash = &v\n\treturn s\n}", "func (s *Transaction) SetTransactionHash(v string) *Transaction {\n\ts.TransactionHash = &v\n\treturn s\n}", "func (i *Info) SetCommit(commit string) {\n\tif i == nil {\n\t\treturn\n\t}\n\ti.commit = commit\n}", "func NewMemoText(s string) *Memo {\n\treturn &Memo{Type: MemoTypeText, Text: &s}\n}", "func (_Token *TokenTransactorSession) Mint(account common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.Contract.Mint(&_Token.TransactOpts, account, amount)\n}", "func (o *WalletTransactionsListResponse) SetTransactions(v []WalletTransaction) {\n\to.Transactions = v\n}", "func (_DetailedTestToken *DetailedTestTokenSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _DetailedTestToken.Contract.Mint(&_DetailedTestToken.TransactOpts, _to, _amount)\n}", "func (mavls *Store) MemSet(datas *types.StoreSet, sync bool) ([]byte, error) {\r\n\tbeg := types.Now()\r\n\tdefer func() {\r\n\t\tmlog.Debug(\"MemSet\", \"cost\", types.Since(beg))\r\n\t}()\r\n\tif len(datas.KV) == 0 {\r\n\t\tmlog.Info(\"store mavl memset,use preStateHash as stateHash for kvset is null\")\r\n\t\tmavls.trees.Store(string(datas.StateHash), nil)\r\n\t\treturn datas.StateHash, nil\r\n\t}\r\n\ttree := mavl.NewTree(mavls.GetDB(), sync)\r\n\ttree.SetBlockHeight(datas.Height)\r\n\terr := tree.Load(datas.StateHash)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tfor i := 0; i < len(datas.KV); i++ {\r\n\t\ttree.Set(datas.KV[i].Key, datas.KV[i].Value)\r\n\t}\r\n\thash := tree.Hash()\r\n\tmavls.trees.Store(string(hash), tree)\r\n\treturn hash, nil\r\n}", "func (_Contract *ContractTransactor) SetContenthash(opts *bind.TransactOpts, node [32]byte, hash []byte) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"setContenthash\", node, hash)\n}", "func (_BREMToken *BREMTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BREMToken.Contract.Mint(&_BREMToken.TransactOpts, _to, _amount)\n}", "func (_DetailedTestToken *DetailedTestTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _DetailedTestToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (_Contract *ContractSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetText(&_Contract.TransactOpts, node, key, value)\n}", "func (o *CreditBankStatementUploadObject) SetTransactions(v []CreditBankStatementUploadTransaction) {\n\to.Transactions = v\n}", "func (transaction *TokenMintTransaction) SetAmount(amount uint64) *TokenMintTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.pb.Amount = amount\n\treturn transaction\n}", "func (_Contract *ContractTransactorSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetText(&_Contract.TransactOpts, node, key, value)\n}", "func (_CrToken *CrTokenTransactor) SetReserveFactor(opts *bind.TransactOpts, newReserveFactorMantissa *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.contract.Transact(opts, \"_setReserveFactor\", newReserveFactorMantissa)\n}", "func (s *GetTransactionInput) SetTransactionHash(v string) *GetTransactionInput {\n\ts.TransactionHash = &v\n\treturn s\n}", "func (_Erc1820Registry *Erc1820RegistryTransactorSession) SetManager(_addr common.Address, _newManager common.Address) (*types.Transaction, error) {\n\treturn _Erc1820Registry.Contract.SetManager(&_Erc1820Registry.TransactOpts, _addr, _newManager)\n}", "func (s *state) SetTx(id ids.ID, tx *Tx) error {\n\tif tx == nil {\n\t\ts.Cache.Evict(id)\n\t\treturn s.DB.Delete(id.Bytes())\n\t}\n\n\ts.Cache.Put(id, tx)\n\treturn s.DB.Put(id.Bytes(), tx.Bytes())\n}", "func (k Keeper) SetExtTransaction(ctx sdk.Context, extTransaction types.ExtTransaction) {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ExtTransactionKey))\n\tb := k.cdc.MustMarshalBinaryBare(&extTransaction)\n\tstore.Set(GetExtTransactionIDBytes(extTransaction.Id), b)\n}", "func (_Contract *ContractTransactor) SetText(opts *bind.TransactOpts, node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"setText\", node, key, value)\n}", "func (_MonsterOwnership *MonsterOwnershipTransactorSession) SetMetadataAddress(_contractAddress common.Address) (*types.Transaction, error) {\n\treturn _MonsterOwnership.Contract.SetMetadataAddress(&_MonsterOwnership.TransactOpts, _contractAddress)\n}", "func (_ResolverContract *ResolverContractTransactorSession) SetContenthash(node [32]byte, hash []byte) (*types.Transaction, error) {\n\treturn _ResolverContract.Contract.SetContenthash(&_ResolverContract.TransactOpts, node, hash)\n}", "func NewTransactionManager() *TransactionManager {\n\ttxmng := new(TransactionManager)\n\ttxmng.TX = make(map[string]Transaction)\n\treturn txmng\n}", "func (_Erc1820Registry *Erc1820RegistryTransactor) SetManager(opts *bind.TransactOpts, _addr common.Address, _newManager common.Address) (*types.Transaction, error) {\n\treturn _Erc1820Registry.contract.Transact(opts, \"setManager\", _addr, _newManager)\n}", "func (e *OptTester) Memo() (string, error) {\n\to := xform.NewOptimizer(&e.evalCtx)\n\troot, required, err := e.buildExpr(o.Factory())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\to.Optimize(root, required)\n\treturn fmt.Sprintf(\"[%d: \\\"%s\\\"]\\n%s\", root, required, o.Memo().String()), nil\n}", "func (_DetailedTestToken *DetailedTestTokenTransactorSession) Mint(_to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _DetailedTestToken.Contract.Mint(&_DetailedTestToken.TransactOpts, _to, _amount)\n}", "func (_ERC721Contract *ERC721ContractSession) Mint(_owner common.Address, _tokenId *big.Int, _approvedAddress common.Address, _metadata string) (*types.Transaction, error) {\n\treturn _ERC721Contract.Contract.Mint(&_ERC721Contract.TransactOpts, _owner, _tokenId, _approvedAddress, _metadata)\n}", "func (_MintableToken *MintableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _MintableToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (a *Agent) setMemMetrics(statsData *types.StatsJSON, entry *stats.MetricsEntry) {\n\tentry.Mem = &stats.MetricsMemEntry{\n\t\tFailcnt: int64(statsData.MemoryStats.Failcnt),\n\t\tLimit: int64(statsData.MemoryStats.Limit),\n\t\tMaxusage: int64(statsData.MemoryStats.MaxUsage),\n\t\tUsage: int64(statsData.MemoryStats.Usage),\n\t\tUsageP: a.getMemUsage(statsData),\n\t}\n}", "func (_Erc1820Registry *Erc1820RegistrySession) SetManager(_addr common.Address, _newManager common.Address) (*types.Transaction, error) {\n\treturn _Erc1820Registry.Contract.SetManager(&_Erc1820Registry.TransactOpts, _addr, _newManager)\n}", "func (_MonsterOwnership *MonsterOwnershipSession) SetMetadataAddress(_contractAddress common.Address) (*types.Transaction, error) {\n\treturn _MonsterOwnership.Contract.SetMetadataAddress(&_MonsterOwnership.TransactOpts, _contractAddress)\n}", "func (_BurnableToken *BurnableTokenTransactor) Mint(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.contract.Transact(opts, \"mint\", _to, _amount)\n}", "func (z *Zoho) SetTokenManager(tm TokenLoaderSaver) {\n\tz.tokenManager = tm\n}" ]
[ "0.85931534", "0.83663094", "0.8341479", "0.8310818", "0.8249859", "0.8200594", "0.7930514", "0.7366162", "0.7018512", "0.69629717", "0.6959359", "0.59170663", "0.57240593", "0.5658485", "0.56367725", "0.55295396", "0.5439948", "0.53262514", "0.5281923", "0.52749574", "0.52240044", "0.5215048", "0.5139941", "0.51181", "0.50652236", "0.505226", "0.50052845", "0.49983907", "0.4908844", "0.49069837", "0.48903772", "0.47836047", "0.47345915", "0.4700664", "0.46756676", "0.46677083", "0.46609965", "0.46535853", "0.4621789", "0.4601556", "0.45433217", "0.45431542", "0.4541477", "0.45408782", "0.45373905", "0.45338276", "0.45293844", "0.45248213", "0.45229465", "0.45047092", "0.44997692", "0.44980437", "0.44901055", "0.44706246", "0.4462351", "0.44581664", "0.44581375", "0.44566253", "0.44545615", "0.44536486", "0.44517374", "0.445144", "0.44457564", "0.44360957", "0.4435232", "0.44340444", "0.4426076", "0.44253084", "0.441953", "0.44143957", "0.44141024", "0.44102898", "0.44075534", "0.43983212", "0.4388957", "0.43839896", "0.4376833", "0.4368197", "0.4365941", "0.43618858", "0.4361152", "0.4351845", "0.43505967", "0.4348278", "0.4348153", "0.43439975", "0.43386358", "0.43271655", "0.43208274", "0.4319962", "0.43198997", "0.4312883", "0.4312755", "0.4312139", "0.43108025", "0.43100908", "0.43100438", "0.43063125", "0.4300682", "0.42938" ]
0.88174623
0
SetTransactionValidDuration sets the valid duration for this TokenMintTransaction.
func (transaction *TokenMintTransaction) SetTransactionValidDuration(duration time.Duration) *TokenMintTransaction { transaction.requireNotFrozen() transaction.Transaction.SetTransactionValidDuration(duration) return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *TokenUpdateTransaction) SetTransactionValidDuration(duration time.Duration) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionValidDuration(duration)\n\treturn transaction\n}", "func (transaction *FileCreateTransaction) SetTransactionValidDuration(duration time.Duration) *FileCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionValidDuration(duration)\n\treturn transaction\n}", "func (transaction *AccountUpdateTransaction) SetTransactionValidDuration(duration time.Duration) *AccountUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionValidDuration(duration)\n\treturn transaction\n}", "func (transaction *ContractUpdateTransaction) SetTransactionValidDuration(duration time.Duration) *ContractUpdateTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.Transaction.SetTransactionValidDuration(duration)\n\treturn transaction\n}", "func (transaction *ScheduleSignTransaction) SetTransactionValidDuration(duration time.Duration) *ScheduleSignTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionValidDuration(duration)\n\treturn transaction\n}", "func (transaction *AccountCreateTransaction) SetTransactionValidDuration(duration time.Duration) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetTransactionValidDuration(duration)\n\treturn transaction\n}", "func (transaction *TokenUpdateTransaction) GetTransactionValidDuration() time.Duration {\n\treturn transaction.Transaction.GetTransactionValidDuration()\n}", "func (transaction *ScheduleSignTransaction) GetTransactionValidDuration() time.Duration {\n\treturn transaction.Transaction.GetTransactionValidDuration()\n}", "func (transaction *FileCreateTransaction) GetTransactionValidDuration() time.Duration {\n\treturn transaction.Transaction.GetTransactionValidDuration()\n}", "func (transaction *AccountCreateTransaction) GetTransactionValidDuration() time.Duration {\n\treturn transaction.Transaction.GetTransactionValidDuration()\n}", "func (v *Verifier) SetDuration(key DurationKey, duration time.Duration) ApiVerifier {\n\tv.Inputs.Flags.DurationFlags[key] = duration\n\treturn v\n}", "func (o *SLOCorrectionCreateRequestAttributes) SetDuration(v int64) {\n\to.Duration = &v\n}", "func (l *LedgerState) TransactionValid(transaction *ledgerstate.Transaction, messageID MessageID) (err error) {\n\tif err = l.UTXODAG.CheckTransaction(transaction); err != nil {\n\t\tl.tangle.Storage.MessageMetadata(messageID).Consume(func(messagemetadata *MessageMetadata) {\n\t\t\tmessagemetadata.SetInvalid(true)\n\t\t})\n\t\tl.tangle.Events.MessageInvalid.Trigger(messageID)\n\n\t\treturn errors.Errorf(\"invalid transaction in message with %s: %w\", messageID, err)\n\t}\n\n\treturn nil\n}", "func (m *sdt) SetDuration(val int32) {\n\tm.durationField = val\n}", "func (timeout *Timeout) SetDuration(nd time.Duration) {\n\ttimeout.d = nd\n}", "func (qiu *QueueItemUpdate) SetDuration(i int) *QueueItemUpdate {\n\tqiu.mutation.ResetDuration()\n\tqiu.mutation.SetDuration(i)\n\treturn qiu\n}", "func (l *LogRequest) SetDuration(duration int64) {\n\tl.Duration = duration\n}", "func (o *MaintenanceWindowRecurrence) SetDuration(v int32) {\n\to.Duration = v\n}", "func ExpectValidDuration(csr *certificatesv1.CertificateSigningRequest, _ crypto.Signer) error {\n\tcert, err := pki.DecodeX509CertificateBytes(csr.Status.Certificate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar expectedDuration time.Duration\n\tdurationString, ok := csr.Annotations[experimentalapi.CertificateSigningRequestDurationAnnotationKey]\n\tif !ok {\n\t\tif csr.Spec.ExpirationSeconds != nil {\n\t\t\texpectedDuration = time.Duration(*csr.Spec.ExpirationSeconds) * time.Second\n\t\t} else {\n\t\t\t// If duration wasn't requested, then we match against the default.\n\t\t\texpectedDuration = cmapi.DefaultCertificateDuration\n\t\t}\n\t} else {\n\t\texpectedDuration, err = time.ParseDuration(durationString)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tactualDuration := cert.NotAfter.Sub(cert.NotBefore)\n\n\t// Here we ensure that the requested duration is what is signed on the\n\t// certificate. We tolerate a 30 second fuzz either way.\n\tif actualDuration > expectedDuration+time.Second*30 || actualDuration < expectedDuration-time.Second*30 {\n\t\treturn fmt.Errorf(\"Expected certificate expiry date to be %v, but got %v\", expectedDuration, actualDuration)\n\t}\n\n\treturn nil\n}", "func (o *UcsdBackupInfoAllOf) SetDuration(v int64) {\n\to.Duration = &v\n}", "func (p *PhoneCallDiscarded) SetDuration(value int) {\n\tp.Flags.Set(1)\n\tp.Duration = value\n}", "func (k2h *K2hash) SetExpirationDuration(duration int) (bool, error) {\n\tcDuration := C.time_t(duration)\n\tok := C.k2h_set_common_attr(k2h.handle, nil, nil, nil, nil, (*C.time_t)(&cDuration))\n\tif ok != true {\n\t\treturn false, fmt.Errorf(\"k2h_set_common_attr() returns false\")\n\t}\n\treturn true, nil\n}", "func (d *segmentationDescriptor) SetDuration(value gots.PTS) {\n\td.duration = value & 0xFFFFFFFFFF // keep 40 bits, truncate the rest.\n}", "func (o *SyntheticsBrowserTestResultShortResult) SetDuration(v float64) {\n\to.Duration = &v\n}", "func (o *EventAttributes) SetDuration(v int64) {\n\to.Duration = &v\n}", "func (context *context) SetDuration(v time.Duration) {\n\tcontext.params.SetDuration(int(v.Milliseconds()))\n}", "func (c *Config) SetDuration(k string, d time.Duration) {\n\tc.SetString(k, d.String())\n}", "func (t *TestCase) SetDuration(duration string) error {\n\tparsedDuration, err := time.ParseDuration(duration)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// we round to the millisecond on duration\n\tt.Duration = float64(int(parsedDuration.Seconds()*1000)) / 1000\n\treturn nil\n}", "func (qiuo *QueueItemUpdateOne) SetDuration(i int) *QueueItemUpdateOne {\n\tqiuo.mutation.ResetDuration()\n\tqiuo.mutation.SetDuration(i)\n\treturn qiuo\n}", "func (o *SparseSSHAuthorizationPolicy) SetActiveDuration(activeDuration string) {\n\n\to.ActiveDuration = &activeDuration\n}", "func (t *Time) SetValid(v time.Time) {\n\tt.Time = v\n\tt.Valid = true\n}", "func (t *NullTime) SetValid(v time.Time) {\n\tt.Time = v\n\tt.Valid = true\n}", "func (ac *AnswerCreate) SetValid(b bool) *AnswerCreate {\n\tac.mutation.SetValid(b)\n\treturn ac\n}", "func SettokenDur(dur time.Duration) {\n\ttokenDur = dur\n}", "func (u *NullUUID) SetValid(v UUID) {\n\tu.UUID = v\n\tu.Valid = true\n}", "func RegisterValidatedDurationSetting(\n\tkey, desc string, defaultValue time.Duration, validateFn func(time.Duration) error,\n) *DurationSetting {\n\tif validateFn != nil {\n\t\tif err := validateFn(defaultValue); err != nil {\n\t\t\tpanic(errors.Wrap(err, \"invalid default\"))\n\t\t}\n\t}\n\tsetting := &DurationSetting{\n\t\tdefaultValue: defaultValue,\n\t\tvalidateFn: validateFn,\n\t}\n\tregister(key, desc, setting)\n\treturn setting\n}", "func (recorder *TrxHistoryRecorder) SetMinDuration(d time.Duration) {\n\trecorder.mu.Lock()\n\tdefer recorder.mu.Unlock()\n\trecorder.minDuration = d\n}", "func ValidateDuration(fl validator.FieldLevel) bool {\n\t_, err := time.ParseDuration(fl.Field().String())\n\treturn err == nil\n}", "func (s *OnlineStoreConfig) SetTtlDuration(v *TtlDuration) *OnlineStoreConfig {\n\ts.TtlDuration = v\n\treturn s\n}", "func (s *SimpleBlockFactory) IsTransactionValid(tx *types.Tx) bool {\n\t// SimpleBlockFactory has no tx valid check.\n\treturn true\n}", "func (i *NullInt) SetValid(n int64) {\n\ti.Int64 = n\n\ti.Valid = true\n}", "func (o *Indicator) SetValidUntil(t interface{}) error {\n\tts, _ := timestamp.ToString(t, \"micro\")\n\n\t// TODO check to make sure this is later than the vaild_from\n\to.ValidUntil = ts\n\treturn nil\n}", "func (s *OnlineStoreConfigUpdate) SetTtlDuration(v *TtlDuration) *OnlineStoreConfigUpdate {\n\ts.TtlDuration = v\n\treturn s\n}", "func (o *SSHAuthorizationPolicy) SetActiveDuration(activeDuration string) {\n\n\to.ActiveDuration = activeDuration\n}", "func (dtc DefaultTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error {\n\tif ctx.Confirmed && ctx.BlockHeight < dtc.TransactionFeeCheckBlockHeight {\n\t\t// as to ensure the miner fee is at least bigger than 0,\n\t\t// we however only want to put this restriction within the consensus set,\n\t\t// the stricter miner fee checks should apply immediately to the transaction pool logic\n\t\tconstants.MinimumMinerFee = types.NewCurrency64(1)\n\t}\n\treturn types.DefaultTransactionValidation(t, ctx, constants)\n}", "func (dtc DefaultTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error {\n\tif ctx.Confirmed && ctx.BlockHeight < dtc.TransactionFeeCheckBlockHeight {\n\t\t// as to ensure the miner fee is at least bigger than 0,\n\t\t// we however only want to put this restriction within the consensus set,\n\t\t// the stricter miner fee checks should apply immediately to the transaction pool logic\n\t\tconstants.MinimumMinerFee = types.NewCurrency64(1)\n\t}\n\treturn types.DefaultTransactionValidation(t, ctx, constants)\n}", "func (ltc LegacyTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error {\n\tif ctx.Confirmed && ctx.BlockHeight < ltc.TransactionFeeCheckBlockHeight {\n\t\t// as to ensure the miner fee is at least bigger than 0,\n\t\t// we however only want to put this restriction within the consensus set,\n\t\t// the stricter miner fee checks should apply immediately to the transaction pool logic\n\t\tconstants.MinimumMinerFee = types.NewCurrency64(1)\n\t}\n\treturn types.DefaultTransactionValidation(t, ctx, constants)\n}", "func (ltc LegacyTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error {\n\tif ctx.Confirmed && ctx.BlockHeight < ltc.TransactionFeeCheckBlockHeight {\n\t\t// as to ensure the miner fee is at least bigger than 0,\n\t\t// we however only want to put this restriction within the consensus set,\n\t\t// the stricter miner fee checks should apply immediately to the transaction pool logic\n\t\tconstants.MinimumMinerFee = types.NewCurrency64(1)\n\t}\n\treturn types.DefaultTransactionValidation(t, ctx, constants)\n}", "func (cs *ConsensusSet) validTransaction(tx *bolt.Tx, t modules.ConsensusTransaction, constants types.TransactionValidationConstants, blockHeight types.BlockHeight, blockTimestamp types.Timestamp, isBlockCreatingTx bool) error {\n\tctx := types.TransactionValidationContext{\n\t\tValidationContext: types.ValidationContext{\n\t\t\tConfirmed: true,\n\t\t\tBlockHeight: blockHeight,\n\t\t\tBlockTime: blockTimestamp,\n\t\t\tIsBlockCreatingTx: isBlockCreatingTx,\n\t\t},\n\t\tBlockSizeLimit: constants.BlockSizeLimit,\n\t\tArbitraryDataSizeLimit: constants.ArbitraryDataSizeLimit,\n\t\tMinimumMinerFee: constants.MinimumMinerFee,\n\t}\n\n\t// return the first error reported by a validator\n\tvar err error\n\n\t// check if we have stand alone validators specific for this tx version, if so apply them\n\tif validators, ok := cs.txVersionMappedValidators[t.Version]; ok {\n\t\tfor _, validator := range validators {\n\t\t\terr = validator(t, ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// validate all transactions using the stand alone validators\n\tfor _, validator := range cs.txValidators {\n\t\terr = validator(t, ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// validate using the plugins, both version-specific as well as global\n\treturn cs.validateTransactionUsingPlugins(t, ctx, tx)\n}", "func (s *TimeSpan) SetDuration(v string) *TimeSpan {\n\ts.Duration = &v\n\treturn s\n}", "func (d *segmentationDescriptor) SetHasDuration(value bool) {\n\td.hasDuration = value\n}", "func (s *JobOutput) SetDuration(v int64) *JobOutput {\n\ts.Duration = &v\n\treturn s\n}", "func (pomo *Pomo) SetDuration(d time.Duration) {\n\n\t// if pomo is running\n\tif pomo.Status == ON {\n\n\t\tpomo.Stop()\n\t\tpomo.Time = d\n\t\tpomo.Start()\n\n\t\treturn\n\t}\n\n\tpomo.Time = d\n\n\t// change notified status when duration is changed\n\tpomo.Notified = false\n}", "func (u *Util) SetControlDuration(duration time.Duration) {\n\tcontrolDuration = duration\n}", "func (s *State) validTransaction(t types.Transaction) error {\n\t// Skip transaction verification if the State is accepting trusted blocks.\n\tif s.verificationRigor != fullVerification {\n\t\treturn nil\n\t}\n\n\t// StandaloneValid will check things like signatures and properties that\n\t// should be inherent to the transaction. (storage proof rules, etc.)\n\terr := t.StandaloneValid(s.height())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check that each portion of the transaction is legal given the current\n\t// consensus set.\n\terr = s.validSiacoins(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = s.validStorageProofs(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = s.validFileContractRevisions(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = s.validSiafunds(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (j *JSON) SetValid(n []byte) {\n\tj.JSON = n\n\tj.Valid = true\n}", "func ValidateTimeDuration(attribute string, duration string) error {\n\t_, err := time.ParseDuration(duration)\n\tif err != nil {\n\t\treturn makeValidationError(attribute, fmt.Sprintf(\"Attribute '%s' must be valid duration (examaple: 1h or 30s)\", attribute))\n\t}\n\treturn nil\n}", "func (r *RPCIngressGateway) SetConnectionDuration(dur int64, _ *struct{}) (err error) {\n\tdefer rpcutil.LogCall(r.log, \"SetConnectionDuration\", dur)(nil, &err)\n\tr.proc.SetConnectionDuration(dur)\n\treturn nil\n}", "func (fs *FactoidState) ValidateTransactionAge(trans interfaces.ITransaction) error {\n\ttsblk := fs.GetCurrentBlock().GetCoinbaseTimestamp().GetTimeMilli()\n\tif tsblk < 0 {\n\t\treturn fmt.Errorf(\"Block has no coinbase transaction at this time\")\n\t}\n\n\ttstrans := trans.GetTimestamp().GetTimeMilli()\n\n\tif tsblk-tstrans > constants.TRANSACTION_PRIOR_LIMIT {\n\t\treturn fmt.Errorf(\"Transaction is too old to be included in the current block\")\n\t}\n\n\tif tstrans-tsblk > constants.TRANSACTION_POST_LIMIT {\n\t\t//\treturn fmt.Errorf(\"Transaction is dated too far in the future to be included in the current block\")\n\t}\n\treturn nil\n}", "func (b *Block) SetInvalid() (wasUpdated bool) {\n\tb.mutex.Lock()\n\tdefer b.mutex.Unlock()\n\n\tif b.invalid {\n\t\treturn false\n\t}\n\n\tb.invalid = true\n\n\treturn true\n}", "func (o *Oracle) transactionValid(ctx context.Context, txID *big.Int) bool {\n\ttransaction, err := o.bch.OracleMultiSig().GetTransaction(ctx, txID)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif transaction.Executed {\n\t\to.logger.Debug(\"transaction already executed\", zap.String(\"transactionID\", txID.String()))\n\t\treturn false\n\t}\n\tif transaction.To.String() != o.bch.ContractRegistry().OracleUsdAddress().String() {\n\t\to.logger.Debug(\"transaction aimed to strange address\",\n\t\t\tzap.String(\"transactionID\", txID.String()),\n\t\t\tzap.String(\"transactionTo\", transaction.To.String()))\n\t\treturn false\n\t}\n\tprice, err := o.bch.OracleUSD().UnpackSetCurrentPriceTransactionData(transaction.Data)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif !o.checkPrice(price) {\n\t\to.logger.Debug(\"invalid price in transaction\",\n\t\t\tzap.String(\"transactionID\", txID.String()),\n\t\t\tzap.String(\"price\", price.String()))\n\t\treturn false\n\t}\n\treturn true\n}", "func (s *GetFederationTokenInput) SetDurationSeconds(v int64) *GetFederationTokenInput {\n\ts.DurationSeconds = &v\n\treturn s\n}", "func (o *CheckTransactionCreditLimitParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (b *Byte) SetValid(n byte) {\n\tb.Byte = n\n\tb.Valid = true\n}", "func (f *Float) SetValid(n float64) {\n\tf.Float64 = n\n\tf.Valid = true\n}", "func (g *BlockGenerator) SetTimeoutTx(tx types.Transaction) {\n\tlogger.Warn().Str(\"hash\", enc.ToString(tx.GetHash())).Msg(\"timeout tx marked for eviction\")\n\tg.bState.SetTimeoutTx(tx)\n}", "func (o *SLOCorrectionCreateRequestAttributes) HasDuration() bool {\n\tif o != nil && o.Duration != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func validateTimeout(v string) error {\n\tduration, err := time.ParseDuration(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\td := struct {\n\t\tDuration time.Duration `validate:\"min=0\"`\n\t}{duration}\n\treturn useValidator(timeoutFlag, d)\n}", "func (t *Transaction) IsValid() bool {\n\treturn t.Recipient.IsVaild() && t.Sender.IsVaild() && !t.BookingDate.IsZero() &&\n\t\tt.Currency != \"\" && t.ValueInSmallestUnit != 0 && t.IntendedUse != \"\"\n}", "func (mt *mockTokenBuilder) SetExpiration(t time.Duration) {\n\t//TODO some mocking\n}", "func (state *SandboxState) ValidTransition(oldState StateString, newState StateString) error {\n\treturn state.State.validTransition(oldState, newState)\n}", "func (t *T) SetBadTimeout(bad z.Lit, d time.Duration) {\n\tb := t.bads[bad]\n\tb.Dur = d\n}", "func (s *GetSessionTokenInput) SetDurationSeconds(v int64) *GetSessionTokenInput {\n\ts.DurationSeconds = &v\n\treturn s\n}", "func (m *Transaction) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif _, ok := _Transaction_Asset_NotInLookup[m.GetAsset()]; ok {\n\t\treturn TransactionValidationError{\n\t\t\tfield: \"Asset\",\n\t\t\treason: \"value must not be in list [0]\",\n\t\t}\n\t}\n\n\tif _, ok := Asset_name[int32(m.GetAsset())]; !ok {\n\t\treturn TransactionValidationError{\n\t\t\tfield: \"Asset\",\n\t\t\treason: \"value must be one of the defined enum values\",\n\t\t}\n\t}\n\n\tif m.GetAmount() <= 0 {\n\t\treturn TransactionValidationError{\n\t\t\tfield: \"Amount\",\n\t\t\treason: \"value must be greater than 0\",\n\t\t}\n\t}\n\n\tif utf8.RuneCountInString(m.GetIdentity()) < 1 {\n\t\treturn TransactionValidationError{\n\t\t\tfield: \"Identity\",\n\t\t\treason: \"value length must be at least 1 runes\",\n\t\t}\n\t}\n\n\tif utf8.RuneCountInString(m.GetRecipientID()) < 1 {\n\t\treturn TransactionValidationError{\n\t\t\tfield: \"RecipientID\",\n\t\t\treason: \"value length must be at least 1 runes\",\n\t\t}\n\t}\n\n\tif m.GetWitness() == nil {\n\t\treturn TransactionValidationError{\n\t\t\tfield: \"Witness\",\n\t\t\treason: \"value is required\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetWitness()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn TransactionValidationError{\n\t\t\t\tfield: \"Witness\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(m.GetPayload()) > 0 {\n\t\treturn TransactionValidationError{\n\t\t\tfield: \"Payload\",\n\t\t\treason: \"value length must be at most 0 bytes\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn TransactionValidationError{\n\t\t\t\tfield: \"Response\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetReturnedAt()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn TransactionValidationError{\n\t\t\t\tfield: \"ReturnedAt\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (d *DurationSetting) Validate(v time.Duration) error {\n\tif d.validateFn != nil {\n\t\tif err := d.validateFn(v); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (b *Bool) SetValid(v bool) {\n\tb.Bool = v\n\tb.Valid = true\n}", "func (f *Float32) SetValid(n float32) {\n\tf.Float32 = n\n\tf.Valid = true\n}", "func (m *RedundantAssignmentAlertConfiguration) SetDuration(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"duration\", value)\n if err != nil {\n panic(err)\n }\n}", "func RegisterDurationSetting(key, desc string, defaultValue time.Duration) *DurationSetting {\n\treturn RegisterValidatedDurationSetting(key, desc, defaultValue, nil)\n}", "func (tr Row) ForceDuration(nn int) (val time.Duration) {\n\tval, _ = tr.DurationErr(nn)\n\treturn\n}", "func (o *CreateInstantPaymentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (i *Int8) SetValid(n int8) {\n\ti.Int8 = n\n\ti.Valid = true\n}", "func (attrPair *AttributePair) SetValidTo(date time.Time) {\n\tattrPair.validTo = date\n}", "func WithinDuration(t Testing, expected, actual time.Time, delta time.Duration, formatAndArgs ...interface{}) bool {\n\tdt := expected.Sub(actual)\n\tif dt < -delta || dt > delta {\n\t\treturn Fail(t,\n\t\t\tfmt.Sprintf(\"Expected max difference between %v and %v allowed is %v, but got: %v\", expected, actual, delta, dt),\n\t\t\tformatAndArgs...)\n\t}\n\n\treturn true\n}", "func (o *APIServiceSendTransactionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (_Transactable *TransactableCaller) ValidateTransaction(opts *bind.CallOpts, _v uint8, _r [32]byte, _s [32]byte, _dest common.Address, _value *big.Int, _ts *big.Int) (bool, error) {\n\tvar out []interface{}\n\terr := _Transactable.contract.Call(opts, &out, \"validateTransaction\", _v, _r, _s, _dest, _value, _ts)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "func ValidCacheDuration(duration string) bool {\n\telements := strings.Split(duration, \" \")\n\tseenDuration := false\n\n\tfor _, element := range elements {\n\t\tif element == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif statusCodeRegex.MatchString(element) {\n\t\t\tif seenDuration {\n\t\t\t\treturn false // code after duration\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif durationRegex.MatchString(element) {\n\t\t\tseenDuration = true\n\t\t}\n\t}\n\treturn seenDuration\n}", "func (o *PiggyBankEvent) SetTransactionGroupId(v string) {\n\to.TransactionGroupId = &v\n}", "func (o *Venda) SetValidade(v time.Time) {\n\to.Validade.Set(&v)\n}", "func (form *FormData) MandatoryDuration(key string, target *time.Duration) *FormData {\n\treturn form.mustMandatoryValue(key, target)\n}", "func (a *Assertions) WithinDuration(expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {\n\treturn WithinDuration(a.t, expected, actual, delta, msgAndArgs...)\n}", "func (o *ClientConfiguration) SetUserAccessTokensValidityPeriod(v int32) {\n\to.UserAccessTokensValidityPeriod = v\n}", "func (_BaseAccessWallet *BaseAccessWalletCaller) ValidateTransaction(opts *bind.CallOpts, _v uint8, _r [32]byte, _s [32]byte, _dest common.Address, _value *big.Int, _ts *big.Int) (bool, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWallet.contract.Call(opts, &out, \"validateTransaction\", _v, _r, _s, _dest, _value, _ts)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "func (o *Gojwt) SetNumHoursDuration(hours time.Duration){\n o.numHoursDuration = hours\n}", "func SetDuration(co *ConfigOption) error {\n\t*(co.ConfigKey.(*time.Duration)) = time.Duration(viper.GetInt(co.Name)) * time.Second\n\treturn nil\n}", "func (a *ProfileSnapshotArgs) SetMinDuration(minDuration float64) *ProfileSnapshotArgs {\n\ta.MinDuration = &minDuration\n\treturn a\n}", "func SetValidEventSource(v *ValidEventSource, reason string, valid bool) {\n\tv.Reason = reason\n\tv.IsValid = valid\n}", "func (_m *KeyLevelValidationParameterManager) SetTxValidationResult(cc string, blockNum uint64, txNum uint64, err error) {\n\t_m.Called(cc, blockNum, txNum, err)\n}", "func (s *AuthSentCode) SetTimeout(value int) {\n\ts.Flags.Set(2)\n\ts.Timeout = value\n}", "func (s *AuthSentCode) SetTimeout(value int) {\n\ts.Flags.Set(2)\n\ts.Timeout = value\n}" ]
[ "0.8365969", "0.8023007", "0.80199265", "0.801695", "0.80135673", "0.7924586", "0.6439203", "0.64107597", "0.639842", "0.6217587", "0.60096455", "0.55625904", "0.5558263", "0.54228437", "0.53639", "0.53395814", "0.5205002", "0.5197713", "0.519424", "0.5164894", "0.51604533", "0.509252", "0.50512344", "0.5041206", "0.50404227", "0.50336426", "0.5002182", "0.4994583", "0.49717924", "0.49257457", "0.49240217", "0.4884968", "0.48808283", "0.48618627", "0.48480397", "0.48323637", "0.4822489", "0.47932106", "0.47643584", "0.47638366", "0.47538897", "0.47427684", "0.47175023", "0.47014013", "0.46912035", "0.46912035", "0.46363392", "0.46363392", "0.463266", "0.46322972", "0.45666152", "0.4563634", "0.45576924", "0.45402327", "0.4539039", "0.4522988", "0.45164725", "0.45150274", "0.4499612", "0.44942304", "0.44921643", "0.44894534", "0.44696355", "0.44531348", "0.4434502", "0.44119617", "0.4410342", "0.43990004", "0.4373169", "0.43713784", "0.4364684", "0.43631923", "0.43491188", "0.43382737", "0.43301275", "0.43236533", "0.43146548", "0.42917278", "0.42835003", "0.42772758", "0.427372", "0.42703202", "0.42673194", "0.42577738", "0.42567584", "0.4249422", "0.4226754", "0.4225635", "0.4224194", "0.42153147", "0.42118424", "0.4207252", "0.42035568", "0.41654107", "0.41640362", "0.41637674", "0.4157466", "0.41523817", "0.41385046", "0.41385046" ]
0.8686727
0
SetTransactionID sets the TransactionID for this TokenMintTransaction.
func (transaction *TokenMintTransaction) SetTransactionID(transactionID TransactionID) *TokenMintTransaction { transaction.requireNotFrozen() transaction.Transaction.SetTransactionID(transactionID) return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *TokenUpdateTransaction) SetTransactionID(transactionID TransactionID) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (o *NotifyStateChangedParams) SetTransactionID(transactionID strfmt.UUID) {\n\to.TransactionID = transactionID\n}", "func (options *GetPublicKeyOptions) SetTransactionID(transactionID string) *GetPublicKeyOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (options *TestNotificationChannelOptions) SetTransactionID(transactionID string) *TestNotificationChannelOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (transaction *ContractUpdateTransaction) SetTransactionID(transactionID TransactionID) *ContractUpdateTransaction {\n\ttransaction.requireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (transaction *FileCreateTransaction) SetTransactionID(transactionID TransactionID) *FileCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (options *CreateNotificationChannelOptions) SetTransactionID(transactionID string) *CreateNotificationChannelOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (transaction *AccountCreateTransaction) SetTransactionID(transactionID TransactionID) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (options *UpdateNotificationChannelOptions) SetTransactionID(transactionID string) *UpdateNotificationChannelOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (transaction *AccountUpdateTransaction) SetTransactionID(transactionID TransactionID) *AccountUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (transaction *ScheduleSignTransaction) SetTransactionID(transactionID TransactionID) *ScheduleSignTransaction {\n\ttransaction._RequireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (options *ListAllChannelsOptions) SetTransactionID(transactionID string) *ListAllChannelsOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (options *GetNotificationChannelOptions) SetTransactionID(transactionID string) *GetNotificationChannelOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (options *DeleteNotificationChannelsOptions) SetTransactionID(transactionID string) *DeleteNotificationChannelsOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (options *DeleteNotificationChannelOptions) SetTransactionID(transactionID string) *DeleteNotificationChannelOptions {\n\toptions.TransactionID = core.StringPtr(transactionID)\n\treturn options\n}", "func (tx *Transaction) SetID() error {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tenc := json.NewEncoder(&encoded)\n\tif err := enc.Encode(tx); err != nil {\n\t\treturn err\n\t}\n\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.id = hash[:]\n\treturn nil\n}", "func (transaction *TokenMintTransaction) SetTokenID(tokenID TokenID) *TokenMintTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.pb.Token = tokenID.toProtobuf()\n\treturn transaction\n}", "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\tencoder := gob.NewEncoder(&encoded)\n\terr := encoder.Encode(tx)\n\tHandle(err)\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tencode := gob.NewEncoder(&encoded)\n\terr := encode.Encode(tx)\n\tif err != nil {\n\t\tlog.Panic()\n\t}\n\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "func (m *HarborMutation) SetSettlementID(id int) {\n\tm.settlement = &id\n}", "func (t *Transaction) SetID() {\n\t// Create some data as a buffer and a hash variable\n\tvar d bytes.Buffer\n\tvar h [32]byte\n\n\t// Create a new encoder, passing the data to it\n\tvar e = gob.NewEncoder(&d)\n\n\t// Encode the transaction, handling any errors\n\terr := e.Encode(t)\n\tHandleError(err)\n\n\t// Create a hash with the datas bytes and assign to the transaction\n\th = sha256.Sum256(d.Bytes())\n\tt.ID = h[:]\n\n}", "func (transaction *TokenUpdateTransaction) SetTokenID(tokenID TokenID) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.tokenID = &tokenID\n\treturn transaction\n}", "func WithTransactionID(id configapi.TransactionID) WatchOption {\n\treturn watchIDOption{id: id}\n}", "func (hc *HarborCreate) SetSettlementID(id int) *HarborCreate {\n\thc.mutation.SetSettlementID(id)\n\treturn hc\n}", "func (commit *Commit) TransactionID() string {\n\treturn commit.transactionID\n}", "func (transaction *ContractUpdateTransaction) SetContractID(contractID ContractID) *ContractUpdateTransaction {\n\ttransaction.pb.ContractID = contractID.toProtobuf()\n\treturn transaction\n}", "func (transaction *TokenUpdateTransaction) GetTransactionID() TransactionID {\n\treturn transaction.Transaction.GetTransactionID()\n}", "func (dt *DeviceToken) SetID(id string) error {\n\tdeviceTokenID, err := strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdt.ID = uint(deviceTokenID)\n\treturn nil\n}", "func (o *NotifyStateChangedParams) WithTransactionID(transactionID strfmt.UUID) *NotifyStateChangedParams {\n\to.SetTransactionID(transactionID)\n\treturn o\n}", "func (tc *TokenCreate) SetID(u uuid.UUID) *TokenCreate {\n\ttc.mutation.SetID(u)\n\treturn tc\n}", "func (th *TransactionHeader) TransactionID() fab.TransactionID {\n\treturn th.id\n}", "func (transaction *FileCreateTransaction) GetTransactionID() TransactionID {\n\treturn transaction.Transaction.GetTransactionID()\n}", "func (rid *RequestID) TransactionID() *valuetransaction.ID {\n\tvar ret valuetransaction.ID\n\tcopy(ret[:], rid[:valuetransaction.IDLength])\n\treturn &ret\n}", "func (m *Request) SetID(id uint64) {\n\tm.RequestID = id\n}", "func (m *Response) SetID(id uint64) {\n\tm.RequestID = id\n}", "func (t *Trade) SetID(id string) {\n\tt.ID = id\n}", "func (wc *WalletCreate) SetID(u uuid.UUID) *WalletCreate {\n\twc.mutation.SetID(u)\n\treturn wc\n}", "func (transaction *ScheduleSignTransaction) GetTransactionID() TransactionID {\n\treturn transaction.Transaction.GetTransactionID()\n}", "func (o *Transaction) SetTransactionId(v string) {\n\to.TransactionId = v\n}", "func (c *EntityObject) SetCommitID(commitID int64) error {\n\tif commitID == 0 {\n\t\treturn errors.New(\"CommitID must be greater than 0\")\n\t}\n\n\tc.commitID = commitID\n\treturn nil\n}", "func (transaction *FileCreateTransaction) SetRegenerateTransactionID(regenerateTransactionID bool) *FileCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetRegenerateTransactionID(regenerateTransactionID)\n\treturn transaction\n}", "func (o *TransactionData) SetTransactionId(v string) {\n\to.TransactionId = v\n}", "func (transaction *AccountCreateTransaction) GetTransactionID() TransactionID {\n\treturn transaction.Transaction.GetTransactionID()\n}", "func (transaction *TokenUpdateTransaction) SetRegenerateTransactionID(regenerateTransactionID bool) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetRegenerateTransactionID(regenerateTransactionID)\n\treturn transaction\n}", "func (tx *Transaction) TxID() string {\n\treturn tx.jsonTransaction.Hash.Hex()\n}", "func (ac *AreahistoryCreate) SetWalletID(s string) *AreahistoryCreate {\n\tac.mutation.SetWalletID(s)\n\treturn ac\n}", "func (o *RebuildIndexSetParams) SetIndexSetID(indexSetID string) {\n\to.IndexSetID = indexSetID\n}", "func (s *TransactionEvent) SetTransactionId(v string) *TransactionEvent {\n\ts.TransactionId = &v\n\treturn s\n}", "func (o *GetMarketsRegionIDHistoryParams) SetRegionID(regionID int32) {\n\to.RegionID = regionID\n}", "func (o *QueryTradeInfoRequest) SetMerchantID(v string) {\n\to.MerchantID = v\n}", "func (pc *PromotionCreate) SetSaleID(id int) *PromotionCreate {\n\tpc.mutation.SetSaleID(id)\n\treturn pc\n}", "func (transaction *AccountUpdateTransaction) SetAccountID(accountID AccountID) *AccountUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.accountID = &accountID\n\treturn transaction\n}", "func (lc *LicenseCreate) SetID(i int) *LicenseCreate {\n\tlc.mutation.SetID(i)\n\treturn lc\n}", "func (m *SeriesMutation) SetID(id uint32) {\n\tm.id = &id\n}", "func (ttc *TagTopicCreate) SetID(i int) *TagTopicCreate {\n\tttc.mutation.SetID(i)\n\treturn ttc\n}", "func (_EthCrossChain *EthCrossChainSession) TransactionId() (*big.Int, error) {\n\treturn _EthCrossChain.Contract.TransactionId(&_EthCrossChain.CallOpts)\n}", "func WithTransactionID(xid uint32) Modifier {\n\treturn func(d *DHCPv4) *DHCPv4 {\n\t\td.SetTransactionID(xid)\n\t\treturn d\n\t}\n}", "func (o *CreditBankIncomeTransaction) SetTransactionId(v string) {\n\to.TransactionId = &v\n}", "func (c CandidateQuery) SetTransformationID(id int) CandidateQuery {\n\tc.TransformationID = id\n\treturn c\n}", "func (nc *NodeCreate) SetID(i int64) *NodeCreate {\n\tnc.mutation.SetID(i)\n\treturn nc\n}", "func (tt *TradeTemplate) SetID(id string) {\n\ttt.ID = id\n}", "func (b *Builder) SetChainID(c uint32) *Builder {\n\tb.blk.Header.chainID = c\n\treturn b\n}", "func (e *Etcd) SetTaskID(ctx context.Context, node string, id string) (err error) {\n\treturn e.Set(ctx, fmt.Sprintf(\"%s/%s/taskid\", InstanceDirPrefix, node), id)\n}", "func (o *PaymentInitiationPaymentGetResponse) SetTransactionId(v string) {\n\to.TransactionId.Set(&v)\n}", "func (transaction *AccountCreateTransaction) SetRegenerateTransactionID(regenerateTransactionID bool) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetRegenerateTransactionID(regenerateTransactionID)\n\treturn transaction\n}", "func (s *Transaction) SetTransactionId(v string) *Transaction {\n\ts.TransactionId = &v\n\treturn s\n}", "func (m NoMDEntries) SetTradingSessionID(v enum.TradingSessionID) {\n\tm.Set(field.NewTradingSessionID(v))\n}", "func SetTransactionContext(tx *apm.Transaction, req *http.Request, resp *Response, body *apm.BodyCapturer) {\n\ttx.Result = StatusCodeResult(resp.StatusCode)\n\tif !tx.Sampled() {\n\t\treturn\n\t}\n\tSetContext(&tx.Context, req, resp, body)\n}", "func (o *PostMultiNodeDeviceParams) SetContractID(contractID *int64) {\n\to.ContractID = contractID\n}", "func (m MetaData) TransactionID() UUID {\n\treturn UUID(fb.GetUint64(m[fb.SizeUint64*2 : fb.SizeUint64*3]))\n}", "func (o *PiggyBankEvent) SetTransactionJournalId(v string) {\n\to.TransactionJournalId = &v\n}", "func (xdc *XxxDemoCreate) SetID(s string) *XxxDemoCreate {\n\txdc.mutation.SetID(s)\n\treturn xdc\n}", "func (sc *SessionCreate) SetID(i int32) *SessionCreate {\n\tsc.mutation.SetID(i)\n\treturn sc\n}", "func (pu *PendingloanbindingUpdate) SetWalletID(s string) *PendingloanbindingUpdate {\n\tpu.mutation.SetWalletID(s)\n\treturn pu\n}", "func (puo *PendingloanbindingUpdateOne) SetWalletID(s string) *PendingloanbindingUpdateOne {\n\tpuo.mutation.SetWalletID(s)\n\treturn puo\n}", "func (m *PromotionMutation) SetSaleID(id int) {\n\tm.sale = &id\n}", "func (_EthCrossChain *EthCrossChainCaller) TransactionId(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _EthCrossChain.contract.Call(opts, out, \"TransactionId\")\n\treturn *ret0, err\n}", "func (_EthCrossChain *EthCrossChainCallerSession) TransactionId() (*big.Int, error) {\n\treturn _EthCrossChain.Contract.TransactionId(&_EthCrossChain.CallOpts)\n}", "func (s *GetTransactionOutput) SetTransaction(v *Transaction) *GetTransactionOutput {\n\ts.Transaction = v\n\treturn s\n}", "func (w *Wire) SetID(id uint32) {\n\tw.id = id\n}", "func (function *Function) SetID(ID string) {\n\tfunction.ID = ID\n}", "func (o *LedgerVoucherPutParams) SetID(id int32) {\n\to.ID = id\n}", "func (acc *AccessControlCreate) SetID(i int64) *AccessControlCreate {\n\tacc.mutation.SetID(i)\n\treturn acc\n}", "func (m *DropMutation) SetID(id uint32) {\n\tm.id = &id\n}", "func (ac *ArticleCreate) SetID(i int64) *ArticleCreate {\n\tac.mutation.SetID(i)\n\treturn ac\n}", "func (o *QueryCreditCardPeriodInfoRequest) SetMerchantID(v string) {\n\to.MerchantID = v\n}", "func (p *MockPeer) SetChaincodeID(ccID string) {\r\n\tp.ChaincodeID = ccID\r\n}", "func (o *SaveTemplateParams) SetTemplateID(templateID string) {\n\to.TemplateID = templateID\n}", "func (tu *TransactionUpdate) SetRequestID(id uuid.UUID) *TransactionUpdate {\n\ttu.mutation.SetRequestID(id)\n\treturn tu\n}", "func (cc *CheckoutCreate) SetCustomerID(id int) *CheckoutCreate {\n\tcc.mutation.SetCustomerID(id)\n\treturn cc\n}", "func (transaction *ScheduleSignTransaction) SetRegenerateTransactionID(regenerateTransactionID bool) *ScheduleSignTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetRegenerateTransactionID(regenerateTransactionID)\n\treturn transaction\n}", "func (b AcraBlock) SetKeyEncryptionKeyID(key, context []byte, idGenerator KeyIDGenerator) error {\n\tkeyID, err := idGenerator.GenerateKeyID(key, context)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcopy(b[KeyEncryptionKeyIDPosition:KeyEncryptionKeyIDPosition+KeyEncryptionKeyIDSize], keyID[:KeyEncryptionKeyIDSize])\n\treturn nil\n}", "func (i *InsertStatement) SetID(s string) {\n\ti.StatementID = s\n}", "func (m *mTOServiceItem) SetID(val strfmt.UUID) {\n\tm.idField = val\n}", "func (wc *WritelogCreate) SetID(i int) *WritelogCreate {\n\twc.mutation.SetID(i)\n\treturn wc\n}", "func (ms Span) SetTraceID(v pcommon.TraceID) {\n\tms.orig.TraceId = data.TraceID(v)\n}", "func (bc *BlockCreate) SetFlowID(id int) *BlockCreate {\n\tbc.mutation.SetFlowID(id)\n\treturn bc\n}", "func (o *EavAttributeSetRepositoryV1GetGetParams) SetAttributeSetID(attributeSetID int64) {\n\to.AttributeSetID = attributeSetID\n}", "func (c *swapCoin) TxID() string {\n\treturn c.txid\n}", "func (ic *InstanceCreate) SetWorkflowID(id uuid.UUID) *InstanceCreate {\n\tic.mutation.SetWorkflowID(id)\n\treturn ic\n}" ]
[ "0.82381386", "0.81250596", "0.79537165", "0.78678894", "0.78176993", "0.7808919", "0.78062093", "0.78025347", "0.7781221", "0.7777949", "0.7755989", "0.7635244", "0.75495344", "0.751994", "0.7457432", "0.6823136", "0.67699295", "0.6500967", "0.64818835", "0.6342158", "0.6296839", "0.6140679", "0.5987803", "0.5981738", "0.57412773", "0.57144564", "0.5712744", "0.56914496", "0.5687367", "0.56464505", "0.5628147", "0.5519021", "0.5513158", "0.5497238", "0.5440006", "0.54293853", "0.54201335", "0.53910273", "0.5382383", "0.53612036", "0.5357012", "0.53404135", "0.53359884", "0.53359604", "0.53299093", "0.5324194", "0.53232515", "0.53181255", "0.5313785", "0.52569246", "0.5248009", "0.5239847", "0.5236477", "0.5235282", "0.52231795", "0.5220381", "0.5208193", "0.5204324", "0.5199392", "0.5181534", "0.5174251", "0.51724213", "0.5172252", "0.5170165", "0.51514286", "0.51479185", "0.5143101", "0.51421106", "0.51357925", "0.5132793", "0.5126351", "0.5119157", "0.51189554", "0.51137817", "0.51103866", "0.51070595", "0.51024026", "0.50925004", "0.5088355", "0.5078398", "0.5069432", "0.50588876", "0.5042561", "0.504195", "0.5041514", "0.50375676", "0.50368655", "0.5025706", "0.5012596", "0.50120425", "0.50044626", "0.5000072", "0.49931175", "0.49900517", "0.49854422", "0.49805948", "0.49671116", "0.49633786", "0.49520332", "0.49513918" ]
0.8700677
0
SetNodeTokenID sets the node TokenID for this TokenMintTransaction.
func (transaction *TokenMintTransaction) SetNodeAccountIDs(nodeID []AccountID) *TokenMintTransaction { transaction.requireNotFrozen() transaction.Transaction.SetNodeAccountIDs(nodeID) return transaction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (transaction *TokenMintTransaction) SetTokenID(tokenID TokenID) *TokenMintTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.pb.Token = tokenID.toProtobuf()\n\treturn transaction\n}", "func (transaction *TokenUpdateTransaction) SetTokenID(tokenID TokenID) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.tokenID = &tokenID\n\treturn transaction\n}", "func (o *PaymentMethodCardRequest) SetTokenId(v string) {\n\to.TokenId = v\n}", "func (c *MqClient) SetToken(token string) {\n\tc.token = token\n}", "func (o *UpdatePasswordReqWeb) SetTokenId(v string) {\n\to.TokenId = v\n}", "func (m *HexMutation) SetNumberTokenID(id int) {\n\tm.number_token = &id\n}", "func (c *Client) SetToken(v string) {\n\tc.modifyLock.Lock()\n\tdefer c.modifyLock.Unlock()\n\tc.token = v\n}", "func (s *TransactionEvent) SetTokenId(v string) *TransactionEvent {\n\ts.TokenId = &v\n\treturn s\n}", "func (a *SetFileInputFilesArgs) SetNodeID(nodeID NodeID) *SetFileInputFilesArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (a *HighlightSourceOrderArgs) SetNodeID(nodeID dom.NodeID) *HighlightSourceOrderArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (a *FocusArgs) SetNodeID(nodeID NodeID) *FocusArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (this *SyncFlightInfo) SetNodeId(nodeId uint64) {\n\tthis.lock.Lock()\n\tdefer this.lock.Unlock()\n\tthis.nodeId = nodeId\n}", "func (s *TokenFilter) SetTokenId(v string) *TokenFilter {\n\ts.TokenId = &v\n\treturn s\n}", "func (c *Client) SetToken(token string) {\n\tc.mu.Lock()\n\tc.token = token\n\tc.mu.Unlock()\n}", "func (a *GetBoxModelArgs) SetNodeID(nodeID NodeID) *GetBoxModelArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (a *GetContentQuadsArgs) SetNodeID(nodeID NodeID) *GetContentQuadsArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (a *HighlightNodeArgs) SetNodeID(nodeID dom.NodeID) *HighlightNodeArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (tk *TokenRedis) SetToken(ctx context.Context, userID int64, token string, duration time.Duration) error {\n\tqueryKey := fmt.Sprintf(\"%s:%s:%d\", RedisKey, TokenKey, userID)\n\n\terr := tk.redis.Set(ctx, queryKey, token, duration).Err()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (client *Client) SetToken(token string) {\n\tclient.Token = token\n}", "func (a *ScrollIntoViewIfNeededArgs) SetNodeID(nodeID NodeID) *ScrollIntoViewIfNeededArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (m *TokenBase) SetToken(token *token32) {\n\tm.token = token\n}", "func (cmd *TransferCmd) SetTokenIDs(tokenIDs *string) {\n\tcmd.tokenIDs = tokenIDs\n}", "func (c *Client) SetToken(token string) {\n\tc.token = \"JWT \" + token\n}", "func (c *APIClient) SetToken(token string) {\n\tc.token = token\n}", "func (s *TokenIdentifier) SetTokenId(v string) *TokenIdentifier {\n\ts.TokenId = &v\n\treturn s\n}", "func (c *Client) SetToken(token string) *Client {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.token = token\n\tc.expiresAt = time.Now().Add(600 * time.Second)\n\treturn c\n}", "func (rb *ResourceBuilder) SetNsxtNodeID(val string) {\n\tif rb.config.NsxtNodeID.Enabled {\n\t\trb.res.Attributes().PutStr(\"nsxt.node.id\", val)\n\t}\n}", "func (a *ResolveNodeArgs) SetNodeID(nodeID NodeID) *ResolveNodeArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (transaction *TokenUpdateTransaction) SetNodeAccountIDs(nodeID []AccountID) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetNodeAccountIDs(nodeID)\n\treturn transaction\n}", "func (c *Client) SetToken(t string) {\n\tc.init()\n\tc.vc.SetToken(t)\n\tc.sw = c.vc.Logical()\n}", "func (transaction *TokenMintTransaction) SetTransactionID(transactionID TransactionID) *TokenMintTransaction {\n\ttransaction.requireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (cb ContextBuilder) SetNodeByID(nodeID node.ID) ContextBuilder {\n\tcb.actions = append(cb.actions, func(ctx Context) (Context, error) {\n\t\tfor index, id := range cb.dht.origin.IDs {\n\t\t\tif nodeID.Equal(id) {\n\t\t\t\treturn context.WithValue(ctx, ctxTableIndex, index), nil\n\t\t\t}\n\t\t}\n\t\treturn nil, errors.New(\"node requestID not found\")\n\t})\n\treturn cb\n}", "func (a *DescribeNodeArgs) SetNodeID(nodeID NodeID) *DescribeNodeArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func SetToken(t string) {\n\ttoken = t\n}", "func (s *SlackConfig) SetToken(t string) {\n\ts.Token = t\n}", "func (a *GetOuterHTMLArgs) SetNodeID(nodeID NodeID) *GetOuterHTMLArgs {\n\ta.NodeID = &nodeID\n\treturn a\n}", "func (o *GetTransportNodeParams) SetTransportnodeID(transportnodeID string) {\n\to.TransportnodeID = transportnodeID\n}", "func (cfg *Config) SetToken(token string) {\n\tcfg.Token = token\n}", "func (cli *Client) SetToken(token string) {\n\tcli.token = token\n}", "func (dt *DeviceToken) SetID(id string) error {\n\tdeviceTokenID, err := strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdt.ID = uint(deviceTokenID)\n\treturn nil\n}", "func (o *JsonMDNOAuthToken) SetToken(v string) {\n\to.Token = &v\n}", "func (client *RestClient) SetToken(newToken string) {\n\tclient.token = newToken\n\tclient.userName = \"\"\n\tclient.userPwd = \"\"\n}", "func (o *NodeUpdate) SetNodeId(v int32) {\n\to.NodeId = v\n}", "func (r SlpMint) TokenID() []byte {\n\treturn r.tokenID\n}", "func (e *Event) SetToken(token string) {\n\te.Token = token\n}", "func (o *Venda) SetToken(v string) {\n\to.Token.Set(&v)\n}", "func SetToken(ctx context.Context, token string) context.Context {\n\treturn context.WithValue(ctx, tokenKey, token)\n}", "func (f *vaultTokenAuthHandler) SetToken(token string) {\n\tf.client.SetToken(token)\n}", "func (u *BasicUpdateOperation) SetToken(token string) {\n\tu.Token = token\n}", "func (transaction *AccountCreateTransaction) SetNodeAccountIDs(nodeID []AccountID) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetNodeAccountIDs(nodeID)\n\treturn transaction\n}", "func (l *Login) SetToken(v string) {\n\t// return if Login type is nil\n\tif l == nil {\n\t\treturn\n\t}\n\n\tl.Token = &v\n}", "func (l *Login) SetToken(v string) {\n\t// return if Login type is nil\n\tif l == nil {\n\t\treturn\n\t}\n\n\tl.Token = &v\n}", "func SetToken(token string) OptionFunc {\n\treturn func(c *Client) error {\n\t\tif token == \"\" {\n\t\t\tc.errorf(\"%v\\n\", ErrBadToken)\n\t\t\treturn ErrBadToken\n\t\t}\n\t\tc.token = token\n\t\treturn nil\n\t}\n}", "func (o *GetIntrospectionParams) SetToken(token string) {\n\to.Token = token\n}", "func SetToken(newtoken string) string {\n\tToken = newtoken\n\treturn Token\n}", "func (b *BoltAuthRepository) SetToken(tkn models.Token) error {\n\treturn b.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(b.bucket))\n\t\tbytes, err := json.Marshal(tkn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn b.Put([]byte(tkn.Value), bytes)\n\t})\n}", "func (transaction *FileCreateTransaction) SetNodeAccountIDs(nodeID []AccountID) *FileCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetNodeAccountIDs(nodeID)\n\treturn transaction\n}", "func (transaction *ScheduleSignTransaction) SetNodeAccountIDs(nodeID []AccountID) *ScheduleSignTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetNodeAccountIDs(nodeID)\n\treturn transaction\n}", "func (o *DeleteNodeParams) SetNode(node string) {\n\to.Node = node\n}", "func (transaction *ContractUpdateTransaction) SetNodeAccountIDs(nodeID []AccountID) *ContractUpdateTransaction {\n\ttransaction.requireNotFrozen()\n\ttransaction.Transaction.SetNodeAccountIDs(nodeID)\n\treturn transaction\n}", "func (m *SessionMutation) SetToken(s string) {\n\tm.token = &s\n}", "func (transaction *EthereumFlow) SetNodeAccountIDs(nodes []AccountID) *EthereumFlow {\n\ttransaction._RequireNotFrozen()\n\ttransaction.nodeAccountIDs = nodes\n\treturn transaction\n}", "func (query *ContractCallQuery) SetNodeAccountIDs(accountID []AccountID) *ContractCallQuery {\n\tquery.Query.SetNodeAccountIDs(accountID)\n\treturn query\n}", "func (s *BatchGetTokenBalanceErrorItem) SetTokenIdentifier(v *TokenIdentifier) *BatchGetTokenBalanceErrorItem {\n\ts.TokenIdentifier = v\n\treturn s\n}", "func SetToken(token string) {\n\tAPI.Token = token\n}", "func (c *Client) SetToken(authToken string) {\n\tc.authToken = authToken\n}", "func (transaction *AccountUpdateTransaction) SetNodeAccountIDs(nodeID []AccountID) *AccountUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.Transaction.SetNodeAccountIDs(nodeID)\n\treturn transaction\n}", "func (u *User) SetToken(token, refreshToken string) {\n\tu.Token = token\n\tu.RefreshToken = refreshToken\n}", "func (s *BatchGetTokenBalanceOutputItem) SetTokenIdentifier(v *TokenIdentifier) *BatchGetTokenBalanceOutputItem {\n\ts.TokenIdentifier = v\n\treturn s\n}", "func (s *GetTokenBalanceOutput) SetTokenIdentifier(v *TokenIdentifier) *GetTokenBalanceOutput {\n\ts.TokenIdentifier = v\n\treturn s\n}", "func (o *OAuth2ConsentSessionExpiresAt) SetIdToken(v time.Time) {\n\to.IdToken = &v\n}", "func (query *ContractInfoQuery) SetNodeAccountIDs(accountID []AccountID) *ContractInfoQuery {\n\tquery.Query.SetNodeAccountIDs(accountID)\n\treturn query\n}", "func (query *ContractInfoQuery) SetNodeAccountIDs(accountID []AccountID) *ContractInfoQuery {\n\tquery.Query.SetNodeAccountIDs(accountID)\n\treturn query\n}", "func SetToken(token string) {\n\tDefaultClient.SetToken(token)\n}", "func (vuu *VacUserUpdate) SetToken(s string) *VacUserUpdate {\n\tvuu.mutation.SetToken(s)\n\treturn vuu\n}", "func (a *API) SetToken(token string) {\r\n\ta.access_token = token\r\n}", "func (vuuo *VacUserUpdateOne) SetToken(s string) *VacUserUpdateOne {\n\tvuuo.mutation.SetToken(s)\n\treturn vuuo\n}", "func (s *BatchGetTokenBalanceInputItem) SetTokenIdentifier(v *TokenIdentifier) *BatchGetTokenBalanceInputItem {\n\ts.TokenIdentifier = v\n\treturn s\n}", "func (_ERC20HecoManager *ERC20HecoManagerTransactor) MintToken(opts *bind.TransactOpts, heco20Token common.Address, amount *big.Int, recipient common.Address, receiptId [32]byte) (*types.Transaction, error) {\n\treturn _ERC20HecoManager.contract.Transact(opts, \"mintToken\", heco20Token, amount, recipient, receiptId)\n}", "func (o *AwsIamToken) SetToken(v string) {\n\to.Token = v\n}", "func (transaction *TokenUpdateTransaction) SetTransactionID(transactionID TransactionID) *TokenUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\n\ttransaction.Transaction.SetTransactionID(transactionID)\n\treturn transaction\n}", "func (o *Authorization) SetToken(v string) {\n\to.Token = &v\n}", "func (c *Client) SetToken(req *http.Request) {\n\treq.Header.Set(\"X-Vault-Token\", c.token)\n}", "func (o *RecoverySubmitParams) SetToken(token string) {\n\to.Token = token\n}", "func (p *protoOutputNode) SetXID(xid string) { p.Node.Xid = xid }", "func (s *GetTokenBalanceInput) SetTokenIdentifier(v *TokenIdentifier) *GetTokenBalanceInput {\n\ts.TokenIdentifier = v\n\treturn s\n}", "func (o *PostRestoreKVResponse) SetToken(v string) {\n\to.Token = &v\n}", "func (conf *OnboardingConfig) SetToken(token string) {\n\tconf.TokenValue = token\n}", "func (l *LockArgs) SetToken(token string) {\n\tl.Token = token\n}", "func (p *jsonOutputNode) SetXID(xid string) {\n\tp.data[\"_xid_\"] = xid\n}", "func (rb *DatafeedsRecordBuilder) NodeId(nodeid string) *DatafeedsRecordBuilder {\n\trb.v.NodeId = &nodeid\n\treturn rb\n}", "func (o *CreateUser200Response) SetToken(v string) {\n\to.Token = &v\n}", "func (transaction *TokenUpdateTransaction) GetTokenID() TokenID {\n\tif transaction.tokenID == nil {\n\t\treturn TokenID{}\n\t}\n\n\treturn *transaction.tokenID\n}", "func (s *Session) SetToken(token oauth2.Token) {\n\ts.tokenChan <- token\n}", "func (o *Token) SetToken(v string) {\n\to.Token = v\n}", "func (s *TokenBalance) SetTokenIdentifier(v *TokenIdentifier) *TokenBalance {\n\ts.TokenIdentifier = v\n\treturn s\n}", "func (r *ReconciliationLoop) setNodeID(nodes []redis.ClusterNode) {\n\tvar nodeID string\n\tfor _, node := range nodes {\n\t\tif node.Myself {\n\t\t\tnodeID = node.NodeID\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif nodeID != \"\" {\n\t\tif nodeID != r.nodeID {\n\t\t\tlog.Infof(\"Updating nodeID, new ID: %s\", nodeID)\n\t\t\tr.nodeID = nodeID\n\t\t}\n\t} else {\n\t\tlog.Warn(\"Could not find nodeID, invalid nodes list\")\n\t}\n}", "func (_m *NoteServiceHandler) SetToken(token string) {\n\t_m.Called(token)\n}", "func (s *GetNodeInput) SetNodeId(v string) *GetNodeInput {\n\ts.NodeId = &v\n\treturn s\n}", "func (m *Application) SetTokenEncryptionKeyId(value *string)() {\n m.tokenEncryptionKeyId = value\n}" ]
[ "0.750417", "0.7288023", "0.64172256", "0.61529917", "0.6152681", "0.60864747", "0.60786504", "0.6058954", "0.5985139", "0.59829587", "0.59726155", "0.59182125", "0.58770865", "0.58524454", "0.5847443", "0.5828913", "0.58048546", "0.5791855", "0.5769831", "0.576629", "0.57653505", "0.5722858", "0.56922513", "0.56912905", "0.564109", "0.5638757", "0.56245244", "0.5608812", "0.56000835", "0.5566622", "0.5566192", "0.55384547", "0.55372655", "0.55251974", "0.55097413", "0.5499841", "0.54942286", "0.5490361", "0.5486596", "0.5485906", "0.5480851", "0.54792696", "0.547663", "0.546277", "0.54586434", "0.54507893", "0.54444903", "0.54371595", "0.54284805", "0.5388237", "0.5382228", "0.5382228", "0.5374039", "0.5372592", "0.53644735", "0.53593194", "0.5351613", "0.53418857", "0.5334763", "0.5332635", "0.5325343", "0.5303936", "0.5299723", "0.5297705", "0.5289402", "0.525479", "0.52542114", "0.52521425", "0.5248038", "0.52464306", "0.52309287", "0.5219789", "0.5219789", "0.5206924", "0.520472", "0.5190507", "0.51903397", "0.51639783", "0.5147702", "0.5143838", "0.5139517", "0.5129305", "0.51285636", "0.5126226", "0.5125977", "0.51137996", "0.5111846", "0.51039934", "0.5066442", "0.50655675", "0.506301", "0.50594145", "0.50547564", "0.5048508", "0.5032249", "0.5026747", "0.5015476", "0.501226", "0.49677548", "0.49495906" ]
0.59007496
12
WrapMiddlewareFromHandler wrap `echo.HandlerFunc` into `echo.Middleware`.
func WrapMiddlewareFromHandler(h HandlerFunc) Middleware { return MiddlewareFunc(func(next Handler) Handler { return HandlerFunc(func(c Context) error { if err := h.Handle(c); err != nil { return err } return next.Handle(c) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func WrapperHandlerMiddleware(w HandlerWrapper) Middleware { return w }", "func WrapperMiddleware(w HandlerFuncWrapper) Middleware { return w }", "func Wrap(\n\tmiddleware Middleware,\n\thandler Handler,\n) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tmiddleware(handler)(context.Background(), w, r)\n\t}\n}", "func wrap(handler http.Handler) mwFunc {\n\tif handler == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandler.ServeHTTP(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func ToMiddleware(handler func(next http.Handler) http.Handler) Middleware {\n\treturn func(handle http.HandlerFunc) http.HandlerFunc {\n\t\treturn handler(handle).ServeHTTP\n\t}\n}", "func wrapHandler(handler func(http.ResponseWriter, *http.Request, *receiver.Receiver), rcvr *receiver.Receiver) http.HandlerFunc {\n\treturn func(response http.ResponseWriter, req *http.Request) {\n\t\thandler(response, req, rcvr)\n\t}\n}", "func WrapMiddlewareFromStdHandleFunc(h func(http.ResponseWriter, *http.Request)) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\th(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t)\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(c Context, next HandlerFunc) (err error) {\n\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tc.SetRequest(r)\n\t\t\terr = next(c)\n\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\treturn\n\t}\n}", "func WrapMiddlewareFromStdHandler(h http.Handler) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\th.ServeHTTP(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t)\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(next HandlerFunc) HandlerFunc {\n\t\treturn func(c Context) (err error) {\n\t\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tc.SetRequest(r)\n\t\t\t\tc.SetResponse(newResponse(w))\n\t\t\t\terr = next(c)\n\t\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\t\treturn\n\t\t}\n\t}\n}", "func wrapHandler(h http.HandlerFunc) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\tctx := r.Context()\n\t\tr = r.WithContext(ctx)\n\t\th.ServeHTTP(w, r)\n\t}\n}", "func WrapMiddlewareFromStdHandleFuncd(h func(http.ResponseWriter, *http.Request) error) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\tif err := h(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func FromHTTPMiddleware(fn func(http.Handler) http.Handler) Handler {\n\treturn HandlerFunc(func(c context.Context) {\n\t\th := fn(mkNextHTTPHandler(c))\n\t\th.ServeHTTP(GetResponseWriter(c), GetRequest(c))\n\t})\n}", "func (s *Server) wrapMiddleware(h handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := h(s, w, r)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[Error][Server] %+v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t}\n}", "func ToMiddleware(classicMiddleware func(http.HandlerFunc) http.HandlerFunc) Middleware {\n\treturn func(c Container, next Handler) {\n\t\tclassicMiddleware(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t\tnext(c)\n\t\t})(c.GetResponseWriter(), c.GetRequest())\n\t}\n}", "func WrapHandlerFunc(h HandlerFunc) HandlerFunc {\n\treturn func(c *Context) {\n\t\th(c)\n\t\tc.Next()\n\t}\n}", "func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\t\tw.Header().Set(\"Docker-Experimental\", e.experimental)\n\t\treturn handler(ctx, w, r, vars)\n\t}\n}", "func wrapHandler(h func(http.ResponseWriter, *http.Request)) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\thttpcontext.Set(r, \"params\", ps)\n\t\th(w, r)\n\t}\n}", "func WrapHandler(handler *Handler) alice.Constructor {\n\treturn func(next http.Handler) (http.Handler, error) {\n\t\treturn http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\t\thandler.ServeHTTP(rw, req, next)\n\t\t}), nil\n\t}\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func Wrap(hf interface{}, mf ...interface{}) Handler {\n\treturn wrap(hf, mf...)\n}", "func useMiddlewareHandler(h http.Handler, mw ...Middleware) http.Handler {\n\tfor i := range mw {\n\t\th = mw[len(mw)-1-i](h)\n\t}\n\n\treturn h\n}", "func (m MiddlewareFunc) Handler(next http.Handler) http.Handler {\n\treturn m(next)\n}", "func wrapMiddleware(mw []Middleware, handler Handler) Handler {\n\n\t// Loop backwards through the middleware invoking each one. Replace the\n\t// handler with the new wrapped handler. Looping backwards ensures that the\n\t// first middleware of the slice is the first to be executed by requests.\n\tfor i := len(mw) - 1; i >= 0; i-- {\n\t\th := mw[i]\n\t\t// h is of type Middleware func(Handler) Handler - so it takes a handler and returns a handler\n\t\tif h != nil {\n\t\t\thandler = h(handler)\n\t\t}\n\t}\n\n\treturn handler\n}", "func (h MiddlewareFunc) Handler(next http.Handler) http.Handler {\n\treturn h(next)\n}", "func (h MiddlewareFunc) Handler(next http.Handler) http.Handler {\n\treturn h(next)\n}", "func (a *Middleware) Wrap(h http.Handler) {\n\ta.Handler = h\n}", "func Adapt(fn func(http.Handler) http.Handler) Middleware {\n\treturn func(ctx *Context, h http.Handler) http.Handler {\n\t\treturn fn(h)\n\t}\n}", "func WrapperHandler(f HandlerFunc, dd ...DecoratorFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := newCtxWithRqID(r.Context(), r)\n\t\thf := f\n\t\tfor _, d := range dd {\n\t\t\thf = d(hf)\n\t\t}\n\t\terr := hf(w, r.WithContext(ctx))\n\t\tif err != nil {\n\t\t\terrProcessor(err, w)\n\t\t}\n\t}\n}", "func (s *server) handlerWrapper(h http.Handler) httprouter.Handle {\n\treturn s.middleware(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func NewHandlerWrapper(p micro.Publisher) server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\t// add TranID to context if not present\n\t\t\tctx = metadata.MergeContext(ctx, map[string]string{\"trans-id\": uuid.New().String()}, false)\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t// we already logged error in Publish. lets ignore error here.\n\t\t\t_ = publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\t// go publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\treturn\n\t\t}\n\t}\n}", "func (e ErrorHandler) Wrap(handler func(w http.ResponseWriter, r *http.Request) error) http.Handler {\n\treturn errorHandler{\n\t\tHandler: handler,\n\t\tLogWriter: e.LogWriter,\n\t}\n}", "func wrapHandle(handle httprouter.Handle) mwFunc {\n\tif handle == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandle(w, r, ps)\n\t\tnext(w, r, ps)\n\t}\n}", "func BuildMiddleware(handler insolar.MessageHandler, wrapHandlers ...Handler) insolar.MessageHandler {\n\tresult := handler\n\n\tfor i := range wrapHandlers {\n\t\tresult = wrapHandlers[len(wrapHandlers)-1-i](result)\n\t}\n\n\treturn result\n}", "func adaptHandler(h http.Handler) Handler {\n\treturn func(ctx *Context) http.Handler {\n\t\treturn h\n\t}\n}", "func Middleware(\n\tenv *Env,\n) func(http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn middleware{h, env}\n\t}\n}", "func Middleware(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tappengineCtx := appengine.NewContext(r)\n\t\tctx := context.WithValue(r.Context(), contextKeyContext, appengineCtx)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func NewMiddlewareWrapper(logger Logger, metrics Metrics, corsOptions *CORSOptions, globals ServiceGlobals) MiddlewareWrapper {\n\tm := &middlewareWrapperImpl{\n\t\tlogger: logger,\n\t\tmetrics: metrics,\n\t\tglobals: globals,\n\t}\n\tm.corsOptions = m.mergeCORSOptions(corsOptions)\n\treturn m\n}", "func Middleware(fn AppHandler, c interface{}) AppHandler {\n\treturn func(w http.ResponseWriter, r *http.Request) *AppError {\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"env\", c))\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"vars\", mux.Vars(r)))\n\t\treturn fn(w, r)\n\t}\n}", "func (h *Handler) WrapHandler(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar shouldCompress = true\n\n\t\tfor _, filter := range h.requestFilter {\n\t\t\tshouldCompress = filter.ShouldCompress(r)\n\t\t\tif !shouldCompress {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif shouldCompress {\n\t\t\twrapper := h.getWriteWrapper()\n\t\t\twrapper.Reset(w)\n\t\t\toriginWriter := w\n\t\t\tw = wrapper\n\t\t\tdefer func() {\n\t\t\t\th.putWriteWrapper(wrapper)\n\t\t\t\tw = originWriter\n\t\t\t}()\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func MakeTracingMiddleware(component string) func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn MakeTracingHandler(next, component)\n\t}\n}", "func FromHandler(handler http.Handler) func(Container) {\n\treturn func(c Container) {\n\t\thandler.ServeHTTP(c.GetResponseWriter(), c.GetRequest())\n\t}\n}", "func (h Handler) Wrap(middlewares ...Middleware) Handler {\n\treturn Queue(middlewares).Finish(h)\n}", "func NewHandlerWrapper() server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\tmd, _ := metadata.FromContext(ctx)\n\t\t\tlog.Debug().Fields(map[string]interface{}{\n\t\t\t\t\"category\": \"LogWrapper\",\n\t\t\t\t\"service\": req.Service(),\n\t\t\t\t\"method\": req.Method(),\n\t\t\t\t\"ctx\": md,\n\t\t\t}).Msg(\"Server-Side Handler\")\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t//securityLog(ctx, req, rsp)\n\t\t\treturn\n\t\t}\n\t}\n}", "func EchoMiddleware(AppID string) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tvar r *http.Request = c.Request\n\t\tvalidations.AppID = AppID\n\n\t\t// Verify certificate is good\n\t\tcert, err := validations.ValidateCertificate(r)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Verify signature is good\n\t\tbody, err := validations.ValidateSignature(r, cert)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tvar data json.RawMessage\n\n\t\terr = json.Unmarshal(body, &data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tev, err := parser.Parse(data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the request is good\n\t\tif err = validations.ValidateRequest(ev); err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tc.Set(\"echoRequest\", ev)\n\t\tc.Next()\n\t}\n}", "func WrapHandler(w ...server.HandlerWrapper) Option {\n\treturn func(o *Options) {\n\t\to.HandlerWrapper = w\n\t}\n}", "func (m *middlewares) UseHandler(handler http.Handler) {\n\tm.Use(&middlewareForHandler{handler})\n}", "func Middleware(o ...Option) func(http.Handler) http.Handler {\n\topts := options{\n\t\ttracer: apm.DefaultTracer(),\n\t}\n\tfor _, o := range o {\n\t\to(&opts)\n\t}\n\tif opts.requestIgnorer == nil {\n\t\topts.requestIgnorer = apmhttp.NewDynamicServerRequestIgnorer(opts.tracer)\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\tserverOpts := []apmhttp.ServerOption{\n\t\t\tapmhttp.WithTracer(opts.tracer),\n\t\t\tapmhttp.WithServerRequestName(routeRequestName),\n\t\t\tapmhttp.WithServerRequestIgnorer(opts.requestIgnorer),\n\t\t}\n\t\tif opts.panicPropagation {\n\t\t\tserverOpts = append(serverOpts, apmhttp.WithPanicPropagation())\n\t\t}\n\t\treturn apmhttp.Wrap(\n\t\t\th,\n\t\t\tserverOpts...,\n\t\t)\n\t}\n}", "func Wrap(h http.Handler, o ...ServerOption) http.Handler {\n\tif h == nil {\n\t\tpanic(\"h == nil\")\n\t}\n\thandler := &handler{\n\t\thandler: h,\n\t\ttracer: apm.DefaultTracer(),\n\t\trequestName: ServerRequestName,\n\t}\n\tfor _, o := range o {\n\t\to(handler)\n\t}\n\tif handler.requestIgnorer == nil {\n\t\thandler.requestIgnorer = NewDynamicServerRequestIgnorer(handler.tracer)\n\t}\n\tif handler.recovery == nil {\n\t\thandler.recovery = NewTraceRecovery(handler.tracer)\n\t}\n\treturn handler\n}", "func With(inner http.HandlerFunc) http.HandlerFunc {\n\treturn http.HandlerFunc(handler(inner))\n}", "func wrapFunc(fn http.HandlerFunc) mwFunc {\n\tif fn == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\tfn(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func (l *Logger) Middleware(next http.Handler) http.Handler {\n\treturn httpHandler{\n\t\tlogger: l,\n\t\tnext: next,\n\t}\n}", "func (ch *CFHosting) EchoMiddleware(h echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\n\t\t// If request is a WebSocket request, don't do anything special\n\t\tupgrade := c.Request().Header.Get(\"Upgrade\")\n\t\twebSocketKey := c.Request().Header.Get(\"Sec-Websocket-Key\")\n\n\t\tif len(upgrade) > 0 && len(webSocketKey) > 0 {\n\t\t\tlog.Infof(\"Not redirecting this request\")\n\t\t\treturn h(c)\n\t\t}\n\n\t\t// Check that we are on HTTPS - redirect if not\n\t\tproto := c.Request().Header.Get(\"X-Forwarded-Proto\")\n\t\tif len(proto) > 0 {\n\t\t\tif proto != \"https\" {\n\t\t\t\tredirect := fmt.Sprintf(\"https://%s%s\", c.Request().Host, c.Request().RequestURI)\n\t\t\t\treturn c.Redirect(301, redirect)\n\t\t\t}\n\t\t\treturn h(c)\n\t\t}\n\n\t\treturn interfaces.NewHTTPShadowError(\n\t\t\thttp.StatusBadRequest,\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t)\n\t}\n}", "func Wrap(name string, handle HandlerFunc, middlewares ...Middleware) HandlerFunc {\n\tfor i := len(middlewares) - 1; i >= 0; i-- {\n\t\thandle = middlewares[i](name, handle)\n\t}\n\treturn handle\n}", "func TracingHandlerFunc(h http.HandlerFunc) http.HandlerFunc {\n\treturn TracingMiddleware(LoggingMiddleWare(h))\n}", "func (mvcI *MvcInfrastructure) wrapHandler(c Controller, a Action) func(response http.ResponseWriter, request *http.Request) {\n\treturn func(response http.ResponseWriter, request *http.Request) {\n\t\tlogger.Debugf(\"c: %v, a: %v, m: %s\", c, a, request.Method)\n\n\t\tmvcI.handleRequest(c, a, response, request)\n\t}\n}", "func handlerWrapper(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\thandler := panicRecover(f)\n\thandler = stopwatch(handler)\n\thandler = i18nLoad(handler)\n\n\treturn handler\n}", "func Middleware() echo.MiddlewareFunc {\n\tstats.Do(func() {\n\t\tstats.init()\n\t})\n\treturn echo.WrapMiddleware(handlerFunc)\n}", "func Middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func (wi *WebInterface) wrapHandler(f func(*WebInterface, *http.Conn, *http.Request)) (func(*http.Conn, *http.Request)) {\n\tfmt.Printf(\">> wrapping handler wi %v f %v\\n\", wi, f)\n\treturn func(c *http.Conn, r *http.Request) {\n\t\tfmt.Printf(\"outer handler called with wi %v c %v\\n\", wi, c)\n\t\tf(wi, c, r)\n\t}\n}", "func adaptHandlerFunc(fn func(w http.ResponseWriter, r *http.Request)) Handler {\n\treturn adaptHandler(http.HandlerFunc(fn))\n}", "func FromHandlerFunc(handlerFunc func(http.ResponseWriter, *http.Request)) func(Container) {\n\treturn func(c Container) {\n\t\thandlerFunc(c.GetResponseWriter(), c.GetRequest())\n\t}\n}", "func (s *server) loggingMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tlogger := logging.GetLogger(ctx)\n\t\trouteName := mux.CurrentRoute(r).GetName()\n\t\tmethod := r.Method\n\t\trequestLogger := logger.With(\n\t\t\tzap.String(\"route\", routeName),\n\t\t\tzap.String(\"method\", method),\n\t\t)\n\n\t\tctx = logging.ContextWithLogger(ctx, requestLogger)\n\t\tctx = context.WithValue(ctx, \"route\", routeName)\n\t\tctx = context.WithValue(ctx, \"method\", method)\n\n\t\tlogging.GetLogger(ctx).Info(\"request started\")\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\tlogging.GetLogger(ctx).Info(\"request completed\")\n\t})\n}", "func UseMiddleware(mw ...Middleware) func(http.HandlerFunc) http.Handler {\n\treturn func(fn http.HandlerFunc) http.Handler {\n\t\treturn useMiddlewareHandler(fn, mw...)\n\t}\n}", "func (a *App) MountHandler(verb, path string, handler Handler, mw ...Middleware) {\n\thandler = wrapMiddleware(mw, handler)\n\n\t// wrap application level middlewares\n\thandler = wrapMiddleware(a.mw, handler)\n\n\th := func(w http.ResponseWriter, r *http.Request) {\n\t\t// TODO: start tracer span\n\n\t\t// add relevant values the context for propagation\n\t\tv := Values{\n\t\t\tNow: time.Now(),\n\t\t}\n\t\tctx := context.WithValue(r.Context(), KeyValues, &v)\n\n\t\tif err := handler(ctx, w, r); err != nil {\n\t\t\tlog.Println(err)\n\t\t\ta.Shutdown()\n\t\t\treturn\n\t\t}\n\t}\n\ta.HandleFunc(path, h).Methods(verb)\n}", "func toHandler(h interface{}) Handler {\n\tswitch h := h.(type) {\n\tcase Handler:\n\t\treturn h\n\tcase func(context.Context, http.ResponseWriter, *http.Request):\n\t\treturn HandlerFunc(h)\n\t}\n\tpanic(\"muxy: handler must be muxy.Handler or func(context.Context, http.ResponseWriter, *http.Request)\")\n}", "func makeHandler(fn func(http.ResponseWriter, *http.Request, *Server), s *Server) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, s)\n\t}\n}", "func Middleware(store *Store) func(h http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(\n\t\t\tw http.ResponseWriter,\n\t\t\tr *http.Request,\n\t\t) {\n\t\t\tctx := r.Context()\n\t\t\tctx = context.WithValue(ctx, contextKey, store)\n\t\t\th.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "func makeHandler(ctx models.AppContext, fn func(*gin.Context, models.AppContext)) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tfn(c, ctx)\n\t}\n}", "func DecorateHandler(handler http.Handler, mw ...Middleware) http.Handler {\n\n\tif len(mw) == 0 {\n\t\treturn handler\n\t}\n\n\tn := len(mw) - 1\n\th := handler\n\n\t// Call the right most middleware first\n\tfor i := n; i >= 0; i-- {\n\t\th = mw[i].Handler(h)\n\t}\n\n\treturn PanicTrap(h)\n}", "func (v *Verifier) WrapFunc(handler http.HandlerFunc) http.Handler {\n\treturn v.Wrap(http.HandlerFunc(handler))\n}", "func FromHTTPHandler(handler http.Handler) Handler {\n\treturn HandlerFunc(func(c context.Context) {\n\t\thandler.ServeHTTP(GetResponseWriter(c), GetRequest(c))\n\t\tNext(c)\n\t})\n}", "func (c *Config) Middleware(next http.Handler) http.Handler {\n\tfun := func(w http.ResponseWriter, r *http.Request) {\n\t\tc.l.Lock()\n\t\texpirable, ok := c.content[r.URL.Path]\n\t\tif !ok {\n\t\t\texpirable = futures.NewExpirable(c.timeout,\n\t\t\t\tfunc() interface{} {\n\t\t\t\t\treturn execute(r, next)\n\t\t\t\t})\n\t\t\tc.content[r.URL.Path] = expirable\n\t\t}\n\t\tc.l.Unlock()\n\t\trecorded := expirable.Read().(*httptest.ResponseRecorder)\n\t\tfor k, v := range recorded.Header() {\n\t\t\tw.Header()[k] = v\n\t\t}\n\t\tw.WriteHeader(recorded.Code)\n\t\tw.Write(recorded.Body.Bytes())\n\t}\n\treturn http.HandlerFunc(fun)\n}", "func WrapHandler(h http.Handler) http.Handler {\n\twrapped := h\n\tfor _, f := range factories {\n\t\twrapped = f(wrapped)\n\t}\n\treturn wrapped\n}", "func (zm *ZipkinMiddleware) GetMiddlewareHandler() func(http.ResponseWriter, *http.Request, http.HandlerFunc) {\n\treturn func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\t\twireContext, err := zm.tracer.Extract(\n\t\t\topentracing.TextMap,\n\t\t\topentracing.HTTPHeadersCarrier(r.Header),\n\t\t)\n\t\tif err != nil {\n\t\t\tcommon.ServerObj.Logger.Debug(\"Error encountered while trying to extract span \", zap.Error(err))\n\t\t\tnext(rw, r)\n\t\t}\n\t\tspan := zm.tracer.StartSpan(r.URL.Path, ext.RPCServerOption(wireContext))\n\t\tdefer span.Finish()\n\t\tctx := opentracing.ContextWithSpan(r.Context(), span)\n\t\tr = r.WithContext(ctx)\n\t\tnext(rw, r)\n\t}\n}", "func (f *Fastglue) handler(h FastRequestHandler) func(*fasthttp.RequestCtx) {\n\treturn func(ctx *fasthttp.RequestCtx) {\n\t\treq := &Request{\n\t\t\tRequestCtx: ctx,\n\t\t\tContext: f.context,\n\t\t}\n\n\t\t// Apply \"before\" middleware.\n\t\tfor _, p := range f.before {\n\t\t\tif p(req) == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t_ = h(req)\n\n\t\t// Apply \"after\" middleware.\n\t\tfor _, p := range f.after {\n\t\t\tif p(req) == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}" ]
[ "0.7558637", "0.72505367", "0.7112123", "0.6922102", "0.69177586", "0.6855931", "0.6841805", "0.6823596", "0.68088424", "0.6793157", "0.66682506", "0.66541815", "0.6639649", "0.6620051", "0.65788704", "0.6524391", "0.6486042", "0.64800584", "0.6419346", "0.6367166", "0.6367166", "0.6358633", "0.6320385", "0.6297763", "0.6283584", "0.62605953", "0.62605953", "0.6215491", "0.6207328", "0.6178071", "0.6175598", "0.6145163", "0.6137619", "0.6129452", "0.61254334", "0.6116405", "0.6113115", "0.60724646", "0.6060597", "0.6047725", "0.6047368", "0.60467404", "0.60287726", "0.60269684", "0.6007902", "0.6006837", "0.6002206", "0.60014683", "0.5994242", "0.59848833", "0.5980772", "0.59765244", "0.596769", "0.59610295", "0.59600997", "0.5957184", "0.59547853", "0.5944004", "0.5919175", "0.5918467", "0.5916492", "0.5913326", "0.59107417", "0.5901796", "0.5896743", "0.5887638", "0.5878354", "0.58754086", "0.5869874", "0.58644444", "0.58607227", "0.58580303", "0.5823796", "0.5819454", "0.58159685", "0.57900065", "0.57853234", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397", "0.5745397" ]
0.80302405
0
WrapMiddlewareFromStdHandler wrap `http.HandlerFunc` into `echo.Middleware`.
func WrapMiddlewareFromStdHandler(h http.Handler) Middleware { return MiddlewareFunc(func(next Handler) Handler { return HandlerFunc(func(c Context) error { h.ServeHTTP( c.Response().StdResponseWriter(), c.Request().StdRequest().WithContext(c), ) if c.Response().Committed() { return nil } return next.Handle(c) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func WrapMiddlewareFromStdHandleFunc(h func(http.ResponseWriter, *http.Request)) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\th(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t)\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapMiddlewareFromStdHandleFuncd(h func(http.ResponseWriter, *http.Request) error) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\tif err := h(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapperMiddleware(w HandlerFuncWrapper) Middleware { return w }", "func WrapperHandlerMiddleware(w HandlerWrapper) Middleware { return w }", "func wrap(handler http.Handler) mwFunc {\n\tif handler == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandler.ServeHTTP(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func Wrap(\n\tmiddleware Middleware,\n\thandler Handler,\n) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tmiddleware(handler)(context.Background(), w, r)\n\t}\n}", "func WrapMiddlewareFromHandler(h HandlerFunc) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\tif err := h.Handle(c); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func (s *Server) wrapMiddleware(h handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := h(s, w, r)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[Error][Server] %+v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t}\n}", "func (ch *CFHosting) EchoMiddleware(h echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\n\t\t// If request is a WebSocket request, don't do anything special\n\t\tupgrade := c.Request().Header.Get(\"Upgrade\")\n\t\twebSocketKey := c.Request().Header.Get(\"Sec-Websocket-Key\")\n\n\t\tif len(upgrade) > 0 && len(webSocketKey) > 0 {\n\t\t\tlog.Infof(\"Not redirecting this request\")\n\t\t\treturn h(c)\n\t\t}\n\n\t\t// Check that we are on HTTPS - redirect if not\n\t\tproto := c.Request().Header.Get(\"X-Forwarded-Proto\")\n\t\tif len(proto) > 0 {\n\t\t\tif proto != \"https\" {\n\t\t\t\tredirect := fmt.Sprintf(\"https://%s%s\", c.Request().Host, c.Request().RequestURI)\n\t\t\t\treturn c.Redirect(301, redirect)\n\t\t\t}\n\t\t\treturn h(c)\n\t\t}\n\n\t\treturn interfaces.NewHTTPShadowError(\n\t\t\thttp.StatusBadRequest,\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t)\n\t}\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(c Context, next HandlerFunc) (err error) {\n\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tc.SetRequest(r)\n\t\t\terr = next(c)\n\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\treturn\n\t}\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(next HandlerFunc) HandlerFunc {\n\t\treturn func(c Context) (err error) {\n\t\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tc.SetRequest(r)\n\t\t\t\tc.SetResponse(newResponse(w))\n\t\t\t\terr = next(c)\n\t\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\t\treturn\n\t\t}\n\t}\n}", "func ToMiddleware(handler func(next http.Handler) http.Handler) Middleware {\n\treturn func(handle http.HandlerFunc) http.HandlerFunc {\n\t\treturn handler(handle).ServeHTTP\n\t}\n}", "func FromHTTPMiddleware(fn func(http.Handler) http.Handler) Handler {\n\treturn HandlerFunc(func(c context.Context) {\n\t\th := fn(mkNextHTTPHandler(c))\n\t\th.ServeHTTP(GetResponseWriter(c), GetRequest(c))\n\t})\n}", "func EchoMiddleware(AppID string) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tvar r *http.Request = c.Request\n\t\tvalidations.AppID = AppID\n\n\t\t// Verify certificate is good\n\t\tcert, err := validations.ValidateCertificate(r)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Verify signature is good\n\t\tbody, err := validations.ValidateSignature(r, cert)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tvar data json.RawMessage\n\n\t\terr = json.Unmarshal(body, &data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tev, err := parser.Parse(data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the request is good\n\t\tif err = validations.ValidateRequest(ev); err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tc.Set(\"echoRequest\", ev)\n\t\tc.Next()\n\t}\n}", "func ToMiddleware(classicMiddleware func(http.HandlerFunc) http.HandlerFunc) Middleware {\n\treturn func(c Container, next Handler) {\n\t\tclassicMiddleware(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t\tnext(c)\n\t\t})(c.GetResponseWriter(), c.GetRequest())\n\t}\n}", "func (s *server) handlerWrapper(h http.Handler) httprouter.Handle {\n\treturn s.middleware(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func (a *Middleware) Wrap(h http.Handler) {\n\ta.Handler = h\n}", "func Wrap(name string, handle HandlerFunc, middlewares ...Middleware) HandlerFunc {\n\tfor i := len(middlewares) - 1; i >= 0; i-- {\n\t\thandle = middlewares[i](name, handle)\n\t}\n\treturn handle\n}", "func Wrap(h http.Handler, o ...ServerOption) http.Handler {\n\tif h == nil {\n\t\tpanic(\"h == nil\")\n\t}\n\thandler := &handler{\n\t\thandler: h,\n\t\ttracer: apm.DefaultTracer(),\n\t\trequestName: ServerRequestName,\n\t}\n\tfor _, o := range o {\n\t\to(handler)\n\t}\n\tif handler.requestIgnorer == nil {\n\t\thandler.requestIgnorer = NewDynamicServerRequestIgnorer(handler.tracer)\n\t}\n\tif handler.recovery == nil {\n\t\thandler.recovery = NewTraceRecovery(handler.tracer)\n\t}\n\treturn handler\n}", "func wrapHandler(handler func(http.ResponseWriter, *http.Request, *receiver.Receiver), rcvr *receiver.Receiver) http.HandlerFunc {\n\treturn func(response http.ResponseWriter, req *http.Request) {\n\t\thandler(response, req, rcvr)\n\t}\n}", "func LoggingMiddleware(next stdhttp.Handler) stdhttp.Handler {\n\treturn LoggingMiddlewareWithOptions(Options{})(next)\n}", "func wrapHandler(h http.HandlerFunc) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\tctx := r.Context()\n\t\tr = r.WithContext(ctx)\n\t\th.ServeHTTP(w, r)\n\t}\n}", "func NewMiddlewareWrapper(logger Logger, metrics Metrics, corsOptions *CORSOptions, globals ServiceGlobals) MiddlewareWrapper {\n\tm := &middlewareWrapperImpl{\n\t\tlogger: logger,\n\t\tmetrics: metrics,\n\t\tglobals: globals,\n\t}\n\tm.corsOptions = m.mergeCORSOptions(corsOptions)\n\treturn m\n}", "func (h Handler) Wrap(middlewares ...Middleware) Handler {\n\treturn Queue(middlewares).Finish(h)\n}", "func wrapHandle(handle httprouter.Handle) mwFunc {\n\tif handle == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandle(w, r, ps)\n\t\tnext(w, r, ps)\n\t}\n}", "func wrapHandler(h func(http.ResponseWriter, *http.Request)) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\thttpcontext.Set(r, \"params\", ps)\n\t\th(w, r)\n\t}\n}", "func TracingHandlerFunc(h http.HandlerFunc) http.HandlerFunc {\n\treturn TracingMiddleware(LoggingMiddleWare(h))\n}", "func Wrap(router *echo.Echo) {\n\trouter.Get(\"/debug/pprof/\", IndexHandler())\n\trouter.Get(\"/debug/pprof/heap\", HeapHandler())\n\trouter.Get(\"/debug/pprof/goroutine\", GoroutineHandler())\n\trouter.Get(\"/debug/pprof/block\", BlockHandler())\n\trouter.Get(\"/debug/pprof/threadcreate\", ThreadCreateHandler())\n\trouter.Get(\"/debug/pprof/cmdline\", CmdlineHandler())\n\trouter.Get(\"/debug/pprof/profile\", ProfileHandler())\n\trouter.Get(\"/debug/pprof/symbol\", SymbolHandler())\n\trouter.Get(\"/debug/pprof/trace\", TraceHandler())\n}", "func wrapFunc(fn http.HandlerFunc) mwFunc {\n\tif fn == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\tfn(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func MakeTracingMiddleware(component string) func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn MakeTracingHandler(next, component)\n\t}\n}", "func Wrap(hf interface{}, mf ...interface{}) Handler {\n\treturn wrap(hf, mf...)\n}", "func wrapMiddleware(mw []Middleware, handler Handler) Handler {\n\n\t// Loop backwards through the middleware invoking each one. Replace the\n\t// handler with the new wrapped handler. Looping backwards ensures that the\n\t// first middleware of the slice is the first to be executed by requests.\n\tfor i := len(mw) - 1; i >= 0; i-- {\n\t\th := mw[i]\n\t\t// h is of type Middleware func(Handler) Handler - so it takes a handler and returns a handler\n\t\tif h != nil {\n\t\t\thandler = h(handler)\n\t\t}\n\t}\n\n\treturn handler\n}", "func Middleware(o ...Option) func(http.Handler) http.Handler {\n\topts := options{\n\t\ttracer: apm.DefaultTracer(),\n\t}\n\tfor _, o := range o {\n\t\to(&opts)\n\t}\n\tif opts.requestIgnorer == nil {\n\t\topts.requestIgnorer = apmhttp.NewDynamicServerRequestIgnorer(opts.tracer)\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\tserverOpts := []apmhttp.ServerOption{\n\t\t\tapmhttp.WithTracer(opts.tracer),\n\t\t\tapmhttp.WithServerRequestName(routeRequestName),\n\t\t\tapmhttp.WithServerRequestIgnorer(opts.requestIgnorer),\n\t\t}\n\t\tif opts.panicPropagation {\n\t\t\tserverOpts = append(serverOpts, apmhttp.WithPanicPropagation())\n\t\t}\n\t\treturn apmhttp.Wrap(\n\t\t\th,\n\t\t\tserverOpts...,\n\t\t)\n\t}\n}", "func (e ErrorHandler) Wrap(handler func(w http.ResponseWriter, r *http.Request) error) http.Handler {\n\treturn errorHandler{\n\t\tHandler: handler,\n\t\tLogWriter: e.LogWriter,\n\t}\n}", "func WrapHandlerFunc(h HandlerFunc) HandlerFunc {\n\treturn func(c *Context) {\n\t\th(c)\n\t\tc.Next()\n\t}\n}", "func NewHandlerWrapper() server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\tmd, _ := metadata.FromContext(ctx)\n\t\t\tlog.Debug().Fields(map[string]interface{}{\n\t\t\t\t\"category\": \"LogWrapper\",\n\t\t\t\t\"service\": req.Service(),\n\t\t\t\t\"method\": req.Method(),\n\t\t\t\t\"ctx\": md,\n\t\t\t}).Msg(\"Server-Side Handler\")\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t//securityLog(ctx, req, rsp)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (v *Verifier) WrapFunc(handler http.HandlerFunc) http.Handler {\n\treturn v.Wrap(http.HandlerFunc(handler))\n}", "func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\t\tw.Header().Set(\"Docker-Experimental\", e.experimental)\n\t\treturn handler(ctx, w, r, vars)\n\t}\n}", "func (aw AWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tw.Write([]byte(\"A wrapper wrote this\\n\"))\n\t})\n}", "func Inject(inner http.Handler) http.Handler {\n\treturn http.HandlerFunc(handler(inner))\n}", "func EchoMiddlewareAutomatic(app *EchoApplication) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tapp.Context.GinContext = c\n\t\tec := app.Context\n\n\t\tvar r *http.Request = c.Request\n\t\tvalidations.AppID = app.AppID\n\n\t\t// Verify certificate is good\n\t\tcert, err := validations.ValidateCertificate(r)\n\t\tif err != nil {\n\t\t\tlog.Println(\"validation of certificate failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Verify signature is good\n\t\tbody, err := validations.ValidateSignature(r, cert)\n\t\tif err != nil {\n\t\t\tlog.Println(\"validation of signature failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif MiddlewareLogInput {\n\t\t\tlog.Println(string(body))\n\t\t}\n\n\t\tvar data json.RawMessage\n\n\t\terr = json.Unmarshal(body, &data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"unmarshalling of json rawmessage failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\treq, err := parser.Parse(data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"parsing of json failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the request is good\n\t\tif err = validations.ValidateRequest(req); err != nil {\n\t\t\tlog.Println(\"validation of request failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tT, err := i18n.Tfunc(req.Request.Locale, \"en-US\")\n\t\tif err != nil {\n\t\t\tlog.Println(\"loading of translate failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tapp.Context.T = T\n\n\t\tres := response.New()\n\t\tc.Set(\"echoRequest\", req)\n\n\t\tif app.OnAuthCheck != nil {\n\t\t\tif err := app.OnAuthCheck(ec, req, res); err != nil {\n\n\t\t\t\tres.AddLinkAccountCard()\n\n\t\t\t\tif req.Request.Locale == \"de-DE\" {\n\t\t\t\t\tres.AddSSMLSpeech(fmt.Sprintf(\"<speak>%v</speak>\", AccountLinkMessageDE))\n\t\t\t\t} else {\n\t\t\t\t\tres.AddSSMLSpeech(fmt.Sprintf(\"<speak>%v</speak>\", AccountLinkMessageEN))\n\t\t\t\t}\n\n\t\t\t\tc.Header(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\t\t\tc.JSON(200, res)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif app.Session != nil {\n\n\t\t\tsess, err := app.Session.New(req.Session.ID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panicln(err)\n\t\t\t}\n\n\t\t\tapp.Context.Session = sess\n\t\t}\n\n\t\tswitch req.Request.Type {\n\t\tcase \"LaunchRequest\":\n\n\t\t\tif app.OnLaunch != nil {\n\t\t\t\tapp.OnLaunch(ec, req, res)\n\t\t\t}\n\n\t\t\tapp.Context.Session.Store()\n\n\t\tcase \"IntentRequest\":\n\n\t\t\tname := req.Request.Intent.Name\n\t\t\tproc, ok := app.intents[name]\n\t\t\tif !ok {\n\n\t\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\t\t\tpanic(\"unknown event \" + name)\n\t\t\t}\n\n\t\t\tproc(ec, req, res)\n\t\t\tapp.Context.Session.Store()\n\n\t\tcase \"SessionEndedRequest\":\n\n\t\t\tif app.OnSessionEnded != nil {\n\t\t\t\tapp.OnSessionEnded(ec, req, res)\n\t\t\t\tapp.Context.Session.DeleteSession()\n\t\t\t}\n\n\t\tdefault:\n\n\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif MiddlewareLogOutput {\n\n\t\t\traw, err := json.Marshal(res)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\t\tlog.Println(string(raw))\n\t\t}\n\n\t\tc.Header(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\tc.JSON(200, res)\n\n\t\tc.Next()\n\t}\n}", "func Adapt(fn func(http.Handler) http.Handler) Middleware {\n\treturn func(ctx *Context, h http.Handler) http.Handler {\n\t\treturn fn(h)\n\t}\n}", "func Middleware() echo.MiddlewareFunc {\n\tstats.Do(func() {\n\t\tstats.init()\n\t})\n\treturn echo.WrapMiddleware(handlerFunc)\n}", "func NewHandlerWrapper(p micro.Publisher) server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\t// add TranID to context if not present\n\t\t\tctx = metadata.MergeContext(ctx, map[string]string{\"trans-id\": uuid.New().String()}, false)\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t// we already logged error in Publish. lets ignore error here.\n\t\t\t_ = publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\t// go publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\treturn\n\t\t}\n\t}\n}", "func handlerWrapper(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\thandler := panicRecover(f)\n\thandler = stopwatch(handler)\n\thandler = i18nLoad(handler)\n\n\treturn handler\n}", "func (c Chain) WrapFunc(handlerFunc HandlerFunc) http.Handler {\n\treturn c.Wrap(http.HandlerFunc(handlerFunc))\n}", "func NewMiddleware(ctx Context, command string) (Middleware, error) {\n\tif command == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tctx.Logger = ctx.Logger.With().\n\t\tStr(LoggerKeyComponent, \"middleware\").\n\t\tStr(\"command\", command).\n\t\tLogger()\n\n\tcmd := exec.CommandContext(ctx.StdContext, command)\n\tcmd.Stderr = &logWrapper{\n\t\tl: ctx.Logger,\n\t}\n\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get stdin pipe: %w\", err)\n\t}\n\n\tctx.Logger.Debug().Msg(\"stdin pipe retrieved\")\n\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get stdout pipe: %w\", err)\n\t}\n\n\tctx.Logger.Debug().Msg(\"stdout pipe retrieved\")\n\n\treturn &mware{\n\t\tcmd: cmd,\n\t\tstdin: stdin,\n\t\tstdout: stdout,\n\t}, nil\n}", "func useMiddlewareHandler(h http.Handler, mw ...Middleware) http.Handler {\n\tfor i := range mw {\n\t\th = mw[len(mw)-1-i](h)\n\t}\n\n\treturn h\n}", "func WrapperHandler(f HandlerFunc, dd ...DecoratorFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := newCtxWithRqID(r.Context(), r)\n\t\thf := f\n\t\tfor _, d := range dd {\n\t\t\thf = d(hf)\n\t\t}\n\t\terr := hf(w, r.WithContext(ctx))\n\t\tif err != nil {\n\t\t\terrProcessor(err, w)\n\t\t}\n\t}\n}", "func NewMiddleware(router *mux.Router, options ...FuncOption) *Middleware {\n\tm := &Middleware{\n\t\toutput: os.Stdout,\n\t\toptions: Options{\n\t\t\tLogging: true,\n\t\t},\n\t\trouter: router,\n\t}\n\n\tfor _, opt := range options {\n\t\topt(m)\n\t}\n\n\tm.RegisterHook(m.loggingProcessor)\n\treturn m\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func Middleware(fn AppHandler, c interface{}) AppHandler {\n\treturn func(w http.ResponseWriter, r *http.Request) *AppError {\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"env\", c))\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"vars\", mux.Vars(r)))\n\t\treturn fn(w, r)\n\t}\n}", "func Middleware(service string, opts ...Option) echo.MiddlewareFunc {\n\tcfg := config{}\n\tfor _, opt := range opts {\n\t\topt.apply(&cfg)\n\t}\n\tif cfg.TracerProvider == nil {\n\t\tcfg.TracerProvider = otel.GetTracerProvider()\n\t}\n\ttracer := cfg.TracerProvider.Tracer(\n\t\ttracerName,\n\t\toteltrace.WithInstrumentationVersion(Version()),\n\t)\n\tif cfg.Propagators == nil {\n\t\tcfg.Propagators = otel.GetTextMapPropagator()\n\t}\n\n\tif cfg.Skipper == nil {\n\t\tcfg.Skipper = middleware.DefaultSkipper\n\t}\n\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tif cfg.Skipper(c) {\n\t\t\t\treturn next(c)\n\t\t\t}\n\n\t\t\tc.Set(tracerKey, tracer)\n\t\t\trequest := c.Request()\n\t\t\tsavedCtx := request.Context()\n\t\t\tdefer func() {\n\t\t\t\trequest = request.WithContext(savedCtx)\n\t\t\t\tc.SetRequest(request)\n\t\t\t}()\n\t\t\tctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(request.Header))\n\t\t\topts := []oteltrace.SpanStartOption{\n\t\t\t\toteltrace.WithAttributes(semconvutil.HTTPServerRequest(service, request)...),\n\t\t\t\toteltrace.WithSpanKind(oteltrace.SpanKindServer),\n\t\t\t}\n\t\t\tif path := c.Path(); path != \"\" {\n\t\t\t\trAttr := semconv.HTTPRoute(path)\n\t\t\t\topts = append(opts, oteltrace.WithAttributes(rAttr))\n\t\t\t}\n\t\t\tspanName := c.Path()\n\t\t\tif spanName == \"\" {\n\t\t\t\tspanName = fmt.Sprintf(\"HTTP %s route not found\", request.Method)\n\t\t\t}\n\n\t\t\tctx, span := tracer.Start(ctx, spanName, opts...)\n\t\t\tdefer span.End()\n\n\t\t\t// pass the span through the request context\n\t\t\tc.SetRequest(request.WithContext(ctx))\n\n\t\t\t// serve the request to the next middleware\n\t\t\terr := next(c)\n\t\t\tif err != nil {\n\t\t\t\tspan.SetAttributes(attribute.String(\"echo.error\", err.Error()))\n\t\t\t\t// invokes the registered HTTP error handler\n\t\t\t\tc.Error(err)\n\t\t\t}\n\n\t\t\tstatus := c.Response().Status\n\t\t\tspan.SetStatus(semconvutil.HTTPServerStatus(status))\n\t\t\tif status > 0 {\n\t\t\t\tspan.SetAttributes(semconv.HTTPStatusCode(status))\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n}", "func EchoHandlerFunc(w http.ResponseWriter, r *http.Request) {\n\trequestBody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr2 := r.Write(bytes.NewBufferString(\"Failed to get request\"))\n\t\tif err2 != nil {\n\t\t\tlog.Fatalf(\"failed to write error response; %s\", err2)\n\t\t}\n\t} else {\n\t\tw.Header().Set(contentTypeHeaderName, r.Header.Get(contentTypeHeaderName))\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, err := w.Write(requestBody)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to write response body; %s\", err)\n\t\t}\n\t}\n}", "func (s *server) loggingMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tlogger := logging.GetLogger(ctx)\n\t\trouteName := mux.CurrentRoute(r).GetName()\n\t\tmethod := r.Method\n\t\trequestLogger := logger.With(\n\t\t\tzap.String(\"route\", routeName),\n\t\t\tzap.String(\"method\", method),\n\t\t)\n\n\t\tctx = logging.ContextWithLogger(ctx, requestLogger)\n\t\tctx = context.WithValue(ctx, \"route\", routeName)\n\t\tctx = context.WithValue(ctx, \"method\", method)\n\n\t\tlogging.GetLogger(ctx).Info(\"request started\")\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\tlogging.GetLogger(ctx).Info(\"request completed\")\n\t})\n}", "func wrap(fn func(map[string]string) http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(mux.Vars(r))(w, r)\n\t}\n}", "func Middleware(\n\tenv *Env,\n) func(http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn middleware{h, env}\n\t}\n}", "func (s *Service) LoggingMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Do stuff here\n\t\tl := log.WithFields(log.Fields{\n\t\t\t\"environment\": s.environment,\n\t\t\t\"request-path\": r.RequestURI,\n\t\t\t\"request-method\": r.Method,\n\t\t})\n\t\tl.Infoln()\n\t\t// Call the next handler, which can be another middleware in the chain, or the final handler.\n\t\tm := httpsnoop.CaptureMetrics(next, w, r)\n\t\tl.WithFields(log.Fields{\n\t\t\t\"request-duration\": m.Duration,\n\t\t\t\"response-code\": m.Code,\n\t\t}).Infoln(\"handler response\")\n\t})\n}", "func simpleMw(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Do stuff here\n\t\tlog.Printf(\"\\nRequestURI: %v\\n\\n\", r.RequestURI)\n\t\t// Call the next handler, which can be another middleware in the chain, or the final handler.\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func DecorateHandler(handler http.Handler, mw ...Middleware) http.Handler {\n\n\tif len(mw) == 0 {\n\t\treturn handler\n\t}\n\n\tn := len(mw) - 1\n\th := handler\n\n\t// Call the right most middleware first\n\tfor i := n; i >= 0; i-- {\n\t\th = mw[i].Handler(h)\n\t}\n\n\treturn PanicTrap(h)\n}", "func LogMiddleware(typ string, opts LogOptions) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tvar message []byte\n\t\t\tvar err error\n\n\t\t\t// Read r.Body, and then replace with a fresh ReadCloser for the next handler\n\t\t\tif message, err = ioutil.ReadAll(r.Body); err != nil {\n\t\t\t\tmessage = []byte(\"<failed to read body: \" + err.Error() + \">\")\n\t\t\t}\n\t\t\t_ = r.Body.Close()\n\t\t\tr.Body = ioutil.NopCloser(bytes.NewBuffer(message))\n\n\t\t\tvar headers http.Header\n\t\t\tvar from string\n\t\t\tif opts.Headers {\n\t\t\t\theaders = r.Header\n\t\t\t}\n\t\t\tif opts.From {\n\t\t\t\tfrom = r.RemoteAddr\n\t\t\t}\n\t\t\tLogRequest(typ, r.Proto, r.Method, r.URL.String(), from, headers, message)\n\n\t\t\t// copy output of HTTP handler to our buffer for later logging\n\t\t\tww := middleware.NewWrapResponseWriter(w, r.ProtoMajor)\n\t\t\tvar buf *bytes.Buffer\n\t\t\tif opts.Response {\n\t\t\t\tbuf = new(bytes.Buffer)\n\t\t\t\tww.Tee(buf)\n\t\t\t}\n\n\t\t\t// print response afterwards\n\t\t\tvar resp []byte\n\t\t\tvar start time.Time\n\t\t\tdefer func() {\n\t\t\t\tif ww.Header().Get(\"Content-Type\") == \"text/event-stream\" {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif opts.Response && ww.BytesWritten() > 0 {\n\t\t\t\t\tresp = buf.Bytes()\n\t\t\t\t}\n\t\t\t\tif ww.Status() >= 400 {\n\t\t\t\t\tresp = nil // avoid printing stacktraces and SSE in response\n\t\t\t\t}\n\t\t\t\tvar hexencode bool\n\t\t\t\tif opts.EncodeBinary && ww.Header().Get(\"Content-Type\") != \"application/json\" {\n\t\t\t\t\thexencode = true\n\t\t\t\t}\n\t\t\t\tLogResponse(ww.Status(), time.Since(start), hexencode, resp)\n\t\t\t}()\n\n\t\t\t// start timer and preform request\n\t\t\tstart = time.Now()\n\t\t\tnext.ServeHTTP(ww, r)\n\t\t})\n\t}\n}", "func NewMiddleware(writer Writer, minOutSeverity string) *Middleware {\n\tmos := NewSeverity(minOutSeverity)\n\treturn &Middleware{\n\t\tWriter: writer,\n\t\tMinOutSeverity: mos,\n\t}\n}", "func InternalRedirectWrap(url string) Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn InternalRedirect(h, url)\n\t}\n}", "func (fn MuxWrappable) Wrapped(tokenCheck bool) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tlogEndpoint(req)\n\t\tif tokenCheck {\n\t\t\t_, ok := AuthHandler(w, req)\n\t\t\tif !ok {\n\t\t\t\treturn // AuthHandler takes care of this stuff\n\t\t\t}\n\t\t}\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tstatus, err := fn(w, req)\n\t\tif err != nil {\n\t\t\temap := makeErrMap()\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, emap[status], status)\n\t\t}\n\t}\n}", "func logMiddleware(handler http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"%s - %s - %s\", r.RemoteAddr, r.Method, r.URL.Path)\n\t\tif debug {\n\t\t\tlog.Printf(\"Request: %+v\", r)\n\t\t}\n\t\t// Execute the original handler\n\t\thandler(w, r)\n\t}\n}", "func Middleware(e *echo.Echo) {\n\te.Use(\n\t\tmiddleware.Logger(),\n\t\tmiddleware.Recover(),\n\t\tcontext.InjectBezuncAPIContext,\n\t)\n}", "func Middleware(options ...HijackOptions) func(http.Handler) http.Handler {\n\topt := DefaultHijackOptions\n\tif len(options) > 0 {\n\t\topt = options[0]\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx, log := chi.RouteContext(r.Context()), middleware.GetLogEntry(r)\n\t\t\tif ctx == nil || r.Method != \"OPTIONS\" {\n\t\t\t\t// Just proxy to the next handler\n\t\t\t\th.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Hijack request\n\t\t\tvar routes Routes\n\t\t\tu := getStringSliceFromURI(r.RequestURI)\n\t\t\tchi.Walk(ctx.Routes, walkFn(u, &routes))\n\t\t\traw, err := opt.Render(routes)\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tlog.Panic(fmt.Sprintf(\"rendering OPTIONS description failed: %s\", err), nil)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.WriteHeader(200)\n\t\t\tw.Header().Add(\"Content-Type\", opt.ContentType)\n\t\t\tw.Write(raw)\n\t\t})\n\t}\n}", "func LoggingMiddleware(svc things.Service, logger log.Logger) things.Service {\n\treturn &loggingMiddleware{logger, svc}\n}", "func With(inner http.HandlerFunc) http.HandlerFunc {\n\treturn http.HandlerFunc(handler(inner))\n}", "func New() echo.MiddlewareFunc {\n\treturn NewWithLogger(logrus.StandardLogger())\n}", "func New() echo.MiddlewareFunc {\n\treturn NewWithLogger(logrus.StandardLogger())\n}", "func NewMiddleware(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger := WithContext(r.Context())\n\n\t\tlogger.Infow(\"Started request\",\n\t\t\t\"method\", r.Method,\n\t\t\t\"path\", r.URL.Path,\n\t\t)\n\n\t\t// reverse proxy replaces original request with target request, so keep original one\n\t\toriginalURL := &url.URL{}\n\t\t*originalURL = *r.URL\n\n\t\tlogger = logger.With(\n\t\t\t\"method\", r.Method,\n\t\t\t\"host\", r.Host,\n\t\t\t\"request\", r.RequestURI,\n\t\t\t\"remote-addr\", r.RemoteAddr,\n\t\t\t\"referer\", r.Referer(),\n\t\t\t\"user-agent\", r.UserAgent(),\n\t\t)\n\n\t\tm := httpsnoop.CaptureMetrics(handler, w, r)\n\n\t\tlogger = logger.With(\n\t\t\t\"code\", m.Code,\n\t\t\t\"duration\", int(m.Duration/time.Millisecond),\n\t\t\t\"duration-fmt\", m.Duration.String(),\n\t\t)\n\n\t\tlogger.Info(\"Completed handling request\")\n\t})\n}", "func (lw LoggingWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tlog.Info(fmt.Sprintf(\"request for %v with method %v\", r.RequestURI, r.Method))\n\t})\n}", "func ChainMiddleware(f http.Handler, middlewares ...Middleware) http.Handler {\n\tfor _, m := range middlewares {\n\t\tf = m(f)\n\t}\n\treturn f\n}", "func Middleware(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\ttracer := opentracing.GlobalTracer()\n\t\toperationName := fmt.Sprintf(\"%s %s%s\", req.Method, req.Host, req.URL.Path)\n\n\t\tvar span opentracing.Span\n\t\tvar ctx context.Context\n\t\tif spanCtx, err := tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header)); err != nil {\n\t\t\tspan, ctx = opentracing.StartSpanFromContext(req.Context(), operationName)\n\t\t\text.SpanKindRPCServer.Set(span)\n\t\t} else {\n\t\t\tspan = tracer.StartSpan(operationName, ext.RPCServerOption((spanCtx)))\n\t\t\tctx = opentracing.ContextWithSpan(req.Context(), span)\n\t\t\text.SpanKindRPCClient.Set(span)\n\t\t}\n\n\t\tbody, _ := ioutil.ReadAll(req.Body)\n\t\tbodyString := string(golib.MaskJSONPassword(body))\n\t\tbodyString = golib.MaskPassword(bodyString)\n\n\t\tisRemoveBody, ok := req.Context().Value(\"remove-tag-body\").(bool)\n\t\tif ok {\n\t\t\tif !isRemoveBody {\n\t\t\t\tspan.SetTag(\"body\", bodyString)\n\t\t\t}\n\t\t} else {\n\t\t\tspan.SetTag(\"body\", bodyString)\n\t\t}\n\n\t\treq.Body = ioutil.NopCloser(bytes.NewBuffer(body)) // reuse body\n\n\t\tspan.SetTag(\"http.headers\", req.Header)\n\t\text.HTTPUrl.Set(span, req.Host+req.RequestURI)\n\t\text.HTTPMethod.Set(span, req.Method)\n\n\t\tspan.LogEvent(\"start_handling_request\")\n\n\t\tdefer func() {\n\t\t\tspan.LogEvent(\"complete_handling_request\")\n\t\t\tspan.Finish()\n\t\t}()\n\n\t\th.ServeHTTP(w, req.WithContext(ctx))\n\t})\n}", "func Middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func (api *API) Use(middleware ...echo.MiddlewareFunc) {\n\tapi.echo.Use(middleware...)\n}", "func (v *Verifier) Wrap(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\tv.Negroni().ServeHTTP(rw, req, handler.ServeHTTP)\n\t})\n}", "func LoggingMiddleware(svc ws.Service, logger log.Logger) ws.Service {\n\treturn &loggingMiddleware{logger, svc}\n}", "func LoggingMiddleware(svc pms.Service, logger log.Logger) pms.Service {\n\treturn &loggingMiddleware{logger, svc}\n}", "func UseMiddleware(mw ...Middleware) func(http.HandlerFunc) http.Handler {\n\treturn func(fn http.HandlerFunc) http.Handler {\n\t\treturn useMiddlewareHandler(fn, mw...)\n\t}\n}", "func makeHandler(fn func(http.ResponseWriter, *http.Request, *Server), s *Server) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, s)\n\t}\n}", "func Wrap(next http.Handler) httprouter.Handle {\n\treturn func(rw http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\t\treq = req.WithContext(context.WithValue(req.Context(), httprouter.ParamsKey, params))\n\t\tnext.ServeHTTP(rw, req)\n\t}\n}", "func (a *App) MountHandler(verb, path string, handler Handler, mw ...Middleware) {\n\thandler = wrapMiddleware(mw, handler)\n\n\t// wrap application level middlewares\n\thandler = wrapMiddleware(a.mw, handler)\n\n\th := func(w http.ResponseWriter, r *http.Request) {\n\t\t// TODO: start tracer span\n\n\t\t// add relevant values the context for propagation\n\t\tv := Values{\n\t\t\tNow: time.Now(),\n\t\t}\n\t\tctx := context.WithValue(r.Context(), KeyValues, &v)\n\n\t\tif err := handler(ctx, w, r); err != nil {\n\t\t\tlog.Println(err)\n\t\t\ta.Shutdown()\n\t\t\treturn\n\t\t}\n\t}\n\ta.HandleFunc(path, h).Methods(verb)\n}", "func LoggingMiddleware(svc authz.Service, logger log.Logger) authz.Service {\n\treturn &loggingMiddleware{logger, svc}\n}", "func LoggingMiddleware(svc authz.Service, logger log.Logger) authz.Service {\n\treturn &loggingMiddleware{logger, svc}\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn handler\n}" ]
[ "0.8091286", "0.7852527", "0.6618271", "0.66112894", "0.62574714", "0.6217333", "0.60465735", "0.58923787", "0.58671194", "0.58613384", "0.5851591", "0.581897", "0.57947665", "0.5778245", "0.577551", "0.5746015", "0.5710405", "0.56949145", "0.56762147", "0.56551254", "0.5640552", "0.56384945", "0.5611489", "0.56106013", "0.5608028", "0.55972165", "0.558583", "0.55804026", "0.5565392", "0.5551906", "0.5531691", "0.5520522", "0.5517601", "0.5498442", "0.5468991", "0.54674083", "0.544396", "0.54385954", "0.54117185", "0.5406375", "0.5406108", "0.5400717", "0.53989977", "0.53927076", "0.53894407", "0.5386442", "0.5385975", "0.5382602", "0.535756", "0.5347268", "0.5347192", "0.5347192", "0.5346847", "0.53283787", "0.5326835", "0.53192526", "0.53117055", "0.5310291", "0.53052115", "0.529581", "0.5252995", "0.5252815", "0.5249931", "0.5231786", "0.5229805", "0.52284867", "0.5227113", "0.5223665", "0.5206734", "0.5206315", "0.52032393", "0.52032393", "0.5187146", "0.5185779", "0.5173865", "0.5170184", "0.51701576", "0.51686156", "0.5167148", "0.5164833", "0.5156158", "0.5138698", "0.513314", "0.5128884", "0.51268303", "0.51264673", "0.51264673", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425", "0.5126425" ]
0.7871749
1
WrapMiddlewareFromStdHandleFunc wrap `func(http.ResponseWriter, http.Request)` into `echo.Middleware`.
func WrapMiddlewareFromStdHandleFunc(h func(http.ResponseWriter, *http.Request)) Middleware { return MiddlewareFunc(func(next Handler) Handler { return HandlerFunc(func(c Context) error { h( c.Response().StdResponseWriter(), c.Request().StdRequest().WithContext(c), ) if c.Response().Committed() { return nil } return next.Handle(c) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func WrapMiddlewareFromStdHandleFuncd(h func(http.ResponseWriter, *http.Request) error) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\tif err := h(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapMiddlewareFromStdHandler(h http.Handler) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\th.ServeHTTP(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t)\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapperMiddleware(w HandlerFuncWrapper) Middleware { return w }", "func Wrap(\n\tmiddleware Middleware,\n\thandler Handler,\n) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tmiddleware(handler)(context.Background(), w, r)\n\t}\n}", "func WrapperHandlerMiddleware(w HandlerWrapper) Middleware { return w }", "func wrap(handler http.Handler) mwFunc {\n\tif handler == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandler.ServeHTTP(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func wrapFunc(fn http.HandlerFunc) mwFunc {\n\tif fn == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\tfn(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func wrap(fn func(map[string]string) http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(mux.Vars(r))(w, r)\n\t}\n}", "func wrapHandle(handle httprouter.Handle) mwFunc {\n\tif handle == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandle(w, r, ps)\n\t\tnext(w, r, ps)\n\t}\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(c Context, next HandlerFunc) (err error) {\n\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tc.SetRequest(r)\n\t\t\terr = next(c)\n\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\treturn\n\t}\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(next HandlerFunc) HandlerFunc {\n\t\treturn func(c Context) (err error) {\n\t\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tc.SetRequest(r)\n\t\t\t\tc.SetResponse(newResponse(w))\n\t\t\t\terr = next(c)\n\t\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\t\treturn\n\t\t}\n\t}\n}", "func EchoHandlerFunc(w http.ResponseWriter, r *http.Request) {\n\trequestBody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr2 := r.Write(bytes.NewBufferString(\"Failed to get request\"))\n\t\tif err2 != nil {\n\t\t\tlog.Fatalf(\"failed to write error response; %s\", err2)\n\t\t}\n\t} else {\n\t\tw.Header().Set(contentTypeHeaderName, r.Header.Get(contentTypeHeaderName))\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, err := w.Write(requestBody)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to write response body; %s\", err)\n\t\t}\n\t}\n}", "func wrapHandler(h func(http.ResponseWriter, *http.Request)) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\thttpcontext.Set(r, \"params\", ps)\n\t\th(w, r)\n\t}\n}", "func (v *Verifier) WrapFunc(handler http.HandlerFunc) http.Handler {\n\treturn v.Wrap(http.HandlerFunc(handler))\n}", "func (s *Server) wrapMiddleware(h handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := h(s, w, r)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[Error][Server] %+v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t}\n}", "func Wrap(name string, handle HandlerFunc, middlewares ...Middleware) HandlerFunc {\n\tfor i := len(middlewares) - 1; i >= 0; i-- {\n\t\thandle = middlewares[i](name, handle)\n\t}\n\treturn handle\n}", "func (s *server) handlerWrapper(h http.Handler) httprouter.Handle {\n\treturn s.middleware(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func handlerWrapper(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\thandler := panicRecover(f)\n\thandler = stopwatch(handler)\n\thandler = i18nLoad(handler)\n\n\treturn handler\n}", "func (aw AWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tw.Write([]byte(\"A wrapper wrote this\\n\"))\n\t})\n}", "func (m *Metrics) WrapHandleFunc(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tbefore := time.Now()\n\t\trw := &statusRecorder{\n\t\t\tResponseWriter: w,\n\t\t\tstatusCode: http.StatusOK,\n\t\t}\n\t\th.ServeHTTP(rw, r)\n\t\tafter := time.Now()\n\t\tm.add(rw, after.Sub(before).Seconds())\n\t})\n}", "func wrapHandler(h http.HandlerFunc) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\tctx := r.Context()\n\t\tr = r.WithContext(ctx)\n\t\th.ServeHTTP(w, r)\n\t}\n}", "func NewMiddlewareWrapper(logger Logger, metrics Metrics, corsOptions *CORSOptions, globals ServiceGlobals) MiddlewareWrapper {\n\tm := &middlewareWrapperImpl{\n\t\tlogger: logger,\n\t\tmetrics: metrics,\n\t\tglobals: globals,\n\t}\n\tm.corsOptions = m.mergeCORSOptions(corsOptions)\n\treturn m\n}", "func FromHTTPMiddleware(fn func(http.Handler) http.Handler) Handler {\n\treturn HandlerFunc(func(c context.Context) {\n\t\th := fn(mkNextHTTPHandler(c))\n\t\th.ServeHTTP(GetResponseWriter(c), GetRequest(c))\n\t})\n}", "func (ch *CFHosting) EchoMiddleware(h echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\n\t\t// If request is a WebSocket request, don't do anything special\n\t\tupgrade := c.Request().Header.Get(\"Upgrade\")\n\t\twebSocketKey := c.Request().Header.Get(\"Sec-Websocket-Key\")\n\n\t\tif len(upgrade) > 0 && len(webSocketKey) > 0 {\n\t\t\tlog.Infof(\"Not redirecting this request\")\n\t\t\treturn h(c)\n\t\t}\n\n\t\t// Check that we are on HTTPS - redirect if not\n\t\tproto := c.Request().Header.Get(\"X-Forwarded-Proto\")\n\t\tif len(proto) > 0 {\n\t\t\tif proto != \"https\" {\n\t\t\t\tredirect := fmt.Sprintf(\"https://%s%s\", c.Request().Host, c.Request().RequestURI)\n\t\t\t\treturn c.Redirect(301, redirect)\n\t\t\t}\n\t\t\treturn h(c)\n\t\t}\n\n\t\treturn interfaces.NewHTTPShadowError(\n\t\t\thttp.StatusBadRequest,\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t)\n\t}\n}", "func ToMiddleware(classicMiddleware func(http.HandlerFunc) http.HandlerFunc) Middleware {\n\treturn func(c Container, next Handler) {\n\t\tclassicMiddleware(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t\tnext(c)\n\t\t})(c.GetResponseWriter(), c.GetRequest())\n\t}\n}", "func EchoMiddlewareAutomatic(app *EchoApplication) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tapp.Context.GinContext = c\n\t\tec := app.Context\n\n\t\tvar r *http.Request = c.Request\n\t\tvalidations.AppID = app.AppID\n\n\t\t// Verify certificate is good\n\t\tcert, err := validations.ValidateCertificate(r)\n\t\tif err != nil {\n\t\t\tlog.Println(\"validation of certificate failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Verify signature is good\n\t\tbody, err := validations.ValidateSignature(r, cert)\n\t\tif err != nil {\n\t\t\tlog.Println(\"validation of signature failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif MiddlewareLogInput {\n\t\t\tlog.Println(string(body))\n\t\t}\n\n\t\tvar data json.RawMessage\n\n\t\terr = json.Unmarshal(body, &data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"unmarshalling of json rawmessage failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\treq, err := parser.Parse(data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"parsing of json failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the request is good\n\t\tif err = validations.ValidateRequest(req); err != nil {\n\t\t\tlog.Println(\"validation of request failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tT, err := i18n.Tfunc(req.Request.Locale, \"en-US\")\n\t\tif err != nil {\n\t\t\tlog.Println(\"loading of translate failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tapp.Context.T = T\n\n\t\tres := response.New()\n\t\tc.Set(\"echoRequest\", req)\n\n\t\tif app.OnAuthCheck != nil {\n\t\t\tif err := app.OnAuthCheck(ec, req, res); err != nil {\n\n\t\t\t\tres.AddLinkAccountCard()\n\n\t\t\t\tif req.Request.Locale == \"de-DE\" {\n\t\t\t\t\tres.AddSSMLSpeech(fmt.Sprintf(\"<speak>%v</speak>\", AccountLinkMessageDE))\n\t\t\t\t} else {\n\t\t\t\t\tres.AddSSMLSpeech(fmt.Sprintf(\"<speak>%v</speak>\", AccountLinkMessageEN))\n\t\t\t\t}\n\n\t\t\t\tc.Header(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\t\t\tc.JSON(200, res)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif app.Session != nil {\n\n\t\t\tsess, err := app.Session.New(req.Session.ID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panicln(err)\n\t\t\t}\n\n\t\t\tapp.Context.Session = sess\n\t\t}\n\n\t\tswitch req.Request.Type {\n\t\tcase \"LaunchRequest\":\n\n\t\t\tif app.OnLaunch != nil {\n\t\t\t\tapp.OnLaunch(ec, req, res)\n\t\t\t}\n\n\t\t\tapp.Context.Session.Store()\n\n\t\tcase \"IntentRequest\":\n\n\t\t\tname := req.Request.Intent.Name\n\t\t\tproc, ok := app.intents[name]\n\t\t\tif !ok {\n\n\t\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\t\t\tpanic(\"unknown event \" + name)\n\t\t\t}\n\n\t\t\tproc(ec, req, res)\n\t\t\tapp.Context.Session.Store()\n\n\t\tcase \"SessionEndedRequest\":\n\n\t\t\tif app.OnSessionEnded != nil {\n\t\t\t\tapp.OnSessionEnded(ec, req, res)\n\t\t\t\tapp.Context.Session.DeleteSession()\n\t\t\t}\n\n\t\tdefault:\n\n\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif MiddlewareLogOutput {\n\n\t\t\traw, err := json.Marshal(res)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\t\tlog.Println(string(raw))\n\t\t}\n\n\t\tc.Header(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\tc.JSON(200, res)\n\n\t\tc.Next()\n\t}\n}", "func authWrapFunc(f func(http.ResponseWriter, *http.Request)) http.Handler {\n\treturn negroni.New(&AuthMiddleware{}, negroni.Wrap(http.HandlerFunc(f)))\n}", "func Middleware(o ...Option) func(http.Handler) http.Handler {\n\topts := options{\n\t\ttracer: apm.DefaultTracer(),\n\t}\n\tfor _, o := range o {\n\t\to(&opts)\n\t}\n\tif opts.requestIgnorer == nil {\n\t\topts.requestIgnorer = apmhttp.NewDynamicServerRequestIgnorer(opts.tracer)\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\tserverOpts := []apmhttp.ServerOption{\n\t\t\tapmhttp.WithTracer(opts.tracer),\n\t\t\tapmhttp.WithServerRequestName(routeRequestName),\n\t\t\tapmhttp.WithServerRequestIgnorer(opts.requestIgnorer),\n\t\t}\n\t\tif opts.panicPropagation {\n\t\t\tserverOpts = append(serverOpts, apmhttp.WithPanicPropagation())\n\t\t}\n\t\treturn apmhttp.Wrap(\n\t\t\th,\n\t\t\tserverOpts...,\n\t\t)\n\t}\n}", "func (fn MuxWrappable) Wrapped(tokenCheck bool) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tlogEndpoint(req)\n\t\tif tokenCheck {\n\t\t\t_, ok := AuthHandler(w, req)\n\t\t\tif !ok {\n\t\t\t\treturn // AuthHandler takes care of this stuff\n\t\t\t}\n\t\t}\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tstatus, err := fn(w, req)\n\t\tif err != nil {\n\t\t\temap := makeErrMap()\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, emap[status], status)\n\t\t}\n\t}\n}", "func Middleware(fn AppHandler, c interface{}) AppHandler {\n\treturn func(w http.ResponseWriter, r *http.Request) *AppError {\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"env\", c))\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"vars\", mux.Vars(r)))\n\t\treturn fn(w, r)\n\t}\n}", "func (c Chain) WrapFunc(handlerFunc HandlerFunc) http.Handler {\n\treturn c.Wrap(http.HandlerFunc(handlerFunc))\n}", "func EchoMiddleware(AppID string) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tvar r *http.Request = c.Request\n\t\tvalidations.AppID = AppID\n\n\t\t// Verify certificate is good\n\t\tcert, err := validations.ValidateCertificate(r)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Verify signature is good\n\t\tbody, err := validations.ValidateSignature(r, cert)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tvar data json.RawMessage\n\n\t\terr = json.Unmarshal(body, &data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tev, err := parser.Parse(data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the request is good\n\t\tif err = validations.ValidateRequest(ev); err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tc.Set(\"echoRequest\", ev)\n\t\tc.Next()\n\t}\n}", "func Wrap(next http.Handler) httprouter.Handle {\n\treturn func(rw http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\t\treq = req.WithContext(context.WithValue(req.Context(), httprouter.ParamsKey, params))\n\t\tnext.ServeHTTP(rw, req)\n\t}\n}", "func TracingHandlerFunc(h http.HandlerFunc) http.HandlerFunc {\n\treturn TracingMiddleware(LoggingMiddleWare(h))\n}", "func wrapHandler(handler func(http.ResponseWriter, *http.Request, *receiver.Receiver), rcvr *receiver.Receiver) http.HandlerFunc {\n\treturn func(response http.ResponseWriter, req *http.Request) {\n\t\thandler(response, req, rcvr)\n\t}\n}", "func WrapMiddlewareFromHandler(h HandlerFunc) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\tif err := h.Handle(c); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func (a *Middleware) Wrap(h http.Handler) {\n\ta.Handler = h\n}", "func Wrap(router *echo.Echo) {\n\trouter.Get(\"/debug/pprof/\", IndexHandler())\n\trouter.Get(\"/debug/pprof/heap\", HeapHandler())\n\trouter.Get(\"/debug/pprof/goroutine\", GoroutineHandler())\n\trouter.Get(\"/debug/pprof/block\", BlockHandler())\n\trouter.Get(\"/debug/pprof/threadcreate\", ThreadCreateHandler())\n\trouter.Get(\"/debug/pprof/cmdline\", CmdlineHandler())\n\trouter.Get(\"/debug/pprof/profile\", ProfileHandler())\n\trouter.Get(\"/debug/pprof/symbol\", SymbolHandler())\n\trouter.Get(\"/debug/pprof/trace\", TraceHandler())\n}", "func Wrap(h http.Handler, o ...ServerOption) http.Handler {\n\tif h == nil {\n\t\tpanic(\"h == nil\")\n\t}\n\thandler := &handler{\n\t\thandler: h,\n\t\ttracer: apm.DefaultTracer(),\n\t\trequestName: ServerRequestName,\n\t}\n\tfor _, o := range o {\n\t\to(handler)\n\t}\n\tif handler.requestIgnorer == nil {\n\t\thandler.requestIgnorer = NewDynamicServerRequestIgnorer(handler.tracer)\n\t}\n\tif handler.recovery == nil {\n\t\thandler.recovery = NewTraceRecovery(handler.tracer)\n\t}\n\treturn handler\n}", "func ToMiddleware(handler func(next http.Handler) http.Handler) Middleware {\n\treturn func(handle http.HandlerFunc) http.HandlerFunc {\n\t\treturn handler(handle).ServeHTTP\n\t}\n}", "func Adapt(fn func(http.Handler) http.Handler) Middleware {\n\treturn func(ctx *Context, h http.Handler) http.Handler {\n\t\treturn fn(h)\n\t}\n}", "func WrapperHandler(f HandlerFunc, dd ...DecoratorFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := newCtxWithRqID(r.Context(), r)\n\t\thf := f\n\t\tfor _, d := range dd {\n\t\t\thf = d(hf)\n\t\t}\n\t\terr := hf(w, r.WithContext(ctx))\n\t\tif err != nil {\n\t\t\terrProcessor(err, w)\n\t\t}\n\t}\n}", "func (lw LoggingWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tlog.Info(fmt.Sprintf(\"request for %v with method %v\", r.RequestURI, r.Method))\n\t})\n}", "func WrapHandlerFunc(h HandlerFunc) HandlerFunc {\n\treturn func(c *Context) {\n\t\th(c)\n\t\tc.Next()\n\t}\n}", "func Middleware(service string, opts ...Option) echo.MiddlewareFunc {\n\tcfg := config{}\n\tfor _, opt := range opts {\n\t\topt.apply(&cfg)\n\t}\n\tif cfg.TracerProvider == nil {\n\t\tcfg.TracerProvider = otel.GetTracerProvider()\n\t}\n\ttracer := cfg.TracerProvider.Tracer(\n\t\ttracerName,\n\t\toteltrace.WithInstrumentationVersion(Version()),\n\t)\n\tif cfg.Propagators == nil {\n\t\tcfg.Propagators = otel.GetTextMapPropagator()\n\t}\n\n\tif cfg.Skipper == nil {\n\t\tcfg.Skipper = middleware.DefaultSkipper\n\t}\n\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tif cfg.Skipper(c) {\n\t\t\t\treturn next(c)\n\t\t\t}\n\n\t\t\tc.Set(tracerKey, tracer)\n\t\t\trequest := c.Request()\n\t\t\tsavedCtx := request.Context()\n\t\t\tdefer func() {\n\t\t\t\trequest = request.WithContext(savedCtx)\n\t\t\t\tc.SetRequest(request)\n\t\t\t}()\n\t\t\tctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(request.Header))\n\t\t\topts := []oteltrace.SpanStartOption{\n\t\t\t\toteltrace.WithAttributes(semconvutil.HTTPServerRequest(service, request)...),\n\t\t\t\toteltrace.WithSpanKind(oteltrace.SpanKindServer),\n\t\t\t}\n\t\t\tif path := c.Path(); path != \"\" {\n\t\t\t\trAttr := semconv.HTTPRoute(path)\n\t\t\t\topts = append(opts, oteltrace.WithAttributes(rAttr))\n\t\t\t}\n\t\t\tspanName := c.Path()\n\t\t\tif spanName == \"\" {\n\t\t\t\tspanName = fmt.Sprintf(\"HTTP %s route not found\", request.Method)\n\t\t\t}\n\n\t\t\tctx, span := tracer.Start(ctx, spanName, opts...)\n\t\t\tdefer span.End()\n\n\t\t\t// pass the span through the request context\n\t\t\tc.SetRequest(request.WithContext(ctx))\n\n\t\t\t// serve the request to the next middleware\n\t\t\terr := next(c)\n\t\t\tif err != nil {\n\t\t\t\tspan.SetAttributes(attribute.String(\"echo.error\", err.Error()))\n\t\t\t\t// invokes the registered HTTP error handler\n\t\t\t\tc.Error(err)\n\t\t\t}\n\n\t\t\tstatus := c.Response().Status\n\t\t\tspan.SetStatus(semconvutil.HTTPServerStatus(status))\n\t\t\tif status > 0 {\n\t\t\t\tspan.SetAttributes(semconv.HTTPStatusCode(status))\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n}", "func (api *API) Use(middleware ...echo.MiddlewareFunc) {\n\tapi.echo.Use(middleware...)\n}", "func (e ErrorHandler) Wrap(handler func(w http.ResponseWriter, r *http.Request) error) http.Handler {\n\treturn errorHandler{\n\t\tHandler: handler,\n\t\tLogWriter: e.LogWriter,\n\t}\n}", "func (w HandlerFuncWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tw(next)(rw, r)\n}", "func (fn EchoHandlerFunc) Handle(params EchoParams) middleware.Responder {\n\treturn fn(params)\n}", "func adaptHandlerFunc(fn func(w http.ResponseWriter, r *http.Request)) Handler {\n\treturn adaptHandler(http.HandlerFunc(fn))\n}", "func logMiddleware(handler http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"%s - %s - %s\", r.RemoteAddr, r.Method, r.URL.Path)\n\t\tif debug {\n\t\t\tlog.Printf(\"Request: %+v\", r)\n\t\t}\n\t\t// Execute the original handler\n\t\thandler(w, r)\n\t}\n}", "func LogMiddleware(typ string, opts LogOptions) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tvar message []byte\n\t\t\tvar err error\n\n\t\t\t// Read r.Body, and then replace with a fresh ReadCloser for the next handler\n\t\t\tif message, err = ioutil.ReadAll(r.Body); err != nil {\n\t\t\t\tmessage = []byte(\"<failed to read body: \" + err.Error() + \">\")\n\t\t\t}\n\t\t\t_ = r.Body.Close()\n\t\t\tr.Body = ioutil.NopCloser(bytes.NewBuffer(message))\n\n\t\t\tvar headers http.Header\n\t\t\tvar from string\n\t\t\tif opts.Headers {\n\t\t\t\theaders = r.Header\n\t\t\t}\n\t\t\tif opts.From {\n\t\t\t\tfrom = r.RemoteAddr\n\t\t\t}\n\t\t\tLogRequest(typ, r.Proto, r.Method, r.URL.String(), from, headers, message)\n\n\t\t\t// copy output of HTTP handler to our buffer for later logging\n\t\t\tww := middleware.NewWrapResponseWriter(w, r.ProtoMajor)\n\t\t\tvar buf *bytes.Buffer\n\t\t\tif opts.Response {\n\t\t\t\tbuf = new(bytes.Buffer)\n\t\t\t\tww.Tee(buf)\n\t\t\t}\n\n\t\t\t// print response afterwards\n\t\t\tvar resp []byte\n\t\t\tvar start time.Time\n\t\t\tdefer func() {\n\t\t\t\tif ww.Header().Get(\"Content-Type\") == \"text/event-stream\" {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif opts.Response && ww.BytesWritten() > 0 {\n\t\t\t\t\tresp = buf.Bytes()\n\t\t\t\t}\n\t\t\t\tif ww.Status() >= 400 {\n\t\t\t\t\tresp = nil // avoid printing stacktraces and SSE in response\n\t\t\t\t}\n\t\t\t\tvar hexencode bool\n\t\t\t\tif opts.EncodeBinary && ww.Header().Get(\"Content-Type\") != \"application/json\" {\n\t\t\t\t\thexencode = true\n\t\t\t\t}\n\t\t\t\tLogResponse(ww.Status(), time.Since(start), hexencode, resp)\n\t\t\t}()\n\n\t\t\t// start timer and preform request\n\t\t\tstart = time.Now()\n\t\t\tnext.ServeHTTP(ww, r)\n\t\t})\n\t}\n}", "func (s *server) middleware(n httprouter.Handle) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\t// Log the basics\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"method\": r.Method,\n\t\t\t\"remote-addr\": r.RemoteAddr,\n\t\t\t\"http-protocol\": r.Proto,\n\t\t\t\"headers\": r.Header,\n\t\t\t\"content-length\": r.ContentLength,\n\t\t}).Debugf(\"HTTP Request to %s\", r.URL)\n\n\t\tif r.ContentLength > 0 {\n\t\t\t// Dump payload into logs for visibility\n\t\t\tb, err := ioutil.ReadAll(r.Body)\n\t\t\tif err == nil {\n\t\t\t\tlog.Debugf(\"Dumping Payload for request to %s: %s\", r.URL, b)\n\t\t\t}\n\t\t}\n\n\t\t// Call registered handler\n\t\tn(w, r, ps)\n\t}\n}", "func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\t\tw.Header().Set(\"Docker-Experimental\", e.experimental)\n\t\treturn handler(ctx, w, r, vars)\n\t}\n}", "func Wrap(hf interface{}, mf ...interface{}) Handler {\n\treturn wrap(hf, mf...)\n}", "func MakeTracingMiddleware(component string) func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn MakeTracingHandler(next, component)\n\t}\n}", "func Middleware(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\ttracer := opentracing.GlobalTracer()\n\t\toperationName := fmt.Sprintf(\"%s %s%s\", req.Method, req.Host, req.URL.Path)\n\n\t\tvar span opentracing.Span\n\t\tvar ctx context.Context\n\t\tif spanCtx, err := tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header)); err != nil {\n\t\t\tspan, ctx = opentracing.StartSpanFromContext(req.Context(), operationName)\n\t\t\text.SpanKindRPCServer.Set(span)\n\t\t} else {\n\t\t\tspan = tracer.StartSpan(operationName, ext.RPCServerOption((spanCtx)))\n\t\t\tctx = opentracing.ContextWithSpan(req.Context(), span)\n\t\t\text.SpanKindRPCClient.Set(span)\n\t\t}\n\n\t\tbody, _ := ioutil.ReadAll(req.Body)\n\t\tbodyString := string(golib.MaskJSONPassword(body))\n\t\tbodyString = golib.MaskPassword(bodyString)\n\n\t\tisRemoveBody, ok := req.Context().Value(\"remove-tag-body\").(bool)\n\t\tif ok {\n\t\t\tif !isRemoveBody {\n\t\t\t\tspan.SetTag(\"body\", bodyString)\n\t\t\t}\n\t\t} else {\n\t\t\tspan.SetTag(\"body\", bodyString)\n\t\t}\n\n\t\treq.Body = ioutil.NopCloser(bytes.NewBuffer(body)) // reuse body\n\n\t\tspan.SetTag(\"http.headers\", req.Header)\n\t\text.HTTPUrl.Set(span, req.Host+req.RequestURI)\n\t\text.HTTPMethod.Set(span, req.Method)\n\n\t\tspan.LogEvent(\"start_handling_request\")\n\n\t\tdefer func() {\n\t\t\tspan.LogEvent(\"complete_handling_request\")\n\t\t\tspan.Finish()\n\t\t}()\n\n\t\th.ServeHTTP(w, req.WithContext(ctx))\n\t})\n}", "func Middleware() echo.MiddlewareFunc {\n\tstats.Do(func() {\n\t\tstats.init()\n\t})\n\treturn echo.WrapMiddleware(handlerFunc)\n}", "func (s *server) loggingMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tlogger := logging.GetLogger(ctx)\n\t\trouteName := mux.CurrentRoute(r).GetName()\n\t\tmethod := r.Method\n\t\trequestLogger := logger.With(\n\t\t\tzap.String(\"route\", routeName),\n\t\t\tzap.String(\"method\", method),\n\t\t)\n\n\t\tctx = logging.ContextWithLogger(ctx, requestLogger)\n\t\tctx = context.WithValue(ctx, \"route\", routeName)\n\t\tctx = context.WithValue(ctx, \"method\", method)\n\n\t\tlogging.GetLogger(ctx).Info(\"request started\")\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\tlogging.GetLogger(ctx).Info(\"request completed\")\n\t})\n}", "func (p *spaDevProxy) HandleFunc(w http.ResponseWriter, r *http.Request) {\n\tp.proxy.ServeHTTP(w, r)\n}", "func (mf MiddlewareFunc) Run(req *Request, handler Handler) (*Response, error) {\n\treturn mf(req, handler)\n}", "func (f MiddlewareFunc) ServeHTTP(w http.ResponseWriter, r *http.Request, next func()) {\n\tf(w, r, next)\n}", "func Wrapper(fn RequestHandlerFunc, mds ...func(RequestHandlerFunc) RequestHandlerFunc) RequestHandlerFunc {\n\tfor _, md := range mds {\n\t\tfn = md(fn)\n\t}\n\treturn fn\n}", "func (h Handler) Wrap(middlewares ...Middleware) Handler {\n\treturn Queue(middlewares).Finish(h)\n}", "func Middleware(options ...HijackOptions) func(http.Handler) http.Handler {\n\topt := DefaultHijackOptions\n\tif len(options) > 0 {\n\t\topt = options[0]\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx, log := chi.RouteContext(r.Context()), middleware.GetLogEntry(r)\n\t\t\tif ctx == nil || r.Method != \"OPTIONS\" {\n\t\t\t\t// Just proxy to the next handler\n\t\t\t\th.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Hijack request\n\t\t\tvar routes Routes\n\t\t\tu := getStringSliceFromURI(r.RequestURI)\n\t\t\tchi.Walk(ctx.Routes, walkFn(u, &routes))\n\t\t\traw, err := opt.Render(routes)\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tlog.Panic(fmt.Sprintf(\"rendering OPTIONS description failed: %s\", err), nil)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.WriteHeader(200)\n\t\t\tw.Header().Add(\"Content-Type\", opt.ContentType)\n\t\t\tw.Write(raw)\n\t\t})\n\t}\n}", "func Middleware(\n\tenv *Env,\n) func(http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn middleware{h, env}\n\t}\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func (m *MuxTracer) TraceHandleFunc(handler http.HandlerFunc) http.HandlerFunc {\n\n\treturn func(writer http.ResponseWriter, req *http.Request) {\n\n\t\t// bail our if tracing isn't enabled.\n\t\tif !m.tracer.Enabled() {\n\t\t\thandler(writer, req)\n\t\t\treturn\n\t\t}\n\n\t\t// trace the request\n\t\ttracedRequest, span := m.trace(req)\n\t\tdefer span.Finish()\n\n\t\t// trace the response\n\t\ttracedWriter := newTracedResponseWriter(span, writer)\n\n\t\t// run the request\n\t\thandler(tracedWriter, tracedRequest)\n\t}\n}", "func InternalRedirectWrap(url string) Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn InternalRedirect(h, url)\n\t}\n}", "func simpleMw(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Do stuff here\n\t\tlog.Printf(\"\\nRequestURI: %v\\n\\n\", r.RequestURI)\n\t\t// Call the next handler, which can be another middleware in the chain, or the final handler.\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func LoggingMiddleware(next stdhttp.Handler) stdhttp.Handler {\n\treturn LoggingMiddlewareWithOptions(Options{})(next)\n}", "func LoggingMiddleware(next http.Handler) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tstart := time.Now()\n\t\twrapped := wrapResponseWriter(w)\n\t\tnext.ServeHTTP(wrapped, r)\n\t\tLog.Info().Int(\"status\", wrapped.status).Str(\"method\", r.Method).Str(\"path\", r.URL.EscapedPath()).Str(\"duration\", time.Since(start).String()).Msg(\"Request processed\")\n\t})\n}", "func Middleware(e *echo.Echo) {\n\te.Use(\n\t\tmiddleware.Logger(),\n\t\tmiddleware.Recover(),\n\t\tcontext.InjectBezuncAPIContext,\n\t)\n}", "func wrappedHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tgg, ok := r.URL.Query()[\"go-get\"]\n\t\tif ok && len(gg) == 1 && gg[0] == \"1\" {\n\t\t\t// Serve a trivial html page.\n\t\t\tw.Write([]byte(goGetHTML5))\n\t\t\treturn\n\t\t}\n\t\t// Fallthrough.\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func MiddlewarePrint(h http.HandlerFunc) http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Store the time prior to handling\n\t\tstart := time.Now()\n\n\t\t// Wrap the response writer to record code\n\t\t// Ideally we'd instead take mux.HandlerFunc\n\t\tcw := newCodeResponseWriter(w)\n\n\t\t// Run the handler with our recording response writer\n\t\th(cw, r)\n\n\t\t// Calculate method, url, code, response time\n\t\tmethod := r.Method\n\t\turl := r.URL.Path\n\t\tduration := time.Now().UTC().Sub(start)\n\t\tcode := cw.StatusCode\n\n\t\t// Skip logging assets, favicon\n\t\tif strings.HasPrefix(url, \"/assets\") || strings.HasPrefix(url, \"/favicon.ico\") {\n\t\t\treturn\n\t\t}\n\n\t\t// Pretty print to the standard loggers colorized\n\t\tlogWithColor(method, url, code, duration)\n\t}\n}", "func NewMiddleware(ctx Context, command string) (Middleware, error) {\n\tif command == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tctx.Logger = ctx.Logger.With().\n\t\tStr(LoggerKeyComponent, \"middleware\").\n\t\tStr(\"command\", command).\n\t\tLogger()\n\n\tcmd := exec.CommandContext(ctx.StdContext, command)\n\tcmd.Stderr = &logWrapper{\n\t\tl: ctx.Logger,\n\t}\n\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get stdin pipe: %w\", err)\n\t}\n\n\tctx.Logger.Debug().Msg(\"stdin pipe retrieved\")\n\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get stdout pipe: %w\", err)\n\t}\n\n\tctx.Logger.Debug().Msg(\"stdout pipe retrieved\")\n\n\treturn &mware{\n\t\tcmd: cmd,\n\t\tstdin: stdin,\n\t\tstdout: stdout,\n\t}, nil\n}", "func makeHandler(env env, fn func(http.ResponseWriter, *http.Request, env)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, env)\n\t}\n}", "func (bw BWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tw.Write([]byte(\"B wrapper wrote this\\n\"))\n\t})\n\n}", "func (a *BasicAuth) Wrap(wrapped AuthenticatedHandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif username := a.CheckAuth(r); username == \"\" {\n\t\t\ta.RequireAuth(w, r)\n\t\t} else {\n\t\t\tar := &AuthenticatedRequest{Request: *r, Username: username}\n\t\t\twrapped(w, ar)\n\t\t}\n\t}\n}", "func (v *Verifier) Wrap(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\tv.Negroni().ServeHTTP(rw, req, handler.ServeHTTP)\n\t})\n}", "func (s *Service) LoggingMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Do stuff here\n\t\tl := log.WithFields(log.Fields{\n\t\t\t\"environment\": s.environment,\n\t\t\t\"request-path\": r.RequestURI,\n\t\t\t\"request-method\": r.Method,\n\t\t})\n\t\tl.Infoln()\n\t\t// Call the next handler, which can be another middleware in the chain, or the final handler.\n\t\tm := httpsnoop.CaptureMetrics(next, w, r)\n\t\tl.WithFields(log.Fields{\n\t\t\t\"request-duration\": m.Duration,\n\t\t\t\"response-code\": m.Code,\n\t\t}).Infoln(\"handler response\")\n\t})\n}", "func makeHandler(fn func(http.ResponseWriter, *http.Request, *Server), s *Server) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, s)\n\t}\n}", "func NewHandlerWrapper(p micro.Publisher) server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\t// add TranID to context if not present\n\t\t\tctx = metadata.MergeContext(ctx, map[string]string{\"trans-id\": uuid.New().String()}, false)\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t// we already logged error in Publish. lets ignore error here.\n\t\t\t_ = publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\t// go publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\treturn\n\t\t}\n\t}\n}", "func NewHandlerWrapper() server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\tmd, _ := metadata.FromContext(ctx)\n\t\t\tlog.Debug().Fields(map[string]interface{}{\n\t\t\t\t\"category\": \"LogWrapper\",\n\t\t\t\t\"service\": req.Service(),\n\t\t\t\t\"method\": req.Method(),\n\t\t\t\t\"ctx\": md,\n\t\t\t}).Msg(\"Server-Side Handler\")\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t//securityLog(ctx, req, rsp)\n\t\t\treturn\n\t\t}\n\t}\n}", "func echoContextHandler(ctx context.Context, in io.Reader, out io.Writer) {\n\tnctx := GetContext(ctx)\n\n\tif resp, ok := out.(http.ResponseWriter); ok {\n\t\tresp.Header().Add(\"traceId\", nctx.TracingContextData().TraceId())\n\t\tresp.Header().Add(\"spanId\", nctx.TracingContextData().SpanId())\n\t\tresp.Header().Add(\"parentSpanId\", nctx.TracingContextData().ParentSpanId())\n\t\tresp.Header().Add(\"sampled\", strconv.FormatBool(nctx.TracingContextData().IsSampled()))\n\t\tresp.Header().Add(\"ociURL\", nctx.TracingContextData().TraceCollectorURL())\n\t\tresp.Header().Add(\"flag\", nctx.TracingContextData().Flags())\n\t\tresp.Header().Add(\"ServiceName\", nctx.TracingContextData().ServiceName())\n\t}\n\t// XXX(reed): could configure this to test too\n\n\tWriteStatus(out, http.StatusTeapot+2)\n\tio.Copy(out, in)\n}", "func Middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func (s *HTTPServer) wrap(handler endpoint, methods []string) http.HandlerFunc {\n\treturn func(resp http.ResponseWriter, req *http.Request) {\n\t\tsetHeaders(resp, s.agent.config.HTTPResponseHeaders)\n\t\tsetTranslateAddr(resp, s.agent.config.TranslateWANAddrs)\n\n\t\t// Obfuscate any tokens from appearing in the logs\n\t\tformVals, err := url.ParseQuery(req.URL.RawQuery)\n\t\tif err != nil {\n\t\t\ts.agent.logger.Printf(\"[ERR] http: Failed to decode query: %s from=%s\", err, req.RemoteAddr)\n\t\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tlogURL := req.URL.String()\n\t\tif tokens, ok := formVals[\"token\"]; ok {\n\t\t\tfor _, token := range tokens {\n\t\t\t\tif token == \"\" {\n\t\t\t\t\tlogURL += \"<hidden>\"\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlogURL = strings.Replace(logURL, token, \"<hidden>\", -1)\n\t\t\t}\n\t\t}\n\t\tlogURL = aclEndpointRE.ReplaceAllString(logURL, \"$1<hidden>$4\")\n\n\t\tif s.blacklist.Block(req.URL.Path) {\n\t\t\terrMsg := \"Endpoint is blocked by agent configuration\"\n\t\t\ts.agent.logger.Printf(\"[ERR] http: Request %s %v, error: %v from=%s\", req.Method, logURL, err, req.RemoteAddr)\n\t\t\tresp.WriteHeader(http.StatusForbidden)\n\t\t\tfmt.Fprint(resp, errMsg)\n\t\t\treturn\n\t\t}\n\n\t\tisForbidden := func(err error) bool {\n\t\t\tif acl.IsErrPermissionDenied(err) || acl.IsErrNotFound(err) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t_, ok := err.(ForbiddenError)\n\t\t\treturn ok\n\t\t}\n\n\t\tisMethodNotAllowed := func(err error) bool {\n\t\t\t_, ok := err.(MethodNotAllowedError)\n\t\t\treturn ok\n\t\t}\n\n\t\tisBadRequest := func(err error) bool {\n\t\t\t_, ok := err.(BadRequestError)\n\t\t\treturn ok\n\t\t}\n\n\t\tisTooManyRequests := func(err error) bool {\n\t\t\t// Sadness net/rpc can't do nice typed errors so this is all we got\n\t\t\treturn err.Error() == consul.ErrRateLimited.Error()\n\t\t}\n\n\t\taddAllowHeader := func(methods []string) {\n\t\t\tresp.Header().Add(\"Allow\", strings.Join(methods, \",\"))\n\t\t}\n\n\t\thandleErr := func(err error) {\n\t\t\ts.agent.logger.Printf(\"[ERR] http: Request %s %v, error: %v from=%s\", req.Method, logURL, err, req.RemoteAddr)\n\t\t\tswitch {\n\t\t\tcase isForbidden(err):\n\t\t\t\tresp.WriteHeader(http.StatusForbidden)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tcase structs.IsErrRPCRateExceeded(err):\n\t\t\t\tresp.WriteHeader(http.StatusTooManyRequests)\n\t\t\tcase isMethodNotAllowed(err):\n\t\t\t\t// RFC2616 states that for 405 Method Not Allowed the response\n\t\t\t\t// MUST include an Allow header containing the list of valid\n\t\t\t\t// methods for the requested resource.\n\t\t\t\t// https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\n\t\t\t\taddAllowHeader(err.(MethodNotAllowedError).Allow)\n\t\t\t\tresp.WriteHeader(http.StatusMethodNotAllowed) // 405\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tcase isBadRequest(err):\n\t\t\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tcase isTooManyRequests(err):\n\t\t\t\tresp.WriteHeader(http.StatusTooManyRequests)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tdefault:\n\t\t\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\t}\n\t\t}\n\n\t\tstart := time.Now()\n\t\tdefer func() {\n\t\t\ts.agent.logger.Printf(\"[DEBUG] http: Request %s %v (%v) from=%s\", req.Method, logURL, time.Since(start), req.RemoteAddr)\n\t\t}()\n\n\t\tvar obj interface{}\n\n\t\t// if this endpoint has declared methods, respond appropriately to OPTIONS requests. Otherwise let the endpoint handle that.\n\t\tif req.Method == \"OPTIONS\" && len(methods) > 0 {\n\t\t\taddAllowHeader(append([]string{\"OPTIONS\"}, methods...))\n\t\t\treturn\n\t\t}\n\n\t\t// if this endpoint has declared methods, check the request method. Otherwise let the endpoint handle that.\n\t\tmethodFound := len(methods) == 0\n\t\tfor _, method := range methods {\n\t\t\tif method == req.Method {\n\t\t\t\tmethodFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !methodFound {\n\t\t\terr = MethodNotAllowedError{req.Method, append([]string{\"OPTIONS\"}, methods...)}\n\t\t} else {\n\t\t\terr = s.checkWriteAccess(req)\n\n\t\t\tif err == nil {\n\t\t\t\t// Invoke the handler\n\t\t\t\tobj, err = handler(resp, req)\n\t\t\t}\n\t\t}\n\t\tcontentType := \"application/json\"\n\t\thttpCode := http.StatusOK\n\t\tif err != nil {\n\t\t\tif errPayload, ok := err.(CodeWithPayloadError); ok {\n\t\t\t\thttpCode = errPayload.StatusCode\n\t\t\t\tif errPayload.ContentType != \"\" {\n\t\t\t\t\tcontentType = errPayload.ContentType\n\t\t\t\t}\n\t\t\t\tif errPayload.Reason != \"\" {\n\t\t\t\t\tresp.Header().Add(\"X-Consul-Reason\", errPayload.Reason)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandleErr(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif obj == nil {\n\t\t\treturn\n\t\t}\n\t\tvar buf []byte\n\t\tif contentType == \"application/json\" {\n\t\t\tbuf, err = s.marshalJSON(req, obj)\n\t\t\tif err != nil {\n\t\t\t\thandleErr(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tif strings.HasPrefix(contentType, \"text/\") {\n\t\t\t\tif val, ok := obj.(string); ok {\n\t\t\t\t\tbuf = []byte(val)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tresp.Header().Set(\"Content-Type\", contentType)\n\t\tresp.WriteHeader(httpCode)\n\t\tresp.Write(buf)\n\t}\n}", "func Middleware(h http.Handler) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n log.Println(\"Running PRE plugin\")\n r.Header.Set(\"X-Trace-ID\", strconv.Itoa(int(rand.Int63())))\n h.ServeHTTP(w, r)\n })\n}", "func Middleware() func(next echo.HandlerFunc) echo.HandlerFunc {\n\tl := logger.New()\n\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\t// Record the time start time of the middleware invocation\n\t\t\tt1 := time.Now()\n\n\t\t\t// Generate a new UUID that will be used to recognize this particular\n\t\t\t// request\n\t\t\tid, err := uuid.NewV4()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\n\t\t\t// Create a child logger with the unique UUID created and attach it to\n\t\t\t// the echo.Context. By attaching it to the context it can be fetched by\n\t\t\t// later middleware or handler functions to emit events with a logger\n\t\t\t// that contains this ID. This is useful as it allows us to emit all\n\t\t\t// events with the same request UUID.\n\t\t\tlog := l.ID(id.String())\n\t\t\tc.Set(key, log)\n\n\t\t\t// Execute the next middleware/handler function in the stack.\n\t\t\tif err := next(c); err != nil {\n\t\t\t\tc.Error(err)\n\t\t\t}\n\n\t\t\t// We have now succeeded executing all later middlewares in the stack and\n\t\t\t// have come back to the logger middleware. Record the time at which we\n\t\t\t// came back to this middleware. We can use the difference between t2 and\n\t\t\t// t1 to calculate the request duration.\n\t\t\tt2 := time.Now()\n\n\t\t\t// Get the request IP address.\n\t\t\tvar ipAddress string\n\t\t\tif xff := c.Request().Header.Get(\"x-forwarded-for\"); xff != \"\" {\n\t\t\t\tsplit := strings.Split(xff, \",\")\n\t\t\t\tipAddress = strings.TrimSpace(split[len(split)-1])\n\t\t\t} else {\n\t\t\t\tipAddress = c.Request().RemoteAddr\n\t\t\t}\n\n\t\t\t// Emit a log event with as much metadata as we can.\n\t\t\tlog.Root(logger.Data{\n\t\t\t\t\"status_code\": c.Response().Status,\n\t\t\t\t\"method\": c.Request().Method,\n\t\t\t\t\"path\": c.Request().URL.Path,\n\t\t\t\t\"route\": c.Path(),\n\t\t\t\t\"response_time\": t2.Sub(t1).Seconds() * 1000,\n\t\t\t\t\"referer\": c.Request().Referer(),\n\t\t\t\t\"user_agent\": c.Request().UserAgent(),\n\t\t\t\t\"ip_address\": ipAddress,\n\t\t\t\t\"trace_id\": c.Request().Header.Get(\"x-amzn-trace-id\"),\n\t\t\t}).Info(\"request handled\")\n\n\t\t\t// Succeeded executing the middleware invocation. A nil response\n\t\t\t// represents no errors happened.\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func Middleware() func(http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn orhttp.Wrap(\n\t\t\thttp.HandlerFunc(\n\t\t\t\tfunc(w http.ResponseWriter, req *http.Request) {\n\t\t\t\t\th.ServeHTTP(w, req)\n\t\t\t\t}))\n\t}\n}", "func (w HandlerWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tw(next).ServeHTTP(rw, r)\n}", "func wrapMiddleware(mw []Middleware, handler Handler) Handler {\n\n\t// Loop backwards through the middleware invoking each one. Replace the\n\t// handler with the new wrapped handler. Looping backwards ensures that the\n\t// first middleware of the slice is the first to be executed by requests.\n\tfor i := len(mw) - 1; i >= 0; i-- {\n\t\th := mw[i]\n\t\t// h is of type Middleware func(Handler) Handler - so it takes a handler and returns a handler\n\t\tif h != nil {\n\t\t\thandler = h(handler)\n\t\t}\n\t}\n\n\treturn handler\n}", "func middleware(handler http.HandlerFunc) http.HandlerFunc {\n\t// no-auth middware func\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// poor man's logging:\n\t\tfmt.Println(r.Method, r.URL.Path, time.Now())\n\n\t\t// If this server is operating behind a proxy, but we still want to force\n\t\t// users to use https, cfg.ProxyForceHttps == true will listen for the common\n\t\t// X-Forward-Proto & redirect to https\n\t\tif cfg.ProxyForceHttps {\n\t\t\tif r.Header.Get(\"X-Forwarded-Proto\") == \"http\" {\n\t\t\t\tw.Header().Set(\"Connection\", \"close\")\n\t\t\t\turl := \"https://\" + r.Host + r.URL.String()\n\t\t\t\thttp.Redirect(w, r, url, http.StatusMovedPermanently)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\taddCORSHeaders(w, r)\n\n\t\t// TODO - Strict Transport config?\n\t\t// if cfg.TLS {\n\t\t// \t// If TLS is enabled, set 1 week strict TLS, 1 week for now to prevent catastrophic mess-ups\n\t\t// \tw.Header().Add(\"Strict-Transport-Security\", \"max-age=604800\")\n\t\t// }\n\t\thandler(w, r)\n\t}\n}", "func Middleware(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tappengineCtx := appengine.NewContext(r)\n\t\tctx := context.WithValue(r.Context(), contextKeyContext, appengineCtx)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func ConsoleLogger() mux.MiddlewareFunc {\n return FormatLogger( log.Printf )\n}", "func Middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\trAddr := r.RemoteAddr\n\t\tmethod := r.Method\n\t\tpath := r.URL.Path\n\t\tctx := r.Context()\n\t\tInfof(ctx, \"Remote: %s [%s] %s\", rAddr, method, path)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func (fn PostEchoNameHandlerFunc) Handle(params PostEchoNameParams) middleware.Responder {\n\treturn fn(params)\n}", "func New() echo.MiddlewareFunc {\n\treturn NewWithLogger(logrus.StandardLogger())\n}", "func New() echo.MiddlewareFunc {\n\treturn NewWithLogger(logrus.StandardLogger())\n}" ]
[ "0.80454236", "0.7378278", "0.672914", "0.6519933", "0.6450588", "0.6427789", "0.6284391", "0.6197663", "0.6195328", "0.61297154", "0.6080955", "0.5932094", "0.5910922", "0.58937997", "0.5855916", "0.5842944", "0.5828681", "0.5757336", "0.5753943", "0.5721365", "0.5721332", "0.57182324", "0.5688109", "0.5667828", "0.5657765", "0.56562024", "0.5655085", "0.5650283", "0.5648321", "0.56379604", "0.5637176", "0.5624881", "0.55991584", "0.5594299", "0.55745876", "0.5568247", "0.5567537", "0.5566528", "0.5547921", "0.5530481", "0.5524053", "0.55067843", "0.5504521", "0.5487769", "0.5478909", "0.54670775", "0.5462893", "0.54480714", "0.5446067", "0.54406375", "0.54323035", "0.54277027", "0.5426133", "0.5419931", "0.54174316", "0.5385225", "0.53704363", "0.53471917", "0.53369653", "0.53315926", "0.5330808", "0.532079", "0.5318722", "0.53102845", "0.53065205", "0.530341", "0.5296065", "0.5296065", "0.52835566", "0.52831864", "0.5277737", "0.52691984", "0.52557504", "0.52428323", "0.5241998", "0.52362454", "0.5227325", "0.5227022", "0.5225357", "0.522193", "0.5219445", "0.5215907", "0.5215375", "0.5206722", "0.5205639", "0.51944894", "0.5186152", "0.51829493", "0.5178514", "0.51732486", "0.5162587", "0.5143484", "0.51412225", "0.5131537", "0.51220554", "0.51214063", "0.51142514", "0.51131773", "0.5110849", "0.5110849" ]
0.8348193
0
WrapMiddlewareFromStdHandleFuncd wrap `func(http.ResponseWriter, http.Request)` into `echo.Middleware`.
func WrapMiddlewareFromStdHandleFuncd(h func(http.ResponseWriter, *http.Request) error) Middleware { return MiddlewareFunc(func(next Handler) Handler { return HandlerFunc(func(c Context) error { if err := h( c.Response().StdResponseWriter(), c.Request().StdRequest().WithContext(c), ); err != nil { return err } if c.Response().Committed() { return nil } return next.Handle(c) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func WrapMiddlewareFromStdHandleFunc(h func(http.ResponseWriter, *http.Request)) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\th(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t)\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapMiddlewareFromStdHandler(h http.Handler) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\th.ServeHTTP(\n\t\t\t\tc.Response().StdResponseWriter(),\n\t\t\t\tc.Request().StdRequest().WithContext(c),\n\t\t\t)\n\t\t\tif c.Response().Committed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func WrapperMiddleware(w HandlerFuncWrapper) Middleware { return w }", "func Wrap(\n\tmiddleware Middleware,\n\thandler Handler,\n) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tmiddleware(handler)(context.Background(), w, r)\n\t}\n}", "func WrapperHandlerMiddleware(w HandlerWrapper) Middleware { return w }", "func wrap(handler http.Handler) mwFunc {\n\tif handler == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandler.ServeHTTP(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func wrapFunc(fn http.HandlerFunc) mwFunc {\n\tif fn == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\tfn(w, r)\n\t\tnext(w, r, ps)\n\t}\n}", "func wrap(fn func(map[string]string) http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(mux.Vars(r))(w, r)\n\t}\n}", "func wrapHandle(handle httprouter.Handle) mwFunc {\n\tif handle == nil {\n\t\treturn nil\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, next httprouter.Handle) {\n\t\thandle(w, r, ps)\n\t\tnext(w, r, ps)\n\t}\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(c Context, next HandlerFunc) (err error) {\n\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tc.SetRequest(r)\n\t\t\terr = next(c)\n\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\treturn\n\t}\n}", "func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {\n\treturn func(next HandlerFunc) HandlerFunc {\n\t\treturn func(c Context) (err error) {\n\t\t\tm(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tc.SetRequest(r)\n\t\t\t\tc.SetResponse(newResponse(w))\n\t\t\t\terr = next(c)\n\t\t\t})).ServeHTTP(c.Response(), c.Request())\n\t\t\treturn\n\t\t}\n\t}\n}", "func EchoHandlerFunc(w http.ResponseWriter, r *http.Request) {\n\trequestBody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr2 := r.Write(bytes.NewBufferString(\"Failed to get request\"))\n\t\tif err2 != nil {\n\t\t\tlog.Fatalf(\"failed to write error response; %s\", err2)\n\t\t}\n\t} else {\n\t\tw.Header().Set(contentTypeHeaderName, r.Header.Get(contentTypeHeaderName))\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, err := w.Write(requestBody)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to write response body; %s\", err)\n\t\t}\n\t}\n}", "func (s *Server) wrapMiddleware(h handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := h(s, w, r)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[Error][Server] %+v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t}\n}", "func wrapHandler(h func(http.ResponseWriter, *http.Request)) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\thttpcontext.Set(r, \"params\", ps)\n\t\th(w, r)\n\t}\n}", "func handlerWrapper(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\thandler := panicRecover(f)\n\thandler = stopwatch(handler)\n\thandler = i18nLoad(handler)\n\n\treturn handler\n}", "func (v *Verifier) WrapFunc(handler http.HandlerFunc) http.Handler {\n\treturn v.Wrap(http.HandlerFunc(handler))\n}", "func (s *server) handlerWrapper(h http.Handler) httprouter.Handle {\n\treturn s.middleware(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func Wrap(name string, handle HandlerFunc, middlewares ...Middleware) HandlerFunc {\n\tfor i := len(middlewares) - 1; i >= 0; i-- {\n\t\thandle = middlewares[i](name, handle)\n\t}\n\treturn handle\n}", "func (fn MuxWrappable) Wrapped(tokenCheck bool) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tlogEndpoint(req)\n\t\tif tokenCheck {\n\t\t\t_, ok := AuthHandler(w, req)\n\t\t\tif !ok {\n\t\t\t\treturn // AuthHandler takes care of this stuff\n\t\t\t}\n\t\t}\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tstatus, err := fn(w, req)\n\t\tif err != nil {\n\t\t\temap := makeErrMap()\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, emap[status], status)\n\t\t}\n\t}\n}", "func (aw AWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tw.Write([]byte(\"A wrapper wrote this\\n\"))\n\t})\n}", "func wrapHandler(h http.HandlerFunc) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\tctx := r.Context()\n\t\tr = r.WithContext(ctx)\n\t\th.ServeHTTP(w, r)\n\t}\n}", "func authWrapFunc(f func(http.ResponseWriter, *http.Request)) http.Handler {\n\treturn negroni.New(&AuthMiddleware{}, negroni.Wrap(http.HandlerFunc(f)))\n}", "func NewMiddlewareWrapper(logger Logger, metrics Metrics, corsOptions *CORSOptions, globals ServiceGlobals) MiddlewareWrapper {\n\tm := &middlewareWrapperImpl{\n\t\tlogger: logger,\n\t\tmetrics: metrics,\n\t\tglobals: globals,\n\t}\n\tm.corsOptions = m.mergeCORSOptions(corsOptions)\n\treturn m\n}", "func Middleware(o ...Option) func(http.Handler) http.Handler {\n\topts := options{\n\t\ttracer: apm.DefaultTracer(),\n\t}\n\tfor _, o := range o {\n\t\to(&opts)\n\t}\n\tif opts.requestIgnorer == nil {\n\t\topts.requestIgnorer = apmhttp.NewDynamicServerRequestIgnorer(opts.tracer)\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\tserverOpts := []apmhttp.ServerOption{\n\t\t\tapmhttp.WithTracer(opts.tracer),\n\t\t\tapmhttp.WithServerRequestName(routeRequestName),\n\t\t\tapmhttp.WithServerRequestIgnorer(opts.requestIgnorer),\n\t\t}\n\t\tif opts.panicPropagation {\n\t\t\tserverOpts = append(serverOpts, apmhttp.WithPanicPropagation())\n\t\t}\n\t\treturn apmhttp.Wrap(\n\t\t\th,\n\t\t\tserverOpts...,\n\t\t)\n\t}\n}", "func (m *Metrics) WrapHandleFunc(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tbefore := time.Now()\n\t\trw := &statusRecorder{\n\t\t\tResponseWriter: w,\n\t\t\tstatusCode: http.StatusOK,\n\t\t}\n\t\th.ServeHTTP(rw, r)\n\t\tafter := time.Now()\n\t\tm.add(rw, after.Sub(before).Seconds())\n\t})\n}", "func wrapHandler(handler func(http.ResponseWriter, *http.Request, *receiver.Receiver), rcvr *receiver.Receiver) http.HandlerFunc {\n\treturn func(response http.ResponseWriter, req *http.Request) {\n\t\thandler(response, req, rcvr)\n\t}\n}", "func (a *Middleware) Wrap(h http.Handler) {\n\ta.Handler = h\n}", "func EchoMiddlewareAutomatic(app *EchoApplication) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tapp.Context.GinContext = c\n\t\tec := app.Context\n\n\t\tvar r *http.Request = c.Request\n\t\tvalidations.AppID = app.AppID\n\n\t\t// Verify certificate is good\n\t\tcert, err := validations.ValidateCertificate(r)\n\t\tif err != nil {\n\t\t\tlog.Println(\"validation of certificate failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Verify signature is good\n\t\tbody, err := validations.ValidateSignature(r, cert)\n\t\tif err != nil {\n\t\t\tlog.Println(\"validation of signature failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif MiddlewareLogInput {\n\t\t\tlog.Println(string(body))\n\t\t}\n\n\t\tvar data json.RawMessage\n\n\t\terr = json.Unmarshal(body, &data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"unmarshalling of json rawmessage failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\treq, err := parser.Parse(data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"parsing of json failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the request is good\n\t\tif err = validations.ValidateRequest(req); err != nil {\n\t\t\tlog.Println(\"validation of request failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tT, err := i18n.Tfunc(req.Request.Locale, \"en-US\")\n\t\tif err != nil {\n\t\t\tlog.Println(\"loading of translate failed\", err)\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tapp.Context.T = T\n\n\t\tres := response.New()\n\t\tc.Set(\"echoRequest\", req)\n\n\t\tif app.OnAuthCheck != nil {\n\t\t\tif err := app.OnAuthCheck(ec, req, res); err != nil {\n\n\t\t\t\tres.AddLinkAccountCard()\n\n\t\t\t\tif req.Request.Locale == \"de-DE\" {\n\t\t\t\t\tres.AddSSMLSpeech(fmt.Sprintf(\"<speak>%v</speak>\", AccountLinkMessageDE))\n\t\t\t\t} else {\n\t\t\t\t\tres.AddSSMLSpeech(fmt.Sprintf(\"<speak>%v</speak>\", AccountLinkMessageEN))\n\t\t\t\t}\n\n\t\t\t\tc.Header(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\t\t\tc.JSON(200, res)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif app.Session != nil {\n\n\t\t\tsess, err := app.Session.New(req.Session.ID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panicln(err)\n\t\t\t}\n\n\t\t\tapp.Context.Session = sess\n\t\t}\n\n\t\tswitch req.Request.Type {\n\t\tcase \"LaunchRequest\":\n\n\t\t\tif app.OnLaunch != nil {\n\t\t\t\tapp.OnLaunch(ec, req, res)\n\t\t\t}\n\n\t\t\tapp.Context.Session.Store()\n\n\t\tcase \"IntentRequest\":\n\n\t\t\tname := req.Request.Intent.Name\n\t\t\tproc, ok := app.intents[name]\n\t\t\tif !ok {\n\n\t\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\t\t\tpanic(\"unknown event \" + name)\n\t\t\t}\n\n\t\t\tproc(ec, req, res)\n\t\t\tapp.Context.Session.Store()\n\n\t\tcase \"SessionEndedRequest\":\n\n\t\t\tif app.OnSessionEnded != nil {\n\t\t\t\tapp.OnSessionEnded(ec, req, res)\n\t\t\t\tapp.Context.Session.DeleteSession()\n\t\t\t}\n\n\t\tdefault:\n\n\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif MiddlewareLogOutput {\n\n\t\t\traw, err := json.Marshal(res)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\t\tlog.Println(string(raw))\n\t\t}\n\n\t\tc.Header(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\tc.JSON(200, res)\n\n\t\tc.Next()\n\t}\n}", "func Wrap(h http.Handler, o ...ServerOption) http.Handler {\n\tif h == nil {\n\t\tpanic(\"h == nil\")\n\t}\n\thandler := &handler{\n\t\thandler: h,\n\t\ttracer: apm.DefaultTracer(),\n\t\trequestName: ServerRequestName,\n\t}\n\tfor _, o := range o {\n\t\to(handler)\n\t}\n\tif handler.requestIgnorer == nil {\n\t\thandler.requestIgnorer = NewDynamicServerRequestIgnorer(handler.tracer)\n\t}\n\tif handler.recovery == nil {\n\t\thandler.recovery = NewTraceRecovery(handler.tracer)\n\t}\n\treturn handler\n}", "func TracingHandlerFunc(h http.HandlerFunc) http.HandlerFunc {\n\treturn TracingMiddleware(LoggingMiddleWare(h))\n}", "func (ch *CFHosting) EchoMiddleware(h echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\n\t\t// If request is a WebSocket request, don't do anything special\n\t\tupgrade := c.Request().Header.Get(\"Upgrade\")\n\t\twebSocketKey := c.Request().Header.Get(\"Sec-Websocket-Key\")\n\n\t\tif len(upgrade) > 0 && len(webSocketKey) > 0 {\n\t\t\tlog.Infof(\"Not redirecting this request\")\n\t\t\treturn h(c)\n\t\t}\n\n\t\t// Check that we are on HTTPS - redirect if not\n\t\tproto := c.Request().Header.Get(\"X-Forwarded-Proto\")\n\t\tif len(proto) > 0 {\n\t\t\tif proto != \"https\" {\n\t\t\t\tredirect := fmt.Sprintf(\"https://%s%s\", c.Request().Host, c.Request().RequestURI)\n\t\t\t\treturn c.Redirect(301, redirect)\n\t\t\t}\n\t\t\treturn h(c)\n\t\t}\n\n\t\treturn interfaces.NewHTTPShadowError(\n\t\t\thttp.StatusBadRequest,\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t\t\"X-Forwarded-Proto not found and is required\",\n\t\t)\n\t}\n}", "func (c Chain) WrapFunc(handlerFunc HandlerFunc) http.Handler {\n\treturn c.Wrap(http.HandlerFunc(handlerFunc))\n}", "func ToMiddleware(classicMiddleware func(http.HandlerFunc) http.HandlerFunc) Middleware {\n\treturn func(c Container, next Handler) {\n\t\tclassicMiddleware(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t\tnext(c)\n\t\t})(c.GetResponseWriter(), c.GetRequest())\n\t}\n}", "func WrapperHandler(f HandlerFunc, dd ...DecoratorFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := newCtxWithRqID(r.Context(), r)\n\t\thf := f\n\t\tfor _, d := range dd {\n\t\t\thf = d(hf)\n\t\t}\n\t\terr := hf(w, r.WithContext(ctx))\n\t\tif err != nil {\n\t\t\terrProcessor(err, w)\n\t\t}\n\t}\n}", "func Wrap(router *echo.Echo) {\n\trouter.Get(\"/debug/pprof/\", IndexHandler())\n\trouter.Get(\"/debug/pprof/heap\", HeapHandler())\n\trouter.Get(\"/debug/pprof/goroutine\", GoroutineHandler())\n\trouter.Get(\"/debug/pprof/block\", BlockHandler())\n\trouter.Get(\"/debug/pprof/threadcreate\", ThreadCreateHandler())\n\trouter.Get(\"/debug/pprof/cmdline\", CmdlineHandler())\n\trouter.Get(\"/debug/pprof/profile\", ProfileHandler())\n\trouter.Get(\"/debug/pprof/symbol\", SymbolHandler())\n\trouter.Get(\"/debug/pprof/trace\", TraceHandler())\n}", "func Middleware(fn AppHandler, c interface{}) AppHandler {\n\treturn func(w http.ResponseWriter, r *http.Request) *AppError {\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"env\", c))\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"vars\", mux.Vars(r)))\n\t\treturn fn(w, r)\n\t}\n}", "func EchoMiddleware(AppID string) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tvar r *http.Request = c.Request\n\t\tvalidations.AppID = AppID\n\n\t\t// Verify certificate is good\n\t\tcert, err := validations.ValidateCertificate(r)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Verify signature is good\n\t\tbody, err := validations.ValidateSignature(r, cert)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tvar data json.RawMessage\n\n\t\terr = json.Unmarshal(body, &data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tev, err := parser.Parse(data)\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the request is good\n\t\tif err = validations.ValidateRequest(ev); err != nil {\n\t\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tc.Set(\"echoRequest\", ev)\n\t\tc.Next()\n\t}\n}", "func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\t\tw.Header().Set(\"Docker-Experimental\", e.experimental)\n\t\treturn handler(ctx, w, r, vars)\n\t}\n}", "func Wrap(next http.Handler) httprouter.Handle {\n\treturn func(rw http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\t\treq = req.WithContext(context.WithValue(req.Context(), httprouter.ParamsKey, params))\n\t\tnext.ServeHTTP(rw, req)\n\t}\n}", "func FromHTTPMiddleware(fn func(http.Handler) http.Handler) Handler {\n\treturn HandlerFunc(func(c context.Context) {\n\t\th := fn(mkNextHTTPHandler(c))\n\t\th.ServeHTTP(GetResponseWriter(c), GetRequest(c))\n\t})\n}", "func (lw LoggingWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tlog.Info(fmt.Sprintf(\"request for %v with method %v\", r.RequestURI, r.Method))\n\t})\n}", "func (s *server) middleware(n httprouter.Handle) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\t// Log the basics\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"method\": r.Method,\n\t\t\t\"remote-addr\": r.RemoteAddr,\n\t\t\t\"http-protocol\": r.Proto,\n\t\t\t\"headers\": r.Header,\n\t\t\t\"content-length\": r.ContentLength,\n\t\t}).Debugf(\"HTTP Request to %s\", r.URL)\n\n\t\tif r.ContentLength > 0 {\n\t\t\t// Dump payload into logs for visibility\n\t\t\tb, err := ioutil.ReadAll(r.Body)\n\t\t\tif err == nil {\n\t\t\t\tlog.Debugf(\"Dumping Payload for request to %s: %s\", r.URL, b)\n\t\t\t}\n\t\t}\n\n\t\t// Call registered handler\n\t\tn(w, r, ps)\n\t}\n}", "func WrapHandlerFunc(h HandlerFunc) HandlerFunc {\n\treturn func(c *Context) {\n\t\th(c)\n\t\tc.Next()\n\t}\n}", "func (e ErrorHandler) Wrap(handler func(w http.ResponseWriter, r *http.Request) error) http.Handler {\n\treturn errorHandler{\n\t\tHandler: handler,\n\t\tLogWriter: e.LogWriter,\n\t}\n}", "func ToMiddleware(handler func(next http.Handler) http.Handler) Middleware {\n\treturn func(handle http.HandlerFunc) http.HandlerFunc {\n\t\treturn handler(handle).ServeHTTP\n\t}\n}", "func Adapt(fn func(http.Handler) http.Handler) Middleware {\n\treturn func(ctx *Context, h http.Handler) http.Handler {\n\t\treturn fn(h)\n\t}\n}", "func (w HandlerFuncWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tw(next)(rw, r)\n}", "func WrapMiddlewareFromHandler(h HandlerFunc) Middleware {\n\treturn MiddlewareFunc(func(next Handler) Handler {\n\t\treturn HandlerFunc(func(c Context) error {\n\t\t\tif err := h.Handle(c); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn next.Handle(c)\n\t\t})\n\t})\n}", "func LogMiddleware(typ string, opts LogOptions) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tvar message []byte\n\t\t\tvar err error\n\n\t\t\t// Read r.Body, and then replace with a fresh ReadCloser for the next handler\n\t\t\tif message, err = ioutil.ReadAll(r.Body); err != nil {\n\t\t\t\tmessage = []byte(\"<failed to read body: \" + err.Error() + \">\")\n\t\t\t}\n\t\t\t_ = r.Body.Close()\n\t\t\tr.Body = ioutil.NopCloser(bytes.NewBuffer(message))\n\n\t\t\tvar headers http.Header\n\t\t\tvar from string\n\t\t\tif opts.Headers {\n\t\t\t\theaders = r.Header\n\t\t\t}\n\t\t\tif opts.From {\n\t\t\t\tfrom = r.RemoteAddr\n\t\t\t}\n\t\t\tLogRequest(typ, r.Proto, r.Method, r.URL.String(), from, headers, message)\n\n\t\t\t// copy output of HTTP handler to our buffer for later logging\n\t\t\tww := middleware.NewWrapResponseWriter(w, r.ProtoMajor)\n\t\t\tvar buf *bytes.Buffer\n\t\t\tif opts.Response {\n\t\t\t\tbuf = new(bytes.Buffer)\n\t\t\t\tww.Tee(buf)\n\t\t\t}\n\n\t\t\t// print response afterwards\n\t\t\tvar resp []byte\n\t\t\tvar start time.Time\n\t\t\tdefer func() {\n\t\t\t\tif ww.Header().Get(\"Content-Type\") == \"text/event-stream\" {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif opts.Response && ww.BytesWritten() > 0 {\n\t\t\t\t\tresp = buf.Bytes()\n\t\t\t\t}\n\t\t\t\tif ww.Status() >= 400 {\n\t\t\t\t\tresp = nil // avoid printing stacktraces and SSE in response\n\t\t\t\t}\n\t\t\t\tvar hexencode bool\n\t\t\t\tif opts.EncodeBinary && ww.Header().Get(\"Content-Type\") != \"application/json\" {\n\t\t\t\t\thexencode = true\n\t\t\t\t}\n\t\t\t\tLogResponse(ww.Status(), time.Since(start), hexencode, resp)\n\t\t\t}()\n\n\t\t\t// start timer and preform request\n\t\t\tstart = time.Now()\n\t\t\tnext.ServeHTTP(ww, r)\n\t\t})\n\t}\n}", "func logMiddleware(handler http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"%s - %s - %s\", r.RemoteAddr, r.Method, r.URL.Path)\n\t\tif debug {\n\t\t\tlog.Printf(\"Request: %+v\", r)\n\t\t}\n\t\t// Execute the original handler\n\t\thandler(w, r)\n\t}\n}", "func Wrap(hf interface{}, mf ...interface{}) Handler {\n\treturn wrap(hf, mf...)\n}", "func Middleware() echo.MiddlewareFunc {\n\tstats.Do(func() {\n\t\tstats.init()\n\t})\n\treturn echo.WrapMiddleware(handlerFunc)\n}", "func Middleware(service string, opts ...Option) echo.MiddlewareFunc {\n\tcfg := config{}\n\tfor _, opt := range opts {\n\t\topt.apply(&cfg)\n\t}\n\tif cfg.TracerProvider == nil {\n\t\tcfg.TracerProvider = otel.GetTracerProvider()\n\t}\n\ttracer := cfg.TracerProvider.Tracer(\n\t\ttracerName,\n\t\toteltrace.WithInstrumentationVersion(Version()),\n\t)\n\tif cfg.Propagators == nil {\n\t\tcfg.Propagators = otel.GetTextMapPropagator()\n\t}\n\n\tif cfg.Skipper == nil {\n\t\tcfg.Skipper = middleware.DefaultSkipper\n\t}\n\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tif cfg.Skipper(c) {\n\t\t\t\treturn next(c)\n\t\t\t}\n\n\t\t\tc.Set(tracerKey, tracer)\n\t\t\trequest := c.Request()\n\t\t\tsavedCtx := request.Context()\n\t\t\tdefer func() {\n\t\t\t\trequest = request.WithContext(savedCtx)\n\t\t\t\tc.SetRequest(request)\n\t\t\t}()\n\t\t\tctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(request.Header))\n\t\t\topts := []oteltrace.SpanStartOption{\n\t\t\t\toteltrace.WithAttributes(semconvutil.HTTPServerRequest(service, request)...),\n\t\t\t\toteltrace.WithSpanKind(oteltrace.SpanKindServer),\n\t\t\t}\n\t\t\tif path := c.Path(); path != \"\" {\n\t\t\t\trAttr := semconv.HTTPRoute(path)\n\t\t\t\topts = append(opts, oteltrace.WithAttributes(rAttr))\n\t\t\t}\n\t\t\tspanName := c.Path()\n\t\t\tif spanName == \"\" {\n\t\t\t\tspanName = fmt.Sprintf(\"HTTP %s route not found\", request.Method)\n\t\t\t}\n\n\t\t\tctx, span := tracer.Start(ctx, spanName, opts...)\n\t\t\tdefer span.End()\n\n\t\t\t// pass the span through the request context\n\t\t\tc.SetRequest(request.WithContext(ctx))\n\n\t\t\t// serve the request to the next middleware\n\t\t\terr := next(c)\n\t\t\tif err != nil {\n\t\t\t\tspan.SetAttributes(attribute.String(\"echo.error\", err.Error()))\n\t\t\t\t// invokes the registered HTTP error handler\n\t\t\t\tc.Error(err)\n\t\t\t}\n\n\t\t\tstatus := c.Response().Status\n\t\t\tspan.SetStatus(semconvutil.HTTPServerStatus(status))\n\t\t\tif status > 0 {\n\t\t\t\tspan.SetAttributes(semconv.HTTPStatusCode(status))\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n}", "func adaptHandlerFunc(fn func(w http.ResponseWriter, r *http.Request)) Handler {\n\treturn adaptHandler(http.HandlerFunc(fn))\n}", "func (api *API) Use(middleware ...echo.MiddlewareFunc) {\n\tapi.echo.Use(middleware...)\n}", "func Wrapper(fn RequestHandlerFunc, mds ...func(RequestHandlerFunc) RequestHandlerFunc) RequestHandlerFunc {\n\tfor _, md := range mds {\n\t\tfn = md(fn)\n\t}\n\treturn fn\n}", "func Middleware(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\ttracer := opentracing.GlobalTracer()\n\t\toperationName := fmt.Sprintf(\"%s %s%s\", req.Method, req.Host, req.URL.Path)\n\n\t\tvar span opentracing.Span\n\t\tvar ctx context.Context\n\t\tif spanCtx, err := tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header)); err != nil {\n\t\t\tspan, ctx = opentracing.StartSpanFromContext(req.Context(), operationName)\n\t\t\text.SpanKindRPCServer.Set(span)\n\t\t} else {\n\t\t\tspan = tracer.StartSpan(operationName, ext.RPCServerOption((spanCtx)))\n\t\t\tctx = opentracing.ContextWithSpan(req.Context(), span)\n\t\t\text.SpanKindRPCClient.Set(span)\n\t\t}\n\n\t\tbody, _ := ioutil.ReadAll(req.Body)\n\t\tbodyString := string(golib.MaskJSONPassword(body))\n\t\tbodyString = golib.MaskPassword(bodyString)\n\n\t\tisRemoveBody, ok := req.Context().Value(\"remove-tag-body\").(bool)\n\t\tif ok {\n\t\t\tif !isRemoveBody {\n\t\t\t\tspan.SetTag(\"body\", bodyString)\n\t\t\t}\n\t\t} else {\n\t\t\tspan.SetTag(\"body\", bodyString)\n\t\t}\n\n\t\treq.Body = ioutil.NopCloser(bytes.NewBuffer(body)) // reuse body\n\n\t\tspan.SetTag(\"http.headers\", req.Header)\n\t\text.HTTPUrl.Set(span, req.Host+req.RequestURI)\n\t\text.HTTPMethod.Set(span, req.Method)\n\n\t\tspan.LogEvent(\"start_handling_request\")\n\n\t\tdefer func() {\n\t\t\tspan.LogEvent(\"complete_handling_request\")\n\t\t\tspan.Finish()\n\t\t}()\n\n\t\th.ServeHTTP(w, req.WithContext(ctx))\n\t})\n}", "func (h Handler) Wrap(middlewares ...Middleware) Handler {\n\treturn Queue(middlewares).Finish(h)\n}", "func Middleware(\n\tenv *Env,\n) func(http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn middleware{h, env}\n\t}\n}", "func (fn EchoHandlerFunc) Handle(params EchoParams) middleware.Responder {\n\treturn fn(params)\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {\n\treturn mw(handler)\n}", "func MiddlewarePrint(h http.HandlerFunc) http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Store the time prior to handling\n\t\tstart := time.Now()\n\n\t\t// Wrap the response writer to record code\n\t\t// Ideally we'd instead take mux.HandlerFunc\n\t\tcw := newCodeResponseWriter(w)\n\n\t\t// Run the handler with our recording response writer\n\t\th(cw, r)\n\n\t\t// Calculate method, url, code, response time\n\t\tmethod := r.Method\n\t\turl := r.URL.Path\n\t\tduration := time.Now().UTC().Sub(start)\n\t\tcode := cw.StatusCode\n\n\t\t// Skip logging assets, favicon\n\t\tif strings.HasPrefix(url, \"/assets\") || strings.HasPrefix(url, \"/favicon.ico\") {\n\t\t\treturn\n\t\t}\n\n\t\t// Pretty print to the standard loggers colorized\n\t\tlogWithColor(method, url, code, duration)\n\t}\n}", "func (f MiddlewareFunc) ServeHTTP(w http.ResponseWriter, r *http.Request, next func()) {\n\tf(w, r, next)\n}", "func (s *server) loggingMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tlogger := logging.GetLogger(ctx)\n\t\trouteName := mux.CurrentRoute(r).GetName()\n\t\tmethod := r.Method\n\t\trequestLogger := logger.With(\n\t\t\tzap.String(\"route\", routeName),\n\t\t\tzap.String(\"method\", method),\n\t\t)\n\n\t\tctx = logging.ContextWithLogger(ctx, requestLogger)\n\t\tctx = context.WithValue(ctx, \"route\", routeName)\n\t\tctx = context.WithValue(ctx, \"method\", method)\n\n\t\tlogging.GetLogger(ctx).Info(\"request started\")\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\tlogging.GetLogger(ctx).Info(\"request completed\")\n\t})\n}", "func (p *spaDevProxy) HandleFunc(w http.ResponseWriter, r *http.Request) {\n\tp.proxy.ServeHTTP(w, r)\n}", "func Middleware() func(next echo.HandlerFunc) echo.HandlerFunc {\n\tl := logger.New()\n\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\t// Record the time start time of the middleware invocation\n\t\t\tt1 := time.Now()\n\n\t\t\t// Generate a new UUID that will be used to recognize this particular\n\t\t\t// request\n\t\t\tid, err := uuid.NewV4()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\n\t\t\t// Create a child logger with the unique UUID created and attach it to\n\t\t\t// the echo.Context. By attaching it to the context it can be fetched by\n\t\t\t// later middleware or handler functions to emit events with a logger\n\t\t\t// that contains this ID. This is useful as it allows us to emit all\n\t\t\t// events with the same request UUID.\n\t\t\tlog := l.ID(id.String())\n\t\t\tc.Set(key, log)\n\n\t\t\t// Execute the next middleware/handler function in the stack.\n\t\t\tif err := next(c); err != nil {\n\t\t\t\tc.Error(err)\n\t\t\t}\n\n\t\t\t// We have now succeeded executing all later middlewares in the stack and\n\t\t\t// have come back to the logger middleware. Record the time at which we\n\t\t\t// came back to this middleware. We can use the difference between t2 and\n\t\t\t// t1 to calculate the request duration.\n\t\t\tt2 := time.Now()\n\n\t\t\t// Get the request IP address.\n\t\t\tvar ipAddress string\n\t\t\tif xff := c.Request().Header.Get(\"x-forwarded-for\"); xff != \"\" {\n\t\t\t\tsplit := strings.Split(xff, \",\")\n\t\t\t\tipAddress = strings.TrimSpace(split[len(split)-1])\n\t\t\t} else {\n\t\t\t\tipAddress = c.Request().RemoteAddr\n\t\t\t}\n\n\t\t\t// Emit a log event with as much metadata as we can.\n\t\t\tlog.Root(logger.Data{\n\t\t\t\t\"status_code\": c.Response().Status,\n\t\t\t\t\"method\": c.Request().Method,\n\t\t\t\t\"path\": c.Request().URL.Path,\n\t\t\t\t\"route\": c.Path(),\n\t\t\t\t\"response_time\": t2.Sub(t1).Seconds() * 1000,\n\t\t\t\t\"referer\": c.Request().Referer(),\n\t\t\t\t\"user_agent\": c.Request().UserAgent(),\n\t\t\t\t\"ip_address\": ipAddress,\n\t\t\t\t\"trace_id\": c.Request().Header.Get(\"x-amzn-trace-id\"),\n\t\t\t}).Info(\"request handled\")\n\n\t\t\t// Succeeded executing the middleware invocation. A nil response\n\t\t\t// represents no errors happened.\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func MakeTracingMiddleware(component string) func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn MakeTracingHandler(next, component)\n\t}\n}", "func Middleware(e *echo.Echo) {\n\te.Use(\n\t\tmiddleware.Logger(),\n\t\tmiddleware.Recover(),\n\t\tcontext.InjectBezuncAPIContext,\n\t)\n}", "func Middleware(options ...HijackOptions) func(http.Handler) http.Handler {\n\topt := DefaultHijackOptions\n\tif len(options) > 0 {\n\t\topt = options[0]\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx, log := chi.RouteContext(r.Context()), middleware.GetLogEntry(r)\n\t\t\tif ctx == nil || r.Method != \"OPTIONS\" {\n\t\t\t\t// Just proxy to the next handler\n\t\t\t\th.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Hijack request\n\t\t\tvar routes Routes\n\t\t\tu := getStringSliceFromURI(r.RequestURI)\n\t\t\tchi.Walk(ctx.Routes, walkFn(u, &routes))\n\t\t\traw, err := opt.Render(routes)\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tlog.Panic(fmt.Sprintf(\"rendering OPTIONS description failed: %s\", err), nil)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.WriteHeader(200)\n\t\t\tw.Header().Add(\"Content-Type\", opt.ContentType)\n\t\t\tw.Write(raw)\n\t\t})\n\t}\n}", "func makeHandler(fn func(http.ResponseWriter, *http.Request, *Server), s *Server) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, s)\n\t}\n}", "func (mf MiddlewareFunc) Run(req *Request, handler Handler) (*Response, error) {\n\treturn mf(req, handler)\n}", "func NewHandlerWrapper() server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\tmd, _ := metadata.FromContext(ctx)\n\t\t\tlog.Debug().Fields(map[string]interface{}{\n\t\t\t\t\"category\": \"LogWrapper\",\n\t\t\t\t\"service\": req.Service(),\n\t\t\t\t\"method\": req.Method(),\n\t\t\t\t\"ctx\": md,\n\t\t\t}).Msg(\"Server-Side Handler\")\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t//securityLog(ctx, req, rsp)\n\t\t\treturn\n\t\t}\n\t}\n}", "func LoggingMiddleware(next http.Handler) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tstart := time.Now()\n\t\twrapped := wrapResponseWriter(w)\n\t\tnext.ServeHTTP(wrapped, r)\n\t\tLog.Info().Int(\"status\", wrapped.status).Str(\"method\", r.Method).Str(\"path\", r.URL.EscapedPath()).Str(\"duration\", time.Since(start).String()).Msg(\"Request processed\")\n\t})\n}", "func Middleware() func(http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn orhttp.Wrap(\n\t\t\thttp.HandlerFunc(\n\t\t\t\tfunc(w http.ResponseWriter, req *http.Request) {\n\t\t\t\t\th.ServeHTTP(w, req)\n\t\t\t\t}))\n\t}\n}", "func (bw BWrapper) Wrap(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(w, r)\n\t\tw.Write([]byte(\"B wrapper wrote this\\n\"))\n\t})\n\n}", "func NewHandlerWrapper(p micro.Publisher) server.HandlerWrapper {\n\treturn func(fn server.HandlerFunc) server.HandlerFunc {\n\t\treturn func(ctx context.Context, req server.Request, rsp interface{}) (err error) {\n\t\t\t// add TranID to context if not present\n\t\t\tctx = metadata.MergeContext(ctx, map[string]string{\"trans-id\": uuid.New().String()}, false)\n\t\t\terr = fn(ctx, req, rsp)\n\t\t\t// we already logged error in Publish. lets ignore error here.\n\t\t\t_ = publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\t// go publish(ctx, p, req.Body().(proto.Message), rsp.(proto.Message))\n\t\t\treturn\n\t\t}\n\t}\n}", "func simpleMw(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Do stuff here\n\t\tlog.Printf(\"\\nRequestURI: %v\\n\\n\", r.RequestURI)\n\t\t// Call the next handler, which can be another middleware in the chain, or the final handler.\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func (s *HTTPServer) wrap(handler endpoint, methods []string) http.HandlerFunc {\n\treturn func(resp http.ResponseWriter, req *http.Request) {\n\t\tsetHeaders(resp, s.agent.config.HTTPResponseHeaders)\n\t\tsetTranslateAddr(resp, s.agent.config.TranslateWANAddrs)\n\n\t\t// Obfuscate any tokens from appearing in the logs\n\t\tformVals, err := url.ParseQuery(req.URL.RawQuery)\n\t\tif err != nil {\n\t\t\ts.agent.logger.Printf(\"[ERR] http: Failed to decode query: %s from=%s\", err, req.RemoteAddr)\n\t\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tlogURL := req.URL.String()\n\t\tif tokens, ok := formVals[\"token\"]; ok {\n\t\t\tfor _, token := range tokens {\n\t\t\t\tif token == \"\" {\n\t\t\t\t\tlogURL += \"<hidden>\"\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlogURL = strings.Replace(logURL, token, \"<hidden>\", -1)\n\t\t\t}\n\t\t}\n\t\tlogURL = aclEndpointRE.ReplaceAllString(logURL, \"$1<hidden>$4\")\n\n\t\tif s.blacklist.Block(req.URL.Path) {\n\t\t\terrMsg := \"Endpoint is blocked by agent configuration\"\n\t\t\ts.agent.logger.Printf(\"[ERR] http: Request %s %v, error: %v from=%s\", req.Method, logURL, err, req.RemoteAddr)\n\t\t\tresp.WriteHeader(http.StatusForbidden)\n\t\t\tfmt.Fprint(resp, errMsg)\n\t\t\treturn\n\t\t}\n\n\t\tisForbidden := func(err error) bool {\n\t\t\tif acl.IsErrPermissionDenied(err) || acl.IsErrNotFound(err) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t_, ok := err.(ForbiddenError)\n\t\t\treturn ok\n\t\t}\n\n\t\tisMethodNotAllowed := func(err error) bool {\n\t\t\t_, ok := err.(MethodNotAllowedError)\n\t\t\treturn ok\n\t\t}\n\n\t\tisBadRequest := func(err error) bool {\n\t\t\t_, ok := err.(BadRequestError)\n\t\t\treturn ok\n\t\t}\n\n\t\tisTooManyRequests := func(err error) bool {\n\t\t\t// Sadness net/rpc can't do nice typed errors so this is all we got\n\t\t\treturn err.Error() == consul.ErrRateLimited.Error()\n\t\t}\n\n\t\taddAllowHeader := func(methods []string) {\n\t\t\tresp.Header().Add(\"Allow\", strings.Join(methods, \",\"))\n\t\t}\n\n\t\thandleErr := func(err error) {\n\t\t\ts.agent.logger.Printf(\"[ERR] http: Request %s %v, error: %v from=%s\", req.Method, logURL, err, req.RemoteAddr)\n\t\t\tswitch {\n\t\t\tcase isForbidden(err):\n\t\t\t\tresp.WriteHeader(http.StatusForbidden)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tcase structs.IsErrRPCRateExceeded(err):\n\t\t\t\tresp.WriteHeader(http.StatusTooManyRequests)\n\t\t\tcase isMethodNotAllowed(err):\n\t\t\t\t// RFC2616 states that for 405 Method Not Allowed the response\n\t\t\t\t// MUST include an Allow header containing the list of valid\n\t\t\t\t// methods for the requested resource.\n\t\t\t\t// https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\n\t\t\t\taddAllowHeader(err.(MethodNotAllowedError).Allow)\n\t\t\t\tresp.WriteHeader(http.StatusMethodNotAllowed) // 405\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tcase isBadRequest(err):\n\t\t\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tcase isTooManyRequests(err):\n\t\t\t\tresp.WriteHeader(http.StatusTooManyRequests)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\tdefault:\n\t\t\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\t}\n\t\t}\n\n\t\tstart := time.Now()\n\t\tdefer func() {\n\t\t\ts.agent.logger.Printf(\"[DEBUG] http: Request %s %v (%v) from=%s\", req.Method, logURL, time.Since(start), req.RemoteAddr)\n\t\t}()\n\n\t\tvar obj interface{}\n\n\t\t// if this endpoint has declared methods, respond appropriately to OPTIONS requests. Otherwise let the endpoint handle that.\n\t\tif req.Method == \"OPTIONS\" && len(methods) > 0 {\n\t\t\taddAllowHeader(append([]string{\"OPTIONS\"}, methods...))\n\t\t\treturn\n\t\t}\n\n\t\t// if this endpoint has declared methods, check the request method. Otherwise let the endpoint handle that.\n\t\tmethodFound := len(methods) == 0\n\t\tfor _, method := range methods {\n\t\t\tif method == req.Method {\n\t\t\t\tmethodFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !methodFound {\n\t\t\terr = MethodNotAllowedError{req.Method, append([]string{\"OPTIONS\"}, methods...)}\n\t\t} else {\n\t\t\terr = s.checkWriteAccess(req)\n\n\t\t\tif err == nil {\n\t\t\t\t// Invoke the handler\n\t\t\t\tobj, err = handler(resp, req)\n\t\t\t}\n\t\t}\n\t\tcontentType := \"application/json\"\n\t\thttpCode := http.StatusOK\n\t\tif err != nil {\n\t\t\tif errPayload, ok := err.(CodeWithPayloadError); ok {\n\t\t\t\thttpCode = errPayload.StatusCode\n\t\t\t\tif errPayload.ContentType != \"\" {\n\t\t\t\t\tcontentType = errPayload.ContentType\n\t\t\t\t}\n\t\t\t\tif errPayload.Reason != \"\" {\n\t\t\t\t\tresp.Header().Add(\"X-Consul-Reason\", errPayload.Reason)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandleErr(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif obj == nil {\n\t\t\treturn\n\t\t}\n\t\tvar buf []byte\n\t\tif contentType == \"application/json\" {\n\t\t\tbuf, err = s.marshalJSON(req, obj)\n\t\t\tif err != nil {\n\t\t\t\thandleErr(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tif strings.HasPrefix(contentType, \"text/\") {\n\t\t\t\tif val, ok := obj.(string); ok {\n\t\t\t\t\tbuf = []byte(val)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tresp.Header().Set(\"Content-Type\", contentType)\n\t\tresp.WriteHeader(httpCode)\n\t\tresp.Write(buf)\n\t}\n}", "func (v *Verifier) Wrap(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\tv.Negroni().ServeHTTP(rw, req, handler.ServeHTTP)\n\t})\n}", "func (s *Service) LoggingMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Do stuff here\n\t\tl := log.WithFields(log.Fields{\n\t\t\t\"environment\": s.environment,\n\t\t\t\"request-path\": r.RequestURI,\n\t\t\t\"request-method\": r.Method,\n\t\t})\n\t\tl.Infoln()\n\t\t// Call the next handler, which can be another middleware in the chain, or the final handler.\n\t\tm := httpsnoop.CaptureMetrics(next, w, r)\n\t\tl.WithFields(log.Fields{\n\t\t\t\"request-duration\": m.Duration,\n\t\t\t\"response-code\": m.Code,\n\t\t}).Infoln(\"handler response\")\n\t})\n}", "func Middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func middleware(handler http.HandlerFunc) http.HandlerFunc {\n\t// no-auth middware func\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// poor man's logging:\n\t\tfmt.Println(r.Method, r.URL.Path, time.Now())\n\n\t\t// If this server is operating behind a proxy, but we still want to force\n\t\t// users to use https, cfg.ProxyForceHttps == true will listen for the common\n\t\t// X-Forward-Proto & redirect to https\n\t\tif cfg.ProxyForceHttps {\n\t\t\tif r.Header.Get(\"X-Forwarded-Proto\") == \"http\" {\n\t\t\t\tw.Header().Set(\"Connection\", \"close\")\n\t\t\t\turl := \"https://\" + r.Host + r.URL.String()\n\t\t\t\thttp.Redirect(w, r, url, http.StatusMovedPermanently)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\taddCORSHeaders(w, r)\n\n\t\t// TODO - Strict Transport config?\n\t\t// if cfg.TLS {\n\t\t// \t// If TLS is enabled, set 1 week strict TLS, 1 week for now to prevent catastrophic mess-ups\n\t\t// \tw.Header().Add(\"Strict-Transport-Security\", \"max-age=604800\")\n\t\t// }\n\t\thandler(w, r)\n\t}\n}", "func InternalRedirectWrap(url string) Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn InternalRedirect(h, url)\n\t}\n}", "func LoggingMiddleware(next stdhttp.Handler) stdhttp.Handler {\n\treturn LoggingMiddlewareWithOptions(Options{})(next)\n}", "func Middleware(h http.Handler) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n log.Println(\"Running PRE plugin\")\n r.Header.Set(\"X-Trace-ID\", strconv.Itoa(int(rand.Int63())))\n h.ServeHTTP(w, r)\n })\n}", "func makeHandler(env env, fn func(http.ResponseWriter, *http.Request, env)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, env)\n\t}\n}", "func wrappedHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tgg, ok := r.URL.Query()[\"go-get\"]\n\t\tif ok && len(gg) == 1 && gg[0] == \"1\" {\n\t\t\t// Serve a trivial html page.\n\t\t\tw.Write([]byte(goGetHTML5))\n\t\t\treturn\n\t\t}\n\t\t// Fallthrough.\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func wrapMiddleware(mw []Middleware, handler Handler) Handler {\n\n\t// Loop backwards through the middleware invoking each one. Replace the\n\t// handler with the new wrapped handler. Looping backwards ensures that the\n\t// first middleware of the slice is the first to be executed by requests.\n\tfor i := len(mw) - 1; i >= 0; i-- {\n\t\th := mw[i]\n\t\t// h is of type Middleware func(Handler) Handler - so it takes a handler and returns a handler\n\t\tif h != nil {\n\t\t\thandler = h(handler)\n\t\t}\n\t}\n\n\treturn handler\n}", "func setupMiddleware() {\n\tfn.Plugin(func(ctx context.Context, request *http.Request) (context.Context, error) {\n\t\treturn context.WithValue(ctx, constant.KeyRawRequest, request), nil\n\t})\n\n\ttype (\n\t\tSuccess struct {\n\t\t\tData interface{} `json:\"data\"`\n\t\t}\n\n\t\tFailure struct {\n\t\t\tCode message.StatusCode `json:\"code\"`\n\t\t\tError string `json:\"error\"`\n\t\t}\n\t)\n\n\t// Define a error encoder to unify all error response\n\tfn.SetErrorEncoder(func(ctx context.Context, err error) interface{} {\n\t\trequest := ctx.Value(constant.KeyRawRequest).(*http.Request)\n\t\tzap.L().Error(\"Handle HTTP API request failed\",\n\t\t\tzap.String(\"api\", request.RequestURI),\n\t\t\tzap.String(\"method\", request.Method),\n\t\t\tzap.String(\"remote\", request.RemoteAddr),\n\t\t\tzap.Error(err))\n\n\t\tcode := message.StatusCode_ServerInternal\n\t\tif e, ok := err.(*Error); ok {\n\t\t\tcode = e.Code\n\t\t}\n\t\treturn &Failure{\n\t\t\tCode: code,\n\t\t\tError: err.Error(),\n\t\t}\n\t})\n\n\t// Define a body response to unify all success response\n\tfn.SetResponseEncoder(func(ctx context.Context, payload interface{}) interface{} {\n\t\trequest := ctx.Value(constant.KeyRawRequest).(*http.Request)\n\t\tzap.L().Debug(\"Handle HTTP API request success\",\n\t\t\tzap.String(\"api\", request.RequestURI),\n\t\t\tzap.String(\"method\", request.Method),\n\t\t\tzap.String(\"remote\", request.RemoteAddr),\n\t\t\tzap.Reflect(\"data\", payload))\n\t\treturn &Success{\n\t\t\tData: payload,\n\t\t}\n\t})\n}", "func (m *MuxTracer) TraceHandleFunc(handler http.HandlerFunc) http.HandlerFunc {\n\n\treturn func(writer http.ResponseWriter, req *http.Request) {\n\n\t\t// bail our if tracing isn't enabled.\n\t\tif !m.tracer.Enabled() {\n\t\t\thandler(writer, req)\n\t\t\treturn\n\t\t}\n\n\t\t// trace the request\n\t\ttracedRequest, span := m.trace(req)\n\t\tdefer span.Finish()\n\n\t\t// trace the response\n\t\ttracedWriter := newTracedResponseWriter(span, writer)\n\n\t\t// run the request\n\t\thandler(tracedWriter, tracedRequest)\n\t}\n}", "func (a *BasicAuth) Wrap(wrapped AuthenticatedHandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif username := a.CheckAuth(r); username == \"\" {\n\t\t\ta.RequireAuth(w, r)\n\t\t} else {\n\t\t\tar := &AuthenticatedRequest{Request: *r, Username: username}\n\t\t\twrapped(w, ar)\n\t\t}\n\t}\n}", "func echoContextHandler(ctx context.Context, in io.Reader, out io.Writer) {\n\tnctx := GetContext(ctx)\n\n\tif resp, ok := out.(http.ResponseWriter); ok {\n\t\tresp.Header().Add(\"traceId\", nctx.TracingContextData().TraceId())\n\t\tresp.Header().Add(\"spanId\", nctx.TracingContextData().SpanId())\n\t\tresp.Header().Add(\"parentSpanId\", nctx.TracingContextData().ParentSpanId())\n\t\tresp.Header().Add(\"sampled\", strconv.FormatBool(nctx.TracingContextData().IsSampled()))\n\t\tresp.Header().Add(\"ociURL\", nctx.TracingContextData().TraceCollectorURL())\n\t\tresp.Header().Add(\"flag\", nctx.TracingContextData().Flags())\n\t\tresp.Header().Add(\"ServiceName\", nctx.TracingContextData().ServiceName())\n\t}\n\t// XXX(reed): could configure this to test too\n\n\tWriteStatus(out, http.StatusTeapot+2)\n\tio.Copy(out, in)\n}", "func (w HandlerWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tw(next).ServeHTTP(rw, r)\n}", "func (mvcI *MvcInfrastructure) wrapHandler(c Controller, a Action) func(response http.ResponseWriter, request *http.Request) {\n\treturn func(response http.ResponseWriter, request *http.Request) {\n\t\tlogger.Debugf(\"c: %v, a: %v, m: %s\", c, a, request.Method)\n\n\t\tmvcI.handleRequest(c, a, response, request)\n\t}\n}", "func Middleware(f MiddlewareFunc) {\n\tDefaultMux.Middleware(f)\n}", "func APIWrapper(handler APIHandler, cfg cli.Config) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\thandler(w, r, cfg)\n\t}\n}", "func NewMiddleware(ctx Context, command string) (Middleware, error) {\n\tif command == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tctx.Logger = ctx.Logger.With().\n\t\tStr(LoggerKeyComponent, \"middleware\").\n\t\tStr(\"command\", command).\n\t\tLogger()\n\n\tcmd := exec.CommandContext(ctx.StdContext, command)\n\tcmd.Stderr = &logWrapper{\n\t\tl: ctx.Logger,\n\t}\n\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get stdin pipe: %w\", err)\n\t}\n\n\tctx.Logger.Debug().Msg(\"stdin pipe retrieved\")\n\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get stdout pipe: %w\", err)\n\t}\n\n\tctx.Logger.Debug().Msg(\"stdout pipe retrieved\")\n\n\treturn &mware{\n\t\tcmd: cmd,\n\t\tstdin: stdin,\n\t\tstdout: stdout,\n\t}, nil\n}", "func setupMiddlewares(handler http.Handler) http.Handler {\n\treturn responseLoggingMiddleware(handler)\n}", "func Middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\trAddr := r.RemoteAddr\n\t\tmethod := r.Method\n\t\tpath := r.URL.Path\n\t\tctx := r.Context()\n\t\tInfof(ctx, \"Remote: %s [%s] %s\", rAddr, method, path)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}" ]
[ "0.82763463", "0.73265177", "0.69448745", "0.6710127", "0.66577464", "0.6619891", "0.6491556", "0.6335089", "0.63039446", "0.6226173", "0.6213247", "0.6105327", "0.60697603", "0.60642695", "0.6045147", "0.6023457", "0.602146", "0.6020279", "0.59575015", "0.5933252", "0.58639944", "0.5848662", "0.5846529", "0.5843937", "0.5843829", "0.5813879", "0.5787654", "0.5782766", "0.5778886", "0.577807", "0.5774028", "0.57689697", "0.57597256", "0.57591057", "0.57273203", "0.57242996", "0.5720751", "0.5685557", "0.5679561", "0.56758034", "0.56724006", "0.5668604", "0.5663891", "0.5662175", "0.5661069", "0.56414664", "0.5638064", "0.5623577", "0.56171995", "0.56153", "0.5607949", "0.56059283", "0.5603749", "0.55934346", "0.5579278", "0.55592257", "0.5558501", "0.55399597", "0.55279344", "0.5518679", "0.5510283", "0.5510283", "0.5495134", "0.54893893", "0.54816616", "0.54783654", "0.54721594", "0.5466593", "0.5462329", "0.5460587", "0.5443583", "0.5442146", "0.54361355", "0.5424055", "0.541715", "0.5414984", "0.5413085", "0.54106605", "0.54088867", "0.54075205", "0.54019207", "0.5396289", "0.53770435", "0.5372221", "0.5363374", "0.5358408", "0.53492093", "0.5343075", "0.5340676", "0.5336654", "0.5336324", "0.53327507", "0.531283", "0.5307759", "0.53062296", "0.5301611", "0.52894384", "0.52768934", "0.5269365", "0.526896" ]
0.8050236
1
AddFlags add flags to app
func (opts *Options) AddFlags(app *cli.App) { flags := []cli.Flag{ cli.StringFlag{ Name: "kubeconfig", Usage: "Path to a kube config. Only required if out-of-cluster.", Destination: &opts.Kubeconfig, }, cli.BoolFlag{ Name: "debug", Usage: "run with debug mode", Destination: &opts.Debug, }, cli.StringFlag{ Name: "loadbalancer-namespace", EnvVar: "LOADBALANCER_NAMESPACE", Usage: "specify loadbalancer resource namespace", Destination: &opts.LoadBalancerNamespace, }, cli.StringFlag{ Name: "loadbalancer-name", EnvVar: "LOADBALANCER_NAME", Usage: "specify loadbalancer resource name", Destination: &opts.LoadBalancerName, }, cli.StringFlag{ Name: "pod-namespace", EnvVar: "POD_NAMESPACE", Usage: "specify pod namespace", Destination: &opts.PodNamespace, }, cli.StringFlag{ Name: "pod-name", EnvVar: "POD_NAME", Usage: "specify pod name", Destination: &opts.PodName, }, cli.StringFlag{ Name: "nodeip-label", EnvVar: "NODEIP_LABEL", Usage: "tell provider which label of node stores node ip", Destination: &opts.NodeIPLabel, }, cli.StringFlag{ Name: "nodeip-annotation", EnvVar: "NODEIP_ANNOTATION", Usage: "tell provider which annotation of node stores node ip", Destination: &opts.NodeIPAnnotation, }, } app.Flags = append(app.Flags, flags...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *cmdCreate) AddFlags(fs *flag.FlagSet) {\n\tfs.StringVar(&(c.fileName), \"f\", \"\", \"gateway app file\")\n\tfs.StringVar(&(c.pingport), \"pingport\", \"\", \"ping port\")\n}", "func AddFlags(a *kingpin.Application, config *promlog.Config) {\n\tconfig.Level = &promlog.AllowedLevel{}\n\ta.Flag(LevelFlagName, LevelFlagHelp).\n\t\tDefault(\"info\").SetValue(config.Level)\n\n\tconfig.Format = &promlog.AllowedFormat{}\n\ta.Flag(FormatFlagName, FormatFlagHelp).\n\t\tDefault(\"logfmt\").SetValue(config.Format)\n}", "func AddFlags(a *kingpin.Application) *Config {\n\tconfig := &Config{}\n\tAddFlagsVar(a, config)\n\treturn config\n}", "func AddFlags(a *kingpin.Application) *Config {\n\tconfig := &Config{}\n\tAddFlagsVar(a, config)\n\treturn config\n}", "func (p *Pack) AddFlags(flags registry.Flags) {\n\tp.flags |= flags\n}", "func (p *PublisherMunger) AddFlags(cmd *cobra.Command, config *github.Config) {}", "func (v *VersionCommand) addFlags() {\n\t// TODO: add flags here\n}", "func (*SigMentionHandler) AddFlags(cmd *cobra.Command, config *github.Config) {}", "func (c *cmdVersion) AddFlags(fs *flag.FlagSet) {\n\t// no flags\n}", "func (PingCIMunger) AddFlags(cmd *cobra.Command, config *github_util.Config) {}", "func addFlags(f *testFlags, flags []string) {\n\tfor _, flag := range flags {\n\t\tfields := strings.SplitN(flag, \"=\", 2)\n\t\tswitch len(fields) {\n\t\tcase 1:\n\t\t\tf.bools[fields[0]] = true\n\t\tcase 2:\n\t\t\tif i, err := strconv.Atoi(fields[1]); err == nil {\n\t\t\t\tf.ints[fields[0]] = i\n\t\t\t} else {\n\t\t\t\tf.strings[fields[0]] = fields[1]\n\t\t\t}\n\t\t}\n\t}\n}", "func (b *PktBase) AddFlags(flags ...PktFlags) {\n\tfor _, f := range flags {\n\t\tb.flags |= f\n\t}\n}", "func (s *APIEnablementOptions) AddFlags(fs *pflag.FlagSet) {\n\tfs.Var(&s.RuntimeConfig, \"runtime-config\", \"\"+\n\t\t\"A set of key=value pairs that describe runtime configuration that may be passed \"+\n\t\t\"to apiserver. apis/<groupVersion> key can be used to turn on/off specific api versions. \"+\n\t\t\"apis/<groupVersion>/<resource> can be used to turn on/off specific resources. api/all and \"+\n\t\t\"api/legacy are special keys to control all and legacy api versions respectively.\")\n}", "func (g *Getter) AddFlags() {\n\tflag.StringVar(&g.icon, \"icon\", \"Icon.png\", \"The name of the application icon file\")\n}", "func AddAndParseFlags(fs *flag.FlagSet) error { return nil }", "func (p *PullCommand) addFlags() {\n\t// TODO: add flags here\n}", "func (o *Options) AddFlags(fs *pflag.FlagSet) {\n\tfs.StringVar(&o.BindAddress, \"bind-address\", \"0.0.0.0\", \"address to bind to\")\n\tfs.IntVar(&o.Port, \"port\", 9443, \"webhook server port\")\n\tfs.StringVar(&o.ServerCertDir, \"tls-cert-dir\", \"\", \"directory with server TLS certificate and key (must contain a tls.crt and tls.key file)\")\n\tfs.BoolVar(&o.AllowInvalidExtensionResources, \"allow-invalid-extension-resources\", false, \"Allow invalid extension resources\")\n}", "func AddFlags(rootCmd *cobra.Command) {\n\tflag.CommandLine.VisitAll(func(gf *flag.Flag) {\n\t\trootCmd.PersistentFlags().AddGoFlag(gf)\n\t})\n}", "func (o *GitHubOptions) AddFlags(fs *flag.FlagSet) {\n\to.addFlags(fs)\n}", "func (o *Options) AddFlags(fs *pflag.FlagSet) {\n\tBindLoggingFlags(&o.Config, fs)\n}", "func AddFlags(flags *flag.FlagSet) {\n\tflags.Int(collectorQueueSize, app.DefaultQueueSize, \"The queue size of the collector\")\n\tflags.Int(collectorNumWorkers, app.DefaultNumWorkers, \"The number of workers pulling items from the queue\")\n\tflags.Duration(collectorWriteCacheTTL, time.Hour*12, \"The duration to wait before rewriting an existing service or operation name\")\n\tflags.Int(collectorPort, 14267, \"The tchannel port for the collector service\")\n\tflags.Int(collectorHTTPPort, 14268, \"The http port for the collector service\")\n\tflags.Int(collectorZipkinHTTPort, 0, \"The http port for the Zipkin collector service e.g. 9411\")\n\tflags.Int(collectorHealthCheckHTTPPort, 14269, \"The http port for the health check service\")\n\tflags.Bool(collectorAuthSpan, false, \"Defines if incoming spans should be authenticated\")\n\tflags.String(collectorSpanAuthTagKey, app.DefaultSpanAuthTagKey, \"The name of the tag's key associated with password / api token\")\n\tflags.Int(collectorAuthManagerCacheSize, 1000, \"The size of the authentication manager cache\")\n\tflags.Duration(collectorAuthManagerCacheTTL, time.Second * 3600, \"The TTL of the auth manager cache items\")\n}", "func AddFlagsVar(a *kingpin.Application, config *Config) {\n\ta.Flag(LevelFlagName, LevelFlagHelp).\n\t\tEnvar(LevelFlagEnvar).\n\t\tDefault(\"info\").\n\t\tSetValue(&config.Level)\n\ta.Flag(FormatFlagName, FormatFlagHelp).\n\t\tEnvar(FormatFlagEnvar).\n\t\tDefault(\"console\").\n\t\tSetValue(&config.Format)\n}", "func (g *Generator) AddFlags(command *cobra.Command) {\n\tflags := command.Flags()\n\tflags.SortFlags = false\n\n\tflags.StringP(base.Output, \"o\", \"\", \"output dir path\")\n\tif err := command.MarkFlagRequired(base.Output); err != nil {\n\t\tpanic(err)\n\t}\n\n\tflags.StringP(mfdFlag, \"m\", \"\", \"mfd file path\")\n\tif err := command.MarkFlagRequired(mfdFlag); err != nil {\n\t\tpanic(err)\n\t}\n\n\tflags.StringSliceP(nsFlag, \"n\", []string{}, \"namespaces to generate. separate by comma\\n\")\n\tflags.StringSliceP(entitiesFlag, \"e\", []string{}, \"entities to generate, must be in vt.xml file. separate by comma\")\n\n\tflags.String(routesTemplateFlag, \"\", \"path to routes custom template\")\n\tflags.String(listTemplateFlag, \"\", \"path to list custom template\")\n\tflags.String(filterTemplateFlag, \"\", \"path to filter custom template\")\n\tflags.String(formTemplateFlag, \"\", \"path to form custom template\\n\")\n}", "func addFlags(options *Options, fs *pflag.FlagSet) {\n\tfs.StringVar(&options.ConfigFile, \"config\", options.ConfigFile, \"The path to the configuration file.\")\n}", "func (PickMustHaveMilestone) AddFlags(cmd *cobra.Command, config *github.Config) {}", "func (t *T) AddFlags(fs *flag.FlagSet) {\n\tt.RequirementLevels.AddFlags(fs)\n\tt.FeatureStates.AddFlags(fs)\n}", "func (n *NetworkListCommand) addFlags() {\n\t//TODO add flags\n}", "func (n *NetworkConnectCommand) addFlags() {\n\tflagSet := n.cmd.Flags()\n\n\tflagSet.StringVar(&n.ipAddress, \"ip\", \"\", \"IP Address\")\n\tflagSet.StringVar(&n.ipv6Address, \"ip6\", \"\", \"IPv6 Address\")\n\tflagSet.StringSliceVar(&n.links, \"link\", []string{}, \"Add link to another container\")\n\tflagSet.StringSliceVar(&n.aliases, \"alias\", []string{}, \"Add network-scoped alias for the container\")\n\tflagSet.StringSliceVar(&n.linklocalips, \"link-local-ip\", []string{}, \"Add a link-local address for the container\")\n}", "func (this *AggregateBase) AddFlags(flags uint32) {\n\tthis.flags |= flags\n}", "func (v Info) appendFlags(flags map[string]string) {\n\tif v.Version != \"\" {\n\t\tflags[\"main.version\"] = v.Version\n\t}\n\tif v.Branch != \"\" {\n\t\tflags[\"main.branch\"] = v.Branch\n\t}\n\tif v.Hash != \"\" {\n\t\tflags[\"main.commit\"] = v.Hash\n\t}\n\n\tout, err := json.Marshal(v)\n\tif err == nil {\n\t\tflags[\"github.com/grafana/grafana-plugin-sdk-go/build.buildInfoJSON\"] = string(out)\n\t}\n}", "func addFlags(s *server.Server, fs *pflag.FlagSet) {\n\tfs.StringVar(&s.APIServer, \"api-server\", s.APIServer, \"Endpoint for the api server\")\n\tfs.StringVar(&s.APIToken, \"api-token\", s.APIToken, \"Token to authenticate with the api server\")\n\tfs.StringVar(&s.AppPort, \"app-port\", s.AppPort, \"Kube2iam server http port\")\n\tfs.StringVar(&s.MetricsPort, \"metrics-port\", s.MetricsPort, \"Metrics server http port (default: same as kube2iam server port)\")\n\tfs.StringVar(&s.BaseRoleARN, \"base-role-arn\", s.BaseRoleARN, \"Base role ARN\")\n\tfs.BoolVar(&s.Debug, \"debug\", s.Debug, \"Enable debug features\")\n\tfs.StringVar(&s.DefaultIAMRole, \"default-role\", s.DefaultIAMRole, \"Fallback role to use when annotation is not set\")\n\tfs.StringVar(&s.IAMRoleKey, \"iam-role-key\", s.IAMRoleKey, \"Pod annotation key used to retrieve the IAM role\")\n\tfs.StringVar(&s.IAMExternalID, \"iam-external-id\", s.IAMExternalID, \"Pod annotation key used to retrieve the IAM ExternalId\")\n\tfs.DurationVar(&s.IAMRoleSessionTTL, \"iam-role-session-ttl\", s.IAMRoleSessionTTL, \"TTL for the assume role session\")\n\tfs.BoolVar(&s.Insecure, \"insecure\", false, \"Kubernetes server should be accessed without verifying the TLS. Testing only\")\n\tfs.StringVar(&s.MetadataAddress, \"metadata-addr\", s.MetadataAddress, \"Address for the ec2 metadata\")\n\tfs.BoolVar(&s.AddIPTablesRule, \"iptables\", false, \"Add iptables rule (also requires --host-ip)\")\n\tfs.BoolVar(&s.AutoDiscoverBaseArn, \"auto-discover-base-arn\", false, \"Queries EC2 Metadata to determine the base ARN\")\n\tfs.BoolVar(&s.AutoDiscoverDefaultRole, \"auto-discover-default-role\", false, \"Queries EC2 Metadata to determine the default Iam Role and base ARN, cannot be used with --default-role, overwrites any previous setting for --base-role-arn\")\n\tfs.StringVar(&s.HostInterface, \"host-interface\", \"docker0\", \"Host interface for proxying AWS metadata\")\n\tfs.BoolVar(&s.NamespaceRestriction, \"namespace-restrictions\", false, \"Enable namespace restrictions\")\n\tfs.StringVar(&s.NamespaceRestrictionFormat, \"namespace-restriction-format\", s.NamespaceRestrictionFormat, \"Namespace Restriction Format (glob/regexp)\")\n\tfs.StringVar(&s.NamespaceKey, \"namespace-key\", s.NamespaceKey, \"Namespace annotation key used to retrieve the IAM roles allowed (value in annotation should be json array)\")\n\tfs.DurationVar(&s.CacheResyncPeriod, \"cache-resync-period\", s.CacheResyncPeriod, \"Kubernetes caches resync period\")\n\tfs.BoolVar(&s.ResolveDupIPs, \"resolve-duplicate-cache-ips\", false, \"Queries the k8s api server to find the source of truth when the pod cache contains multiple pods with the same IP\")\n\tfs.StringVar(&s.HostIP, \"host-ip\", s.HostIP, \"IP address of host\")\n\tfs.StringVar(&s.NodeName, \"node\", s.NodeName, \"Name of the node where kube2iam is running\")\n\tfs.DurationVar(&s.BackoffMaxInterval, \"backoff-max-interval\", s.BackoffMaxInterval, \"Max interval for backoff when querying for role.\")\n\tfs.DurationVar(&s.BackoffMaxElapsedTime, \"backoff-max-elapsed-time\", s.BackoffMaxElapsedTime, \"Max elapsed time for backoff when querying for role.\")\n\tfs.StringVar(&s.LogFormat, \"log-format\", s.LogFormat, \"Log format (text/json)\")\n\tfs.StringVar(&s.LogLevel, \"log-level\", s.LogLevel, \"Log level\")\n\tfs.BoolVar(&s.UseRegionalStsEndpoint, \"use-regional-sts-endpoint\", false, \"use the regional sts endpoint if AWS_REGION is set\")\n\tfs.BoolVar(&s.Verbose, \"verbose\", false, \"Verbose\")\n\tfs.BoolVar(&s.Version, \"version\", false, \"Print the version and exits\")\n}", "func (i *ImageInspectCommand) addFlags() {\n\ti.cmd.Flags().StringVarP(&i.format, \"format\", \"f\", \"\", \"Format the output using the given go template\")\n}", "func AddFlags(v *viper.Viper, command *cobra.Command, inits ...func(*flag.FlagSet)) (*viper.Viper, *cobra.Command) {\n\tflagSet := new(flag.FlagSet)\n\tfor i := range inits {\n\t\tinits[i](flagSet)\n\t}\n\tcommand.Flags().AddGoFlagSet(flagSet)\n\n\tconfigureViper(v)\n\tv.BindPFlags(command.Flags())\n\treturn v, command\n}", "func AddFlags(flags *flag.FlagSet) {\n\tflags.Bool(flagTenancyEnabled, false, \"Enable tenancy header when receiving or querying\")\n\tflags.String(flagTenancyHeader, \"x-tenant\", \"HTTP header carrying tenant\")\n\tflags.String(flagValidTenants, \"\",\n\t\tfmt.Sprintf(\"comma-separated list of allowed values for --%s header. (If not supplied, tenants are not restricted)\",\n\t\t\tflagTenancyHeader))\n}", "func AddGlobalFlags(fs *pflag.FlagSet) {\n\taddCadvisorFlags(fs)\n\taddCredentialProviderFlags(fs)\n\tverflag.AddFlags(fs)\n\tlogs.AddFlags(fs, logs.SkipLoggingConfigurationFlags())\n}", "func (*bzlLibraryLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {}", "func (opt *Options) AddFlags(fs *pflag.FlagSet) {\n\tfs.StringVar(&opt.Addr, \"addr\", opt.Addr, \"listen address\")\n\n\tfs.DurationVar(\n\t\t&opt.GracefulShutdownTimeout,\n\t\t\"graceful-shutdown-timeout\",\n\t\topt.GracefulShutdownTimeout,\n\t\t\"graceful shutdown timeout\",\n\t)\n\n\tfs.StringVar(&opt.Remote, \"remote\", opt.Remote, \"remote url of git repo\")\n\tfs.StringVar(&opt.Ref, \"ref\", opt.Ref, \"ref of git repo\")\n\n\t// TODO(liubog2008): set token which should not be seen in kubernetes yaml\n\tfs.StringVar(&opt.Token, \"token\", opt.Token, \"token of mario file\")\n}", "func AddFlags(cmd *cobra.Command) {\n\tcmd.Flags().String(\"log-level\", \"info\", \"The log-level for the operator. Possible values: trace, debug, info, warning, error, fatal, panic\")\n\tcmd.Flags().String(\"jaeger-version\", version.DefaultJaeger(), \"Deprecated: the Jaeger version is now managed entirely by the operator. This option is currently no-op.\")\n\tcmd.Flags().String(\"jaeger-agent-image\", \"jaegertracing/jaeger-agent\", \"The Docker image for the Jaeger Agent\")\n\tcmd.Flags().String(\"jaeger-query-image\", \"jaegertracing/jaeger-query\", \"The Docker image for the Jaeger Query\")\n\tcmd.Flags().String(\"jaeger-collector-image\", \"jaegertracing/jaeger-collector\", \"The Docker image for the Jaeger Collector\")\n\tcmd.Flags().String(\"jaeger-ingester-image\", \"jaegertracing/jaeger-ingester\", \"The Docker image for the Jaeger Ingester\")\n\tcmd.Flags().String(\"jaeger-all-in-one-image\", \"jaegertracing/all-in-one\", \"The Docker image for the Jaeger all-in-one\")\n\tcmd.Flags().String(\"jaeger-cassandra-schema-image\", \"jaegertracing/jaeger-cassandra-schema\", \"The Docker image for the Jaeger Cassandra Schema\")\n\tcmd.Flags().String(\"jaeger-spark-dependencies-image\", \"ghcr.io/jaegertracing/spark-dependencies/spark-dependencies\", \"The Docker image for the Spark Dependencies Job\")\n\tcmd.Flags().String(\"jaeger-es-index-cleaner-image\", \"jaegertracing/jaeger-es-index-cleaner\", \"The Docker image for the Jaeger Elasticsearch Index Cleaner\")\n\tcmd.Flags().String(\"jaeger-es-rollover-image\", \"jaegertracing/jaeger-es-rollover\", \"The Docker image for the Jaeger Elasticsearch Rollover\")\n\tcmd.Flags().String(\"openshift-oauth-proxy-image\", \"quay.io/openshift/origin-oauth-proxy:4.12\", \"The Docker image location definition for the OpenShift OAuth Proxy\")\n\tcmd.Flags().String(\"openshift-oauth-proxy-imagestream-ns\", \"\", \"The namespace for the OpenShift OAuth Proxy imagestream\")\n\tcmd.Flags().String(\"openshift-oauth-proxy-imagestream-name\", \"\", \"The name for the OpenShift OAuth Proxy imagestream\")\n\tcmd.Flags().String(\"platform\", v1.FlagPlatformAutoDetect, \"The target platform the operator will run. Possible values: 'kubernetes', 'openshift', 'auto-detect'\")\n\tcmd.Flags().String(\"es-provision\", v1.FlagProvisionElasticsearchAuto, \"Whether to auto-provision an Elasticsearch cluster for suitable Jaeger instances. Possible values: 'yes', 'no', 'auto'. When set to 'auto' and the API name 'logging.openshift.io' is available, auto-provisioning is enabled.\")\n\tcmd.Flags().String(\"kafka-provision\", \"auto\", \"Whether to auto-provision a Kafka cluster for suitable Jaeger instances. Possible values: 'yes', 'no', 'auto'. When set to 'auto' and the API name 'kafka.strimzi.io' is available, auto-provisioning is enabled.\")\n\tcmd.Flags().Bool(\"kafka-provisioning-minimal\", false, \"(unsupported) Whether to provision Kafka clusters with minimal requirements, suitable for demos and tests.\")\n\tcmd.Flags().String(\"secure-listen-address\", \"\", \"\")\n\tcmd.Flags().String(\"health-probe-bind-address\", \":8081\", \"The address the probe endpoint binds to.\")\n\tcmd.Flags().Int(\"webhook-bind-port\", 9443, \"The address webhooks expose.\")\n\tcmd.Flags().String(\"tls-min-version\", \"VersionTLS12\", \"Minimum TLS version supported. Value must match version names from https://golang.org/pkg/crypto/tls/#pkg-constants.\")\n\tcmd.Flags().StringSlice(\"tls-cipher-suites\", nil, \"Comma-separated list of cipher suites for the server. Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). If omitted, the default Go cipher suites will be used\")\n\tcmd.Flags().Bool(\"leader-elect\", false, \"Enable leader election for controller manager. \"+\n\t\t\"Enabling this will ensure there is only one active controller manager.\")\n\n\tdocURL := fmt.Sprintf(\"https://www.jaegertracing.io/docs/%s\", version.DefaultJaegerMajorMinor())\n\tcmd.Flags().String(\"documentation-url\", docURL, \"The URL for the 'Documentation' menu item\")\n}", "func AddFlags() {\n\tflag.StringVar(&configFile, \"config\", \"\", \"TOML config file.\")\n\tflag.BoolVar(&helpConfig, \"help-config\", false, \"Output sample commented config file.\")\n\tflag.BoolVar(&version, \"version\", false, \"Output version information and exit.\")\n}", "func (o *ClientOptions) AddFlags(fs *flag.FlagSet) {\n\tfs.StringVar(&o.LogID, \"cloud-logging-logs-id\", o.LogID,\n\t\t\"For cloud logging, the log stream ID.\")\n\tfs.StringVar(&o.ServiceName, \"cloud-logging-service\", o.ServiceName,\n\t\t\"For cloud logging, the service name.\")\n\tfs.StringVar(&o.ProjectID, \"cloud-logging-project-name\", o.ProjectID,\n\t\t\"For cloud logging, the project name.\")\n\tfs.StringVar(&o.ResourceType, \"cloud-logging-resource-type\", o.ResourceType,\n\t\t\"For cloud logging, the instance name.\")\n\tfs.StringVar(&o.ResourceID, \"cloud-logging-resource-id\", o.ResourceID,\n\t\t\"For cloud logging, the instance ID.\")\n\tfs.StringVar(&o.Region, \"cloud-logging-region\", o.Region,\n\t\t\"For cloud logging, the region.\")\n\tfs.StringVar(&o.UserID, \"cloud-logging-user\", o.UserID,\n\t\t\"For cloud logging, the user ID.\")\n\tfs.StringVar(&o.Zone, \"cloud-logging-zone\", o.Zone,\n\t\t\"For cloud logging, the zone.\")\n}", "func addLdFlags(args []string, ldflags string) ([]string, error) {\n\tif ldIdx := findArg(args, \"-ldflags\"); ldIdx != -1 { // -ldflag exists, normalize and append\n\t\targs = normalizeArg(args, \"-ldflags\")\n\t\targs[ldIdx] = appendToFlag(args[ldIdx], ldflags)\n\t\treturn args, nil\n\t}\n\n\t// -ldflags argument does not exist in args.\n\t// find where to insert the new argument (after \"build\" or \"install\")\n\tinsertIdx := findArg(args, \"build\")\n\tif insertIdx == -1 {\n\t\tinsertIdx = findArg(args, \"install\")\n\t}\n\tif insertIdx == -1 {\n\t\treturn nil, fmt.Errorf(\"cannot locate where to append -ldflags\")\n\t}\n\n\t// allocate a new slice to prevent modifying the old one\n\tnewArgs := make([]string, insertIdx+1, len(args)+2)\n\tcopy(newArgs, args[:insertIdx+1])\n\tnewArgs = append(newArgs, \"-ldflags\", ldflags)\n\tnewArgs = append(newArgs, args[insertIdx+1:]...)\n\treturn newArgs, nil\n}", "func addRenderFlags(settings *render.Settings, cmd *cobra.Command) {\n\tflags := cmd.Flags()\n\n\tflags.StringVarP(\n\t\t&settings.Label,\n\t\t\"label\",\n\t\t\"l\",\n\t\t\"\",\n\t\t\"filter documents by Labels\")\n\n\tflags.StringVarP(\n\t\t&settings.Annotation,\n\t\t\"annotation\",\n\t\t\"a\",\n\t\t\"\",\n\t\t\"filter documents by Annotations\")\n\n\tflags.StringVarP(\n\t\t&settings.APIVersion,\n\t\t\"apiversion\",\n\t\t\"g\",\n\t\t\"\",\n\t\t\"filter documents by API version\")\n\n\tflags.StringVarP(\n\t\t&settings.Kind,\n\t\t\"kind\",\n\t\t\"k\",\n\t\t\"\",\n\t\t\"filter documents by Kinds\")\n}", "func (f *VerboseFlags) AddFlags(cmd *cobra.Command) {\n\tmessage := \"Output more information in JSON format. (default false)\"\n\tif strings.HasPrefix(cmd.Use, \"open-stream\") {\n\t\tmessage = \"Output more information. (default false)\"\n\t}\n\tcmd.Flags().BoolVarP(&f.IsVerbose, \"verbose\", \"v\", false, message)\n}", "func (o *Options) AddFlags(fs *pflag.FlagSet) {\n\tif o == nil {\n\t\treturn\n\t}\n\tfs.StringVar(&o.ShowHiddenMetricsForVersion, \"show-hidden-metrics-for-version\", o.ShowHiddenMetricsForVersion,\n\t\t\"The previous version for which you want to show hidden metrics. \"+\n\t\t\t\"Only the previous minor version is meaningful, other values will not be allowed. \"+\n\t\t\t\"The format is <major>.<minor>, e.g.: '1.16'. \"+\n\t\t\t\"The purpose of this format is make sure you have the opportunity to notice if the next release hides additional metrics, \"+\n\t\t\t\"rather than being surprised when they are permanently removed in the release after that.\")\n\tfs.StringSliceVar(&o.DisabledMetrics,\n\t\t\"disabled-metrics\",\n\t\to.DisabledMetrics,\n\t\t\"This flag provides an escape hatch for misbehaving metrics. \"+\n\t\t\t\"You must provide the fully qualified metric name in order to disable it. \"+\n\t\t\t\"Disclaimer: disabling metrics is higher in precedence than showing hidden metrics.\")\n\tfs.StringToStringVar(&o.AllowListMapping, \"allow-metric-labels\", o.AllowListMapping,\n\t\t\"The map from metric-label to value allow-list of this label. The key's format is <MetricName>,<LabelName>. \"+\n\t\t\t\"The value's format is <allowed_value>,<allowed_value>...\"+\n\t\t\t\"e.g. metric1,label1='v1,v2,v3', metric1,label2='v1,v2,v3' metric2,label1='v1,v2,v3'.\")\n}", "func (n *NetworkInspectCommand) addFlags() {\n\t//TODO add flags\n\tn.cmd.Flags().StringVarP(&n.format, \"format\", \"f\", \"\", \"Format the output using the given go template\")\n}", "func (o *SetupOptions) AddFlags(flagSet *pflag.FlagSet) {\n\t// Add flags for generic options\n\tflagSet.StringVarP(&o.LogLevel, \"log-level\", \"l\", \"INFO\", \"log print level\")\n\tflagSet.StringVarP(&o.ConfigPath, \"config\", \"c\", \"./cmd/client/conf/config-dev.toml\", \"init client by given config\")\n}", "func AddFlags(flags *pflag.FlagSet) {\n\tflags.StringP(kafkaAddr, \"k\", \"\", \"Kafka URL\")\n\tflags.StringP(kafkaTopic, \"t\", \"/owner/*\", \"Kafka's topic\")\n\tflags.StringP(kafkaSchemaRegistry, \"e\", \"\", \"Kafka's schema registry\")\n\tflags.StringP(influxdbAddr, \"i\", \"\", \"InfluxDB URL\")\n\tflags.StringP(influxdbName, \"n\", \"interactws\", \"[optional] Sets the InfluxDB's name. Default: 'interactws'\")\n\tflags.StringP(influxdbUser, \"u\", \"\", \"Sets the InfluxDB's user\")\n\tflags.StringP(influxdbPassword, \"s\", \"\", \"Sets the InfluxDB's password\")\n\tflags.StringP(port, \"p\", \"7070\", \"[optional] Custom port for accessing Kafka2InfluxDB's services. Default: 7070\")\n\tflags.StringP(logLevel, \"l\", \"info\", \"[optional] Sets the Log Level to one of seven (trace, debug, info, warn, error, fatal, panic). Default: info\")\n\tflags.StringP(withSASL, \"w\", \"false\", \"[optional] Enable/Disable SASL Kafka Security. Default: false\")\n\tflags.StringP(kerberosConfigPath, \"c\", \"\", \"Kerberos config path\")\n\tflags.StringP(kerberosServiceName, \"d\", \"kafka\", \"[optional] Kerberos service name. Default: kafka\")\n\tflags.StringP(kerberosUsername, \"f\", \"\", \"Kerberos user\")\n\tflags.StringP(kerberosPassword, \"g\", \"\", \"Kerberos password\")\n\tflags.StringP(kerberosRealm, \"r\", \"KERBEROS\", \"[optional] Kerberos realm. Default: KERBEROS\")\n}", "func (ss *SousServer) AddFlags(fs *flag.FlagSet) {\n\tfs.StringVar(&ss.flags.laddr, `listen`, `:80`, \"The address to listen on, like '127.0.0.1:https'\")\n\tfs.StringVar(&ss.flags.gdmRepo, \"gdm-repo\", \"\", \"Git repo containing the GDM (cloned into config.SourceLocation)\")\n}", "func (o *PullRequestOptions) AddFlags(cmd *cobra.Command) {\n\to.Options.AddFlags(cmd)\n\n\tcmd.Flags().IntVarP(&o.Number, \"pr\", \"\", 0, \"the Pull Request number. If not specified we detect it via $PULL_NUMBER or $BRANCH_NAME environment variables\")\n\n}", "func (o *Options) addFlags(fs *pflag.FlagSet) {\n\tfs.StringVar(&o.configFile, \"config\", o.configFile, \"The path to the configuration file\")\n}", "func AddFlags(flags *flag.FlagSet) {\n\tflags.String(reporterType, string(GRPC), fmt.Sprintf(\"Reporter type to use e.g. %s\", string(GRPC)))\n\tif !setupcontext.IsAllInOne() {\n\t\tflags.String(agentTags, \"\", \"One or more tags to be added to the Process tags of all spans passing through this agent. Ex: key1=value1,key2=${envVar:defaultValue}\")\n\t}\n}", "func (o *Options) AddFlags() {\n\to.flags = pflag.NewFlagSet(\"\", pflag.ExitOnError)\n\n\t// Add klog flags.\n\tklogFlags := flag.NewFlagSet(\"klog\", flag.ExitOnError)\n\tklog.InitFlags(klogFlags)\n\to.flags.AddGoFlagSet(klogFlags)\n\n\to.flags.Usage = func() {\n\t\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\t\to.flags.PrintDefaults()\n\t}\n\n\to.flags.StringVar(&o.Apiserver, \"apiserver\", \"\", \"The URL of the apiserver to use as a master.\")\n\to.flags.StringVar(&o.Kubeconfig, \"kubeconfig\", os.Getenv(\"KUBECONFIG\"), \"Absolute path to the kubeconfig file.\")\n\to.flags.StringVar(&o.Host, \"host\", \"0.0.0.0\", \"Host to expose Events metrics on.\")\n\to.flags.IntVar(&o.Port, \"port\", 8080, \"Port to expose Events metrics on.\")\n\to.flags.StringVar(&o.ExporterHost, \"exporter-host\", \"0.0.0.0\", \"Host to expose kube-events-exporter own metrics on.\")\n\to.flags.IntVar(&o.ExporterPort, \"exporter-port\", 8081, \"Port to expose kube-events-exporter own metrics on.\")\n\to.flags.BoolVar(&o.Version, \"version\", false, \"kube-events-exporter version information\")\n\n\to.flags.StringArrayVar(&o.EventTypes, \"event-types\", []string{EventTypeAll}, \"List of allowed Event types. Defaults to all types.\")\n\to.flags.StringArrayVar(&o.InvolvedObjectAPIGroups, \"involved-object-api-groups\", []string{APIGroupAll}, \"List of allowed Event involved object API groups. Defaults to all API groups.\")\n\to.flags.StringArrayVar(&o.InvolvedObjectNamespaces, \"involved-object-namespaces\", []string{metav1.NamespaceAll}, \"List of allowed Event involved object namespaces. Defaults to all namespaces.\")\n\to.flags.StringArrayVar(&o.ReportingControllers, \"reporting-controllers\", []string{ReportingControllerAll}, \"List of controllers allowed to report Event. Defaults to all controllers.\")\n}", "func (n *NetworkRemoveCommand) addFlags() {\n\t//TODO add flags\n}", "func (sd *SousNewDeploy) AddFlags(fs *flag.FlagSet) {\n\tMustAddFlags(fs, &sd.DeployFilterFlags, NewDeployFilterFlagsHelp)\n\n\tfs.BoolVar(&sd.force, \"force\", false,\n\t\t\"force deploy no matter if GDM already is at the correct version\")\n\tfs.BoolVar(&sd.waitStable, \"wait-stable\", true,\n\t\t\"wait for the deploy to complete before returning (otherwise, use --wait-stable=false)\")\n\tfs.StringVar(&sd.dryrunOption, \"dry-run\", \"none\",\n\t\t\"prevent rectify from actually changing things - \"+\n\t\t\t\"values are none,scheduler,registry,both\")\n}", "func (s *ServerOption) AddFlags(fs *flag.FlagSet) {\n\tfs.BoolVar(&s.JsonLogFormat, \"json-log-format\", true, \"Set true to use json style log format. Set false to use plaintext style log format\")\n\tfs.StringVar(&s.AreaConfigPath, \"area-config-path\", \"https://raw.githubusercontent.com/kubeflow/community/master/labels-owners.yaml\", \"Path to the YAML file mapping area labels to owners.\")\n\tfs.IntVar(&s.Port, \"port\", 8080, \"The port to use for an http server.\")\n}", "func (s *DeprecatedInsecureServingOptions) AddFlags(fs *pflag.FlagSet) {\n\tif s == nil {\n\t\treturn\n\t}\n\n\tfs.IPVar(&s.BindAddress, \"insecure-bind-address\", s.BindAddress, \"\"+\n\t\t\"The IP address on which to serve the --insecure-port (set to 0.0.0.0 or :: for listening on all interfaces and IP address families).\")\n\t// Though this flag is deprecated, we discovered security concerns over how to do health checks without it e.g. #43784\n\tfs.MarkDeprecated(\"insecure-bind-address\", \"This flag will be removed in a future version.\")\n\tfs.Lookup(\"insecure-bind-address\").Hidden = false\n\n\tfs.IntVar(&s.BindPort, \"insecure-port\", s.BindPort, \"\"+\n\t\t\"The port on which to serve unsecured, unauthenticated access.\")\n\t// Though this flag is deprecated, we discovered security concerns over how to do health checks without it e.g. #43784\n\tfs.MarkDeprecated(\"insecure-port\", \"This flag will be removed in a future version.\")\n\tfs.Lookup(\"insecure-port\").Hidden = false\n}", "func (cli *Application) AddFlag(f flags.Interface) {\n\tcli.Log.Debugf(\"CLI:AddFlag - %q\", f.Name())\n\t// Verify flag\n\tcli.errs.Add(f.Verify())\n\n\t// add flag if there was no errors\n\tif cli.errs.Nil() {\n\t\tnextFlagID := len(cli.flags) + 1\n\t\t// assign the flag and set error if there is flag alias shadowing.\n\t\tcli.flags[nextFlagID] = f\n\t\t// Check that flag or it's aliases do not shadow other global flag\n\t\tfor _, alias := range f.GetAliases() {\n\t\t\tif flagID, exists := cli.flagAliases[alias]; exists {\n\t\t\t\tcli.errs.Appendf(FmtErrFlagShadowing, f.Name(), alias, cli.flags[flagID].Name())\n\t\t\t} else {\n\t\t\t\tcli.flagAliases[alias] = nextFlagID\n\t\t\t}\n\t\t}\n\t}\n}", "func AddFlags(flags *flag.FlagSet) {\n\tflags.String(\n\t\thttpServerHostPort,\n\t\tdefaultHTTPServerHostPort,\n\t\t\"host:port of the http server (e.g. for /sampling point and /baggageRestrictions endpoint)\")\n\n\tfor _, p := range defaultProcessors {\n\t\tprefix := fmt.Sprintf(processorPrefixFmt, p.model, p.protocol)\n\t\tflags.Int(prefix+suffixWorkers, defaultServerWorkers, \"how many workers the processor should run\")\n\t\tflags.Int(prefix+suffixServerQueueSize, defaultQueueSize, \"length of the queue for the UDP server\")\n\t\tflags.Int(prefix+suffixServerMaxPacketSize, defaultMaxPacketSize, \"max packet size for the UDP server\")\n\t\tflags.Int(prefix+suffixServerSocketBufferSize, 0, \"socket buffer size for UDP packets in bytes\")\n\t\tflags.String(prefix+suffixServerHostPort, \":\"+strconv.Itoa(p.port), \"host:port for the UDP server\")\n\t}\n}", "func AddDatabaseFlags(fs *pflag.FlagSet) {\n\tfs.String(\"db-dialect\", \"sqlite\", \"database dialect [mysql, postgres, sqlite]\")\n\tfs.String(\"db-args\", \"\", \"database args\")\n}", "func (opt *Options) AddFlags(flagSet *flag.FlagSet) {\n\tflagSet.String(\n\t\tconfigPrefix+suffixHost,\n\t\tdefaultHost,\n\t\t\"Quest database host:port , REST endpoint\")\n}", "func AddFlagsVar(a *kingpin.Application, config *Config) {\n\ta.Flag(\"event.pub-url\", \"events pub url\").\n\t\tEnvar(\"EVENT_PUB_URL\").\n\t\tDefault(\"mem://events\").\n\t\tURLVar(&config.PubURL)\n\ta.Flag(\"event.sub-url\", \"events sub url\").\n\t\tEnvar(\"EVENT_SUB_URL\").\n\t\tDefault(\"mem://events\").\n\t\tURLVar(&config.SubURL)\n}", "func (n *NetworkCreateCommand) addFlags() {\n\tflagSet := n.cmd.Flags()\n\n\tflagSet.StringVarP(&n.name, \"name\", \"n\", \"\", \"the name of network\")\n\tflagSet.StringVarP(&n.driver, \"driver\", \"d\", \"bridge\", \"the driver of network\")\n\tflagSet.StringVar(&n.gateway, \"gateway\", \"\", \"the gateway of network\")\n\tflagSet.StringVar(&n.ipRange, \"ip-range\", \"\", \"the range of network's ip\")\n\tflagSet.StringVar(&n.subnet, \"subnet\", \"\", \"the subnet of network\")\n\tflagSet.StringVar(&n.ipamDriver, \"ipam-driver\", \"default\", \"the ipam driver of network\")\n\tflagSet.BoolVar(&n.enableIPv6, \"enable-ipv6\", false, \"enable ipv6 network\")\n\tflagSet.StringSliceVarP(&n.options, \"option\", \"o\", nil, \"create network with options\")\n\tflagSet.StringSliceVarP(&n.labels, \"label\", \"l\", nil, \"create network with labels\")\n}", "func WithFlags(flag int) OptFunc {\n\treturn func(l *Logger) {\n\t\tl.SetFlags(flag)\n\t}\n}", "func AddFlags() {\n\tif atomic.AddInt32(&called, 1) != 1 {\n\t\tError.Printf(\"log.AddFlags: called twice!\")\n\t\tdebug.PrintStack()\n\t\treturn\n\t}\n\tflag.Var(new(logFlag), \"log\", \"set log level (off, error, info, debug)\")\n}", "func PopulateFlags(jump *cli.App) {\n jump.Flags = []cli.Flag {\n cli.BoolFlag{\n Name: \"all\",\n Usage: \"function on all the checkpoints\",\n Destination: &flags.All,\n },\n cli.BoolFlag{\n Name: \"raw\",\n Usage: \"no cleaning of the name takes place\",\n Destination: &flags.Raw,\n },\n }\n}", "func AddFlags(flags *pflag.FlagSet) {\n\tflags.StringP(source, \"s\", \"\", \"Source directory\")\n\tflags.StringP(destination, \"d\", \"\", \"Destination directory\")\n}", "func (cc *BackupCommand) addFlags() {\n\tflagSet := cc.cmd.Flags()\n\thome, _ := homedir.Dir()\n\tbackPath := filepath.Join(home, \".mysshbackup\")\n\tflagSet.StringVarP(&cc.backupPath, \"path\", \"p\", backPath, \"backup path\")\n\n}", "func AddFlags(flags *flag.FlagSet) {\n\tflags.Int(collectorQueueSize, DefaultQueueSize, \"The queue size of the collector\")\n\tflags.Int(collectorNumWorkers, DefaultNumWorkers, \"The number of workers pulling items from the queue\")\n\tflags.Int(collectorHTTPPort, 0, collectorHTTPPortWarning+\" see --\"+CollectorHTTPHostPort)\n\tflags.Int(collectorGRPCPort, 0, collectorGRPCPortWarning+\" see --\"+CollectorGRPCHostPort)\n\tflags.Int(collectorZipkinHTTPPort, 0, collectorZipkinHTTPPortWarning+\" see --\"+CollectorZipkinHTTPHostPort)\n\tflags.Uint(collectorDynQueueSizeMemory, 0, \"(experimental) The max memory size in MiB to use for the dynamic queue.\")\n\tflags.String(collectorTags, \"\", \"One or more tags to be added to the Process tags of all spans passing through this collector. Ex: key1=value1,key2=${envVar:defaultValue}\")\n\tflags.String(collectorZipkinAllowedOrigins, \"*\", \"Comma separated list of allowed origins for the Zipkin collector service, default accepts all\")\n\tflags.String(collectorZipkinAllowedHeaders, \"content-type\", \"Comma separated list of allowed headers for the Zipkin collector service, default content-type\")\n\tAddOTELJaegerFlags(flags)\n\tAddOTELZipkinFlags(flags)\n}", "func AddFlags(flags *pflag.FlagSet) {\n\tflags.StringSlice(kpars, []string{}, \"A list of comma-separated parameters that will be removed from the event\")\n\tflags.Bool(enabled, false, \"Indicates if remove transformer is enabled\")\n}", "func AddRakkessFlags(cmd *cobra.Command) {\n\tcmd.Flags().StringSliceVar(&opts.Verbs, constants.FlagVerbs, []string{\"list\", \"create\", \"update\", \"delete\"}, fmt.Sprintf(\"show access for verbs out of (%s)\", strings.Join(constants.ValidVerbs, \", \")))\n\tcmd.Flags().StringVarP(&opts.OutputFormat, constants.FlagOutput, \"o\", \"icon-table\", fmt.Sprintf(\"output format out of (%s)\", strings.Join(constants.ValidOutputFormats, \", \")))\n\tcmd.Flags().StringSliceVar(&diffWith, constants.FlagDiffWith, nil, \"Show diff for modified call. For example --diff-with=namespace=kube-system.\")\n\n\topts.ConfigFlags.AddFlags(cmd.Flags())\n}", "func (o *unsafeCommonOptions) addFlags(cmd *cobra.Command) {\n\tcmd.PersistentFlags().BoolVar(&o.noConfirm, \"no-confirm\", false, \"Don't ask user whether to confirm executing meta command\")\n}", "func (app *App) AddFlag(f Flag) {\n\tif app.flagsQueue == nil {\n\t\tapp.flagsQueue = make([]Flag, 0)\n\t}\n\tapp.flagsQueue = append(app.flagsQueue, f)\n}", "func (cfg *Config) AddFlags(fs *flag.FlagSet) {\n\tfs.StringVar(&cfg.GatewayIP, \"gateway.ip\", cfg.GatewayIP, \"ScaleIO Gateway IP\")\n\tfs.StringVar(&cfg.Username, \"gateway.username\", cfg.Username, \"ScaleIO Gateway Username\")\n\tfs.StringVar(&cfg.Password, \"gateway.password\", cfg.Password, \"ScaleIO Gateway Password\")\n\tfs.StringVar(&cfg.Version, \"gateway.version\", cfg.Version, \"ScaleIO Gateway Version\")\n\tfs.StringVar(&cfg.SdsList, \"gateway.sds\", cfg.SdsList, \"ScaleIO SDS List\")\n}", "func (o *RebootMachineConfigPoolOptions) AddFlags(cmd *cobra.Command) {\n\to.PrintFlags.AddFlags(cmd)\n\to.ResourceBuilderFlags.AddFlags(cmd.Flags())\n\n\tcmd.Flags().BoolVar(&o.DryRun, \"dry-run\", o.DryRun, \"Set to true to use server-side dry run.\")\n}", "func (o *ControllerRunOptions) AddFlags(fs *pflag.FlagSet) {\n\tfs.StringVar(&o.KubeConfig, \"kubeconfig\", \"\",\n\t\t\"The kubeconfig to connect to cluster to watch/apply resources.\")\n\tfs.StringVar(&o.CAFile, \"agent-cafile\", o.CAFile, \"\"+\n\t\t\"Agent CA file.\")\n\tfs.StringVar(&o.LogCertSecret, \"log-cert-secret\", o.LogCertSecret,\n\t\t\"log cert secret name.\")\n\tfs.BoolVar(&o.EnableInventory, \"enable-inventory\", o.EnableInventory,\n\t\t\"enable multi-cluster inventory\")\n\tfs.BoolVar(&o.EnableLeaderElection, \"enable-leader-election\", o.EnableLeaderElection,\n\t\t\"Enable leader election for controller manager. \"+\n\t\t\t\"Enabling this will ensure there is only one active controller manager.\")\n\tfs.BoolVar(&o.EnableRBAC, \"enable-rbac\", o.EnableRBAC,\n\t\t\"Enable RBAC controller.\")\n\tfs.Float32Var(&o.QPS, \"max-qps\", o.QPS,\n\t\t\"Maximum QPS to the hub server from this controller.\")\n\tfs.IntVar(&o.Burst, \"max-burst\", o.Burst,\n\t\t\"Maximum burst for throttle.\")\n}", "func (s *DynamoDBOptions) AddFlags(fs *pflag.FlagSet) {\n\tfs.StringVar(&s.StorageConfig.Region, \"aws-region\", s.StorageConfig.Region, \"\"+\n\t\t\"specify the region where the session to connection.\")\n\n\tfs.StringVar(&s.StorageConfig.Table, \"aws-table\", s.StorageConfig.Table, \"\"+\n\t\t\"specify the table name. default(program name)\")\n\n\tfs.StringVar(&s.StorageConfig.Token, \"aws-cred-token\", s.StorageConfig.Table, \"\"+\n\t\t\"specify the token for credentials.\")\n\n\tfs.StringVar(&s.StorageConfig.AccessID, \"aws-cred-accessid\", s.StorageConfig.AccessID, \"\"+\n\t\t\"specify the access id for credentials.\")\n\n\tfs.StringVar(&s.StorageConfig.AccessKey, \"aws-cred-accesskey\", s.StorageConfig.AccessKey, \"\"+\n\t\t\"specify the access key for credentials.\")\n}", "func AddFlags(cmd *cobra.Command) {\n\tcmd.Flags().BoolVarP(&quiet, \"quiet\", \"q\", false, \"Suppress output to stderr.\")\n}", "func SetFlags(flag int) { std.SetFlags(flag) }", "func BindGlobalFlags(v *viper.Viper, flags *pflag.FlagSet) {\n}", "func Write_AddAttributedOrderFlags(stream Streams.IMitchWriter, value AddAttributedOrderFlags) (byteCount int, err error) {\n\treturn stream.Write_byte(byte(value.Flags))\n}", "func Write_AddOrderFlags(stream Streams.IMitchWriter, value AddOrderFlags) (byteCount int, err error) {\n\treturn stream.Write_byte(byte(value.Flags))\n}", "func (s *ClusterOperatorServerRunOptions) AddFlags(fs *pflag.FlagSet) {\n\t// Add the generic flags.\n\ts.GenericServerRunOptions.AddUniversalFlags(fs)\n\ts.Etcd.AddFlags(fs)\n\ts.SecureServing.AddFlags(fs)\n\ts.SecureServing.AddDeprecatedFlags(fs)\n\t//s.InsecureServing.AddFlags(fs)\n\t//s.InsecureServing.AddDeprecatedFlags(fs)\n\ts.Audit.AddFlags(fs)\n\ts.Features.AddFlags(fs)\n\ts.Authentication.AddFlags(fs)\n\ts.Authorization.AddFlags(fs)\n\ts.Admission.AddFlags(fs)\n\n\t// Note: the weird \"\"+ in below lines seems to be the only way to get gofmt to\n\t// arrange these text blocks sensibly. Grrr.\n\n\tfs.BoolVar(&s.EnableLogsHandler, \"enable-logs-handler\", s.EnableLogsHandler,\n\t\t\"If true, install a /logs handler for the apiserver logs.\")\n\n\tfs.IntVar(&s.MasterCount, \"apiserver-count\", s.MasterCount,\n\t\t\"The number of apiservers running in the cluster, must be a positive number.\")\n\n\tfs.BoolVar(&s.DisableAuth, \"disable-auth\", false,\n\t\t\"Disable authentication and authorization for testing purposes\")\n}", "func (ft *FieldType) AddFlag(flag uint) {\n\tft.flag |= flag\n}", "func (c *coder) addFlags(flags *flag.FlagSet) {\n\tflags.StringVar(&c.registryURL, \"registry\", \"\", \"The Avro schema registry server URL.\")\n\tflags.StringVar(&c.avscFile, \"value-avro-schema\", \"\", `Path to AVSC file to format the file. If it is set, then -valuecodec is set to \"avro\"`)\n\tflags.StringVar(&c.avroRecordName, \"value-avro-record-name\", \"\", \"Record name to use when using TopicRecordNameStrategy to find the schema subject in Schema Registry\")\n\tflags.Int64Var(&c.avroSchemaID, \"value-avro-schema-id\", 0, \"Use it to select schema to produce Avro formatted schemas.\")\n}", "func AddReadOnlyFlag(set *pflag.FlagSet, readOnly *bool) {\n\tset.BoolVarP(readOnly, \"read-only\", \"\", false, \"only do checks that dont require creating resources (i.e. port forwards)\")\n}", "func configureFlags(api *operations.LolchestWinAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (c *Command) addFlag(flag *Flag) {\n\n\tif _, exists := c.innerFlagsLong[flag.Long]; exists {\n\t\tpanic(fmt.Errorf(\"Flag '%s' already exists \", flag.Long))\n\t}\n\tif _, exists := c.innerFlagsShort[flag.Short]; exists {\n\t\tpanic(fmt.Errorf(\"Flag '%s' already exists \", flag.Short))\n\t}\n\tc.innerFlagsLong[flag.Long] = flag\n\tc.orderedFlags = append(c.orderedFlags, flag)\n\tif flag.Short != \"\" {\n\t\tc.innerFlagsShort[flag.Short] = flag\n\t}\n\n}", "func configureFlags(api *operations.CalculatorAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (o *Options) AddFlags(fs *pflag.FlagSet) {\n\tfs.StringVar(&o.HelperImage, \"helper-image\", defaultHelperImage,\n\t\t\"The image that instrumentate mysql.\")\n\n\tfs.StringVar(&o.MetricsExporterImage, \"metrics-exporter-image\", defaultExporterImage,\n\t\t\"The image for mysql metrics exporter.\")\n\tfs.StringVar(&o.ImagePullSecretName, \"image-pull-secret\", \"\",\n\t\t\"The secret name for used as pull secret.\")\n\n\tfs.VarP(newPullPolicyValue(defaultImagePullPolicy, &o.ImagePullPolicy),\n\t\t\"image-pull-policy\", \"\", \"Set image pull policy.\")\n\n\tfs.StringVar(&o.OrchestratorURI, \"orchestrator-uri\", \"\",\n\t\t\"The orchestrator uri\")\n\tfs.StringVar(&o.OrchestratorTopologyPassword, \"orchestrator-topology-password\", defaultOrchestratorTopologyUser,\n\t\t\"The orchestrator topology password. Can also be set as ORC_TOPOLOGY_PASSWORD environment variable.\")\n\tfs.StringVar(&o.OrchestratorTopologyUser, \"orchestrator-topology-user\", defaultOrchestratorTopologyPassword,\n\t\t\"The orchestrator topology user. Can also be set as ORC_TOPOLOGY_USER environment variable.\")\n\tfs.DurationVar(&o.JobCompleteSuccessGraceTime, \"job-grace-time\", defaultJobGraceTime,\n\t\t\"The time in hours how jobs after completion are keept.\")\n\n\tfs.StringVar(&o.HTTPServeAddr, \"http-serve-addr\", defaultHTTPServerAddr,\n\t\t\"The address for http server.\")\n\n\tfs.StringVar(&o.LeaderElectionNamespace, \"leader-election-namespace\", defaultLeaderElectionNamespace,\n\t\t\"The leader election namespace.\")\n\tfs.StringVar(&o.LeaderElectionID, \"leader-election-id\", defaultLeaderElectionID,\n\t\t\"The leader election id.\")\n}", "func PharseFlags(appl *App) error {\n\n\tif appl.Contact == \"\" {\n\t\tappl.Contact = DEFAULT_CONTACT\n\t} else {\n\t\tappl.Contact = appl.Contact + CONTACT_ENDING\n\t}\n\n\tif appl.Heading == \"\" && appl.Position != \"\" && appl.Source != \"\" {\n\t\tappl.Heading = \"I am excited about the possibility of joining your organization in the position of \" + appl.Position + \", as advertised on \" + appl.Source + \". \" + appl.HeadingAdd// default heading\n\t} else {\n\t\tif appl.Option <= 6 && appl.Option > 0 {\n\t\t\tpanic(\"heading undefined\")\n\t\t}\n\t}\n\n if appl.Option == 10 && appl.Position != \"\" && appl.PositionID != \"\" {\n appl.FollowUpRef = \"For reference, I have pasted the position title and ID number below.\"\n appl.FollowUpRefInfo = appl.Position + \" - \" + appl.PositionID\n }\n\n if appl.Option == 10 && appl.Position != \"\" && appl.PositionID == \"\" {\n appl.FollowUpRef = \"For reference, I have pasted the position title below.\"\n appl.FollowUpRefInfo = appl.Position\n }\n\n if appl.Option == 10 && (appl.Position == \"\" || appl.Company == \"\") {\n panic(\"Not all of the required flags for a follow up were provided. Need: --position and --company\")\n }\n\n\t// If additional note is present, add a newline at the end of it\n\tif appl.Note1 != \"\" {\n\t\tappl.Note1_tex = appl.Note1 + \" \\\\newline\"\n\t\tappl.Note1_email = \"<div><p style=\\\"text-align:left\\\";>\" + appl.Note1 + \"</p></div>\"\n\t}\n\n // If additional note is present, add a newline at the end of it\n if appl.Note2 != \"\" {\n appl.Note2_tex = appl.Note2 + \" \\\\newline\"\n appl.Note2_email = \"<div><p style=\\\"text-align:left\\\";>\" + appl.Note2 + \"</p></div>\"\n }\n\n\t// If additional skill is present, add a \\item before it\n\tif appl.Skill1 != \"\" {\n\t\tappl.Skill1_tex = \"\\\\item \" + appl.Skill1\n\t\tappl.Skill1_email = \"<li>\" + appl.Skill1 + \"</li>\"\n\t\tappl.Skill1_text = \"- \" + appl.Skill1\n\t}\n\n\t// If additional skill is present, add a \\item before it\n\tif appl.Skill2 != \"\" {\n\t\tappl.Skill2_tex = \"\\\\item \" + appl.Skill2\n\t\tappl.Skill2_email = \"<li>\" + appl.Skill2 + \"</li>\"\n\t\tappl.Skill2_text = \"- \" + appl.Skill2\n\t}\n\n // If additional skill is present, add a \\item before it\n if appl.Skill3 != \"\" {\n appl.Skill3_tex = \"\\\\item \" + appl.Skill3\n appl.Skill3_email = \"<li>\" + appl.Skill3 + \"</li>\"\n appl.Skill3_text = \"- \" + appl.Skill3\n }\n\n fmt.Println(appl.Local)\n\n\tif appl.Local == true {\n\t\tappl.ReloLine = LOCAL\n }\n\tif appl.Local == false {\n\t\tappl.ReloLine = DISTANT\n }\n\n\tappl.ReloLine_email = \"<div><p style=\\\"text-align:left;\\\">\" + appl.ReloLine + \"</p></div>\"\n\n\n\tif (appl.Option <= 6 && appl.Option > 0) || appl.Option == 10 {\n\t\tappl.KvMap_tex = map[string]string{\"[COMPANY_NAME]\": strings.Replace(appl.Company, \"&\", \"\\\\&\", -1), \"[COMPANY_CONTACT]\": strings.Replace(appl.Contact, \"&\", \"\\\\&\", -1),\n\t\t\t\"[POSITION_NAME]\": strings.Replace(appl.Position, \"&\", \"\\\\&\", -1), \"[HEADING]\": strings.Replace(appl.Heading, \"&\", \"\\\\&\", -1), \"[POSITION_SOURCE]\": strings.Replace(appl.Source, \"&\", \"\\\\&\", -1),\n\t\t\t\"[ADDITIONAL_SKILL_1]\": strings.Replace(appl.Skill1_tex, \"&\", \"\\\\&\", -1), \"[ADDITIONAL_SKILL_2]\": strings.Replace(appl.Skill2_tex, \"&\", \"\\\\&\", -1), \"[ADDITIONAL_SKILL_3]\": strings.Replace(appl.Skill3_tex, \"&\", \"\\\\&\", -1),\n\t\t\t\"[ADDITIONAL_NOTE1]\": strings.Replace(appl.Note1_tex, \"&\", \"\\\\&\", -1),\t\"[ADDITIONAL_NOTE2]\": strings.Replace(appl.Note2_tex, \"&\", \"\\\\&\", -1), \"[RELOCATION]\": strings.Replace(appl.ReloLine, \"&\", \"\\\\&\", -1)}\n\n\t\tappl.KvMap_text = map[string]string{\"[COMPANY_NAME]\": appl.Company, \"[COMPANY_CONTACT]\": appl.Contact, \"[POSITION_NAME]\": appl.Position,\n\t\t\t\"[HEADING]\": appl.Heading, \"[POSITION_SOURCE]\": appl.Source, \"[ADDITIONAL_SKILL_1]\": appl.Skill1_text, \"[ADDITIONAL_SKILL_2]\": appl.Skill2_text, \"[ADDITIONAL_SKILL_3]\": appl.Skill3_text,\n\t\t\t\"[ADDITIONAL_NOTE1]\": appl.Note1, \"[ADDITIONAL_NOTE2]\": appl.Note2, \"[CURRENT_DATE]\": date.Get_date(\"email\"), \"[RELOCATION]\": appl.ReloLine, \"[WHEN_APPLIED]\": appl.WhenApplied, \"[FOLLOWUPREF]\": appl.FollowUpRef, \"[FOLLOWUPREFINFO]\": appl.FollowUpRefInfo}\n\t}\n\n\tif appl.MailTo != \"\" && os.Getenv(\"EmailPass\") != \"\" && os.Getenv(\"MailFrom\") != \"\" {\n\t\tappl.KvMap_email = map[string]string{\"[COMPANY_NAME]\": appl.Company, \"[COMPANY_CONTACT]\": appl.Contact, \"[POSITION_NAME]\": appl.Position,\n\t\t\t\"[HEADING]\": appl.Heading, \"[POSITION_SOURCE]\": appl.Source, \"[ADDITIONAL_SKILL_1]\": appl.Skill1_email, \"[ADDITIONAL_SKILL_2]\": appl.Skill2_email, \"[ADDITIONAL_SKILL_3]\": appl.Skill3_email,\n\t\t\t\"[ADDITIONAL_NOTE1]\": appl.Note1_email, \"[ADDITIONAL_NOTE2]\": appl.Note2_email, \"[CURRENT_DATE]\": date.Get_date(\"email\"), \"[RELOCATION]\": appl.ReloLine_email, \"[WHEN_APPLIED]\": appl.WhenApplied, \"[FOLLOWUPREF]\": appl.FollowUpRef, \"[FOLLOWUPREFINFO]\": appl.FollowUpRefInfo}\n\n\n\t\tif appl.Subject == \"\" && appl.Position != \"\" {\n\t\t\tappl.Subject = \"Joshua Haupt appllication for \" + appl.Position + \" position at \" + appl.Company // default subject\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func AddIntFlag(cmd *cobra.Command, name string, aliases []string, value int, env, usage string) {\n\tif env != \"\" {\n\t\tusage = fmt.Sprintf(\"%s [$%s]\", usage, env)\n\t}\n\tif envV, ok := os.LookupEnv(env); ok {\n\t\tv, err := strconv.ParseInt(envV, 10, 64)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Warnf(\"Invalid int value for `%s`\", env)\n\t\t}\n\t\tvalue = int(v)\n\t}\n\taliasesUsage := fmt.Sprintf(\"Alias of --%s\", name)\n\tp := new(int)\n\tflags := cmd.Flags()\n\tflags.IntVar(p, name, value, usage)\n\tfor _, a := range aliases {\n\t\tif len(a) == 1 {\n\t\t\t// pflag doesn't support short-only flags, so we have to register long one as well here\n\t\t\tflags.IntVarP(p, a, a, value, aliasesUsage)\n\t\t} else {\n\t\t\tflags.IntVar(p, a, value, aliasesUsage)\n\t\t}\n\t}\n}", "func (o *StandardOptions) AddSelectionFlags(app FlagApp) {\n\tapp.Flag(\"dm\", \"Sets a discovery method (mc, choria, file, external, inventory)\").EnumVar(&o.DiscoveryMethod, \"broadcast\", \"choria\", \"mc\", \"file\", \"flatfile\", \"external\", \"inventory\")\n\tapp.Flag(\"discovery-timeout\", \"Timeout for doing discovery\").PlaceHolder(\"SECONDS\").IntVar(&o.DiscoveryTimeout)\n\tapp.Flag(\"discovery-window\", \"Enables a sliding window based dynamic discovery timeout (experimental)\").BoolVar(&o.DynamicDiscoveryTimeout)\n}", "func (b *AdapterBase) InstallFlags() {\n\tb.initFlagSet()\n\tb.flagOnce.Do(func() {\n\t\tif b.CustomMetricsAdapterServerOptions == nil {\n\t\t\tb.CustomMetricsAdapterServerOptions = server.NewCustomMetricsAdapterServerOptions()\n\t\t\tb.CustomMetricsAdapterServerOptions.OpenAPIConfig = b.OpenAPIConfig\n\t\t}\n\n\t\tb.SecureServing.AddFlags(b.FlagSet)\n\t\tb.Authentication.AddFlags(b.FlagSet)\n\t\tb.Authorization.AddFlags(b.FlagSet)\n\t\tb.Audit.AddFlags(b.FlagSet)\n\t\tb.Features.AddFlags(b.FlagSet)\n\n\t\tb.FlagSet.StringVar(&b.RemoteKubeConfigFile, \"lister-kubeconfig\", b.RemoteKubeConfigFile,\n\t\t\t\"kubeconfig file pointing at the 'core' kubernetes server with enough rights to list \"+\n\t\t\t\t\"any described objects\")\n\t\tb.FlagSet.DurationVar(&b.DiscoveryInterval, \"discovery-interval\", b.DiscoveryInterval,\n\t\t\t\"interval at which to refresh API discovery information\")\n\t})\n}", "func (o *SAControllerOptions) AddFlags(fs *pflag.FlagSet) {\n\tif o == nil {\n\t\treturn\n\t}\n\n\tfs.StringVar(&o.ServiceAccountKeyFile, \"service-account-private-key-file\", o.ServiceAccountKeyFile, \"Filename containing a PEM-encoded private RSA or ECDSA key used to sign service account tokens.\")\n\tfs.Int32Var(&o.ConcurrentSATokenSyncs, \"concurrent-serviceaccount-token-syncs\", o.ConcurrentSATokenSyncs, \"The number of service account token objects that are allowed to sync concurrently. Larger number = more responsive token generation, but more CPU (and network) load\")\n\tfs.StringVar(&o.RootCAFile, \"root-ca-file\", o.RootCAFile, \"If set, this root certificate authority will be included in service account's token secret. This must be a valid PEM-encoded CA bundle.\")\n}", "func configureFlags(api *operations.ToDoDemoAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.ToDoDemoAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.MonocularAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (o *Options) AddFlags(fs *pflag.FlagSet) {\n\tfs.BoolVar(&o.InstallCRDs, \"install-crds\", true, \"install the CRDs used by the controller as part of startup\")\n\tfs.Var(flagutil.NewMapStringBool(&o.FeatureGates), \"feature-gates\", \"A set of key=value pairs that describe feature gates for alpha/experimental features. \"+\n\t\t\"Options are:\\n\"+strings.Join(utilfeature.DefaultFeatureGate.KnownFeatures(), \"\\n\"))\n\n\tfs.StringVar(&o.Config.FederationNamespace, \"federation-namespace\", util.DefaultFederationSystemNamespace, \"The namespace the federation control plane is deployed in.\")\n\tfs.StringVar(&o.Config.ClusterNamespace, \"registry-namespace\", util.MulticlusterPublicNamespace, \"The cluster registry namespace.\")\n\tfs.DurationVar(&o.Config.ClusterAvailableDelay, \"cluster-available-delay\", util.DefaultClusterAvailableDelay, \"Time to wait before reconciling on a healthy cluster.\")\n\tfs.DurationVar(&o.Config.ClusterUnavailableDelay, \"cluster-unavailable-delay\", util.DefaultClusterUnavailableDelay, \"Time to wait before giving up on an unhealthy cluster.\")\n\n\tfs.BoolVar(&o.LimitedScope, \"limited-scope\", false, \"Whether the federation namespace will be the only target for federation.\")\n\tfs.DurationVar(&o.ClusterMonitorPeriod, \"cluster-monitor-period\", time.Second*40, \"How often to monitor the cluster health\")\n\n\tfs.DurationVar(&o.LeaderElection.LeaseDuration, \"leader-elect-lease-duration\", util.DefaultLeaderElectionLeaseDuration, \"\"+\n\t\t\"The duration that non-leader candidates will wait after observing a leadership \"+\n\t\t\"renewal until attempting to acquire leadership of a led but unrenewed leader \"+\n\t\t\"slot. This is effectively the maximum duration that a leader can be stopped \"+\n\t\t\"before it is replaced by another candidate. This is only applicable if leader \"+\n\t\t\"election is enabled.\")\n\tfs.DurationVar(&o.LeaderElection.RenewDeadline, \"leader-elect-renew-deadline\", util.DefaultLeaderElectionRenewDeadline, \"\"+\n\t\t\"The interval between attempts by the acting master to renew a leadership slot \"+\n\t\t\"before it stops leading. This must be less than or equal to the lease duration. \"+\n\t\t\"This is only applicable if leader election is enabled.\")\n\tfs.DurationVar(&o.LeaderElection.RetryPeriod, \"leader-elect-retry-period\", util.DefaultLeaderElectionRetryPeriod, \"\"+\n\t\t\"The duration the clients should wait between attempting acquisition and renewal \"+\n\t\t\"of a leadership. This is only applicable if leader election is enabled.\")\n\tfs.StringVar(&o.LeaderElection.ResourceLock, \"leader-elect-resource-lock\", \"configmaps\", \"\"+\n\t\t\"The type of resource object that is used for locking during \"+\n\t\t\"leader election. Supported options are `configmaps` (default) and `endpoints`.\")\n}", "func recordFlags(flags ...string) {\n\tif myimportpath == \"\" {\n\t\t// We can't record the flags if we don't know what the\n\t\t// package name is.\n\t\treturn\n\t}\n\n\ttype BoolFlag interface {\n\t\tIsBoolFlag() bool\n\t}\n\ttype CountFlag interface {\n\t\tIsCountFlag() bool\n\t}\n\tvar cmd bytes.Buffer\n\tfor _, name := range flags {\n\t\tf := flag.Lookup(name)\n\t\tif f == nil {\n\t\t\tcontinue\n\t\t}\n\t\tgetter := f.Value.(flag.Getter)\n\t\tif getter.String() == f.DefValue {\n\t\t\t// Flag has default value, so omit it.\n\t\t\tcontinue\n\t\t}\n\t\tif bf, ok := f.Value.(BoolFlag); ok && bf.IsBoolFlag() {\n\t\t\tval, ok := getter.Get().(bool)\n\t\t\tif ok && val {\n\t\t\t\tfmt.Fprintf(&cmd, \" -%s\", f.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif cf, ok := f.Value.(CountFlag); ok && cf.IsCountFlag() {\n\t\t\tval, ok := getter.Get().(int)\n\t\t\tif ok && val == 1 {\n\t\t\t\tfmt.Fprintf(&cmd, \" -%s\", f.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tfmt.Fprintf(&cmd, \" -%s=%v\", f.Name, getter.Get())\n\t}\n\n\tif cmd.Len() == 0 {\n\t\treturn\n\t}\n\ts := Ctxt.Lookup(dwarf.CUInfoPrefix + \"producer.\" + myimportpath)\n\ts.Type = objabi.SDWARFINFO\n\t// Sometimes (for example when building tests) we can link\n\t// together two package main archives. So allow dups.\n\ts.Set(obj.AttrDuplicateOK, true)\n\tCtxt.Data = append(Ctxt.Data, s)\n\ts.P = cmd.Bytes()[1:]\n}", "func configureFlags(api *operations.JiliAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}" ]
[ "0.7302995", "0.72852176", "0.72525585", "0.72525585", "0.722496", "0.7076358", "0.69606715", "0.6865291", "0.6825081", "0.67939997", "0.6716574", "0.66168714", "0.6611968", "0.65841687", "0.65588135", "0.6527045", "0.636939", "0.63637686", "0.63425165", "0.63384134", "0.63261896", "0.62994653", "0.6294972", "0.62915945", "0.6281288", "0.62547827", "0.6250659", "0.6229058", "0.6204805", "0.6176334", "0.61676973", "0.61493117", "0.61408377", "0.61222875", "0.6122147", "0.6106963", "0.6087297", "0.6082557", "0.6077811", "0.6061112", "0.6057776", "0.60510856", "0.60422605", "0.60035914", "0.59898853", "0.59823775", "0.5973262", "0.59717375", "0.5968372", "0.59662247", "0.5956371", "0.5952556", "0.59210885", "0.5916723", "0.591625", "0.5907365", "0.59059346", "0.5905295", "0.5904882", "0.5891884", "0.5860996", "0.5856041", "0.58522034", "0.5847197", "0.58391005", "0.5837962", "0.5836789", "0.58342993", "0.5824641", "0.58217764", "0.5784342", "0.57735306", "0.5773001", "0.576482", "0.5744254", "0.57332784", "0.573001", "0.5718324", "0.568125", "0.5653571", "0.5645004", "0.5639348", "0.56331176", "0.5631842", "0.56239676", "0.5623818", "0.56182605", "0.55877554", "0.55847454", "0.5572722", "0.5570738", "0.556183", "0.5560359", "0.5548795", "0.5542853", "0.5542853", "0.55414563", "0.55375236", "0.55348116", "0.55072325" ]
0.6867318
7
URLs downloads a list of urls and saves the respond in a file.
func URLs(urls []*url.URL, suffix string) { var wg sync.WaitGroup for _, u := range urls { wg.Add(1) go func(url *url.URL) { defer wg.Done() fn := filepath.Clean(path.Base(url.Path)) + "-" + suffix out, err := os.Create(fn) if err != nil { log.Printf("error creating the destination file:%v\n", err) return } defer out.Close() resp, err := http.Get(url.String()) if err != nil { log.Printf("error downloading file:%v\n", err) return } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { log.Printf("url:%v,bad status: %v\n", url.String(), resp.Status) return } _, err = io.Copy(out, resp.Body) if err != nil { log.Printf("error while reading the response: %v\n", err) return } log.Printf("downloaded:%v saved as: %v\n", url.String(), fn) }(u) } wg.Wait() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func downloadFiles(urls []string) {\n\tvar wg sync.WaitGroup\n\tfor _, u := range urls {\n\t\twg.Add(1)\n\t\tgo func(uu string) {\n\t\t\tdownloadFromURL(uu)\n\t\t\twg.Done()\n\t\t}(u)\n\t}\n\twg.Wait()\n}", "func DownloadURL(url string) ([]byte, error) {\n urls, err := getDownloadURLs(url, 1400000)\n if err != nil {\n return nil, err\n }\n\n output := \"\"\n\n for _, value := range urls {\n downloaded, _ := downloadPart(value)\n\n output += downloaded\n }\n\n return []byte(output), nil\n}", "func downloadFiles(files *[]synth.File) {\n\tvar wg sync.WaitGroup\n\twg.Add(len(*files))\n\n\tfmt.Println()\n\tfor _, file := range *files {\n\t\tparams := make(map[string]string)\n\t\tparams[\"file\"] = file.Path\n\n\t\tconn := contact.NewConnection(bufferSize)\n\t\tconn.Dial(serverHost, \"/download\", params)\n\n\t\tgo saveFile(conn, file.Path, &wg)\n\t}\n\n\twg.Wait()\n\tfmt.Println()\n}", "func Download(r []string, c int) error {\n\tvar wg sync.WaitGroup\n\tdlch := make(chan string, len(r))\n\tworkers := 2\n\treg := regexp.MustCompile(`\\?.+`)\n\tfor i := 0; i < workers; i++ {\n\t\twg.Add(1)\n\t\tgo func(wg *sync.WaitGroup, dlch chan string) {\n\t\t\tdefer wg.Done()\n\t\t\tvar res *http.Response\n\t\t\tvar err error\n\t\t\tfor {\n\t\t\t\tdlurl, fin := <-dlch\n\t\t\t\tif !fin {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfname := reg.ReplaceAllString(dlurl, \"\")\n\t\t\t\tfilename := filepath.Base(fname)\n\t\t\t\tconv := strings.Replace(strings.TrimSpace(fname), filename, \"\", -1)\n\t\t\t\tconv = strings.Replace(strings.TrimSpace(conv), \"http://\", \"\", -1)\n\t\t\t\tconv = strings.Replace(strings.TrimSpace(conv), \"https://\", \"\", -1)\n\t\t\t\tconv = strings.Replace(strings.TrimSpace(conv), \"/\", \"_\", -1)\n\t\t\t\tconv = strings.Replace(strings.TrimSpace(conv), \".\", \"-\", -1)\n\t\t\t\tconv += filename\n\t\t\t\tr := &requestParams{\n\t\t\t\t\tMethod: \"GET\",\n\t\t\t\t\tURL: dlurl,\n\t\t\t\t\tData: nil,\n\t\t\t\t\tClient: &http.Client{Timeout: time.Duration(100) * time.Second},\n\t\t\t\t}\n\t\t\t\tres, err = r.fetchURL()\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"Error: %v. \", err)\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t\tbody, err := ioutil.ReadAll(res.Body)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"Error: %v. \", err)\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t\tioutil.WriteFile(conv, body, 0777)\n\t\t\t\tdefer res.Body.Close()\n\t\t\t}\n\t\t}(&wg, dlch)\n\t}\n\tfor i := 0; i < c; i++ {\n\t\tdlch <- r[i]\n\t}\n\tclose(dlch)\n\twg.Wait()\n\treturn nil\n}", "func downloadLinksList(url string, links chan string, fail chan error, done chan struct{}) {\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\tfail <- fmt.Errorf(\"cannot process url: %v\", err)\n\t}\n\tdefer response.Body.Close()\n\tlog.Println(\"Succesful connection\")\n\ttokenizer := html.NewTokenizer(response.Body)\n\tlog.Println(\"Start parsing\")\n\tfor {\n\t\ttokenType := tokenizer.Next()\n\t\tswitch tokenType {\n\t\tcase html.ErrorToken:\n\t\t\tdone <- struct{}{}\n\t\tcase html.StartTagToken:\n\t\t\t// gets the current token\n\t\t\ttoken := tokenizer.Token()\n\t\t\tif token.Data != \"a\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlink := extractLink(token.Attr)\n\t\t\tif len(link) < minProtocolLen {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif strings.HasSuffix(link, zipSuffix) {\n\t\t\t\tlinks <- link\n\t\t\t}\n\t\t}\n\t}\n}", "func downloader(wg *sync.WaitGroup, semaphore chan struct{}, URL string) {\n\tsemaphore <- struct{}{}\n\tdefer func() {\n\t\t<-semaphore\n\t\twg.Done()\n\t}()\n\n\tclient := &http.Client{Timeout: 900 * time.Second}\n\tresult, err := client.Get(URL)\n\tif err != nil {\n\t\tlog.Printf(\"Error from server while executing request: %v\", err)\n\t}\n\n\tdefer func() {\n\t\tif err := result.Body.Close(); err != nil {\n\t\t\tlog.Printf(\"Error while reading response body: %v\", err)\n\t\t}\n\t}()\n\n\tvar buf bytes.Buffer\n\t// I'm copying to a buffer before writing it to file\n\t// I could also just use IO copy to write it to the file\n\t// directly and save memory by dumping to the disk directly.\n\t_, _ = io.Copy(&buf, result.Body)\n\t// write the bytes to file\n\tfileName := util.GetFileNameFromUrl(URL)\n\t_ = ioutil.WriteFile(\"./output/\"+fileName, buf.Bytes(), 0644)\n\tnumFilesDownloaded++\n\tlog.Printf(\"Downloaded file with name: %s -> (%d/%d)\", fileName, numFilesDownloaded, numFiles)\n\treturn\n}", "func Download(ctx context.Context, dst string, urls []string) error {\n\topts := []getter.ClientOption{}\n\tfor _, url := range urls {\n\t\tlog.G(ctx).Debugf(\"Initializing go-getter client with url %v and dst %v\", url, dst)\n\t\tclient := &getter.Client{\n\t\t\tCtx: ctx,\n\t\t\tSrc: url,\n\t\t\tDst: dst,\n\t\t\tPwd: dst,\n\t\t\tMode: getter.ClientModeAny,\n\t\t\tDetectors: detectors,\n\t\t\tGetters: getters,\n\t\t\tOptions: opts,\n\t\t}\n\n\t\tif err := client.Get(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func Download() {\n\tfor _, file := range utils.TTLFiles {\n\t\thead, err := http.Head(TTLURL + file.Name)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tsize, err := strconv.Atoi(head.Header.Get(\"Content-Length\"))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tlast, err := http.ParseTime(head.Header.Get(\"Last-Modified\"))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\thead.Body.Close()\n\t\tstat, err := os.Stat(\"./\" + file.Name)\n\t\tif err != nil || stat.ModTime().Before(last) || stat.Size() != int64(size) {\n\t\t\tfmt.Println(\"downloading\", file, size, last)\n\t\t\tresponse, err := http.Get(TTLURL + file.Name)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tout, err := os.Create(\"./\" + file.Name)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\t_, err = io.Copy(out, response.Body)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tresponse.Body.Close()\n\t\t\tout.Close()\n\n\t\t\terr = os.Chtimes(\"./\"+file.Name, last, last)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"skipping\", file, size, last)\n\t\t}\n\t}\n\treturn\n}", "func Download(url string, filepath string) (err error) {\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Writer the body to file\n\t_, err = io.Copy(out, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func URLs(dir string, skip bool) error {\n\turls := []string{federalRevenueURL, nationalTreasureBaseURL}\n\thandlers := []getURLsHandler{federalRevenueGetURLsNoUpdatedAt, nationalTreasureGetURLs}\n\tvar out []string\n\tfor idx := range urls {\n\t\tu, err := getURLs(urls[idx], handlers[idx], dir, skip)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error gathering resources for download: %w\", err)\n\t\t}\n\t\tout = append(out, u...)\n\t}\n\tsort.Strings(out)\n\tfmt.Println(strings.Join(out, \"\\n\"))\n\treturn nil\n}", "func Download(url string, port int, secure bool, accesskey string, secretkey string, enckey string, filelist map[string]string, bucket string, nuke bool) ([]string, error) {\n\t// break up map into 5 parts\n\tjobs := make(chan map[string]string, MAX)\n\tresults := make(chan string, len(filelist))\n\t// reset progress bar\n\n\t// This starts up MAX workers, initially blocked\n\t// because there are no jobs yet.\n\tfor w := 1; w <= MAX; w++ {\n\t\tgo downloadfile(bucket, url, secure, accesskey, secretkey, enckey, w, nuke, jobs, int32(len(filelist)), results)\n\t}\n\n\t// Here we send MAX `jobs` and then `close` that\n\t// channel to indicate that's all the work we have.\n\tfor hash, fpath := range filelist {\n\t\tjob := make(map[string]string)\n\t\tjob[hash] = fpath\n\t\tjobs <- job\n\t}\n\tclose(jobs)\n\n\tvar grmsgs []string\n\tvar failed []string\n\t// Finally we collect all the results of the work.\n\tfor a := 1; a <= len(filelist); a++ {\n\t\tgrmsgs = append(grmsgs, <-results)\n\t}\n\tclose(results)\n\tvar count float64\n\tvar errCount float64\n\tfor _, msg := range grmsgs {\n\t\tif msg != \"\" {\n\t\t\terrCount++\n\t\t\tfailed = append(failed, msg)\n\t\t} else {\n\t\t\tcount++\n\t\t}\n\t}\n\t//fmt.Println(count, \" files downloaded successfully.\")\n\n\tif errCount != 0 {\n\t\tout := fmt.Sprintf(\"Failed to download: %v files\", errCount)\n\t\tfmt.Println(out)\n\t\treturn failed, errors.New(out)\n\t}\n\treturn failed, nil\n\n}", "func Download(fileName string, url string) {\n\tresponse, err := http.Get(url)\n\tcheckError(err, \"print\")\n\tdefer response.Body.Close()\n\n\tfile, err := os.Create(fileName + \".temp\")\n\tcheckError(err, \"print\")\n\tdefer file.Close()\n\n\t//counter := &humanize.WriteCounter{}\n\t_, err = io.Copy(file, response.Body)\n\tcheckError(err, \"print\")\n\n\terr = os.Rename(fileName+\".temp\", fileName)\n\tcheckError(err, \"print\")\t\n}", "func downloadFile(url, output string) error {\n\tif fsutil.IsExist(output) {\n\t\tos.Remove(output)\n\t}\n\n\tfd, err := os.OpenFile(output, os.O_CREATE|os.O_WRONLY, 0644)\n\n\tif err != nil {\n\t\treturn fmtc.Errorf(\"Can't create file: %v\", err)\n\t}\n\n\tdefer fd.Close()\n\n\tresp, err := req.Request{URL: url}.Get()\n\n\tif err != nil {\n\t\treturn fmtc.Errorf(\"Can't download file: %v\", err)\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn fmtc.Errorf(\"Can't download file: server return status code %d\", resp.StatusCode)\n\t}\n\n\tw := bufio.NewWriter(fd)\n\t_, err = io.Copy(w, resp.Body)\n\n\tw.Flush()\n\n\tif err != nil {\n\t\treturn fmtc.Errorf(\"Can't write file: %v\", err)\n\t}\n\n\treturn nil\n}", "func downloadFiles(ctx *log.Context, dir string, cfg handlerSettings) error {\n\t// - prepare the output directory for files and the command output\n\t// - create the directory if missing\n\tctx.Log(\"event\", \"creating output directory\", \"path\", dir)\n\tif err := os.MkdirAll(dir, 0700); err != nil {\n\t\treturn errors.Wrap(err, \"failed to prepare output directory\")\n\t}\n\tctx.Log(\"event\", \"created output directory\")\n\n\t// - download files\n\tctx.Log(\"files\", len(cfg.FileURLs))\n\tfor i, f := range cfg.FileURLs {\n\t\tctx := ctx.With(\"file\", i)\n\t\tctx.Log(\"event\", \"download start\")\n\t\tif err := downloadAndProcessURL(ctx, f, dir, cfg.StorageAccountName, cfg.StorageAccountKey); err != nil {\n\t\t\tctx.Log(\"event\", \"download failed\", \"error\", err)\n\t\t\treturn errors.Wrapf(err, \"failed to download file[%d]\", i)\n\t\t}\n\t\tctx.Log(\"event\", \"download complete\", \"output\", dir)\n\t}\n\treturn nil\n}", "func downloadFiles() {\n\tfor listName, value := range csvs.m {\n\n\t\tfile := listName + \".csv\"\n\n\t\tfilePath := downloadDirectory + file\n\n\t\tlogger.Info(\"Downloading \" + file)\n\n\t\tresults := downloadFile(filePath, value)\n\n\t\tif results != nil {\n\t\t\tlogger.Error(results.Error())\n\t\t} else {\n\t\t\tlogger.Info(\"Download \" + file + \" complete\")\n\t\t}\n\t}\n}", "func DownloadandSaveFiles(elkdemoinstance Elkdemo) {\n\t{\n\t\tfor _, element := range elkdemoinstance.Filesets {\n\n\t\t\tfmt.Printf(\"Fileset Name : %v \\n\", element.Filepersona)\n\t\t\tif element.Action.Download == \"yes\" { //Download only if true\n\t\t\t\tsuccess, filename := getFileFromURL(element.Sourceurl, element.Savefileas)\n\t\t\t\tfmt.Printf(\"%v, %v\", success, filename)\n\t\t\t}\n\t\t}\n\t}\n\n}", "func downloadFile(filepath string, url string) (err error) {\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Get the data into RAM - TODO stream straight to disk\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Check server response\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"bad status: %s\", resp.Status)\n\t}\n\n\t// write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func downloadFile(filename, url string) error {\n\t// Try to create the file with the given filename.\n\tfile, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\t// Get the response from the given url.\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Copy the response body into the file.\n\t_, err = io.Copy(file, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d downloader) download() {\t\n\tclient := &http.Client {}\n\treq, err := http.NewRequest(\"GET\", d.url, nil)\n\tif err != nil {\n\t\td.err <- err\t\t// signall main process this goroutine has encountered an error\n\t\treturn\n\t}\n\trange_header := \"bytes=\" + strconv.Itoa(d.start) + \"-\" + strconv.Itoa(d.end-1) // bytes to grab\n\treq.Header.Add(\"Range\", range_header) // adding byte request to http request1\n\t\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\td.err <- err\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\t\n\terr = d.writeOut(resp.Body)\t\t// function writing to file\n\tif err != nil {\n\t\td.err <- err\n\t\treturn\n\t}\n\td.done <- (d.end-d.start)\t\t// signal main process this goroutine is done\n}", "func DownloadFile(filepath string, url string) error {\n\n // Get the data\n resp, err := http.Get(url)\n if err != nil {\n //return err\n fmt.Println(\"Get the data\")\n }\n defer resp.Body.Close()\n\n // Create the file\n out, err := os.Create(filepath)\n if err != nil {\n fmt.Println(\"Create the file\")\n }\n defer out.Close()\n\n // Write the body to file\n _, err = io.Copy(out, resp.Body)\n return err\n}", "func downloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func Download(bash BashExec, c suitetalk.HTTPClient, paths []string, dest string) (downloads []FileTransfer, err error) {\n\tdest = lib.AbsolutePath(dest)\n\tvar dirs []FileTransfer\n\tfor _, p := range paths {\n\t\tif !strings.HasPrefix(p, \"/\") {\n\t\t\treturn nil, errors.New(\"source paths have to be absolute\")\n\t\t}\n\t\titem, err := suitetalk.GetPath(c, p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif item.IsDir {\n\t\t\tvar dls []FileTransfer\n\t\t\tdls, dirs = getDirDownloads(c, p, dest)\n\t\t\tdownloads = append(downloads, dls...)\n\t\t} else {\n\t\t\tdownloads = append(downloads, FileTransfer{Path: filepath.Base(p), Src: p, Dest: dest})\n\t\t}\n\t}\n\tif len(downloads) > 0 {\n\t\tprocessDownloads(bash, downloads, dirs)\n\t}\n\treturn downloads, nil\n}", "func downloadFile(filepath string, url string) error {\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func downloadFile(filepath string, url string) error {\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func downloadFile(filepath string, url string) error {\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func Download(url string) []byte {\n\tvar resp *http.Response\n\tvar body []byte\n\n\tsleeper()\n\n\tresp, body = httpRequest(url)\n\tif resp != nil {\n\t\tif resp.StatusCode != 200 {\n\t\t\tConfiguration.Logger.Warning.Printf(\"[%d] StatusCode - %s\\n\", resp.StatusCode, url)\n\t\t}\n\t} else {\n\t\tConfiguration.Logger.Warning.Printf(\"BodyNil - %s\\n\", url)\n\t}\n\treturn body\n}", "func main() {\n\tfor _, url := range os.Args[1:] {\n\t\tresp, err := http.Get(\"https://\" + url)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"fetch: %v\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\t//_, err = ioutil.ReadAll(resp.Body)\n\t\t_, err = io.Copy(os.Stdout, resp.Body)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"err to stdout: %v\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfmt.Println(\"Status code:\", resp.Status)\n\n\t}\n}", "func HTTPDownload(url string, dest string) (err error) {\n\n\tfile := path.Base(url)\n\n\tvar path bytes.Buffer\n\tpath.WriteString(dest)\n\n\tstart := time.Now()\n\n\tout, err := os.Create(path.String())\n\n\tif err != nil {\n\t\tfmt.Println(path.String())\n\t\treturn\n\t}\n\n\tdefer out.Close()\n\n\theadResp, err := http.Head(url)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer headResp.Body.Close()\n\n\tsize, err := strconv.Atoi(headResp.Header.Get(\"Content-Length\"))\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdone := make(chan int64)\n\n\tgo PrintDownloadPercent(done, path.String(), int64(size))\n\n\tresp, err := http.Get(url)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer resp.Body.Close()\n\n\tn, err := io.Copy(out, resp.Body)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdone <- n\n\n\telapsed := time.Since(start)\n\tfmt.Println(\"completed!\", file, elapsed)\n\treturn\n}", "func (s *basicService) PostURLs(urls []string) ([]crawl.Result, error) {\n\tif len(urls) == 0 {\n\t\treturn nil, ErrEmptyURLs\n\t}\n\tcrawlResult := []crawl.Result{}\n\n\turlLen := len(urls)\n\n\tjobs := make(chan string, urlLen)\n\tjobResults := make(chan jobResult, urlLen)\n\n\tworkers := urlLen\n\tif workers > s.maxWorkers {\n\t\tworkers = s.maxWorkers\n\t}\n\n\tfor w := 1; w <= workers; w++ {\n\t\tgo s.worker(jobs, jobResults)\n\t}\n\n\tfor _, url := range urls {\n\t\tjobs <- url\n\t}\n\tclose(jobs)\n\n\tfor i := 1; i <= urlLen; i++ {\n\t\tjobResult := <-jobResults\n\t\tif jobResult.err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tcrawlResult = append(crawlResult, jobResult.result)\n\t}\n\n\treturn crawlResult, nil\n}", "func DownloadFile(client *http.Client, url, filepath string) (string, error) {\n\n\tlog.Println(\"Downloading\")\n\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\tlog.Printf(\"error: GET, %s\", err)\n\t\treturn \"\", err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn \"\", fmt.Errorf(\"Received non 200 response code\")\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Printf(\"error: READ, %s\", err)\n\t\treturn \"\", err\n\t}\n\n\t// Create blank file\n\t//file, err := os.Create(filepath)\n\t//file, err := os.OpenFile(filepath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n\t//if err != nil {\n\t//\treturn \"\", err\n\t//}\n\n\t//buff := make([]byte, 4096)\n\n\t//for {\n\t//\tnread, err := resp.Body.Read(buff)\n\t//\tif nread == 0 {\n\t//\t\tif err == nil {\n\t//\t\t\tcontinue\n\t//\t\t}\n\t//\t\tif _, err := file.Write(buff); err != nil {\n\t//\t\t\tbreak\n\t//\t\t}\n\t//\t\tif err != nil {\n\t//\t\t\tbreak\n\t//\t\t}\n\t//\t}\n\t//}\n\t////size, err := io.Copy(file, resp.Body)\n\t//defer file.Close()\n\n\t////if err != nil {\n\t////\tlog.Printf(\"error: WRITE, %s\", err)\n\t////\treturn \"\", err\n\t////}\n\t//statsFile, err := file.Stat()\n\t//log.Printf(\"Downloaded a file %s with size %d\", filepath, statsFile.Size())\n\n\tif err := ioutil.WriteFile(filepath, body, 0644); err != nil {\n\t\tlog.Printf(\"error: WRITE, %s\", err)\n\t\treturn \"\", err\n\t}\n\n\t//content, err := ioutil.ReadAll(file)\n\t//if err != nil {\n\t//\tlog.Printf(\"error: READ, %s\", err)\n\t//\treturn \"\", err\n\t//}\n\n\tmd5sum := md5.Sum(body)\n\tmd5s := hex.EncodeToString(md5sum[0:])\n\n\treturn md5s, nil\n}", "func main() {\n\turl, numThreads, err := getArguments(os.Args)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tres, err := http.Head(url)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tmaps := res.Header\n\tfileLength, err := strconv.Atoi(maps[\"Content-Length\"][0]) // get length of file to be downloaded\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Established a connection to:\", url)\n\tfmt.Println(\"File size: \", humanize.Bytes(uint64(fileLength)))\n\t\n\tfilepath := url[strings.LastIndex(url, \"/\")+1: len(url)] // parse name to use for downloaded file\n\tif len(filepath) < 1 {\n\t\tfilepath = \"file.txt\"\n\t}\n\tfmt.Println(\"Saving file as: \", filepath);\t\n\n\toutFile, err := os.Create(filepath + \".tmp\") // create a temporary file to write downloaded chunks into\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer outFile.Close()\n\n\tchunkSize := fileLength / numThreads // size of chunk each thread will download\n\t\n\tdownloadarr := make([]downloader, numThreads)\t// array holding each goroutine\n\terrchan := make(chan error)\n\tdonechan := make(chan int)\n\tfmt.Println(\"Download Starting\")\n\tfor i := 0; i < numThreads; i++ {\n\t\tdownloadarr[i] = downloader{ \t\t// create a download worker\n\t\t\tstart: i*chunkSize,\n\t\t\tend: (i+1)*chunkSize,\n\t\t\turl: url, \n\t\t\toutfile: outFile, \n\t\t\terr: errchan,\n\t\t\tdone: donechan,\n\t\t}\n\t\t if i == numThreads-1 {\n\t\t\tdownloadarr[i].end = fileLength\t // special case where last chunk may need to be slightly larger to download the whole file\n\t\t}\n\t\tgo downloadarr[i].download()\t\t// start the download goroutine\n\t}\n\t\n\tcount, download_amt := 0, 0\n\terrorloop:for {\t\t// loop waiting for all goroutines to finish\n\t\tselect {\n\t\t\tcase err = <-errchan:\n\t\t\t\tpanic(err)\t// panic if a goroutine sends an error\n\t\t\tcase amt := <- donechan:\n\t\t\t\tcount++\t\t// a goroutine has signalled it is done so increment count of finished goroutines\n\t\t\t\tdownload_amt += amt\n\t\t\t\tfmt.Println(\"Downlading...\",humanize.Bytes(uint64(download_amt)),\"complete\")\n\t\t\t\tif count == numThreads {\n\t\t\t\t\tbreak errorloop\t // If all goroutines are done break out of loop\n\t\t\t\t}\n\t\t}\n\t}\n\n\terr = os.Rename(filepath + \".tmp\", filepath)\t// change file extension from temporary \n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Download finished\")\n}", "func download(w http.ResponseWriter, r *http.Request) {\r\n\t// downloaddata := []string{\"test.zip\", \"test.txt.tar.gz\"}\r\n\tdata := map[string]string{}\r\n\turldata := urlAnalysis(r.URL.Path)\r\n\tvar filepass string\r\n\tfmt.Println(urldata)\r\n\tdata[\"type\"] = urldata[1]\r\n\tdata[\"id\"] = urldata[2]\r\n\r\n\tfilelist_t.ReadId(data[\"id\"])\r\n\tif filelist_t.Tmp.Id == 0 {\r\n\t\tLogout.Out(1, \"download err URL:%v\\n\", r.URL.Path)\r\n\t\tfmt.Fprintf(w, \"%s\", \"download err\")\r\n\t\treturn\r\n\t}\r\n\r\n\t//ダウンロードパス\r\n\tif data[\"type\"] == \"zip\" {\r\n\t\tfilepass = ServersetUp.Zippath + filelist_t.Tmp.Zippass\r\n\t} else if data[\"type\"] == \"pdf\" {\r\n\t\tfilepass = ServersetUp.Pdfpath + filelist_t.Tmp.Pdfpass\r\n\t} else {\r\n\t\tLogout.Out(1, \"download err URL:%v\\n\", r.URL.Path)\r\n\t\tfmt.Fprintf(w, \"%s\", \"download err\")\r\n\t\treturn\r\n\t}\r\n\tfile, err1 := os.Open(filepass)\r\n\r\n\tif err1 != nil {\r\n\t\tfmt.Println(err1)\r\n\t}\r\n\r\n\tdefer file.Close()\r\n\tbuf := make([]byte, 1024)\r\n\tvar buffer []byte\r\n\tfor {\r\n\t\tn, err := file.Read(buf)\r\n\t\tif n == 0 {\r\n\t\t\tbreak\r\n\t\t}\r\n\t\tif err != nil {\r\n\t\t\t// Readエラー処理\r\n\t\t\tbreak\r\n\t\t}\r\n\t\tbuffer = append(buffer, buf[:n]...)\r\n\t}\r\n\tLogout.Out(1, \"download URL:%v,Name:%v\\n\", r.URL.Path, filelist_t.Tmp.Name)\r\n\tif data[\"type\"] == \"zip\" {\r\n\t\t// ファイル名\r\n\t\tw.Header().Set(\"Content-Disposition\", \"attachment; filename=\"+filelist_t.Tmp.Zippass)\r\n\t\t// コンテントタイプ\r\n\t\tw.Header().Set(\"Content-Type\", \"application/zip\")\r\n\t} else if data[\"type\"] == \"pdf\" {\r\n\t\t// ファイル名\r\n\t\tw.Header().Set(\"Content-Disposition\", \"attachment; filename=\"+filelist_t.Tmp.Pdfpass)\r\n\t\t// コンテントタイプ\r\n\t\tw.Header().Set(\"Content-Type\", \"application/pdf\")\r\n\t}\r\n\t// ファイルの長さ\r\n\tw.Header().Set(\"Content-Length\", string(len(buffer)))\r\n\t// bodyに書き込み\r\n\tw.Write(buffer)\r\n}", "func download(url string) (string, error) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfilename, err := urlToFilename(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\t_, err = io.Copy(f, resp.Body)\n\treturn filename, err\n}", "func downloadRemoteArtifactWorker(artDetails *jfauth.ServiceDetails, chFiles <-chan string, tgtDir string) {\n\trtBase := (*artDetails).GetUrl()\n\tdlcount := 0\n\tfor f := range chFiles {\n\t\trtURL := rtBase + f\n\t\tjflog.Debug(\"Getting '\" + rtURL + \"' details ...\")\n\t\t// fmt.Printf(\"Fetching : %s\\n\", rtURL)\n\t\treq, err := http.NewRequest(\"GET\", rtURL, nil)\n\t\tif err != nil {\n\t\t\tjflog.Error(\"http.NewRequest failed\")\n\t\t}\n\t\treq.SetBasicAuth((*artDetails).GetUser(), (*artDetails).GetApiKey())\n\n\t\tresp, err := http.DefaultClient.Do(req)\n\t\tif err != nil {\n\t\t\tjflog.Error(\"http.DefaultClient.Do failed\")\n\t\t\tcontinue\n\t\t}\n\n\t\tfpath := tgtDir + \"/\" + f\n\t\tfdir, _ := filepath.Split(fpath)\n\t\tif _, err := os.Stat(fpath); os.IsNotExist(err) {\n\t\t\tos.MkdirAll(fdir, 0700) // Create directory\n\t\t}\n\n\t\t// Create the file\n\t\tout, err := os.Create(fpath)\n\t\tif err != nil {\n\t\t\tjflog.Error(\"Failed to create file : %s\", fpath)\n\t\t\tresp.Body.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\t// Write the body to file\n\t\t_, err = io.Copy(out, resp.Body)\n\t\tif err != nil {\n\t\t\tjflog.Error(\"Failed to copy download to file : %s\", fpath)\n\t\t}\n\t\t//fmt.Printf(\"downloading to complete: %s\\n\", fpath)\n\t\tdlcount++\n\t\tresp.Body.Close()\n\t\tout.Close()\n\t}\n\t//fmt.Printf(\"downloadRemoteArtifactWorker() complete, downloaded %d files\\n\", dlcount)\n\tjflog.Info(fmt.Sprintf(\"downloadRemoteArtifactWorker() complete, downloaded %d files\", dlcount))\n}", "func (c *Client) Download(url string, path string) error {\n\t// Get the data\n\tresp, err := c.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t_, err = os.Stat(path)\n\tif err == nil || os.IsExist(err) {\n\t\treturn os.ErrExist\n\t}\n\t// captures errors other than does not exist\n\tif err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\n\t// Create the file with .tmp extension, so that we won't overwrite a\n\t// file until it's downloaded fully\n\tout, err := os.Create(path + \".tmp\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Create our bytes counter and pass it to be used alongside our writer\n\tcounter := &writeCounter{Name: filepath.Base(path)}\n\t_, err = io.Copy(out, io.TeeReader(resp.Body, counter))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// The progress use the same line so print a new line once it's finished downloading\n\tfmt.Println()\n\n\t// Rename the tmp file back to the original file\n\terr = os.Rename(path+\".tmp\", path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Download(link string, ch chan string) {\n\tlog.Println(\"Got request to download\", link)\n\tresp, err := http.Get(link)\n\tif err != nil {\n\t\tlog.Println(\"ERROR: fetching link\", link, err)\n\t\tch <- \"ERROR\"\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tlog.Println(\"Got body for link\", link)\n\tfilename := hash(link)\n\terr = ioutil.WriteFile(filename, body, 0777)\n\tif err != nil {\n\t\tlog.Println(\"ERROR: enable to save file\", link, len(body), err)\n\t\tch <- \"ERROR\"\n\t\treturn\n\t}\n\tlog.Println(\"Got file saved\", filename)\n\tch <- filename\n}", "func downloadContent(wg *sync.WaitGroup, linkTo string) {\n\tdefer wg.Done()\n\n\tsetDownloadFolder()\n\n\tresp, err := http.Get(linkTo)\n\tfmt.Println(\"Downloading... Please wait!\")\n\tcolor.Green(resp.Status)\n\tdefer resp.Body.Close()\n\n\tif err != nil {\n\t\tlog.Fatal(\"Trouble making GET request!\")\n\t}\n\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(\"Trouble reading response body!\")\n\t}\n\n\tfilename := path.Base(linkTo)\n\tif filename == \"\" {\n\t\tlog.Fatalf(\"Trouble deriving file name for %s\", linkTo)\n\t}\n\n\terr = ioutil.WriteFile(filename, contents, 0644)\n\tif err != nil {\n\t\tlog.Fatal(\"Trouble creating file! -- \", err)\n\t}\n}", "func (f *Fetcher) Download(downloads []DownloadQuery, startIndex int) {\n\tp := pool.NewPool(f.concurrency)\n\tfor _, query := range downloads {\n\t\tpool.Exec(NewDownloadTask(query,\n\t\t\tf.waitTime, 1))\n\t}\n\tp.Close()\n\tp.Wait()\n}", "func downloadFile(url string, file *os.File) error {\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(file, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (api *HWApi) Downloads(destDir string, urls ...string) (bool, error) {\n\t// store this job and history urls in local temp file with logToken as fileName\n\t// reset channel\n\tif downloadWorker != nil {\n\t\tdownloadWorker = nil\n\t}\n\tdefer func() {\n\t\t_, ok := <-downloadWorker\n\t\tif ok {\n\t\t\tif api.Log != nil {\n\t\t\t\tapi.Log.Error().Msg(\"concurrent downloads failed\")\n\t\t\t}\n\t\t\tclose(downloadWorker)\n\t\t}\n\t\tif e := api.cache.SaveToFile(cacheFilePath); e != nil && api.Log != nil {\n\t\t\tapi.Log.Error().Str(\"dest\", cacheFilePath).Err(e).Msg(\"save cache file failed\")\n\t\t}\n\t}()\n\tdownloadWorker = make(chan downloadJob, api.workers)\n\tvar wg sync.WaitGroup\n\twg.Add(api.workers)\n\t// start worker\n\tfor i := 1; i <= api.workers; i++ {\n\t\tgo func() {\n\t\t\tapi.downloadConcurrently()\n\t\t\twg.Done()\n\t\t}()\n\t}\n\tvar remoteName, remotePath, bucketName string\n\tvar S3 *s3.S3\n\tif strings.Index(destDir, \":\") > 0 {\n\t\ta := strings.Split(destDir, \":\")\n\t\tif len(a) != 3 {\n\t\t\treturn false, ErrRemoteDestFormat\n\t\t}\n\t\tremoteName = a[0]\n\t\tbucketName = a[1]\n\t\tremotePath = a[2]\n\t\tif api.remoteS3 == nil || api.remoteS3[remoteName] == nil {\n\t\t\treturn false, ErrRemoteConfigNotFound\n\t\t}\n\t\tsess, err := session.NewSession(api.remoteS3[remoteName])\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tS3 = s3.New(sess)\n\t} else {\n\t\tremoteName = \"\"\n\t\tremotePath = destDir\n\t}\n\tfor _, u := range urls {\n\t\tif strings.Index(destDir, \":\") > 0 {\n\t\t\tresp, _ := S3.PutObjectRequest(&s3.PutObjectInput{\n\t\t\t\tBucket: &bucketName,\n\t\t\t\tKey: aws.String(remotePath + regexp.MustCompile(`.*([0-9]{4}\\/[0-9]{2}\\/[0-9]{2}\\/[^\\/]+)\\?.*$`).ReplaceAllString(u, \"$1\")),\n\t\t\t})\n\t\t\tdstURL, err := resp.Presign(24 * time.Hour)\n\t\t\tif err != nil {\n\t\t\t\tif api.Log != nil {\n\t\t\t\t\tapi.Log.Debug().Str(\"url\", u).Err(err).Msg(\"presign url failed\")\n\t\t\t\t}\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tdownloadWorker <- downloadJob{\n\t\t\t\tURL: u,\n\t\t\t\tDest: dstURL,\n\t\t\t}\n\t\t} else {\n\t\t\tdownloadWorker <- downloadJob{\n\t\t\t\tURL: u,\n\t\t\t\tDest: destDir,\n\t\t\t}\n\t\t}\n\t}\n\tclose(downloadWorker)\n\twg.Wait()\n\treturn true, nil\n}", "func (d *Downloader) Download() {\n\tfor _, path := range d.sources {\n\t\tif d.Verbose {\n\t\t\tfmt.Println(\"Downloading (recursively:\", d.Recursive, \") from\", path, \"to\", d.dst, \"(and delete:\", d.deleter != nil, \")\")\n\t\t}\n\t\td.download(FixPath(path))\n\t}\n}", "func main() {\n\tvar urls []*url.URL\n\n\t_, err := exec.LookPath(\"wget\")\n\tif err != nil {\n\t\tlog.Fatal(\"can't find wget on your system\")\n\t}\n\n\toutputPath, err := os.Getwd()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tapp := &cli.App{\n\t\tName: \"multi-wget\",\n\t\tUsage: \"automate resumable downloads with wget\",\n\t\tBefore: func(c *cli.Context) error {\n\t\t\tlist := c.Args().Slice()\n\t\t\tfor _, u := range list {\n\t\t\t\tp, err := url.Parse(u)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"invalid url: %w\", err)\n\t\t\t\t}\n\t\t\t\turls = append(urls, p)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tAction: func(c *cli.Context) error {\n\t\t\tvar wg sync.WaitGroup\n\n\t\t\tpb := mpb.New(mpb.WithWaitGroup(&wg))\n\t\t\twg.Add(len(urls))\n\n\t\t\tfor _, downURL := range urls {\n\t\t\t\tgo downloadMedia(&wg, pb, downURL, outputPath)\n\t\t\t}\n\n\t\t\tpb.Wait()\n\t\t\treturn nil\n\t\t},\n\t}\n\n\terr = app.Run(os.Args)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func DownloadFile(filepath string, url string)(err error){\n //Get the data \n resp, err := http.Get(url)\n if err != nil {\n logs.Error(\"Error downloading file: \"+err.Error())\n return err\n }\n defer resp.Body.Close()\n // Create the file\n out, err := os.Create(filepath)\n if err != nil {\n logs.Error(\"Error creating file after download: \"+err.Error())\n return err\n }\n defer out.Close()\n\n // Write the body to file\n _, err = io.Copy(out, resp.Body)\n if err != nil {\n logs.Error(\"Error Copying downloaded file: \"+err.Error())\n return err\n }\n return nil\n}", "func downloadFile(url string) (string, error) {\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tout := new(strings.Builder)\n\n\t// Write the body to the string builder\n\t_, err = io.Copy(out, resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn out.String(), nil\n}", "func downloadFile(url string) (string, error) {\n\tsplittedFileName := strings.Split(url, \"/\")\n\tfileName := splittedFileName[len(splittedFileName)-1]\n\tfmt.Print(\"Downloading \", fileName, \" ... \")\n\toutput, err := os.Create(fileName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer output.Close()\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer response.Body.Close()\n\tn, err := io.Copy(output, response.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfmt.Println(n, \" Bytes\")\n\treturn fileName, nil\n}", "func (c Client) Download(url string) (*http.Response, error) {\n\tlog.Logger().Debugf(\"getting url: %s\", url)\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Accept\", \"application/octet-stream\")\n\n\tresp, err := c.http.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//defer resp.Body.Close()\n\n\tsuccess := resp.StatusCode >= 200 && resp.StatusCode < 300\n\tif !success {\n\t\tlog.Logger().Debugf(\"failed with resp code %d\", resp.StatusCode)\n\t\treturn nil, handleHTTPError(resp)\n\t}\n\n\tif resp.StatusCode == http.StatusNoContent {\n\t\treturn nil, errors.New(\"no content\")\n\t}\n\n\treturn resp, nil\n}", "func Download(id int, userAgent string, dir string, wainting <-chan *url.URL, processed chan<- *url.URL) {\n\n\tlog.Printf(\"Download Worker-[%v] entering loop\", id)\n\n\tvar i *url.URL\n\tvar open bool\n\tvar httpClient = utils.NewHttpClient(userAgent)\n\n\tfor {\n\t\tselect {\n\t\tcase i, open = <-wainting:\n\n\t\t\tif open {\n\n\t\t\t\t//TODO: get data dir as a param from user running program\n\t\t\t\tfilePath := path.Join(dir, i.Path)\n\n\t\t\t\terr := httpClient.Download(i.String(), filePath)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t}\n\n\t\t\t\t//TODO: add to failure list/queue\n\t\t\t\tprocessed <- i\n\n\t\t\t} else {\n\n\t\t\t\tlog.Printf(\"Download Worker-[%v] is exiting\", id)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t}\n\t}\n}", "func Download(url, dst string) error {\n\tf, err := os.Create(dst)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not download file\")\n\t}\n\tdefer f.Close()\n\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not request file\")\n\t}\n\tdefer response.Body.Close()\n\n\tif _, err = io.Copy(f, response.Body); err != nil {\n\t\treturn errors.Wrap(err, \"Could not write downloaded file\")\n\t}\n\n\treturn errors.Wrap(f.Sync(), \"Could not flush downloaded file\")\n}", "func (ffd *FakeFileDownloader) Download(url core.URL, filepath string) (*core.File, error) {\n\tffd.DownloadedFiles[url] = filepath\n\treturn &core.File{Path: filepath}, ffd.Err\n}", "func DownloadFile(outputPath string, url string) {\n\t// Get the data\n\tresp, err := http.Get(url)\n\tcheckErr.CheckErr(err)\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(outputPath)\n\tcheckErr.CheckErr(err)\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\tcheckErr.CheckErr(err)\n}", "func DownloadFile(url string) {\n\n //fmt.Println(`Executing: \"sh\", \"-c\", \"curl -sS \"`+url+`\">/dev/null\"`)\n cmd := exec.Command(\"sh\", \"-c\", \"curl -sS --limit-rate 10M \"+url+\">/dev/null\")\n err := cmd.Run()\n return\n\n // Get the data\n resp, err := http.Get(url)\n if err != nil {\n panic(err)\n }\n defer resp.Body.Close()\n // Write the body to file\n fmt.Println(\"copying file\")\n _, err = io.Copy(os.Stderr, resp.Body)\n fmt.Println(\"finished copying file\")\n if err != nil {\n panic(err)\n }\n}", "func downloadFromURL(u string) {\n\tresp, err := http.Get(u)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\n\tfileName, err := downloadingFileName(u)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tout, err := createFile(fileName)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = out.Close()\n\t}()\n\n\t_, err = io.Copy(out, resp.Body)\n}", "func downloadFile(fileURL string, filePath string) (err error) {\n\tres, err := http.Get(fileURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tdata, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(filePath, data, 0755)\n\n}", "func (p *Post) Download(loc string) error {\n\tres, err := http.Get(p.FileURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tfileName := path.Join(loc, p.GetFileName())\n\n\tfh, err := os.Create(fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fh.Close()\n\n\t_, err = io.Copy(fh, res.Body)\n\treturn err\n}", "func Download() error {\n\tfor i := 2008; i < time.Now().Year(); i++ {\n\t\terr := DownloadYear(i)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr := DownloadFile(\"/pub/data/noaa/isd-history.csv\", \"data/isd-history.csv\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = DownloadFile(\"/pub/data/noaa/isd-inventory.csv.z\", \"data/isd-history.csv.z\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (a *App) DownloadFiles() *TransferRecord {\n\tdownloadRecord := NewDownloadRecord()\n\ta.downloadRecords.Append(downloadRecord)\n\n\tdownloadRunningMutex.Lock()\n\tshouldRun := !downloadRunning && a.fileUseable(a.InputPathList)\n\tdownloadRunningMutex.Unlock()\n\n\tif shouldRun {\n\t\tlog.Info(\"starting download goroutine\")\n\n\t\ta.downloadWait.Add(1)\n\n\t\tgo func() {\n\t\t\tlog.Info(\"running download goroutine\")\n\n\t\t\tvar (\n\t\t\t\tdownloadLogStderrFile *os.File\n\t\t\t\tdownloadLogStdoutFile *os.File\n\t\t\t\tdownloadLogStderrPath string\n\t\t\t\tdownloadLogStdoutPath string\n\t\t\t\terr error\n\t\t\t)\n\n\t\t\tdownloadRunningMutex.Lock()\n\t\t\tdownloadRunning = true\n\t\t\tdownloadRunningMutex.Unlock()\n\n\t\t\tdownloadRecord.SetStatus(DownloadingStatus)\n\n\t\t\tdefer func() {\n\t\t\t\tdownloadRecord.SetCompletionTime()\n\n\t\t\t\tdownloadRunningMutex.Lock()\n\t\t\t\tdownloadRunning = false\n\t\t\t\tdownloadRunningMutex.Unlock()\n\n\t\t\t\ta.downloadWait.Done()\n\t\t\t}()\n\n\t\t\tdownloadLogStdoutPath = path.Join(a.LogDirectory, \"downloads.stdout.log\")\n\t\t\tdownloadLogStdoutFile, err = os.Create(downloadLogStdoutPath)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(errors.Wrapf(err, \"failed to open file %s\", downloadLogStdoutPath))\n\t\t\t\tdownloadRecord.SetStatus(FailedStatus)\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\tdownloadLogStderrPath = path.Join(a.LogDirectory, \"downloads.stderr.log\")\n\t\t\tdownloadLogStderrFile, err = os.Create(downloadLogStderrPath)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(errors.Wrapf(err, \"failed to open file %s\", downloadLogStderrPath))\n\t\t\t\tdownloadRecord.SetStatus(FailedStatus)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tparts := a.downloadCommand()\n\t\t\tcmd := exec.Command(parts[0], parts[1:]...)\n\t\t\tcmd.Stdout = downloadLogStdoutFile\n\t\t\tcmd.Stderr = downloadLogStderrFile\n\n\t\t\tif err = cmd.Run(); err != nil {\n\t\t\t\tlog.Error(errors.Wrap(err, \"error running porklock for downloads\"))\n\t\t\t\tdownloadRecord.SetStatus(FailedStatus)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdownloadRecord.SetStatus(CompletedStatus)\n\n\t\t\tlog.Info(\"exiting download goroutine without errors\")\n\t\t}()\n\t}\n\n\treturn downloadRecord\n}", "func downloadingWorker(\n workerIndex int,\n imagesFolder string,\n urls <-chan string,\n results chan<- Downloaded,\n group *sync.WaitGroup) {\n\n defer group.Done()\n\n fetcher := io.NewImageFetcher(1*time.Hour)\n for url := range urls {\n log.Printf(\"[worker:%d] fetching URL: %s\", workerIndex, url)\n outputFile := path.Join(imagesFolder, utils.SimpleRandomString(20))\n createdFile, err := fetcher.Fetch(url, outputFile)\n if err != nil {\n log.Printf(\"[worker:%d] %s\", workerIndex, err.Error())\n }\n results <- Downloaded{URL:url, Filename:createdFile, Error:err}\n }\n\n log.Printf(\"[worker:%d] terminated\", workerIndex)\n}", "func DownloadFile(url string, filename string) error {\r\n\t// crea archivo temporal para no sobreescribir alguno con el mismo nombre\r\n\tout, err := os.Create(filename + \".tmp\")\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdefer out.Close()\r\n\r\n\t// Obtiene datos de URL\r\n\tresp, err := http.Get(url)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\r\n\tfsize, _ := strconv.Atoi(resp.Header.Get(\"Content-Length\"))\r\n\r\n\t// Crea WriteCounter y le asigna el tamaño especificado por el Content-Length\r\n\tcounter := NewWriteCounter(fsize)\r\n\tcounter.Start()\r\n\r\n\t// io.TeeReader lee body de la respuesta y escribe en un nuevo WriteCounter\r\n\t_, err = io.Copy(out, io.TeeReader(resp.Body, counter))\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tcounter.Finish()\r\n\r\n\terr = os.Rename(filename+\".tmp\", filename)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "func (a *Client) Urls(params *UrlsParams) (*UrlsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUrlsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"URLs\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/predict/urls\",\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: &UrlsReader{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.(*UrlsOK), nil\n\n}", "func (c *Client) Download(list []string) int64 {\n\tmaxQueues := len(list)\n\tmaxWorkers := int(c.opt.MaxConcurrents)\n\tif maxWorkers == 0 {\n\t\tmaxWorkers = len(list)\n\t}\n\n\td := newDispatcher(c, maxQueues, maxWorkers)\n\td.start(list)\n\td.wait()\n\treturn d.errCounts()\n}", "func Download(url, user, pass, path string) error {\n\tdirectory := filepath.Dir(path)\n\n\tif _, err := os.Stat(directory); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(directory, 0755)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tf, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.SetBasicAuth(user, pass)\n\n\tclient := &http.Client{}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"bad status: %s\", resp.Status)\n\t}\n\n\t_, err = io.Copy(f, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func DownloadFile(saveto string, extension string, url string, maxMegabytes uint64) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tfilename := saveto + \"/\" + FilenameFromURL(url)\n\t// Create the file\n\tvar out *os.File\n\tif _, err := os.Stat(filename); err == nil {\n\t\tout, err = os.Create(filename + randString(10) + \".\" + extension)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tout, err = os.Create(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t//_, err = io.Copy(out, resp.Body)\n\tmegabytes := int64(maxMegabytes * 1024000)\n\t_, err = io.CopyN(out, resp.Body, megabytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func Any(urls []string) (*http.Response, error) {\n\tvar wg sync.WaitGroup\n\tcancel := make(chan struct{})\n\tresult := make(chan resultType)\n\terrsChan := make(chan error, len(urls))\n\tfor _, url := range urls {\n\t\twg.Add(1)\n\t\tgo func(url string) {\n\t\t\tdefer wg.Done()\n\t\t\tc := make(chan struct{})\n\t\t\tresp, err := fetch(url, c)\n\t\t\tselect {\n\t\t\tcase <-cancel:\n\t\t\t\tclose(c)\n\t\t\t\treturn\n\n\t\t\tdefault:\n\t\t\t\tif err != nil {\n\t\t\t\t\terrsChan <- fmt.Errorf(\"%q: %w\", url, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tresult <- resultType{\n\t\t\t\tresp: resp,\n\t\t\t\terr: err,\n\t\t\t}\n\t\t\tclose(cancel)\n\t\t}(url)\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\terrs := make([]error, 0)\n\n\tloop:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase err := <-errsChan:\n\t\t\t\terrs = append(errs, err)\n\n\t\t\tdefault:\n\t\t\t\tclose(errsChan)\n\t\t\t\tbreak loop\n\t\t\t}\n\t\t}\n\n\t\tresult <- resultType{\n\t\t\tresp: nil,\n\t\t\terr: &AggregateError{\n\t\t\t\terrs: errs,\n\t\t\t},\n\t\t}\n\t\tclose(cancel)\n\t}()\n\n\tr := <-result\n\twg.Wait()\n\treturn r.resp, r.err\n}", "func (api *HWApi) downloadConcurrently() {\n\t// store this job and history urls in local temp file with logToken as fileName\n\tfor j := range downloadWorker {\n\t\tif _, e := api.download(j.Dest, j.URL); e != nil {\n\t\t\tif api.Log != nil {\n\t\t\t\tapi.Log.Error().Str(\"url\", j.URL).Str(\"dest\", j.Dest).Err(e).Msg(\"download failed\")\n\t\t\t}\n\t\t}\n\t\tif api.Log != nil {\n\t\t\tapi.Log.Debug().Str(\"url\", j.URL).Str(\"dest\", j.Dest).Msg(\"download success\")\n\t\t}\n\t}\n}", "func (a *App) DownloadFilesHandler(writer http.ResponseWriter, req *http.Request) {\n\tlog.Info(\"received download request\")\n\n\tdownloadRecord := a.DownloadFiles()\n\n\tif err := downloadRecord.MarshalAndWrite(writer); err != nil {\n\t\tlog.Error(err)\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func fetchall(urls []string) {\n\tch := make(chan string)\n\tfor _, url := range urls {\n\t\tgo fetch(url, ch)\n\t}\n\n\tfor range urls {\n\t\tfmt.Println(<-ch)\n\t}\n}", "func DownloadFile(destPath string, url string, progressBar bool) (err error) {\n\tif output.JSONOutput || !term.IsTerminal(int(os.Stdin.Fd())) {\n\t\tprogressBar = false\n\t}\n\t// Create the file\n\tout, err := os.Create(destPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CheckClose(out)\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CheckClose(resp.Body)\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"download link %s returned wrong status code: got %v want %v\", url, resp.StatusCode, http.StatusOK)\n\t}\n\treader := resp.Body\n\tif progressBar {\n\n\t\tbar := pb.New(int(resp.ContentLength)).SetUnits(pb.U_BYTES).Prefix(filepath.Base(destPath))\n\t\tbar.Start()\n\n\t\t// create proxy reader\n\t\treader = bar.NewProxyReader(resp.Body)\n\t\t// Writer the body to file\n\t\t_, err = io.Copy(out, reader)\n\t\tbar.Finish()\n\t} else {\n\t\t_, err = io.Copy(out, reader)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Download(url string, out io.Writer, getbar func(size int64) *pb.ProgressBar) error {\n\tresp, err := Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tbar := getbar(resp.ContentLength)\n\t_, err = io.Copy(io.MultiWriter(out, bar), resp.Body)\n\treturn err\n}", "func (p *para) download(url string) error {\n\tvar err error\n\terr = p.checkUrl(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjar, err := cookiejar.New(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Client = &http.Client{Jar: jar}\n\tres, err := p.fetch(p.Url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res.StatusCode == 200 {\n\t\tif len(res.Header[\"Set-Cookie\"]) == 0 {\n\t\t\treturn p.saveFile(res)\n\t\t} else {\n\t\t\tp.checkCookie(res.Header[\"Set-Cookie\"][0])\n\t\t\tif len(p.Code) == 0 && p.Kind == \"file\" {\n\t\t\t\treturn errors.New(fmt.Sprintf(\"File ID [ %s ] is not shared, while the file is existing.\\n\", p.Id))\n\t\t\t} else if len(p.Code) == 0 && p.Kind != \"file\" {\n\t\t\t\treturn p.saveFile(res)\n\t\t\t} else {\n\t\t\t\treturn p.downloadLargeFile()\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn errors.New(fmt.Sprintf(\"File ID [ %s ] cannot be downloaded as [ %s ].\\n\", p.Id, p.Ext))\n\t}\n\treturn nil\n}", "func download(url, fileName, destinationPath string, overwrite bool) (string, error) {\n\n\tfilePath := filepath.Join(destinationPath, fileName)\n\n\tfmt.Println(\"Downloading\", url, \"to\", filePath)\n\n\texecute := overwrite\n\tif !overwrite {\n\t\t_, err := os.Stat(filePath)\n\t\texecute = os.IsNotExist(err)\n\t}\n\tif execute {\n\t\t// The file was not downloaded yet\n\t\toutputFile, err := os.Create(filePath)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tdefer outputFile.Close()\n\n\t\tresponse, err := http.Get(url)\n\t\tif err != nil {\n\t\t\toutputFile.Close()\n\t\t\treturn filePath, err\n\t\t}\n\t\tdefer response.Body.Close()\n\n\t\t//bar\n\t\tbar := pb.Full.Start(int(response.ContentLength))\n\t\tbarReader := bar.NewProxyReader(response.Body)\n\n\t\t_, err = io.Copy(outputFile, barReader)\n\t\toutputFile.Close()\n\t\tbar.Finish()\n\t\tif err != nil {\n\t\t\treturn filePath, err\n\t\t}\n\t}\n\n\treturn filePath, nil\n}", "func (youtubedl *YouTubeDl) Download(url, basedir string) error {\n\tpu, err := parseURL(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Printf(\"downloading %s ...\\n\", pu.sanitized)\n\n\tcmd := exec.Command(youtubedl.path, \"-io\", path.Join(basedir, pu.outputFormat), pu.sanitized)\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tstderr, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstdoutReader := bufio.NewReader(stdout)\n\tstderrReader := bufio.NewReader(stderr)\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tline, err := stdoutReader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"youtube-dl: %s\", line)\n\t\t}\n\t}()\n\tgo func() {\n\t\tfor {\n\t\t\tline, err := stderrReader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"ERROR: %s\", line)\n\t\t}\n\t}()\n\n\tif err := cmd.Wait(); err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func CrawlEachURLFound(url string, fetcher Fetcher, ch chan []string) {\n\tbody, urls, err := fetcher.Fetch(url)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t} else {\n\t\tfmt.Printf(\"Found: %s %q\\n\", url, body)\n\t}\n\tch <- urls\n}", "func (feed *feed) Download(path string) {\n\tfeed.DownloadN(path, -1)\n}", "func downloadFile(filepath string, url string, t time.Time) error {\n\tfmt.Printf(\"downloadPhoto file into: %s \\n from url: %s\\n\", filepath, url)\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.Chtimes(filepath, t, t)\n\tif err != nil {\n\t\tfmt.Printf(\"chtimes err: %s\\n\", err.Error())\n\t}\n\n\treturn err\n}", "func DownloadFilesList(sorted helpers.TimeSlice, creds auth.Creds, flags helpers.Flags, masterkey, readmeFileName string) {\n\tsortedSize := len(sorted)\n\tfmt.Println(\"Which files do you wish to download? Please separate each number by a space. Use a '-' for ranges, like: 1 3-6 11-12:\")\n\treader := bufio.NewReader(os.Stdin)\n\tdownloadIn, _ := reader.ReadString('\\n')\n\tdownload := strings.TrimSuffix(downloadIn, \"\\n\")\n\n\twords := strings.Fields(download)\n\t//download all\n\tif strings.HasPrefix(download, \"0 \") || download == \"0\" || strings.HasSuffix(download, \" 0\") || strings.Contains(download, \" 0 \") {\n\t\tlog.Info(\"zero detected, downloading everything\")\n\t\twords = nil\n\t\tfor i := 0; i < sortedSize; i++ {\n\t\t\tt := strconv.Itoa(i + 1)\n\t\t\twords = append(words, t)\n\t\t}\n\t} else if strings.Contains(download, \"-\") {\n\t\t//parse ranges\n\t\twords = nil\n\t\tnumbers := strings.Split(download, \" \")\n\t\tfor i := 0; i < len(numbers); i++ {\n\t\t\tif strings.Contains(numbers[i], \"-\") {\n\t\t\t\tlog.Info(\"found number with dash \", numbers[i])\n\t\t\t\tsplitNumbers := strings.Split(numbers[i], \"-\")\n\t\t\t\tfirst, err := strconv.Atoi(splitNumbers[0])\n\t\t\t\thelpers.Check(err, true, \"floor check\", helpers.Trace())\n\t\t\t\tsecond, err := strconv.Atoi(splitNumbers[len(splitNumbers)-1])\n\t\t\t\thelpers.Check(err, true, \"ceiling check\", helpers.Trace())\n\t\t\t\tfor j := first; j <= second; j++ {\n\t\t\t\t\tlog.Debug(\"adding to download:\", j)\n\t\t\t\t\twords = append(words, strconv.Itoa(j))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twords = append(words, numbers[i])\n\t\t\t}\n\t\t}\n\t}\n\tlog.Debug(\"downloading the indexes (raw):\", words)\n\t//remove duplicates from list\n\tcheck := make(map[string]int)\n\tfor _, val := range words {\n\t\tcheck[val] = 1\n\t}\n\twords = nil\n\tfor letter, _ := range check {\n\t\twords = append(words, letter)\n\t}\n\tlog.Info(\"downloading the indexes (dedup):\", words)\n\n\t//path := strings.TrimPrefix(sorted[0].DownloadURI, creds.URL+\"/\"+creds.Repository+\"/\")\n\tpath := strings.TrimPrefix(sorted[0].Path, \"/\")\n\tlog.Debug(\"Path trimmed:\" + path)\n\tpath = path[:strings.IndexByte(path, '/')]\n\trelativePath := creds.DlLocation + \"/\" + path + \"/\"\n\tvar filesystemChecksums = make(map[string]string)\n\tif _, err := os.Stat(relativePath); os.IsNotExist(err) {\n\t\tlog.Debug(\"%s does not exist, creating\\n\", relativePath)\n\t\terr2 := os.Mkdir(relativePath, 0700)\n\t\thelpers.Check(err2, true, \"Creating log folder\", helpers.Trace())\n\n\t} else {\n\t\tlog.Info(relativePath, \" exists, running checksum validation\")\n\t\tf, err := os.Open(relativePath)\n\t\thelpers.Check(err, true, \"Opening download directory\", helpers.Trace())\n\t\tfiles, err := f.Readdir(-1)\n\t\tf.Close()\n\t\thelpers.Check(err, true, \"Reading download directory files\", helpers.Trace())\n\n\t\tfor _, file := range files {\n\t\t\tif file.IsDir() {\n\t\t\t\t//I guess we could walk the entire tree if we wanted..\n\t\t\t\tlog.Info(file.Name(), \" is a directory. skipping\\n\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t//store list of checksums in memory then compare before download\n\t\t\tif flags.SkipDownloadedChecksumCheckVar == false {\n\t\t\t\tlog.Debug(\"Checksum check not skipped for:\", relativePath+file.Name())\n\t\t\t\tsha2 := helpers.ComputeSha256(relativePath + file.Name())\n\t\t\t\tfilesystemChecksums[sha2] = relativePath + file.Name()\n\t\t\t}\n\t\t}\n\t}\n\t//create file\n\treadme := relativePath + \"/\" + readmeFileName\n\tlog.Debug(\"Trying to create readme file under \", readme)\n\tDetectDetailsFile(readme, masterkey)\n\n\tlog.Debug(\"size of index\", words)\n\tfor key := range words {\n\t\t//check if the index is an invalid option, skip if needed\n\t\tsize := helpers.StringToInt64(words[key])\n\t\tif size < 1 || size > int64(sortedSize) {\n\t\t\tlog.Warn(\"Out of bounds number \", words[key], \", skipping\")\n\t\t\tcontinue\n\t\t}\n\n\t\t//fileName := strings.TrimPrefix(sorted[size-1].DownloadURI, creds.URL+\"/\"+creds.Repository+\"/\"+path+\"/\")\n\t\tfileName := strings.TrimPrefix(sorted[size-1].Path, \"/\"+path+\"/\")\n\t\tlog.Debug(\"fileName trimmed:\", fileName, \" path:\", path, \" sorted[size-1].Path:\", sorted[size-1].Path)\n\t\t//check shasum of download against in folder\n\t\tif filesystemChecksums[sorted[size-1].Checksums.Sha256] != \"\" {\n\t\t\tlog.Info(\"file \", fileName, \" exists, skipping download\\n\")\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Info(\"downloading \", words[key], \" \", sorted[size-1].DownloadURI)\n\t\tlog.Debug(\"sorted:\", sorted)\n\t\t// do some naive file type detection here\n\t\treadableFilesExtensions := []string{\"txt\", \"pdf\", \"json\", \"yaml\", \"yml\", \"json\", \"xml\", \"log\"}\n\t\tvar readableFile bool\n\t\tfor i := range readableFilesExtensions {\n\t\t\tif strings.HasSuffix(fileName, readableFilesExtensions[i]) {\n\t\t\t\tlog.Info(\"do not create folder, is readable without unarchiving:\", fileName)\n\t\t\t\treadableFile = true\n\t\t\t}\n\t\t}\n\t\toldRelativePath := relativePath\n\t\tif !readableFile {\n\t\t\tlog.Info(\"creating folder due to archive:\", relativePath+fileName+\"-folder\")\n\t\t\terr := os.Mkdir(relativePath+fileName+\"-folder\", 0755)\n\t\t\thelpers.Check(err, false, \"Archive folder create\", helpers.Trace())\n\t\t\trelativePath = relativePath + fileName + \"-folder/\"\n\n\t\t}\n\t\t_, filepath := auth.GetRestAPI(sorted[size-1].DownloadURI, creds.Username, creds.Apikey, relativePath+fileName, sorted[size-1].Checksums.Sha256)\n\t\tif !readableFile {\n\t\t\tlog.Debug(\"creating symlink for file:\", fileName)\n\t\t\tos.Symlink(relativePath+fileName, oldRelativePath+\".\"+fileName)\n\t\t\t//create symlink post download for checksum checker\n\t\t}\n\t\tlog.Info(\"Successfully finished downloading \", sorted[size-1].DownloadURI)\n\n\t\t//try to unarchive if true\n\t\tif flags.UnzipVar {\n\t\t\t//file type detection\n\t\t\tbuff := make([]byte, 512)\n\t\t\tfile, err := os.Open(filepath)\n\t\t\thelpers.Check(err, true, \"File testing failed at open:\", helpers.Trace())\n\n\t\t\t_, err = file.Read(buff)\n\t\t\thelpers.Check(err, true, \"File testing failed at read:\", helpers.Trace())\n\t\t\tfiletype := http.DetectContentType(buff)\n\t\t\tswitch filetype {\n\t\t\tcase \"application/x-gzip\", \"application/zip\":\n\t\t\t\tlog.Info(\"File is compressed with gzip or zip, attempting to unzip\")\n\t\t\t\tlog.Debug(\"Unzipping \", filepath, \" to \", filepath+\"-folder\")\n\t\t\t\terr := helpers.Unzip(filepath, filepath+\"-folder\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tlog.Info(\"File is not compressed\")\n\n\t\t\t}\n\t\t}\n\t\t//reset relative path\n\t\trelativePath = oldRelativePath\n\t}\n\t//update readme last modified\n\tlog.Info(\"Updating readme last modified to \", time.Now())\n\treadmeData := ReadDetailsFile(readme, masterkey)\n\treadmeData.LastModified = time.Now()\n\treadmeData.Title = auth.Encrypt(readmeData.Title, masterkey)\n\treadmeData.Description = auth.Encrypt(readmeData.Description, masterkey)\n\tfileData, err := json.Marshal(readmeData)\n\thelpers.Check(err, true, \"The JSON marshal\", helpers.Trace())\n\n\terr = ioutil.WriteFile(readme, fileData, 0644)\n\thelpers.Check(err, false, \"Readme File update\", helpers.Trace())\n\n\tlog.Info(\"all requested files downloaded to \" + relativePath + \". Safe travels!\")\n}", "func (c *Client) Download(ctx context.Context, baseDir string, progress chan downloader.ProgressUpdate, furl string) error {\n\treq, err := grab.NewRequest(baseDir, furl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp := c.client.Do(req)\n\n\t// publish the progress every 1 second\n\tprogressReporter := time.NewTicker(1 * time.Second)\n\n\tdefer progressReporter.Stop()\n\nLOOP:\n\tfor {\n\t\tselect {\n\t\tcase <-progressReporter.C: // progress update due\n\t\t\tprogress <- downloader.ProgressUpdate{\n\t\t\t\tProgress: resp.Progress(),\n\t\t\t\tURL: furl,\n\t\t\t}\n\t\tcase <-ctx.Done(): // program term\n\t\t\tbreak LOOP\n\t\tcase <-resp.Done: // download finished\n\t\t\tbreak LOOP\n\t\t}\n\t}\n\n\tprogress <- downloader.ProgressUpdate{\n\t\tProgress: 100,\n\t\tURL: furl,\n\t}\n\n\t// we're done :tada:\n\treturn nil\n}", "func FilesDownloadHTTP(mgr *manager.Manager, filepath, version, arch string) error {\n\tkkzone := os.Getenv(\"KKZONE\")\n\tetcd := files.KubeBinary{Name: \"etcd\", Arch: arch, Version: kubekeyapiv1alpha1.DefaultEtcdVersion}\n\tkubeadm := files.KubeBinary{Name: \"kubeadm\", Arch: arch, Version: version}\n\tkubelet := files.KubeBinary{Name: \"kubelet\", Arch: arch, Version: version}\n\tkubectl := files.KubeBinary{Name: \"kubectl\", Arch: arch, Version: version}\n\tkubecni := files.KubeBinary{Name: \"kubecni\", Arch: arch, Version: kubekeyapiv1alpha1.DefaultCniVersion}\n\thelm := files.KubeBinary{Name: \"helm\", Arch: arch, Version: kubekeyapiv1alpha1.DefaultHelmVersion}\n\n\tetcd.Path = fmt.Sprintf(\"%s/etcd-%s-linux-%s.tar.gz\", filepath, kubekeyapiv1alpha1.DefaultEtcdVersion, arch)\n\tkubeadm.Path = fmt.Sprintf(\"%s/kubeadm\", filepath)\n\tkubelet.Path = fmt.Sprintf(\"%s/kubelet\", filepath)\n\tkubectl.Path = fmt.Sprintf(\"%s/kubectl\", filepath)\n\tkubecni.Path = fmt.Sprintf(\"%s/cni-plugins-linux-%s-%s.tgz\", filepath, arch, kubekeyapiv1alpha1.DefaultCniVersion)\n\thelm.Path = fmt.Sprintf(\"%s/helm\", filepath)\n\n\tif kkzone == \"cn\" {\n\t\tetcd.Url = fmt.Sprintf(\"https://kubernetes-release.pek3b.qingstor.com/etcd/release/download/%s/etcd-%s-linux-%s.tar.gz\", etcd.Version, etcd.Version, etcd.Arch)\n\t\tkubeadm.Url = fmt.Sprintf(\"https://kubernetes-release.pek3b.qingstor.com/release/%s/bin/linux/%s/kubeadm\", kubeadm.Version, kubeadm.Arch)\n\t\tkubelet.Url = fmt.Sprintf(\"https://kubernetes-release.pek3b.qingstor.com/release/%s/bin/linux/%s/kubelet\", kubelet.Version, kubelet.Arch)\n\t\tkubectl.Url = fmt.Sprintf(\"https://kubernetes-release.pek3b.qingstor.com/release/%s/bin/linux/%s/kubectl\", kubectl.Version, kubectl.Arch)\n\t\tkubecni.Url = fmt.Sprintf(\"https://containernetworking.pek3b.qingstor.com/plugins/releases/download/%s/cni-plugins-linux-%s-%s.tgz\", kubecni.Version, kubecni.Arch, kubecni.Version)\n\t\thelm.Url = fmt.Sprintf(\"https://kubernetes-helm.pek3b.qingstor.com/linux-%s/%s/helm\", helm.Arch, helm.Version)\n\t\thelm.GetCmd = fmt.Sprintf(\"curl -o %s %s\", helm.Path, helm.Url)\n\t} else {\n\t\tetcd.Url = fmt.Sprintf(\"https://github.com/coreos/etcd/releases/download/%s/etcd-%s-linux-%s.tar.gz\", etcd.Version, etcd.Version, etcd.Arch)\n\t\tkubeadm.Url = fmt.Sprintf(\"https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/%s/kubeadm\", kubeadm.Version, kubeadm.Arch)\n\t\tkubelet.Url = fmt.Sprintf(\"https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/%s/kubelet\", kubelet.Version, kubelet.Arch)\n\t\tkubectl.Url = fmt.Sprintf(\"https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/%s/kubectl\", kubectl.Version, kubectl.Arch)\n\t\tkubecni.Url = fmt.Sprintf(\"https://github.com/containernetworking/plugins/releases/download/%s/cni-plugins-linux-%s-%s.tgz\", kubecni.Version, kubecni.Arch, kubecni.Version)\n\t\thelm.Url = fmt.Sprintf(\"https://get.helm.sh/helm-%s-linux-%s.tar.gz\", helm.Version, helm.Arch)\n\t\thelm.GetCmd = fmt.Sprintf(\"curl -o %s/helm-%s-linux-%s.tar.gz %s && cd %s && tar -zxf helm-%s-linux-%s.tar.gz && mv linux-%s/helm . && rm -rf *linux-%s*\", filepath, helm.Version, helm.Arch, helm.Url, filepath, helm.Version, helm.Arch, helm.Arch, helm.Arch)\n\t}\n\n\tkubeadm.GetCmd = fmt.Sprintf(\"curl -L -o %s %s\", kubeadm.Path, kubeadm.Url)\n\tkubelet.GetCmd = fmt.Sprintf(\"curl -L -o %s %s\", kubelet.Path, kubelet.Url)\n\tkubectl.GetCmd = fmt.Sprintf(\"curl -L -o %s %s\", kubectl.Path, kubectl.Url)\n\tkubecni.GetCmd = fmt.Sprintf(\"curl -L -o %s %s\", kubecni.Path, kubecni.Url)\n\tetcd.GetCmd = fmt.Sprintf(\"curl -L -o %s %s\", etcd.Path, etcd.Url)\n\n\tbinaries := []files.KubeBinary{kubeadm, kubelet, kubectl, helm, kubecni, etcd}\n\n\tfor _, binary := range binaries {\n\t\tif binary.Name == \"etcd\" && mgr.EtcdContainer {\n\t\t\tcontinue\n\t\t}\n\t\tmgr.Logger.Infoln(fmt.Sprintf(\"Downloading %s ...\", binary.Name))\n\t\tif util.IsExist(binary.Path) == false {\n\t\t\tfor i := 5; i > 0; i-- {\n\t\t\t\tif output, err := exec.Command(\"/bin/sh\", \"-c\", binary.GetCmd).CombinedOutput(); err != nil {\n\t\t\t\t\tfmt.Println(string(output))\n\n\t\t\t\t\tif kkzone != \"cn\" {\n\t\t\t\t\t\tmgr.Logger.Warningln(\"Having a problem with accessing https://storage.googleapis.com? You can try again after setting environment 'export KKZONE=cn'\")\n\t\t\t\t\t}\n\t\t\t\t\treturn errors.New(fmt.Sprintf(\"Failed to download %s binary: %s\", binary.Name, binary.GetCmd))\n\t\t\t\t}\n\n\t\t\t\tif err := SHA256Check(binary, version); err != nil {\n\t\t\t\t\tif i == 1 {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\t_ = exec.Command(\"/bin/sh\", \"-c\", fmt.Sprintf(\"rm -f %s\", binary.Path)).Run()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tif err := SHA256Check(binary, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif mgr.Cluster.KubeSphere.Version == \"v2.1.1\" {\n\t\tmgr.Logger.Infoln(fmt.Sprintf(\"Downloading %s ...\", \"helm2\"))\n\t\tif util.IsExist(fmt.Sprintf(\"%s/helm2\", filepath)) == false {\n\t\t\tcmd := fmt.Sprintf(\"curl -o %s/helm2 %s\", filepath, fmt.Sprintf(\"https://kubernetes-helm.pek3b.qingstor.com/linux-%s/%s/helm\", helm.Arch, \"v2.16.9\"))\n\t\t\tif output, err := exec.Command(\"/bin/sh\", \"-c\", cmd).CombinedOutput(); err != nil {\n\t\t\t\tfmt.Println(string(output))\n\t\t\t\treturn errors.Wrap(err, \"Failed to download helm2 binary\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func downloadFile(targetPath, url string) (_ string, errOut error) {\n\thasher := sha256.New()\n\terr := os.MkdirAll(filepath.Dir(targetPath), 0o750)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer deferErr(&errOut, resp.Body.Close)\n\tbodyReader := io.TeeReader(resp.Body, hasher)\n\tif resp.StatusCode >= 300 {\n\t\treturn \"\", fmt.Errorf(\"failed downloading %s\", url)\n\t}\n\tout, err := os.Create(targetPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer deferErr(&errOut, out.Close)\n\t_, err = io.Copy(out, bodyReader)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsum := hex.EncodeToString(hasher.Sum(nil))\n\treturn sum, nil\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// using *.tmp won't overwrite the file until the download is complete\n\tout, err := os.Create(filepath + \".tmp\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// go get the file\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tout.Close()\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// progress reporter\n\tcounter := &WriteCounter{}\n\tif _, err = io.Copy(out, io.TeeReader(resp.Body, counter)); err != nil {\n\t\tout.Close()\n\t\treturn err\n\t}\n\n\tfmt.Print(\"\\n\")\n\n\t// close the output file\n\tout.Close()\n\n\tif err = os.Rename(filepath+\".tmp\", filepath); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (f *FFmpeg_Generator) DownloadFiles() {\n\tvar wg sync.WaitGroup\n\n\t// add extra to wait group if has external audio (because it will download audio as external file from url)\n\tif f.Recipe.ExternalAudio {\n\t\twg.Add(len(f.Recipe.Chunks) + 1)\n\n\t} else {\n\t\twg.Add(len(f.Recipe.Chunks))\n\t}\n\n\tinnerResponseChannel := make(chan *FFmpeg_Message)\n\n\tfor chunkIndex := range f.Recipe.Chunks {\n\t\tgo func(chunkIndex int) {\n\t\t\t// set a uuid as name for chunk (audio or video file)\n\t\t\tif newChunkName, err := uuid.NewV4(); err == nil {\n\t\t\t\tf.Recipe.Chunks[chunkIndex].Name = newChunkName.String()\n\t\t\t} else {\n\t\t\t\tinnerResponseChannel <- &FFmpeg_Message{\n\t\t\t\t\tStatus: false,\n\t\t\t\t\tMessage: \"internal error\",\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstatus, statusCode := filemanager.DownloadFile(\n\t\t\t\t&wg,\n\t\t\t\tf.Recipe.Chunks[chunkIndex].Url,\n\t\t\t\tf.Dir+f.Recipe.Chunks[chunkIndex].Name)\n\t\t\tinnerResponseChannel <- &FFmpeg_Message{\n\t\t\t\tStatus: status,\n\t\t\t\tMessage: \"url responded withCode\" + statusCode,\n\t\t\t}\n\t\t}(chunkIndex)\n\n\t}\n\t// download audio if exists\n\tif f.Recipe.ExternalAudio {\n\t\tgo func() {\n\t\t\taudioName, _ := uuid.NewV4()\n\t\t\tfilemanager.DownloadFile(\n\t\t\t\t&wg,\n\t\t\t\tf.Recipe.Audio,\n\t\t\t\tf.Dir+audioName.String())\n\t\t\tf.Recipe.Audio = audioName.String()\n\t\t}()\n\n\t}\n\twg.Wait()\n\n\tisAllDownloaded := true\n\tcount := 0\n\tfor responseFromInnerChannel := range innerResponseChannel {\n\t\tisAllDownloaded = isAllDownloaded && responseFromInnerChannel.Status\n\t\tlog.Println(\"Downloaded to : \" + f.Dir + f.Recipe.Chunks[count].Name)\n\t\tcount++\n\t\tif count == len(f.Recipe.Chunks) {\n\t\t\tclose(innerResponseChannel)\n\t\t}\n\t}\n\n\tif !isAllDownloaded {\n\t\tf.Error.Status = false\n\t\tf.Error.Message = \"error while downloading files\"\n\t}\n}", "func geturls(w http.ResponseWriter, r *http.Request) {\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar urls []Myurl\n\tdb.Find(&urls)\n\tjson.NewEncoder(w).Encode(urls)\n}", "func download(URL, fPath string) error {\n\tisoReader, err := linkOpen(URL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer isoReader.Close()\n\tf, err := os.Create(fPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tcounter := &WriteCounter{}\n\tif _, err = io.Copy(f, io.TeeReader(isoReader, counter)); err != nil {\n\t\treturn fmt.Errorf(\"Fail to copy iso to a persistent memory device: %v\", err)\n\t}\n\tfmt.Println(\"\\nDone!\")\n\tverbose(\"%q is downloaded at %q\\n\", URL, fPath)\n\treturn nil\n}", "func getLinks(inURLs []string) {\n\tlinksChan := make(chan string)\n\tsignalChan := make(chan bool)\n\n\tfor _, link := range inURLs {\n\n\t\tres, err := http.Get(link)\n\t\tif res.StatusCode != http.StatusOK {\n\t\t\tfmt.Println(\"error fetching url : %s\", err)\n\t\t\treturn\n\t\t}\n\t\tbuf, err := ioutil.ReadAll(res.Body)\n\t\tgo parseHTML(buf, linksChan, signalChan)\n\t}\n\n\tfor count := 0; count < len(inURLs); {\n\t\tselect {\n\t\tcase u := <-linksChan:\n\t\t\tfmt.Println(u)\n\t\tcase <-signalChan:\n\t\t\tcount++\n\t\t}\n\t}\n}", "func (a *httpAxel) Download() error {\n\t// if save path exists, return conflicts\n\tif _, err := os.Stat(a.save); err == nil {\n\t\treturn fmt.Errorf(\"conflicts, save path [%s] already exists\", a.save)\n\t}\n\n\t// get the header & size\n\t// prepare for the chunk size\n\tresp, err := a.client.Get(a.remoteURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// return if not http status 200\n\tif code := resp.StatusCode; code != http.StatusOK {\n\t\treturn fmt.Errorf(\"%d - %s\", code, http.StatusText(code))\n\t}\n\n\t// detect total size & partial support\n\t// note: reset conn=1 if total size unknown\n\t// note: reset conn=1 if not supported partial download\n\ta.totalSize = resp.ContentLength\n\ta.supportPart = resp.Header.Get(\"Accept-Ranges\") != \"\"\n\tif a.totalSize <= 1 || !a.supportPart {\n\t\ta.conn = 1\n\t}\n\n\t// directly download and save\n\tif a.conn == 1 {\n\t\treturn a.directSave(resp.Body)\n\t}\n\n\t// partial downloa and save by concurrency\n\ta.chunkSize = a.totalSize / int64(a.conn)\n\ta.chunksDir = path.Join(filepath.Dir(a.save), filepath.Base(a.save)+\".chunks\")\n\tdefer os.RemoveAll(a.chunksDir)\n\n\t// concurrency get each chunks\n\terr = a.getAllChunks()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// join each pieces to the final save path\n\treturn a.join()\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Create the file, but give it a tmp file extension, this means we won't overwrite a\n\t// file until it's downloaded, but we'll remove the tmp extension once downloaded.\n\tout, err := os.Create(filepath + \".tmp\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create our progress reporter and pass it to be used alongside our writer\n\tcounter := &WriteCounter{}\n\t_, err = io.Copy(out, io.TeeReader(resp.Body, counter))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// The progress use the same line so print a new line once it's finished downloading\n\tfmt.Print(\"\\n\")\n\n\terr = os.Rename(filepath+\".tmp\", filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func DownloadFromURL(url string, target string, user string, pw string) error {\n\tfileName := target\n\tfmt.Println(\"Downloading\", url, \"to\", fileName)\n\n\t// TODO: check file existence first with io.IsExist\n\toutput, err := os.Create(fileName)\n\tif err != nil {\n\t\tfmt.Println(\"Error while creating\", fileName, \"-\", err)\n\t\treturn err\n\t}\n\tdefer output.Close()\n\ttr := &http.Transport{\n\t\tMaxIdleConns: 10,\n\t\tIdleConnTimeout: 30 * time.Second,\n\t\tDisableCompression: true,\n\t}\n\tclient := &http.Client{\n\t\tTransport: tr,\n\t}\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tfmt.Println(\"Error while downloading\", url, \"-\", err)\n\t\treturn err\n\t}\n\tif user != \"\" {\n\t\tfmt.Printf(\"Setting http username for url %s to \\\"%s\\\"\\n\", url, user)\n\t\treq.SetBasicAuth(user, pw)\n\t}\n\tresponse, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(\"Error while downloading\", url, \"-\", err)\n\t\treturn err\n\t}\n\tdefer response.Body.Close()\n\tfmt.Printf(\"Http.Get() response code: %d (code is not necessarily an error)\\n\", response.StatusCode)\n\tif isHttpError(response.StatusCode) {\n\t\ts := fmt.Sprintf(\"http error: %d (%s)\", response.StatusCode, response.Status)\n\t\tfmt.Println(s)\n\t\treturn errors.New(s)\n\t}\n\tn, err := io.Copy(output, response.Body)\n\tif err != nil {\n\t\tfmt.Println(\"Error while downloading\", url, \"-\", err)\n\t\treturn err\n\t}\n\n\tfmt.Println(n, \"bytes downloaded.\")\n\treturn nil\n}", "func Download(url string, destPath string) Err {\n\t// Create the file\n\tout, err := os.Create(destPath)\n\tif err != nil {\n\t\treturn FromError(err)\n\t}\n\tdefer out.Close()\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn FromError(err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// Check server response\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn Err{\n\t\t\tCode: ecdef.ErrCode(resp.StatusCode),\n\t\t\tMsg: fmt.Sprintf(\"bad status: %s\", resp.Status),\n\t\t}\n\t}\n\n\t// Writer the body to file\n\t_, err = io.Copy(out, resp.Body)\n\tif err != nil {\n\t\treturn FromError(err)\n\t}\n\n\treturn NoError\n}", "func DownloadFile(filename string, url string, original_url string) error {\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\text := filepath.Ext(filename)\n\tline := 0\n\tscanner := bufio.NewScanner(resp.Body)\n\tfor scanner.Scan() {\n\t\tif line == 0 {\n\t\t\tout.WriteString(GenerateMagicComment(original_url, ext))\n\t\t}\n\t\tout.WriteString(\"\\n\" + scanner.Text())\n\t\tline += 1\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"reading standard input:\", err)\n\t}\n\treturn err\n}", "func download(client httpDoer, path string, w io.Writer) error {\n\t// Input sanity checks.\n\tif client == nil {\n\t\treturn fmt.Errorf(\"empty http client: %w\", errConnect)\n\t}\n\tif path == \"\" {\n\t\treturn fmt.Errorf(\"image path was empty: %w\", errInput)\n\t}\n\tif w == nil {\n\t\treturn fmt.Errorf(\"no file to write to: %w\", errFile)\n\t}\n\n\t// Obtain the file including status updates.\n\treq, err := http.NewRequest(\"GET\", path, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(`http.NewRequest(\"GET\", %q, nil) returned %v`, path, err)\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get for %q returned %v: %w\", path, err, errDownload)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"failed to get %q with response %d: %w\", path, resp.StatusCode, errStatus)\n\t}\n\n\t// Provide updates during the download.\n\tfileName := regExFileName.FindString(path)\n\top := \"Download of \" + fileName\n\tr := console.ProgressReader(resp.Body, op, resp.ContentLength)\n\tif _, err := io.Copy(w, r); err != nil {\n\t\treturn fmt.Errorf(\"failed to write body of %q, %v: %w\", path, err, errIO)\n\t}\n\treturn nil\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func DownloadFile(filepath string, url string) error {\n\n\t// Get the data\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create the file\n\tout, err := os.Create(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t// Write the body to file\n\t_, err = io.Copy(out, resp.Body)\n\treturn err\n}", "func DownloadFile(url, path string) (err error) {\n\tvar (\n\t\tresp *http.Response\n\t\tdata []byte\n\t)\n\tresp, err = http.Get(url)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdata, err = io.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn os.WriteFile(path, data, 0600)\n}", "func Race(urls []string) (*http.Response, error) {\n\tvar wg sync.WaitGroup\n\tcancel := make(chan struct{})\n\tresult := make(chan resultType)\n\tfor _, url := range urls {\n\t\twg.Add(1)\n\t\tgo func(url string) {\n\t\t\tdefer wg.Done()\n\t\t\tc := make(chan struct{})\n\t\t\tresp, err := fetch(url, c)\n\t\t\tselect {\n\t\t\tcase <-cancel:\n\t\t\t\tclose(c)\n\t\t\t\treturn\n\n\t\t\tdefault:\n\t\t\t\tresult <- resultType{\n\t\t\t\t\tresp: resp,\n\t\t\t\t\terr: err,\n\t\t\t\t}\n\t\t\t\tclose(cancel)\n\t\t\t}\n\t\t}(url)\n\t}\n\n\tr := <-result\n\twg.Wait()\n\treturn r.resp, r.err\n}", "func (h *Handler) Download(source string, destination string) {\n\tlog.Warn(\"generic doesn't support file download\")\n}", "func (f *Fast) GetUrls() (urls []string, err error) {\n\tr := rq.Get(f.url)\n\tr.Qs(\"https\", \"true\")\n\tr.Qs(\"token\", f.token)\n\tr.Qs(\"urlCount\", strconv.Itoa(f.urlCount))\n\n\t_, res, err := f.client.Send(r, false)\n\tif err != nil {\n\t\terr = errInternet\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\n\turls = pickjson.PickString(res.Body, \"url\", 0)\n\tdebug.Info(\"urls:\", len(urls))\n\treturn\n}" ]
[ "0.7353462", "0.6995133", "0.6912997", "0.6820814", "0.6655113", "0.6603656", "0.6512712", "0.64620477", "0.6461163", "0.6447469", "0.64406276", "0.64314866", "0.64134836", "0.64095134", "0.63951224", "0.63430256", "0.63212156", "0.63145566", "0.6310812", "0.62900454", "0.6265932", "0.6249476", "0.6226638", "0.6223414", "0.6223414", "0.61984867", "0.61810845", "0.6177055", "0.6176512", "0.61743873", "0.6172403", "0.61193", "0.6109018", "0.6077765", "0.6068531", "0.60357374", "0.60294294", "0.6019135", "0.6018534", "0.601137", "0.5993571", "0.5992855", "0.5984074", "0.5980996", "0.59606993", "0.59601253", "0.59520185", "0.5942028", "0.5933999", "0.5930902", "0.59190404", "0.5890727", "0.58707404", "0.5860917", "0.58523047", "0.5848966", "0.5833425", "0.58162034", "0.58094615", "0.57815695", "0.5779259", "0.5778271", "0.57601655", "0.5757582", "0.5754024", "0.57372576", "0.57366955", "0.5736157", "0.5710183", "0.5707273", "0.57044274", "0.5697552", "0.56931305", "0.56773174", "0.56712514", "0.5669188", "0.56687796", "0.5664688", "0.5663819", "0.56614554", "0.565632", "0.5638326", "0.5637044", "0.5633377", "0.5629173", "0.5620217", "0.56167495", "0.5615975", "0.56158787", "0.56140673", "0.56140673", "0.56140673", "0.56140673", "0.56140673", "0.56140673", "0.56140673", "0.56105554", "0.5604954", "0.5604898", "0.56023854" ]
0.7896202
0
Flags registers and parses the program flags
func (c *Config) Flags() { flag.BoolVar(&c.Add, "a", false, "Add kubeconfig to the library") flag.BoolVar(&c.Set, "s", false, "Set current kubeconfig") flag.BoolVar(&c.List, "l", false, "List all kubeconfigs from the library") flag.BoolVar(&c.Remove, "r", false, "Remove kubeconfig from the library") flag.Parse() if c.Add { c.Ops |= 1 } if c.Set { c.Ops |= 2 } if c.List { c.Ops |= 4 } if c.Remove { c.Ops |= 8 } // default cases // no flags specified if c.Ops == 0 { switch len(os.Args) { // no args: list case 1: c.List = true // 1 arg: set case 2: c.Set = true // 2 args: add case 3: c.Add = true } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func AddAndParseFlags(fs *flag.FlagSet) error { return nil }", "func processFlags() *flags {\n\tflags := flags{}\n\n\tflag.StringVar(&flags.configFile, \"configfile\", \"\", \"Config File to process\")\n\tflag.StringVar(&flags.consulAddress, \"consuladdr\", \"\", \"Consul Address\")\n\tflag.StringVar(&flags.consulDatacenter, \"consuldc\", \"global\", \"Consul Datacentre\")\n\tflag.StringVar(&flags.consulPrefix, \"consulprefix\", \"\", \"Consul Prefix\")\n\tflag.StringVar(&flags.consulScheme, \"consulscheme\", \"http\", \"Consul Scheme\")\n\tflag.StringVar(&flags.consulToken, \"consultoken\", \"\", \"Consul Token\")\n\tflag.BoolVar(&flags.displayVer, \"version\", false, \"Display version and exit\")\n\tflag.Parse()\n\n\tif flags.displayVer == true {\n\t\tfmt.Printf(\"Build Type: %s\\n\", buildinfo.BuildType)\n\t\tfmt.Printf(\"Build TimeStamp: %s\\n\", buildinfo.BuildStamp)\n\t\tfmt.Printf(\"Build Revision: %s\\n\", buildinfo.BuildRevision)\n\t\tos.Exit(0)\n\t}\n\n\treturn &flags\n}", "func (f *File) parseFlags() error {\n\tset := token.NewFileSet()\n\tfile, err := parser.ParseFile(set, f.Path, nil, parser.ParseComments)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// The last comment group before a package declaration must contain the\n\t// command description.\n\tpackageLine := 2\n\tif packagePos := set.Position(file.Package); packagePos.IsValid() {\n\t\tpackageLine = packagePos.Line\n\t}\n\t// Load comment groups and map them to their ending line number.\n\t// Assume a comment belongs to a command line flag declaration if it\n\t// ends on the previous line of the flag declaration.\n\tcomments := make(map[int]*ast.CommentGroup)\n\tfor _, group := range file.Comments {\n\t\tpos := set.Position(group.Pos())\n\t\tend := set.Position(group.End())\n\t\tif pos.Line < packageLine {\n\t\t\tf.Doc = group.Text()\n\t\t}\n\t\tcomments[end.Line] = group\n\t}\n\t// Memorize flags by their variable names.\n\tbound := make(map[string]*Flag)\n\t// Collect all flags in source file.\n\tast.Inspect(file, func(node ast.Node) bool {\n\t\tif call, ok := node.(*ast.CallExpr); ok {\n\t\t\tif opt, err := NewFlag(set, call); err == nil {\n\t\t\t\t// Check if we have a comment that belongs to flag\n\t\t\t\tif comment, ok := comments[opt.Line-1]; ok {\n\t\t\t\t\topt.Doc = comment.Text()\n\t\t\t\t}\n\t\t\t\t// Check if we already encountered an flag bound to the\n\t\t\t\t// variable.\n\t\t\t\tif opt.Variable != \"\" {\n\t\t\t\t\tif reg, ok := bound[opt.Variable]; ok {\n\t\t\t\t\t\t// Merge currrent flag with the one we already found\n\t\t\t\t\t\treg.merge(opt)\n\t\t\t\t\t\t// Don't add the current flag to the list, since the list\n\t\t\t\t\t\t// already contains the struct stored in the map.\n\t\t\t\t\t\treturn true\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Register variable and the proceed to add flag\n\t\t\t\t\t\t// struct to the flags list\n\t\t\t\t\t\tbound[opt.Variable] = opt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tf.Flags = append(f.Flags, opt)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\treturn nil\n}", "func (*bzlLibraryLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {}", "func ParseFlags() {\n\tflag.Parse()\n}", "func scanFlags(line string) map[string]string {\n\tvar s scanner.Scanner\n\ts.Init(strings.NewReader(line))\n\n\ts.Whitespace = 1<<'\\t' | 1<<'-' | 1<<'\\r' | 1<<' ' | 1<<','\n\ts.IsIdentRune = func(ch rune, i int) bool {\n\t\treturn ch == '*' || unicode.IsLetter(ch) || unicode.IsDigit(ch)\n\t}\n\ts.Mode = scanner.ScanIdents\n\n\tflags := make(map[string]string)\n\n\tvar tok rune\n\tfor {\n\t\tvar key string\n\t\tif tok = s.Scan(); tok == scanner.EOF || tok == '\\n' {\n\t\t\tbreak\n\t\t}\n\t\tkey = s.TokenText()\n\t\tif tok = s.Scan(); tok == scanner.EOF || tok == '\\n' {\n\t\t\tbreak\n\t\t}\n\t\tflags[key] = s.TokenText()\n\t}\n\n\treturn flags\n}", "func parseFlags() {\n\t//Get flags\n\tflagSrcAddress := flag.String(\"S\", \"\", \"Address to block.\")\n\n\t//Get Values\n\tflag.Parse()\n\tsrcAddress = *flagSrcAddress\n}", "func (app *App) RegFlags() {\n\tif app.Flags.values == nil {\n\t\tapp.Flags.values = make(map[string]Flag)\n\t}\n\tapp.flagsRegistered = true\n\tfor _, v := range app.flagsQueue {\n\t\tapp.Flags.values[v.Name] = Flag{\n\t\t\tName: v.Name,\n\t\t\tDescription: v.Description,\n\t\t\tDefault: v.Default,\n\t\t\tValue: flag.String(v.Name, v.Default, v.Description),\n\t\t}\n\t}\n}", "func parseFlags(c *Configuration) {\n\tif err := c.pFlag.Parse(os.Args[1:]); err != nil {\n\t\thandleError(err)\n\t}\n\tif err := c.viperFlag.BindPFlags(c.pFlag); err != nil {\n\t\thandleError(err)\n\t}\n}", "func addFlags(f *testFlags, flags []string) {\n\tfor _, flag := range flags {\n\t\tfields := strings.SplitN(flag, \"=\", 2)\n\t\tswitch len(fields) {\n\t\tcase 1:\n\t\t\tf.bools[fields[0]] = true\n\t\tcase 2:\n\t\t\tif i, err := strconv.Atoi(fields[1]); err == nil {\n\t\t\t\tf.ints[fields[0]] = i\n\t\t\t} else {\n\t\t\t\tf.strings[fields[0]] = fields[1]\n\t\t\t}\n\t\t}\n\t}\n}", "func ParseFlags() {\n\tconfig.ParseFlags()\n}", "func readFlags(fnm *string) (bool, error){\n\t//Initiaize\n\tflag.StringVar(fnm, \"o\", FileName, \"set the name of the file\")\n\t//Read\n\tflag.Parse()\n\t//Error can be returned as null.\n\treturn true, nil\n}", "func ParseFlags() {\n\tvar err error\n\tvar s, n, v, backupDriverName, specDir, logLoc, logLevel, appListCSV, provisionerName, configMapName string\n\tvar schedulerDriver scheduler.Driver\n\tvar volumeDriver volume.Driver\n\tvar nodeDriver node.Driver\n\tvar backupDriver backup.Driver\n\tvar appScaleFactor int\n\tvar volUpgradeEndpointURL string\n\tvar volUpgradeEndpointVersion string\n\tvar minRunTimeMins int\n\tvar chaosLevel int\n\tvar storageNodesPerAZ int\n\tvar destroyAppTimeout time.Duration\n\tvar driverStartTimeout time.Duration\n\tvar autoStorageNodeRecoveryTimeout time.Duration\n\tvar licenseExpiryTimeoutHours time.Duration\n\tvar meteringIntervalMins time.Duration\n\tvar bundleLocation string\n\tvar customConfigPath string\n\tvar customAppConfig map[string]scheduler.AppConfig\n\tvar enableStorkUpgrade bool\n\tvar secretType string\n\tvar pureVolumes bool\n\tvar vaultAddress string\n\tvar vaultToken string\n\tvar schedUpgradeHops string\n\tvar autopilotUpgradeImage string\n\tvar csiGenericDriverConfigMapName string\n\n\tflag.StringVar(&s, schedulerCliFlag, defaultScheduler, \"Name of the scheduler to use\")\n\tflag.StringVar(&n, nodeDriverCliFlag, defaultNodeDriver, \"Name of the node driver to use\")\n\tflag.StringVar(&v, storageDriverCliFlag, defaultStorageDriver, \"Name of the storage driver to use\")\n\tflag.StringVar(&backupDriverName, backupCliFlag, \"\", \"Name of the backup driver to use\")\n\tflag.StringVar(&specDir, specDirCliFlag, defaultSpecsRoot, \"Root directory containing the application spec files\")\n\tflag.StringVar(&logLoc, logLocationCliFlag, defaultLogLocation,\n\t\t\"Path to save logs/artifacts upon failure. Default: /mnt/torpedo_support_dir\")\n\tflag.StringVar(&logLevel, logLevelCliFlag, defaultLogLevel, \"Log level\")\n\tflag.IntVar(&appScaleFactor, scaleFactorCliFlag, defaultAppScaleFactor, \"Factor by which to scale applications\")\n\tflag.IntVar(&minRunTimeMins, minRunTimeMinsFlag, defaultMinRunTimeMins, \"Minimum Run Time in minutes for appliation deletion tests\")\n\tflag.IntVar(&chaosLevel, chaosLevelFlag, defaultChaosLevel, \"Application deletion frequency in minutes\")\n\tflag.StringVar(&volUpgradeEndpointURL, storageUpgradeEndpointURLCliFlag, defaultStorageUpgradeEndpointURL,\n\t\t\"Endpoint URL link which will be used for upgrade storage driver\")\n\tflag.StringVar(&volUpgradeEndpointVersion, storageUpgradeEndpointVersionCliFlag, defaultStorageUpgradeEndpointVersion,\n\t\t\"Endpoint version which will be used for checking version after upgrade storage driver\")\n\tflag.BoolVar(&enableStorkUpgrade, enableStorkUpgradeFlag, false, \"Enable stork upgrade during storage driver upgrade\")\n\tflag.StringVar(&appListCSV, appListCliFlag, \"\", \"Comma-separated list of apps to run as part of test. The names should match directories in the spec dir.\")\n\tflag.StringVar(&provisionerName, provisionerFlag, defaultStorageProvisioner, \"Name of the storage provisioner Portworx or CSI.\")\n\tflag.IntVar(&storageNodesPerAZ, storageNodesPerAZFlag, defaultStorageNodesPerAZ, \"Maximum number of storage nodes per availability zone\")\n\tflag.DurationVar(&destroyAppTimeout, \"destroy-app-timeout\", defaultTimeout, \"Maximum \")\n\tflag.DurationVar(&driverStartTimeout, \"driver-start-timeout\", defaultDriverStartTimeout, \"Maximum wait volume driver startup\")\n\tflag.DurationVar(&autoStorageNodeRecoveryTimeout, \"storagenode-recovery-timeout\", defaultAutoStorageNodeRecoveryTimeout, \"Maximum wait time in minutes for storageless nodes to transition to storagenodes in case of ASG\")\n\tflag.DurationVar(&licenseExpiryTimeoutHours, licenseExpiryTimeoutHoursFlag, defaultLicenseExpiryTimeoutHours, \"Maximum wait time in hours after which force expire license\")\n\tflag.DurationVar(&meteringIntervalMins, meteringIntervalMinsFlag, defaultMeteringIntervalMins, \"Metering interval in minutes for metering agent\")\n\tflag.StringVar(&configMapName, configMapFlag, \"\", \"Name of the config map to be used.\")\n\tflag.StringVar(&bundleLocation, \"bundle-location\", defaultBundleLocation, \"Path to support bundle output files\")\n\tflag.StringVar(&customConfigPath, \"custom-config\", \"\", \"Path to custom configuration files\")\n\tflag.StringVar(&secretType, \"secret-type\", scheduler.SecretK8S, \"Path to custom configuration files\")\n\tflag.BoolVar(&pureVolumes, \"pure-volumes\", false, \"To enable using Pure backend for shared volumes\")\n\tflag.StringVar(&vaultAddress, \"vault-addr\", \"\", \"Path to custom configuration files\")\n\tflag.StringVar(&vaultToken, \"vault-token\", \"\", \"Path to custom configuration files\")\n\tflag.StringVar(&schedUpgradeHops, \"sched-upgrade-hops\", \"\", \"Comma separated list of versions scheduler upgrade to take hops\")\n\tflag.StringVar(&autopilotUpgradeImage, autopilotUpgradeImageCliFlag, \"\", \"Autopilot version which will be used for checking version after upgrade autopilot\")\n\tflag.StringVar(&csiGenericDriverConfigMapName, csiGenericDriverConfigMapFlag, \"\", \"Name of config map that stores provisioner details when CSI generic driver is being used\")\n\tflag.StringVar(&testrailuttils.MilestoneName, milestoneFlag, \"\", \"Testrail milestone name\")\n\tflag.StringVar(&testrailuttils.RunName, testrailRunNameFlag, \"\", \"Testrail run name, this run will be updated in testrail\")\n\tflag.StringVar(&testrailuttils.JobRunID, testrailRunIDFlag, \"\", \"Run ID for the testrail run\")\n\tflag.StringVar(&testrailuttils.JenkinsBuildURL, testrailJenkinsBuildURLFlag, \"\", \"Jenins job url for testrail update\")\n\tflag.StringVar(&testRailHostname, testRailHostFlag, \"\", \"Testrail server hostname\")\n\tflag.StringVar(&testRailUsername, testRailUserNameFlag, \"\", \"Username to be used for adding entries to testrail\")\n\tflag.StringVar(&testRailPassword, testRailPasswordFlag, \"\", \"Password to be used for testrail update\")\n\tflag.StringVar(&jiraUserName, jiraUserNameFlag, \"\", \"Username to be used for JIRA client\")\n\tflag.StringVar(&jiraToken, jiraTokenFlag, \"\", \"API token for accessing the JIRA\")\n\tflag.StringVar(&jirautils.AccountID, jiraAccountIDFlag, \"\", \"AccountID for issue assignment\")\n\tflag.Parse()\n\n\tappList, err := splitCsv(appListCSV)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"failed to parse app list: %v. err: %v\", appListCSV, err)\n\t}\n\n\tsched.Init(time.Second)\n\n\tif schedulerDriver, err = scheduler.Get(s); err != nil {\n\t\tlogrus.Fatalf(\"Cannot find scheduler driver for %v. Err: %v\\n\", s, err)\n\t} else if volumeDriver, err = volume.Get(v); err != nil {\n\t\tlogrus.Fatalf(\"Cannot find volume driver for %v. Err: %v\\n\", v, err)\n\t} else if nodeDriver, err = node.Get(n); err != nil {\n\t\tlogrus.Fatalf(\"Cannot find node driver for %v. Err: %v\\n\", n, err)\n\t} else if err = os.MkdirAll(logLoc, os.ModeDir); err != nil {\n\t\tlogrus.Fatalf(\"Cannot create path %s for saving support bundle. Error: %v\", logLoc, err)\n\t} else {\n\t\tif _, err = os.Stat(customConfigPath); err == nil {\n\t\t\tvar data []byte\n\n\t\t\tlogrus.Infof(\"Using custom app config file %s\", customConfigPath)\n\t\t\tdata, err = ioutil.ReadFile(customConfigPath)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Fatalf(\"Cannot read file %s. Error: %v\", customConfigPath, err)\n\t\t\t}\n\t\t\terr = yaml.Unmarshal(data, &customAppConfig)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Fatalf(\"Cannot unmarshal yml %s. Error: %v\", customConfigPath, err)\n\t\t\t}\n\t\t\tlogrus.Infof(\"Parsed custom app config file: %+v\", customAppConfig)\n\t\t}\n\t\tlogrus.Infof(\"Backup driver name %s\", backupDriverName)\n\t\tif backupDriverName != \"\" {\n\t\t\tif backupDriver, err = backup.Get(backupDriverName); err != nil {\n\t\t\t\tlogrus.Fatalf(\"cannot find backup driver for %s. Err: %v\\n\", backupDriverName, err)\n\t\t\t} else {\n\t\t\t\tlogrus.Infof(\"Backup driver found %v\", backupDriver)\n\t\t\t}\n\t\t}\n\n\t\tonce.Do(func() {\n\t\t\tinstance = &Torpedo{\n\t\t\t\tInstanceID: time.Now().Format(\"01-02-15h04m05s\"),\n\t\t\t\tS: schedulerDriver,\n\t\t\t\tV: volumeDriver,\n\t\t\t\tN: nodeDriver,\n\t\t\t\tSpecDir: specDir,\n\t\t\t\tLogLoc: logLoc,\n\t\t\t\tLogLevel: logLevel,\n\t\t\t\tGlobalScaleFactor: appScaleFactor,\n\t\t\t\tMinRunTimeMins: minRunTimeMins,\n\t\t\t\tChaosLevel: chaosLevel,\n\t\t\t\tStorageDriverUpgradeEndpointURL: volUpgradeEndpointURL,\n\t\t\t\tStorageDriverUpgradeEndpointVersion: volUpgradeEndpointVersion,\n\t\t\t\tEnableStorkUpgrade: enableStorkUpgrade,\n\t\t\t\tAppList: appList,\n\t\t\t\tProvisioner: provisionerName,\n\t\t\t\tMaxStorageNodesPerAZ: storageNodesPerAZ,\n\t\t\t\tDestroyAppTimeout: destroyAppTimeout,\n\t\t\t\tDriverStartTimeout: driverStartTimeout,\n\t\t\t\tAutoStorageNodeRecoveryTimeout: autoStorageNodeRecoveryTimeout,\n\t\t\t\tConfigMap: configMapName,\n\t\t\t\tBundleLocation: bundleLocation,\n\t\t\t\tCustomAppConfig: customAppConfig,\n\t\t\t\tBackup: backupDriver,\n\t\t\t\tSecretType: secretType,\n\t\t\t\tPureVolumes: pureVolumes,\n\t\t\t\tVaultAddress: vaultAddress,\n\t\t\t\tVaultToken: vaultToken,\n\t\t\t\tSchedUpgradeHops: schedUpgradeHops,\n\t\t\t\tAutopilotUpgradeImage: autopilotUpgradeImage,\n\t\t\t\tCsiGenericDriverConfigMap: csiGenericDriverConfigMapName,\n\t\t\t\tLicenseExpiryTimeoutHours: licenseExpiryTimeoutHours,\n\t\t\t\tMeteringIntervalMins: meteringIntervalMins,\n\t\t\t}\n\t\t})\n\t}\n\n\t// Set log level\n\tlogLvl, err := logrus.ParseLevel(instance.LogLevel)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Failed to set log level due to Err: %v\", err)\n\t}\n\tlogrus.SetLevel(logLvl)\n\n}", "func UnmarshalFromFlags(c interface{}) {\n\ttopType := reflect.TypeOf(c).Elem()\n\ttopValue := reflect.ValueOf(c)\n\tfor i := 0; i < topType.NumField(); i++ {\n\t\tfield := topType.Field(i)\n\t\tif field.Tag.Get(\"cli\") != \"\" {\n\t\t\tdesc := field.Tag.Get(\"desc\")\n\t\t\tif field.Tag.Get(\"env\") != \"\" {\n\t\t\t\tdesc = desc + \"; This variable is set by ENV \\\"\" + field.Tag.Get(\"env\") + \"\\\"\"\n\t\t\t}\n\t\t\tswitch field.Type.Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\ttemp := flag.Bool(field.Tag.Get(\"cli\"), topValue.Elem().Field(i).Bool(), desc)\n\t\t\t\tf := topValue.Elem().Field(i)\n\t\t\t\tdefer func() { f.SetBool(*temp) }()\n\t\t\tcase reflect.Int64:\n\t\t\t\ttemp := flag.Int64(field.Tag.Get(\"cli\"), topValue.Elem().Field(i).Int(), desc)\n\t\t\t\tf := topValue.Elem().Field(i)\n\t\t\t\tdefer func() { f.SetInt(*temp) }()\n\t\t\tcase reflect.String:\n\t\t\t\ttemp := flag.String(field.Tag.Get(\"cli\"), topValue.Elem().Field(i).String(), desc)\n\t\t\t\tf := topValue.Elem().Field(i)\n\t\t\t\tdefer func() { f.SetString(*temp) }()\n\t\t\tcase reflect.Float64:\n\t\t\t\ttemp := flag.Float64(field.Tag.Get(\"cli\"), topValue.Elem().Field(i).Float(), desc)\n\t\t\t\tf := topValue.Elem().Field(i)\n\t\t\t\tdefer func() { f.SetFloat(*temp) }()\n\t\t\t}\n\t\t}\n\t}\n\tflag.Parse()\n}", "func (c *Conf) loadFlags(from []string) {\n\n\tif len(from) == 0 {\n\t\t// Nothing to parse.\n\t\treturn\n\t}\n\tc.Command = from[0]\n\tfs := flag.NewFlagSet(c.Command, flag.ExitOnError)\n\n\t// Define relevant flags\n\tfs.BoolVar(&c.Test.Verbose, \"verbose\", c.Test.Verbose, \"Verbose execution.\")\n\tfs.BoolVar(&c.Test.Verbose, \"v\", c.Test.Verbose, \"Verbose execution.\")\n\tfs.BoolVar(&c.Test.Verbose, \"test.v\", c.Test.Verbose, \"Verbose execution.\")\n\tfs.BoolVar(&c.Test.Verbose, \"test.verbose\", c.Test.Verbose, \"Verbose execution.\")\n\n\tfs.BoolVar(&c.Test.Short, \"test.short\", c.Test.Short, \"Verbose execution.\")\n\tfs.BoolVar(&c.Test.Short, \"short\", c.Test.Short, \"Verbose execution.\")\n\n\tfs.String(\"test.testlogfile\", c.Test.LogFile, \"DO NOT USE - used by go test.\")\n\tfs.String(\"test.timeout\", \"\", \"DO NOT USE - used by go test.\")\n\tfs.String(\"test.run\", \"\", \"DO NOT USE - used by go test.\")\n\n\tfs.StringVar(&c.Addr.Public, \"pubaddr\", c.Addr.Public, \"Public address.\")\n\tfs.StringVar(&c.Addr.Private, \"privaddr\", c.Addr.Private, \"Private address.\")\n\n\t// Actual parsing\n\tfs.Parse(from[1:])\n\n\t// Remaining args ..\n\tc.Args = fs.Args()\n\n\t// Display default flags.\n\t// fs.PrintDefaults()\n\n\t//fmt.Println(\"Flag parsed : \", *fs)\n\n\tc.Parsed.Flags = true\n}", "func parseFlags() error {\n\tpflag.UintVar(&params.Port, Port, 0, \"application HTTP port\")\n\n\tpflag.StringVar(&params.ConfigFileName, FileName, \"config\", \"config file name\")\n\tparams.ConfigFileName = strings.TrimSuffix(params.ConfigFileName, filepath.Ext(params.ConfigFileName))\n\n\tpflag.StringVar(&params.DSN, DSN, \"\", \"DSN data for DB access\")\n\tpflag.StringVar(&params.DBDriver, DBDriver, \"postgres\", \"DB driver name\")\n\tpflag.BoolVar(&params.Debug, Debug, false, \"enable debug mode\")\n\n\tpflag.Parse()\n\treturn viper.BindPFlags(pflag.CommandLine)\n}", "func RegisterFlags() {\n\tregisterFlags()\n}", "func parseFlags() {\n\tflag.IntVar(&karaiPort, \"port\", 4200, \"Port to run Karai Coordinator on.\")\n\tflag.BoolVar(&isCoordinator, \"coordinator\", false, \"Run as coordinator.\")\n\t// flag.StringVar(&karaiPort, \"karaiPort\", \"4200\", \"Port to run Karai\")\n\tflag.Parse()\n}", "func parseFlags7VSUnisystem(flags byte) bool {\n\t// Right-most bit position\n\treturn (uint8(flags) & 0x01) == 1\n}", "func registerFlags(c *Configuration) {\n\tfor _, k := range configurationMap {\n\t\tif k.Flag != \"\" {\n\t\t\tflagRegister(k, c)\n\t\t}\n\t}\n}", "func ParseFlags() *Flags {\n\tf := &Flags{}\n\tf.Link()\n\tflag.Parse()\n\treturn f\n}", "func getFlags() (timePtr *int, limitPtr *int) {\n\tlimitPtr = flag.Int(\"limit\", 10, \"--limit 10 to specify limit\")\n\ttimePtr = flag.Int(\"time\", 4, \"--time 10 to specify run-time in seconds\")\n\tflag.Parse()\n\treturn\n}", "func RegisterFlags() {\n\tflag.StringVar(&globalCfg.Endpoint, \"nrinsights-endpoint\", DefaultConfig.Endpoint, \"New Relic Insights API endpoint\")\n\tflag.StringVar(&globalCfg.Token, \"nrinsights-token\", DefaultConfig.Token, \"New Relic Insights API access token\")\n\tflag.IntVar(&globalCfg.MaxBatchSize, \"nrinsights-batch-size\", DefaultConfig.MaxBatchSize, \"Maximum size of message batches to Insights endpoint\")\n\tflag.DurationVar(&globalCfg.MaxBatchDelay, \"nrinsights-batch-delay\", DefaultConfig.MaxBatchDelay, \"Maximum delay between batches to Insights endpoint\")\n}", "func (sr *StatusRegister) getFlags() byte {\n\tvar flags byte\n\tflags |= sr.c << 0\n\tflags |= sr.z << 1\n\tflags |= sr.i << 2\n\tflags |= sr.d << 3\n\tflags |= sr.b << 4\n\tflags |= sr.u << 5\n\tflags |= sr.v << 6\n\tflags |= sr.n << 7\n\treturn flags\n}", "func ParseFlags() {\n\tpflag.Usage = syntaxError\n\tpflag.Parse()\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\tfs.LoadConfig()\n}", "func ParseFlags() {\n\tflag.StringVar(&taskDirFlag, \"d\", \"\", \"task dir\")\n\tflag.StringVar(&payloadFlag, \"payload\", \"\", \"payload file\")\n\tflag.StringVar(&idFlag, \"id\", \"\", \"task id\")\n\tflag.Parse()\n}", "func parseFlags() options {\n var opt options\n fs := setupFlags(&opt)\n fs.Parse(os.Args[1:])\n verifyFlags(&opt, fs)\n // Process the verified options...\n return opt\n}", "func ProcessorFlags() ([]string, error) {\n\tflags, _, err := processorFlagsAndTXTSupport()\n\treturn flags, err\n}", "func registerFlags(td *OsmTestData) {\n\tflag.BoolVar(&td.CleanupTest, \"cleanupTest\", true, \"Cleanup test resources when done\")\n\tflag.BoolVar(&td.WaitForCleanup, \"waitForCleanup\", true, \"Wait for effective deletion of resources\")\n\tflag.BoolVar(&td.IgnoreRestarts, \"ignoreRestarts\", false, \"When true, will not make tests fail if restarts of control plane processes are observed\")\n\n\tflag.StringVar(&td.TestDirBase, \"testDirBase\", testFolderBase, \"Test directory base. Test directory name will be created inside.\")\n\n\tflag.StringVar((*string)(&td.InstType), \"installType\", string(SelfInstall), \"Type of install/deployment for OSM\")\n\tflag.StringVar((*string)(&td.CollectLogs), \"collectLogs\", string(CollectLogsIfErrorOnly), \"Defines if/when to collect logs.\")\n\n\tflag.StringVar(&td.ClusterName, \"kindClusterName\", \"osm-e2e\", \"Name of the Kind cluster to be created\")\n\n\tflag.BoolVar(&td.CleanupKindCluster, \"cleanupKindCluster\", true, \"Cleanup kind cluster upon exit\")\n\tflag.BoolVar(&td.CleanupKindClusterBetweenTests, \"cleanupKindClusterBetweenTests\", false, \"Cleanup kind cluster between tests\")\n\tflag.StringVar(&td.ClusterVersion, \"kindClusterVersion\", \"\", \"Kind cluster version, ex. v.1.20.2\")\n\n\tflag.StringVar(&td.CtrRegistryServer, \"ctrRegistry\", os.Getenv(\"CTR_REGISTRY\"), \"Container registry\")\n\tflag.StringVar(&td.CtrRegistryUser, \"ctrRegistryUser\", os.Getenv(\"CTR_REGISTRY_USER\"), \"Container registry\")\n\tflag.StringVar(&td.CtrRegistryPassword, \"ctrRegistrySecret\", os.Getenv(\"CTR_REGISTRY_PASSWORD\"), \"Container registry secret\")\n\n\tflag.StringVar(&td.OsmImageTag, \"osmImageTag\", utils.GetEnv(\"CTR_TAG\", defaultImageTag), \"OSM image tag\")\n\tflag.StringVar(&td.OsmNamespace, \"OsmNamespace\", utils.GetEnv(\"K8S_NAMESPACE\", defaultOsmNamespace), \"OSM Namespace\")\n\tflag.StringVar(&td.OsmMeshConfigName, \"OsmMeshConfig\", defaultMeshConfigName, \"OSM MeshConfig name\")\n\n\tflag.BoolVar(&td.EnableNsMetricTag, \"EnableMetricsTag\", true, \"Enable tagging Namespaces for metrics collection\")\n\tflag.BoolVar(&td.DeployOnOpenShift, \"deployOnOpenShift\", false, \"Configure tests to run on OpenShift\")\n\tflag.BoolVar(&td.DeployOnWindowsWorkers, \"deployOnWindowsWorkers\", false, \"Configure tests to run on Windows workers\")\n\tflag.BoolVar(&td.RetryAppPodCreation, \"retryAppPodCreation\", true, \"Retry app pod creation on error\")\n\tflag.BoolVar(&td.EnableSPIFFE, \"enableSPIFFE\", false, \"Globally Enables SPIFFE IDs when running tests\")\n}", "func parseUIUseFlags(path string) (map[string]struct{}, error) {\n\tb, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlines := strings.Split(string(b), \"\\n\")\n\tflags := make(map[string]struct{})\n\tfor _, l := range lines {\n\t\tl = strings.TrimSpace(l)\n\t\tif len(l) > 0 && l[0] != '#' {\n\t\t\tflags[l] = struct{}{}\n\t\t}\n\t}\n\treturn flags, nil\n}", "func InitFlags() {\n\n pflag.CommandLine.SetNormalizerFunc(WordSepNormalizeFunc)\n pflag.CommandLine.AddGoFlagSet(goflag.ComamndLine)\n pflag.Parse()\n pflag.VisitAll(func(flag *pflag.Flag)) {\n \tglog.V(2).Infof(\"FLAG: --%s=%q\", flag.Name, flag.Value)\n }\n}", "func parseFlags() *flag.FlagSet {\n\tset := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)\n\n\tset.Usage = func() { // untested section\n\t\tfmt.Fprintf(\n\t\t\tos.Stderr,\n\t\t\t\"logrecycler \"+Version+\"\\n\"+\n\t\t\t\t\"pipe logs to logrecycler to convert them into json logs with custom tags\\n\"+\n\t\t\t\t\"configure with logrecycler.yaml\\n\"+\n\t\t\t\t\"for more info see https://github.com/grosser/logrecycler\\n\",\n\t\t)\n\t\tset.PrintDefaults()\n\t}\n\tversion := set.Bool(\"version\", false, \"Show version\")\n\thelp := set.Bool(\"help\", false, \"Show this\")\n\n\tif err := set.Parse(os.Args[1:]); err != nil { // untested section\n\t\tset.Usage()\n\t\tos.Exit(2)\n\t}\n\n\tif *version { // untested section\n\t\tfmt.Println(Version)\n\t\tos.Exit(0)\n\t}\n\n\tif *help { // untested section\n\t\tset.Usage()\n\t\tos.Exit(0)\n\t}\n\n\tif len(set.Args()) != 0 { // untested section\n\t\tset.Usage()\n\t\tos.Exit(2)\n\t}\n\n\treturn set\n}", "func (s *SysbenchMemory) flags(b *testing.B) []string {\n\tcmd := s.baseFlags(b, false /* useEvents */)\n\tif s.BlockSize != 0 {\n\t\tcmd = append(cmd, fmt.Sprintf(\"--memory-block-size=%dM\", s.BlockSize))\n\t}\n\tif s.Scope != \"\" {\n\t\tcmd = append(cmd, fmt.Sprintf(\"--memory-scope=%s\", s.Scope))\n\t}\n\tif s.HugeTLB {\n\t\tcmd = append(cmd, \"--memory-hugetlb=on\")\n\t}\n\tif s.OperationType != \"\" {\n\t\tcmd = append(cmd, fmt.Sprintf(\"--memory-oper=%s\", s.OperationType))\n\t}\n\tif s.AccessMode != \"\" {\n\t\tcmd = append(cmd, fmt.Sprintf(\"--memory-access-mode=%s\", s.AccessMode))\n\t}\n\t// Sysbench ignores events for memory tests, and uses the total\n\t// size parameter to determine when the test is done. We scale\n\t// with this instead.\n\tcmd = append(cmd, fmt.Sprintf(\"--memory-total-size=%dG\", b.N))\n\treturn cmd\n}", "func getFlagsGroup() []cli.Flag {\n\treturn []cli.Flag{\n\t\t&cli.StringFlag{\n\t\t\tName: \"use\",\n\t\t\tAliases: []string{\"u\"},\n\t\t\tUsage: \"set default engine [gin|http]\",\n\t\t\tValue: \"gin\",\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: \"path\",\n\t\t\tAliases: []string{\"p\", \"static\"},\n\t\t\tUsage: \"set default static file path\",\n\t\t\tValue: \".\",\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: \"index\",\n\t\t\tAliases: []string{\"i\", \"index_file\"},\n\t\t\tUsage: \"set default index file\",\n\t\t\tValue: \"index.html\",\n\t\t},\n\t\t&cli.IntFlag{\n\t\t\tName: \"port\",\n\t\t\tAliases: []string{\"po\"},\n\t\t\tUsage: \"set default listen port\",\n\t\t\tValue: 5000,\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: \"log\",\n\t\t\tAliases: []string{\"l\", \"logfile\"},\n\t\t\tUsage: \"set default logfile\",\n\t\t\tValue: \"\",\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"withtime\",\n\t\t\tAliases: []string{\"enable\", \"time\"},\n\t\t\tUsage: \"log with current time\",\n\t\t\tValue: false,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"test\",\n\t\t\tAliases: []string{\"t\", \"testit\"},\n\t\t\tUsage: \"run in a test mode\",\n\t\t\tValue: false,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"try\",\n\t\t\tAliases: []string{\"tryfile\"},\n\t\t\tUsage: \"run in a try file mode\",\n\t\t\tValue: false,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"daemon\",\n\t\t\tAliases: []string{\"d\"},\n\t\t\tUsage: \"run in a daemon mode\",\n\t\t\tValue: false,\n\t\t},\n\t}\n}", "func init() {\n\tregisterFlags(&Td)\n}", "func parseFlags() *Config {\n\tiPtr := flag.String(\"i\", \"\", \"Input file path or directory for the XML schema definition\")\n\toPtr := flag.String(\"o\", \"xgen_out\", \"Output file path or directory for the generated code\")\n\tpkgPtr := flag.String(\"p\", \"\", \"Specify the package name\")\n\tlangPtr := flag.String(\"l\", \"\", \"Specify the language of generated code\")\n\tverPtr := flag.Bool(\"v\", false, \"Show version and exit\")\n\thelpPtr := flag.Bool(\"h\", false, \"Show this help and exit\")\n\tflag.Parse()\n\tif *helpPtr {\n\t\tfmt.Printf(\"xgen version: %s\\r\\nCopyright (c) 2020 - 2022 Ri Xu https://xuri.me All rights reserved.\\r\\n\\r\\nUsage:\\r\\n$ xgen [<flag> ...] <XSD file or directory> ...\\n -i <path>\\tInput file path or directory for the XML schema definition\\r\\n -o <path>\\tOutput file path or directory for the generated code\\r\\n -p \\tSpecify the package name\\r\\n -l \\tSpecify the language of generated code (Go/C/Java/Rust/TypeScript)\\r\\n -h \\tOutput this help and exit\\r\\n -v \\tOutput version and exit\\r\\n\", Cfg.Version)\n\t\tos.Exit(0)\n\t}\n\tif *verPtr {\n\t\tfmt.Printf(\"xgen version: %s\\r\\n\", Cfg.Version)\n\t\tos.Exit(0)\n\t}\n\tif *iPtr == \"\" {\n\t\tfmt.Println(\"must specify input file path or directory for the XML schema definition\")\n\t\tos.Exit(1)\n\t}\n\tCfg.I = *iPtr\n\tif *langPtr == \"\" {\n\t\tfmt.Println(\"must specify the language of generated code (Go/C/Java/Rust/TypeScript)\")\n\t\tos.Exit(1)\n\t}\n\tCfg.Lang = *langPtr\n\tif *oPtr != \"\" {\n\t\tCfg.O = *oPtr\n\t}\n\tif ok := SupportLang[Cfg.Lang]; !ok {\n\t\tfmt.Println(\"unsupport language\", Cfg.Lang)\n\t\tos.Exit(1)\n\t}\n\tif *pkgPtr != \"\" {\n\t\tCfg.Pkg = *pkgPtr\n\t}\n\treturn &Cfg\n}", "func parseFlags() (filename string, timer int) {\n\tflagFilename := flag.String(\"filename\", \"./problems.csv\", \"Name of the quizz CSV file.\")\n\tflagTimer := flag.Int(\"timer\", 30, \"Time limit in seconds.\")\n\tflag.Parse()\n\treturn *flagFilename, *flagTimer\n}", "func RegisterFlags(f *flag.FlagSet) {\n\tf.StringVar(&CPUProfileFlag, \"cpuprofile\", \"\", \"a filename to write a CPU profile.\")\n\tf.StringVar(&HeapProfileFlag, \"heapprofile\", \"\", \"a filename to write a heap profile.\")\n\tf.StringVar(&ThreadProfileFlag, \"threadprofile\", \"\", \"a filename to write the stack traces that caused new OS threads to be created.\")\n\tf.StringVar(&BlockProfileFlag, \"blockprofile\", \"\", \"a filename to write the stack traces that caused blocking on synchronization primitives.\")\n}", "func Parse() {\n\tfor i := 1; i < len(os.Args); {\n\t\tok, next := flags.parseOne(i);\n\t\tif next > 0 {\n\t\t\tflags.first_arg = next;\n\t\t\ti = next;\n\t\t}\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t}\n}", "func (p *Parser) Flags(flags ...string) *Parser {\n\tp.nextFlags = flags\n\treturn p\n}", "func (d *Data) RegisterFlags(fs *flag.FlagSet) {\n\tfs.BoolVar(&d.Verbose, \"verbose\", false, \"\")\n\tfs.IntVar(&d.Server.Port, \"server.port\", 80, \"\")\n\tfs.DurationVar(&d.Server.Timeout, \"server.timeout\", 60*time.Second, \"\")\n\n\tfs.StringVar(&d.TLS.Cert, \"tls.cert\", \"DEFAULTCERT\", \"\")\n\tfs.StringVar(&d.TLS.Key, \"tls.key\", \"DEFAULTKEY\", \"\")\n}", "func (m *Main) ParseFlags(ctx context.Context, args []string) error {\n\tvar host, port, user, password, dbname, sslmode string\n\tflag.StringVar(&host, \"db-host\", \"localhost\", \"PostgreSQL database: host\")\n\tflag.StringVar(&port, \"db-port\", \"5432\", \"PostgreSQL database: port\")\n\tflag.StringVar(&user, \"db-user\", \"main_user\", \"PostgreSQL database: user\")\n\tflag.StringVar(&password, \"db-password\", \"mysecretuserpassword\", \"PostgreSQL database: password\")\n\tflag.StringVar(&dbname, \"db-name\", \"easysubmit_db\", \"PostgreSQL database: db name\")\n\tflag.StringVar(&m.Config.FS.HashKey, \"fs-hash-key\", \"00000000000000000000000000000000000000000000000000\", \"Hash key for naming files\")\n\tflag.StringVar(&m.Config.HTTP.Addr, \"addr\", \":8080\", \"HTTP network address\")\n\tflag.StringVar(&m.Config.HTTP.Domain, \"domain\", \"\", \"HTTP network address\")\n\tflag.StringVar(&m.Config.SignKey, \"sign-key\", \"000000000000000000000000000000000000000000000000000000000000000\", \"Sign key for JWT\")\n\tflag.StringVar(&m.Config.VerifyKey, \"verify-key\", \"000000000000000000000000000000000000000000000000000000000000000\", \"Verification key for JWT\")\n\tflag.Parse()\n\n\tif host != \"localhost\" {\n\t\tsslmode = \"require\"\n\t} else {\n\t\tsslmode = \"disable\"\n\t}\n\n\tm.Config.DB.DSN = fmt.Sprintf(\"host=%s port=%s user=%s password=%s dbname=%s sslmode=%s\", host, port, user, password, dbname, sslmode)\n\treturn nil\n}", "func GetRegisterFlags() []cli.Flag {\n\treturn []cli.Flag{\n\t\tcli.IntFlag{\n\t\t\tName: FlagWeight,\n\t\t\tUsage: \"initial weight of this backend\",\n\t\t\tValue: 1,\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: FlagDC,\n\t\t\tUsage: \"datacenter short name as defined in VaaS\",\n\t\t\tEnvVar: EnvDC,\n\t\t},\n\t}\n}", "func (g *Generator) ReadFlags(command *cobra.Command) error {\n\tvar err error\n\n\tflags := command.Flags()\n\n\tif g.options.Output, err = flags.GetString(base.Output); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.MFDPath, err = flags.GetString(mfdFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.Namespaces, err = flags.GetStringSlice(nsFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.Entities, err = flags.GetStringSlice(entitiesFlag); err != nil {\n\t\treturn err\n\t}\n\n\tif g.options.RoutesTemplatePath, err = flags.GetString(routesTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\tif g.options.ListTemplatePath, err = flags.GetString(listTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\tif g.options.FiltersTemplatePath, err = flags.GetString(filterTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\tif g.options.FiltersTemplatePath, err = flags.GetString(formTemplateFlag); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func process_arguments() {\n\tfmt.Println(\"Processing arguments\")\n\tflag.Parse()\n}", "func main() {\n\n\tmyflags := flag.NewFlagSet(\"myflags\", flag.ExitOnError)\n\tcfg := &ProjectConfig{}\n\tcfg.DefineFlags(myflags)\n\n\terr := myflags.Parse(os.Args[1:])\n\tif err != nil {\n\t\tlog.Fatalf(\"%s command line flag parse error: '%s'\", ProgramName, err)\n\t}\n\terr = cfg.ValidateConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"%s command line flag error: '%s'\", ProgramName, err)\n\t}\n\n\tfmt.Printf(\"flag parsing done, the rest of program goes here...\\n\")\n}", "func PharseFlags(appl *App) error {\n\n\tif appl.Contact == \"\" {\n\t\tappl.Contact = DEFAULT_CONTACT\n\t} else {\n\t\tappl.Contact = appl.Contact + CONTACT_ENDING\n\t}\n\n\tif appl.Heading == \"\" && appl.Position != \"\" && appl.Source != \"\" {\n\t\tappl.Heading = \"I am excited about the possibility of joining your organization in the position of \" + appl.Position + \", as advertised on \" + appl.Source + \". \" + appl.HeadingAdd// default heading\n\t} else {\n\t\tif appl.Option <= 6 && appl.Option > 0 {\n\t\t\tpanic(\"heading undefined\")\n\t\t}\n\t}\n\n if appl.Option == 10 && appl.Position != \"\" && appl.PositionID != \"\" {\n appl.FollowUpRef = \"For reference, I have pasted the position title and ID number below.\"\n appl.FollowUpRefInfo = appl.Position + \" - \" + appl.PositionID\n }\n\n if appl.Option == 10 && appl.Position != \"\" && appl.PositionID == \"\" {\n appl.FollowUpRef = \"For reference, I have pasted the position title below.\"\n appl.FollowUpRefInfo = appl.Position\n }\n\n if appl.Option == 10 && (appl.Position == \"\" || appl.Company == \"\") {\n panic(\"Not all of the required flags for a follow up were provided. Need: --position and --company\")\n }\n\n\t// If additional note is present, add a newline at the end of it\n\tif appl.Note1 != \"\" {\n\t\tappl.Note1_tex = appl.Note1 + \" \\\\newline\"\n\t\tappl.Note1_email = \"<div><p style=\\\"text-align:left\\\";>\" + appl.Note1 + \"</p></div>\"\n\t}\n\n // If additional note is present, add a newline at the end of it\n if appl.Note2 != \"\" {\n appl.Note2_tex = appl.Note2 + \" \\\\newline\"\n appl.Note2_email = \"<div><p style=\\\"text-align:left\\\";>\" + appl.Note2 + \"</p></div>\"\n }\n\n\t// If additional skill is present, add a \\item before it\n\tif appl.Skill1 != \"\" {\n\t\tappl.Skill1_tex = \"\\\\item \" + appl.Skill1\n\t\tappl.Skill1_email = \"<li>\" + appl.Skill1 + \"</li>\"\n\t\tappl.Skill1_text = \"- \" + appl.Skill1\n\t}\n\n\t// If additional skill is present, add a \\item before it\n\tif appl.Skill2 != \"\" {\n\t\tappl.Skill2_tex = \"\\\\item \" + appl.Skill2\n\t\tappl.Skill2_email = \"<li>\" + appl.Skill2 + \"</li>\"\n\t\tappl.Skill2_text = \"- \" + appl.Skill2\n\t}\n\n // If additional skill is present, add a \\item before it\n if appl.Skill3 != \"\" {\n appl.Skill3_tex = \"\\\\item \" + appl.Skill3\n appl.Skill3_email = \"<li>\" + appl.Skill3 + \"</li>\"\n appl.Skill3_text = \"- \" + appl.Skill3\n }\n\n fmt.Println(appl.Local)\n\n\tif appl.Local == true {\n\t\tappl.ReloLine = LOCAL\n }\n\tif appl.Local == false {\n\t\tappl.ReloLine = DISTANT\n }\n\n\tappl.ReloLine_email = \"<div><p style=\\\"text-align:left;\\\">\" + appl.ReloLine + \"</p></div>\"\n\n\n\tif (appl.Option <= 6 && appl.Option > 0) || appl.Option == 10 {\n\t\tappl.KvMap_tex = map[string]string{\"[COMPANY_NAME]\": strings.Replace(appl.Company, \"&\", \"\\\\&\", -1), \"[COMPANY_CONTACT]\": strings.Replace(appl.Contact, \"&\", \"\\\\&\", -1),\n\t\t\t\"[POSITION_NAME]\": strings.Replace(appl.Position, \"&\", \"\\\\&\", -1), \"[HEADING]\": strings.Replace(appl.Heading, \"&\", \"\\\\&\", -1), \"[POSITION_SOURCE]\": strings.Replace(appl.Source, \"&\", \"\\\\&\", -1),\n\t\t\t\"[ADDITIONAL_SKILL_1]\": strings.Replace(appl.Skill1_tex, \"&\", \"\\\\&\", -1), \"[ADDITIONAL_SKILL_2]\": strings.Replace(appl.Skill2_tex, \"&\", \"\\\\&\", -1), \"[ADDITIONAL_SKILL_3]\": strings.Replace(appl.Skill3_tex, \"&\", \"\\\\&\", -1),\n\t\t\t\"[ADDITIONAL_NOTE1]\": strings.Replace(appl.Note1_tex, \"&\", \"\\\\&\", -1),\t\"[ADDITIONAL_NOTE2]\": strings.Replace(appl.Note2_tex, \"&\", \"\\\\&\", -1), \"[RELOCATION]\": strings.Replace(appl.ReloLine, \"&\", \"\\\\&\", -1)}\n\n\t\tappl.KvMap_text = map[string]string{\"[COMPANY_NAME]\": appl.Company, \"[COMPANY_CONTACT]\": appl.Contact, \"[POSITION_NAME]\": appl.Position,\n\t\t\t\"[HEADING]\": appl.Heading, \"[POSITION_SOURCE]\": appl.Source, \"[ADDITIONAL_SKILL_1]\": appl.Skill1_text, \"[ADDITIONAL_SKILL_2]\": appl.Skill2_text, \"[ADDITIONAL_SKILL_3]\": appl.Skill3_text,\n\t\t\t\"[ADDITIONAL_NOTE1]\": appl.Note1, \"[ADDITIONAL_NOTE2]\": appl.Note2, \"[CURRENT_DATE]\": date.Get_date(\"email\"), \"[RELOCATION]\": appl.ReloLine, \"[WHEN_APPLIED]\": appl.WhenApplied, \"[FOLLOWUPREF]\": appl.FollowUpRef, \"[FOLLOWUPREFINFO]\": appl.FollowUpRefInfo}\n\t}\n\n\tif appl.MailTo != \"\" && os.Getenv(\"EmailPass\") != \"\" && os.Getenv(\"MailFrom\") != \"\" {\n\t\tappl.KvMap_email = map[string]string{\"[COMPANY_NAME]\": appl.Company, \"[COMPANY_CONTACT]\": appl.Contact, \"[POSITION_NAME]\": appl.Position,\n\t\t\t\"[HEADING]\": appl.Heading, \"[POSITION_SOURCE]\": appl.Source, \"[ADDITIONAL_SKILL_1]\": appl.Skill1_email, \"[ADDITIONAL_SKILL_2]\": appl.Skill2_email, \"[ADDITIONAL_SKILL_3]\": appl.Skill3_email,\n\t\t\t\"[ADDITIONAL_NOTE1]\": appl.Note1_email, \"[ADDITIONAL_NOTE2]\": appl.Note2_email, \"[CURRENT_DATE]\": date.Get_date(\"email\"), \"[RELOCATION]\": appl.ReloLine_email, \"[WHEN_APPLIED]\": appl.WhenApplied, \"[FOLLOWUPREF]\": appl.FollowUpRef, \"[FOLLOWUPREFINFO]\": appl.FollowUpRefInfo}\n\n\n\t\tif appl.Subject == \"\" && appl.Position != \"\" {\n\t\t\tappl.Subject = \"Joshua Haupt appllication for \" + appl.Position + \" position at \" + appl.Company // default subject\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func ParseFlags() (f string, i string, e error) {\n\tvar configPath string\n\tvar information string\n\tflag.StringVar(&configPath, \"config\", \"\", \"path to scc credential config file\")\n\tflag.StringVar(&information, \"get\", \"\", \"enter data parts to query scc, e.g. products or subscriptions\")\n\tflag.Parse()\n\n\tif _, err := os.Stat(configPath); err == nil {\n\t\tfmt.Printf(\"config file exists\\n\")\n\t\tif information != \"\" {\n\t\t\treturn configPath, information, nil\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"File does not exist\\n\")\n\t\tlog.Fatal(\"No config file found. Exit with error\")\n\t}\n\n\treturn configPath, information, nil\n\n}", "func processCommandLineFlags(s *suite.Suite) {\n\tgetopt.HelpColumn = 35\n\tgetopt.DisplayWidth = 120\n\tgetopt.SetParameters(\"\")\n\tgetopt.Parse()\n\n\t// Lets check to see if the version command line flag was given. If it is\n\t// lets print out the version information and exit.\n\tif *bOptVer {\n\t\tprintOutputHeader()\n\t\tos.Exit(0)\n\t}\n\n\t// Lets check to see if the help command line flag was given. If it is lets\n\t// print out the help information and exit.\n\tif *bOptHelp {\n\t\tprintOutputHeader()\n\t\tgetopt.Usage()\n\t\tos.Exit(0)\n\t}\n\n\t// ------------------------------------------------------------\n\t// Map command line parameters to struct values\n\t// ------------------------------------------------------------\n\ts.Verbose = *bOptVerbose\n\ts.Debug = *bOptDebug\n\n\ts.Settings.URL = *sOptURL\n\ts.Settings.Proxy = *sOptProxy\n\ts.Settings.Discovery = *sOptDiscovery\n\ts.Settings.APIRoot = *sOptAPIRoot\n\ts.Settings.Username = *sOptUsername\n\ts.Settings.Password = *sOptPassword\n\n\ts.CollectionIDs.ReadOnly = *sOptReadOnly\n\ts.CollectionIDs.WriteOnly = *sOptWriteOnly\n\ts.CollectionIDs.ReadWrite = *sOptReadWrite\n}", "func ReadFlag(c interface{}) {\r\n\tvar err error\r\n\tinfo := configinfos[c]\r\n\tfor _,v := range os.Args[1:] {\r\n\t\tif !strings.HasPrefix(v, \"--\") {\r\n\t\t\tfmt.Println(\"invalid args\",v)\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tkv := strings.SplitN(v[2:],\"=\",2)\r\n\t\tswitch kv[0]{\r\n\t\tcase \"test\",\"help\",\"enable\",\"disable\",\"mode\":\r\n\t\t\terr = SetData(info, v[2:])\r\n\t\tdefault:\r\n\t\t\terr = SetData(c, v[2:])\r\n\t\t}\r\n\t\tif err != nil {\r\n\t\t\tfmt.Println(\"error:\",err,v)\r\n\t\t}\r\n\t}\r\n}", "func (cmd *ListFirmwareCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tvar module string\n\tcc.Flags().StringVar(&cmd.Module, \"module\", module, ``)\n\tvar page int\n\tcc.Flags().IntVar(&cmd.Page, \"page\", page, ``)\n\tvar pageSize int\n\tcc.Flags().IntVar(&cmd.PageSize, \"pageSize\", pageSize, ``)\n\tvar profile string\n\tcc.Flags().StringVar(&cmd.Profile, \"profile\", profile, ``)\n}", "func parseFlags() (string, string, bool, error) {\n\turlsFlag := flag.String(\n\t\t\"urls\", \"\",\n\t\t\"path to a local text file containing a newline separated list of urls\")\n\tdirFlag := flag.String(\n\t\t\"dir\", \"\",\n\t\t\"path to a local directory in which the processed gifs should be saved\")\n\ttransFlag := flag.Bool(\n\t\t\"trans\", false,\n\t\t\"optional boolean value that indicates whether transparency should be corrected on reversal, \"+\n\t\t\t\"avoiding a ghosting effect on certain gifs\")\n\tflag.Parse()\n\n\ttrans := *transFlag\n\n\turlsFile := *urlsFlag\n\tif urlsFile == \"\" {\n\t\treturn \"\", \"\", trans, errors.New(\"Missing --urls flag\")\n\t}\n\n\tdir := *dirFlag\n\tif dir == \"\" {\n\t\treturn urlsFile, \"\", trans, errors.New(\"Missing --dir flag\")\n\t}\n\n\treturn urlsFile, dir, trans, nil\n}", "func parseAdvancedFlags() {\n\t// // Choose buddhabrot mode.\n\tif anti {\n\t\tbrot = mandel.Converged\n\t} else if primitiveFlag {\n\t\tbrot = mandel.Primitive\n\t} else {\n\t\tbrot = mandel.Escaped\n\t}\n\n\t// Parse the _function_ argument to a function pointer.\n\tparseFunctionFlag()\n\tparseModeFlag()\n\n\t// Save the point.\n\tswitch {\n\tcase zrziFlag:\n\t\t// Original.\n\t\tplane = zrzi\n\tcase zrcrFlag:\n\t\t// Pretty :D\n\t\tplane = zrcr\n\tcase zrciFlag:\n\t\t// Pretty :D\n\t\tplane = zrci\n\tcase crciFlag:\n\t\t// Mandelbrot perimiter.\n\t\tplane = crci\n\tcase crziFlag:\n\t\t// Pretty :D\n\t\tplane = crzi\n\tcase ziciFlag:\n\t\t// Pretty :D\n\t\tplane = zici\n\tdefault:\n\t\tplane = zrzi\n\t}\n\t// Create our complex type from two float values.\n\toffset = complex(offsetReal, offsetImag)\n\tcoefficient = complex(realCoefficient, imagCoefficient)\n\titerations = int64(iterationsFlag)\n}", "func checkFlags(c *Command) map[string]bool {\n\tnotMyFlags := make(map[string]bool)\n\t// visit all flags that were passed in via command line:\n\tflag.Visit(func(f *flag.Flag) {\n\t\tisNotMyFlag := true\n\t\tif c != nil {\n\t\t\tfor _, myFlag := range c.Flags {\n\t\t\t\tif f.Name == myFlag {\n\t\t\t\t\tisNotMyFlag = false // yes, f is among my flags\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif isNotMyFlag {\n\t\t\tfor pf := range privateFlags {\n\t\t\t\tif f.Name == pf {\n\t\t\t\t\tnotMyFlags[pf] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn notMyFlags\n}", "func VisitFlags(visitor func(string, FlagsFunc)) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tfor funcName, f := range flags {\n\t\tvisitor(funcName, f)\n\t}\n}", "func ParseFlags(envVar string, parsedVal *string) {\n\tInstanceArgs[envVar] = parsedVal\n}", "func (sr *StatusRegister) setFlags(flags byte) {\n\tsr.c = 0x1 & flags\n\tsr.z = 0x1 & (flags >> 1)\n\tsr.i = 0x1 & (flags >> 2)\n\tsr.d = 0x1 & (flags >> 3)\n\tsr.b = 0x1 & (flags >> 4)\n\tsr.u = 0x1 & (flags >> 5)\n\tsr.v = 0x1 & (flags >> 6)\n\tsr.n = 0x1 & (flags >> 7)\n}", "func main() {\n strFlag := flag.String(\"sFlag\", \"def-value\", \"describing string flag\")\n intFlag := flag.Int(\"iFlag\", 61, \"describing int flag\")\n boolFlag := flag.Bool(\"bFlag\", false, \"describing bool flag\")\n\n var s string\n var i int\n var b bool\n\n flag.StringVar(&s, \"s\", \"def-value\", \"usage-s\")\n flag.IntVar(&i, \"i\", 62, \"usage-i\")\n flag.BoolVar(&b, \"b\", true, \"usage-b\")\n\n flag.Parse()\n fmt.Println(*strFlag, *intFlag, *boolFlag)\n fmt.Println(s, i, b)\n fmt.Println(\"Non flags command line args\", flag.Args())\n}", "func Flags(cmd *cobra.Command, vp *viper.Viper) error {\n\tfor _, fn := range FlagFuncs {\n\t\tif err := fn(cmd, vp); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid flag(s): %w\", err)\n\t\t}\n\t}\n\treturn nil\n}", "func processArgsAndFlags(componentType string, inputArgsAndFlags []string) (schema.ArgsAndFlagsInfo, error) {\n\tvar info schema.ArgsAndFlagsInfo\n\tvar additionalArgsAndFlags []string\n\tvar globalOptions []string\n\n\tvar indexesToRemove []int\n\n\t// https://github.com/roboll/helmfile#cli-reference\n\tvar globalOptionsFlagIndex int\n\n\tfor i, arg := range inputArgsAndFlags {\n\t\tif arg == cfg.GlobalOptionsFlag {\n\t\t\tglobalOptionsFlagIndex = i + 1\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.GlobalOptionsFlag) {\n\t\t\tglobalOptionsFlagIndex = i\n\t\t}\n\n\t\tif arg == cfg.TerraformDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.TerraformDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.TerraformDirFlag) {\n\t\t\tvar terraformDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(terraformDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.TerraformDir = terraformDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.HelmfileDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.HelmfileDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.HelmfileDirFlag) {\n\t\t\tvar helmfileDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(helmfileDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.HelmfileDir = helmfileDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.CliConfigDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.ConfigDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.CliConfigDirFlag) {\n\t\t\tvar configDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(configDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.ConfigDir = configDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.StackDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.StacksDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.StackDirFlag) {\n\t\t\tvar stacksDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(stacksDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.StacksDir = stacksDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.BasePathFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.BasePath = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.BasePathFlag) {\n\t\t\tvar stacksDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(stacksDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.BasePath = stacksDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.DeployRunInitFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.DeployRunInit = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.DeployRunInitFlag) {\n\t\t\tvar deployRunInitFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(deployRunInitFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.DeployRunInit = deployRunInitFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.AutoGenerateBackendFileFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.AutoGenerateBackendFile = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.AutoGenerateBackendFileFlag) {\n\t\t\tvar autoGenerateBackendFileFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(autoGenerateBackendFileFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.AutoGenerateBackendFile = autoGenerateBackendFileFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.WorkflowDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.WorkflowsDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.WorkflowDirFlag) {\n\t\t\tvar workflowDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(workflowDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.WorkflowsDir = workflowDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.InitRunReconfigure {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.InitRunReconfigure = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.InitRunReconfigure) {\n\t\t\tvar initRunReconfigureParts = strings.Split(arg, \"=\")\n\t\t\tif len(initRunReconfigureParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.InitRunReconfigure = initRunReconfigureParts[1]\n\t\t}\n\n\t\tif arg == cfg.JsonSchemaDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.JsonSchemaDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.JsonSchemaDirFlag) {\n\t\t\tvar jsonschemaDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(jsonschemaDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.JsonSchemaDir = jsonschemaDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.OpaDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.OpaDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.OpaDirFlag) {\n\t\t\tvar opaDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(opaDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.OpaDir = opaDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.CueDirFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.CueDir = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.CueDirFlag) {\n\t\t\tvar cueDirFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(cueDirFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.CueDir = cueDirFlagParts[1]\n\t\t}\n\n\t\tif arg == cfg.RedirectStdErrFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.RedirectStdErr = inputArgsAndFlags[i+1]\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.RedirectStdErrFlag) {\n\t\t\tvar redirectStderrParts = strings.Split(arg, \"=\")\n\t\t\tif len(redirectStderrParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.RedirectStdErr = redirectStderrParts[1]\n\t\t}\n\n\t\tif arg == cfg.PlanFileFlag {\n\t\t\tif len(inputArgsAndFlags) <= (i + 1) {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.PlanFile = inputArgsAndFlags[i+1]\n\t\t\tinfo.UseTerraformPlan = true\n\t\t} else if strings.HasPrefix(arg+\"=\", cfg.PlanFileFlag) {\n\t\t\tvar planFileFlagParts = strings.Split(arg, \"=\")\n\t\t\tif len(planFileFlagParts) != 2 {\n\t\t\t\treturn info, fmt.Errorf(\"invalid flag: %s\", arg)\n\t\t\t}\n\t\t\tinfo.PlanFile = planFileFlagParts[1]\n\t\t\tinfo.UseTerraformPlan = true\n\t\t}\n\n\t\tif arg == cfg.FromPlanFlag {\n\t\t\tinfo.UseTerraformPlan = true\n\t\t}\n\n\t\tif arg == cfg.DryRunFlag {\n\t\t\tinfo.DryRun = true\n\t\t}\n\n\t\tif arg == cfg.SkipInitFlag {\n\t\t\tinfo.SkipInit = true\n\t\t}\n\n\t\tif arg == cfg.HelpFlag1 || arg == cfg.HelpFlag2 {\n\t\t\tinfo.NeedHelp = true\n\t\t}\n\n\t\tfor _, f := range commonFlags {\n\t\t\tif arg == f {\n\t\t\t\tindexesToRemove = append(indexesToRemove, i)\n\t\t\t\tindexesToRemove = append(indexesToRemove, i+1)\n\t\t\t} else if strings.HasPrefix(arg, f+\"=\") {\n\t\t\t\tindexesToRemove = append(indexesToRemove, i)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, arg := range inputArgsAndFlags {\n\t\tif !u.SliceContainsInt(indexesToRemove, i) {\n\t\t\tadditionalArgsAndFlags = append(additionalArgsAndFlags, arg)\n\t\t}\n\n\t\tif globalOptionsFlagIndex > 0 && i == globalOptionsFlagIndex {\n\t\t\tif strings.HasPrefix(arg, cfg.GlobalOptionsFlag+\"=\") {\n\t\t\t\tparts := strings.SplitN(arg, \"=\", 2)\n\t\t\t\tglobalOptions = strings.Split(parts[1], \" \")\n\t\t\t} else {\n\t\t\t\tglobalOptions = strings.Split(arg, \" \")\n\t\t\t}\n\t\t}\n\t}\n\n\tinfo.GlobalOptions = globalOptions\n\n\tif info.NeedHelp {\n\t\tif len(additionalArgsAndFlags) > 0 {\n\t\t\tinfo.SubCommand = additionalArgsAndFlags[0]\n\t\t}\n\t\treturn info, nil\n\t}\n\n\tif len(additionalArgsAndFlags) > 1 {\n\t\ttwoWordsCommand := false\n\n\t\t// Handle terraform two-words commands\n\t\t// https://developer.hashicorp.com/terraform/cli/commands\n\t\tif componentType == \"terraform\" {\n\n\t\t\t// Handle the custom legacy command `terraform write varfile` (NOTE: use `terraform generate varfile` instead)\n\t\t\tif additionalArgsAndFlags[0] == \"write\" && additionalArgsAndFlags[1] == \"varfile\" {\n\t\t\t\tinfo.SubCommand = \"write\"\n\t\t\t\tinfo.SubCommand2 = \"varfile\"\n\t\t\t\ttwoWordsCommand = true\n\t\t\t}\n\n\t\t\t// `terraform workspace` commands\n\t\t\t// https://developer.hashicorp.com/terraform/cli/commands/workspace\n\t\t\tif additionalArgsAndFlags[0] == \"workspace\" &&\n\t\t\t\tu.SliceContainsString([]string{\"list\", \"select\", \"new\", \"delete\", \"show\"}, additionalArgsAndFlags[1]) {\n\t\t\t\tinfo.SubCommand = \"workspace\"\n\t\t\t\tinfo.SubCommand2 = additionalArgsAndFlags[1]\n\t\t\t\ttwoWordsCommand = true\n\t\t\t}\n\n\t\t\t// `terraform state` commands\n\t\t\t// https://developer.hashicorp.com/terraform/cli/commands/state\n\t\t\tif additionalArgsAndFlags[0] == \"state\" &&\n\t\t\t\tu.SliceContainsString([]string{\"list\", \"mv\", \"pull\", \"push\", \"replace-provider\", \"rm\", \"show\"}, additionalArgsAndFlags[1]) {\n\t\t\t\tinfo.SubCommand = fmt.Sprintf(\"state %s\", additionalArgsAndFlags[1])\n\t\t\t\ttwoWordsCommand = true\n\t\t\t}\n\t\t}\n\n\t\tif twoWordsCommand {\n\t\t\tif len(additionalArgsAndFlags) > 2 {\n\t\t\t\tinfo.ComponentFromArg = additionalArgsAndFlags[2]\n\t\t\t} else {\n\t\t\t\treturn info, fmt.Errorf(\"command \\\"%s\\\" requires an argument\", info.SubCommand)\n\t\t\t}\n\t\t\tif len(additionalArgsAndFlags) > 3 {\n\t\t\t\tinfo.AdditionalArgsAndFlags = additionalArgsAndFlags[3:]\n\t\t\t}\n\t\t} else {\n\t\t\tinfo.SubCommand = additionalArgsAndFlags[0]\n\t\t\tinfo.ComponentFromArg = additionalArgsAndFlags[1]\n\t\t\tif len(additionalArgsAndFlags) > 2 {\n\t\t\t\tinfo.AdditionalArgsAndFlags = additionalArgsAndFlags[2:]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn info, nil\n}", "func recordFlags(flags ...string) {\n\tif myimportpath == \"\" {\n\t\t// We can't record the flags if we don't know what the\n\t\t// package name is.\n\t\treturn\n\t}\n\n\ttype BoolFlag interface {\n\t\tIsBoolFlag() bool\n\t}\n\ttype CountFlag interface {\n\t\tIsCountFlag() bool\n\t}\n\tvar cmd bytes.Buffer\n\tfor _, name := range flags {\n\t\tf := flag.Lookup(name)\n\t\tif f == nil {\n\t\t\tcontinue\n\t\t}\n\t\tgetter := f.Value.(flag.Getter)\n\t\tif getter.String() == f.DefValue {\n\t\t\t// Flag has default value, so omit it.\n\t\t\tcontinue\n\t\t}\n\t\tif bf, ok := f.Value.(BoolFlag); ok && bf.IsBoolFlag() {\n\t\t\tval, ok := getter.Get().(bool)\n\t\t\tif ok && val {\n\t\t\t\tfmt.Fprintf(&cmd, \" -%s\", f.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif cf, ok := f.Value.(CountFlag); ok && cf.IsCountFlag() {\n\t\t\tval, ok := getter.Get().(int)\n\t\t\tif ok && val == 1 {\n\t\t\t\tfmt.Fprintf(&cmd, \" -%s\", f.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tfmt.Fprintf(&cmd, \" -%s=%v\", f.Name, getter.Get())\n\t}\n\n\tif cmd.Len() == 0 {\n\t\treturn\n\t}\n\ts := Ctxt.Lookup(dwarf.CUInfoPrefix + \"producer.\" + myimportpath)\n\ts.Type = objabi.SDWARFINFO\n\t// Sometimes (for example when building tests) we can link\n\t// together two package main archives. So allow dups.\n\ts.Set(obj.AttrDuplicateOK, true)\n\tCtxt.Data = append(Ctxt.Data, s)\n\ts.P = cmd.Bytes()[1:]\n}", "func newFlags(args []string) (flgs flags, err error) {\n\t// create new FlagSet using the program name being executed (args[0])\n\t// as the name of the FlagSet\n\tfs := flag.NewFlagSet(args[0], flag.ContinueOnError)\n\n\tvar (\n\t\tloglvl = fs.String(\"log-level\", \"info\", \"sets log level (debug, warn, error, fatal, panic, disabled), (also via LOG_LEVEL)\")\n\t\tport = fs.Int(\"port\", 8080, \"listen port for server (also via PORT)\")\n\t\tdbhost = fs.String(\"db-host\", \"\", \"postgresql database host (also via DB_HOST)\")\n\t\tdbport = fs.Int(\"db-port\", 5432, \"postgresql database port (also via DB_PORT)\")\n\t\tdbname = fs.String(\"db-name\", \"\", \"postgresql database name (also via DB_NAME)\")\n\t\tdbuser = fs.String(\"db-user\", \"\", \"postgresql database user (also via DB_USER)\")\n\t\tdbpassword = fs.String(\"db-password\", \"\", \"postgresql database password (also via DB_PASSWORD)\")\n\t)\n\n\t// Parse the command line flags from above\n\terr = ff.Parse(fs, args[1:], ff.WithEnvVarNoPrefix())\n\tif err != nil {\n\t\treturn flgs, err\n\t}\n\n\treturn flags{\n\t\tloglvl: *loglvl,\n\t\tport: *port,\n\t\tdbhost: *dbhost,\n\t\tdbport: *dbport,\n\t\tdbname: *dbname,\n\t\tdbuser: *dbuser,\n\t\tdbpassword: *dbpassword,\n\t}, nil\n}", "func (cmd *FindAllLocationsCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tvar game string\n\tcc.Flags().StringVar(&cmd.Game, \"game\", game, ``)\n}", "func (ctx *Ctx) ParseFlags() {\n\tflag.Var(ctx.BugZilla.Origin, \"bugzilla-origin\", \"Bugzilla origin url\")\n\tflag.Var(ctx.BugZilla.EsIndex, \"bugzilla-es-index\", \"Bugzilla es index base name\")\n\tflag.Var(ctx.BugZilla.FromDate, \"bugzilla-from-date\", \"Optional, date to start syncing from\")\n\tflag.Var(ctx.BugZilla.Project, \"bugzilla-project\", \"Slug name of a project e.g. yocto\")\n\tflag.Var(ctx.BugZilla.DoFetch, \"bugzilla-do-fetch\", \"To decide whether will fetch raw data or not\")\n\tflag.Var(ctx.BugZilla.DoEnrich, \"bugzilla-do-enrich\", \"To decide whether will do enrich raw data or not.\")\n\tflag.Var(ctx.BugZilla.FetchSize, \"bugzilla-fetch-size\", \"Total number of fetched items per request.\")\n\tflag.Var(ctx.BugZilla.EnrichSize, \"bugzilla-enrich-size\", \"Total number of enriched items per request.\")\n\tflag.Var(ctx.PiperMail.ProjectSlug, \"bugzilla-slug\", \"Bugzilla project slug\")\n\n\tflag.Var(ctx.PiperMail.Origin, \"pipermail-origin\", \"Pipermail origin url\")\n\tflag.Var(ctx.PiperMail.ProjectSlug, \"pipermail-slug\", \"Pipermail project slug\")\n\tflag.Var(ctx.PiperMail.GroupName, \"pipermail-groupname\", \"Pipermail group name\")\n\tflag.Var(ctx.PiperMail.EsIndex, \"pipermail-es-index\", \"Pipermail es index base name\")\n\tflag.Var(ctx.PiperMail.FromDate, \"pipermail-from-date\", \"Optional, date to start syncing from\")\n\tflag.Var(ctx.PiperMail.Project, \"pipermail-project\", \"Slug name of a project e.g. yocto\")\n\tflag.Var(ctx.PiperMail.DoFetch, \"pipermail-do-fetch\", \"To decide whether will fetch raw data or not\")\n\tflag.Var(ctx.PiperMail.DoEnrich, \"pipermail-do-enrich\", \"To decide whether will do enrich raw data or not.\")\n\tflag.Var(ctx.PiperMail.FetchSize, \"pipermail-fetch-size\", \"Total number of fetched items per request.\")\n\tflag.Var(ctx.PiperMail.EnrichSize, \"pipermail-enrich-size\", \"Total number of enriched items per request.\")\n\n\tflag.Var(ctx.GoogleGroups.ProjectSlug, \"googlegroups-slug\", \"GoogleGroups project slug\")\n\tflag.Var(ctx.GoogleGroups.GroupName, \"googlegroups-groupname\", \"GoogleGroups email address\")\n\tflag.Var(ctx.GoogleGroups.EsIndex, \"googlegroups-es-index\", \"GoogleGroups es index base name\")\n\tflag.Var(ctx.GoogleGroups.FromDate, \"googlegroups-from-date\", \"Optional, date to start syncing from\")\n\tflag.Var(ctx.GoogleGroups.Project, \"googlegroups-project\", \"Slug name of a project e.g. yocto\")\n\tflag.Var(ctx.GoogleGroups.DoFetch, \"googlegroups-do-fetch\", \"To decide whether will fetch raw data or not\")\n\tflag.Var(ctx.GoogleGroups.DoEnrich, \"googlegroups-do-enrich\", \"To decide whether will do enrich raw data or not.\")\n\tflag.Var(ctx.GoogleGroups.FetchSize, \"googlegroups-fetch-size\", \"Total number of fetched items per request.\")\n\tflag.Var(ctx.GoogleGroups.EnrichSize, \"googlegroups-enrich-size\", \"Total number of enriched items per request.\")\n\n\tflag.Parse()\n}", "func printFlags() {\n\tlog.Println(\"rbe_configs_upload.go \\\\\")\n\tlog.Printf(\"--configs_tarball=%q \\\\\", *configsTarball)\n\tlog.Printf(\"--configs_manifest=%q \\\\\", *configsManifest)\n\tlog.Printf(\"--enable_monitoring=%v \\\\\", *enableMonitoring)\n\tlog.Printf(\"--monitoring_project_id=%q \\\\\", *monitoringProjectID)\n\tlog.Printf(\"--monitoring_docker_image=%q\", *monitoringDockerImage)\n}", "func newFlags(args []string) (flgs flags, err error) {\n\t// create new FlagSet using the program name being executed (args[0])\n\t// as the name of the FlagSet\n\tfs := flag.NewFlagSet(args[0], flag.ContinueOnError)\n\n\tvar (\n\t\tlogLvlMin = fs.String(\"log-level-min\", \"trace\", fmt.Sprintf(\"sets minimum log level (trace, debug, info, warn, error, fatal, panic, disabled), (also via %s)\", logLevelMinEnv))\n\t\tloglvl = fs.String(\"log-level\", \"info\", fmt.Sprintf(\"sets log level (trace, debug, info, warn, error, fatal, panic, disabled), (also via %s)\", loglevelEnv))\n\t\tlogErrorStack = fs.Bool(\"log-error-stack\", true, fmt.Sprintf(\"if true, log full error stacktrace, else just log error, (also via %s)\", logErrorStackEnv))\n\t\tport = fs.Int(\"port\", 8080, fmt.Sprintf(\"listen port for server (also via %s)\", portEnv))\n\t\tdbhost = fs.String(\"db-host\", \"\", fmt.Sprintf(\"postgresql database host (also via %s)\", dbHostEnv))\n\t\tdbport = fs.Int(\"db-port\", 5432, fmt.Sprintf(\"postgresql database port (also via %s)\", dbPortEnv))\n\t\tdbname = fs.String(\"db-name\", \"\", fmt.Sprintf(\"postgresql database name (also via %s)\", dbNameEnv))\n\t\tdbuser = fs.String(\"db-user\", \"\", fmt.Sprintf(\"postgresql database user (also via %s)\", dbUserEnv))\n\t\tdbpassword = fs.String(\"db-password\", \"\", fmt.Sprintf(\"postgresql database password (also via %s)\", dbPasswordEnv))\n\t)\n\n\t// Parse the command line flags from above\n\terr = ff.Parse(fs, args[1:], ff.WithEnvVarNoPrefix())\n\tif err != nil {\n\t\treturn flgs, err\n\t}\n\n\treturn flags{\n\t\tloglvl: *loglvl,\n\t\tlogLvlMin: *logLvlMin,\n\t\tlogErrorStack: *logErrorStack,\n\t\tport: *port,\n\t\tdbhost: *dbhost,\n\t\tdbport: *dbport,\n\t\tdbname: *dbname,\n\t\tdbuser: *dbuser,\n\t\tdbpassword: *dbpassword,\n\t}, nil\n}", "func parseFlags() string {\n\tconfigPath := flag.String(\"config\", \"\", \"path to the configuration file\")\n\tflag.Parse()\n\treturn *configPath\n}", "func configureFlags(api *operations.CalculatorAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (l *Loader) RegisterFlags(fs *flag.FlagSet) {\n\tfs.StringVar(&l.ConfigPath, \"qscheduler-config\", \"\", \"Path to qscheduler config file\")\n}", "func (c *coder) addFlags(flags *flag.FlagSet) {\n\tflags.StringVar(&c.registryURL, \"registry\", \"\", \"The Avro schema registry server URL.\")\n\tflags.StringVar(&c.avscFile, \"value-avro-schema\", \"\", `Path to AVSC file to format the file. If it is set, then -valuecodec is set to \"avro\"`)\n\tflags.StringVar(&c.avroRecordName, \"value-avro-record-name\", \"\", \"Record name to use when using TopicRecordNameStrategy to find the schema subject in Schema Registry\")\n\tflags.Int64Var(&c.avroSchemaID, \"value-avro-schema-id\", 0, \"Use it to select schema to produce Avro formatted schemas.\")\n}", "func Load(opts ...Option) {\n\tdefer flagOut()\n\tmtx.Lock()\n\tdefer mtx.Unlock()\n\tif loaded {\n\t\tpanic(fmt.Errorf(\"flags already loaded\"))\n\t}\n\n\tdefineAliases()\n\n\tvar flagfiles []string\n\tvar skipArgs bool\n\tvar ignoreUnknowns bool\n\tshort_usage := ShortUsage\n\tfull_usage := FullUsage\n\tfor _, opt := range opts {\n\t\tif opt.flagfilePath != \"\" {\n\t\t\tflagfiles = append(flagfiles, opt.flagfilePath)\n\t\t}\n\t\tif opt.skipArgs {\n\t\t\tskipArgs = true\n\t\t}\n\t\tif opt.ignoreUnknowns {\n\t\t\tignoreUnknowns = true\n\t\t}\n\t\tif opt.short_usage != nil {\n\t\t\tshort_usage = opt.short_usage\n\t\t}\n\t\tif opt.full_usage != nil {\n\t\t\tfull_usage = opt.full_usage\n\t\t}\n\t}\n\n\tcmdline_set_flags := map[string]bool{}\n\tif !skipArgs {\n\t\tflag.CommandLine.Usage = short_usage\n\t\targs := os.Args[1:]\n\t\tfor _, arg := range args {\n\t\t\tif arg == \"--\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif arg == \"--help-all\" || arg == \"-help-all\" {\n\t\t\t\tfull_usage()\n\t\t\t\tos.Exit(2)\n\t\t\t}\n\t\t}\n\t\tflag.CommandLine.Parse(os.Args[1:])\n\t\tflag.Visit(func(f *flag.Flag) {\n\t\t\tcmdline_set_flags[f.Name] = true\n\t\t\tset_flags[f.Name] = true\n\t\t})\n\t}\n\tloaded = true\n\n\tflagfiles = append(flagfiles, strings.Split(*flagfile, \",\")...)\n\n\tfor len(flagfiles) > 0 {\n\t\tfile := flagfiles[0]\n\t\tflagfiles = flagfiles[1:]\n\t\tif len(file) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfh, err := os.Open(file)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"unable to open flagfile '%s': %s\", file, err))\n\t\t}\n\t\terr = parser.Parse(fh, func(name, value string) {\n\t\t\tif name == \"flagfile\" {\n\t\t\t\t// allow flagfile chaining\n\t\t\t\tflagfiles = append(flagfiles, value)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// command line flags override file flags\n\t\t\tif cmdline_set_flags[name] {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif ignoreUnknowns && flag.Lookup(name) == nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\terr := trySet(name, value)\n\n\t\t\tif err != nil {\n\t\t\t\tset_flags[name] = true\n\t\t\t}\n\t\t})\n\t\tfh.Close()\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"'%s': %s\", file, err))\n\t\t}\n\t}\n\n\tsetAliases()\n}", "func initFlags() {\n\tflag.Var(&logLevel, \"log\", \"set the `level` of logging.\")\n\tflag.TextVar(&logEnv, \"log-env\", log.DefaultEnv, \"set logging `env`.\")\n\tflag.TextVar(&formatType, \"format\", signalio.WriterTypeText, \"set the output format. Choices are text, json or csv.\")\n\toutfile.DefineFlags(flag.CommandLine, \"out\", \"force\", \"append\", \"OUTFILE\")\n\tflag.Usage = func() {\n\t\tcmdName := path.Base(os.Args[0])\n\t\tw := flag.CommandLine.Output()\n\t\tfmt.Fprintf(w, \"Usage:\\n %s [FLAGS]... {FILE|REPO...}\\n\\n\", cmdName)\n\t\tfmt.Fprintf(w, \"Collects signals for a list of project repository urls.\\n\\n\")\n\t\tfmt.Fprintf(w, \"FILE must be either a file or - to read from stdin. If FILE does not\\n\")\n\t\tfmt.Fprintf(w, \"exist it will be treated as a REPO.\\n\")\n\t\tfmt.Fprintf(w, \"Each REPO must be a project repository url.\\n\")\n\t\tfmt.Fprintf(w, \"\\nFlags:\\n\")\n\t\tflag.PrintDefaults()\n\t}\n\tflag.Parse()\n\n\t// Handle the version flag immediately. It's similar to -help.\n\tif *versionFlag {\n\t\tprintVersion()\n\t\tos.Exit(0)\n\t}\n}", "func ReadFlags() (*string, *string, *string, *string, *string) {\n\tvar input, output, mode, key, length *string\n\n\tflag.String(\"i\", \"\", \"If using file mode, the input file to read.\")\n\tflag.String(\"o\", \"\", \"If using file mode, the output file to create.\")\n\t// This flag does nothing in the original program.\n\tflag.String(\"m\", \"\", \"The encryption mode (unused, for compatibility).\")\n\tflag.String(\"k\", \"\", \"The encryption key.\")\n\t// This flag does nothing in the original program but causes the program to exit prematurely if set.\n\t// It does set the len-> portion of the flag readout if supplied.\n\tflag.String(\"l\", \"\", \"The encryption key length (unused, for compatibility).\")\n\n\t// We're doing this wacky visitor bit here to ensure we have nil values for unset flags, which\n\t// allows us to detect unset flags and display (null) in the output.\n\tvisitor := func(a *flag.Flag) {\n\t\tswitch a.Name {\n\t\t\tcase \"i\":\n\t\t\t\ttemp := a.Value.String()\n\t\t\t\tinput = &temp\n\t\t\t\tbreak\n\t\t\tcase \"o\":\n\t\t\t\ttemp := a.Value.String()\n\t\t\t\toutput = &temp\n\t\t\t\tbreak\n\t\t\tcase \"m\":\n\t\t\t\ttemp := a.Value.String()\n\t\t\t\tmode = &temp\n\t\t\t\tbreak\n\t\t\tcase \"k\":\n\t\t\t\ttemp := a.Value.String()\n\t\t\t\tkey = &temp\n\t\t\t\tbreak\n\t\t\tcase \"l\":\n\t\t\t\ttemp := a.Value.String()\n\t\t\t\tlength = &temp\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tflag.Parse()\n\tflag.Visit(visitor)\n\n\treturn input, output, mode, key, length\n}", "func (h *Header) parseFlag(flag uint16) {\n\th.Response = flag&(1<<15) > 0\n\n\topCodeValue := flag & (0b1111 << 11) >> 11 // get just the four at elenth position\n\th.OpCode = OpCode(opCodeValue)\n\n\th.AuthoritativeAnswer = flag&(1<<10) > 0\n\th.Truncation = flag&(1<<9) > 0\n\th.RecursionDesired = flag&(1<<8) > 0\n\th.RecursionAvailable = flag&(1<<7) > 0\n\n\tresponseCodeValue := flag & (0b1111) // get just the four\n\th.ResponseCode = ResponseCode(responseCodeValue)\n\n}", "func (gunzip *SomeGunzip) ParseFlags(call []string, errPipe io.Writer) (error, int) {\n\tflagSet := uggo.NewFlagSetDefault(\"gunzip\", \"[options] file.gz [list...]\", someutils.VERSION)\n\tflagSet.SetOutput(errPipe)\n\tflagSet.AliasedBoolVar(&gunzip.IsTest, []string{\"t\", \"test\"}, false, \"test archive data\")\n\tflagSet.AliasedBoolVar(&gunzip.IsKeep, []string{\"k\", \"keep\"}, false, \"keep gzip file\")\n\tflagSet.AliasedBoolVar(&gunzip.IsPipeOut, []string{\"c\", \"stdout\", \"is-stdout\"}, false, \"output will go to the standard output\")\n\n\terr, code := flagSet.ParsePlus(call[1:])\n\tif err != nil {\n\t\treturn err, code\n\t}\n\targs := flagSet.Args()\n\t//TODO STDIN support\n\tif len(args) > 0 {\n\t\t//OK\n\t} else if uggo.IsPipingStdin() {\n\t\t//OK\n\t} else {\n\t\treturn errors.New(\"No gzip filename given\"), 1\n\t}\n\tgunzip.Filenames = args\n\treturn nil, 0\n}", "func (m *Main) ParseFlags(ctx context.Context, args []string) error {\n\t// Our flag set is very simple. It only includes a config path.\n\tfs := flag.NewFlagSet(\"booking\", flag.ContinueOnError)\n\tfs.StringVar(&m.ConfigPath, \"config\", DefaultConfigPath, \"config path\")\n\tif err := fs.Parse(args); err != nil {\n\t\treturn err\n\t}\n\n\t// The expand() function is here to automatically expand \"~\" to the user's\n\t// home directory. This is a common task as configuration files are typing\n\t// under the home directory during local development.\n\tconfigPath, err := expand(m.ConfigPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Read our TOML formatted configuration file.\n\tconfig, err := ReadConfigFile(configPath)\n\tif os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"config file not found: %s\", m.ConfigPath)\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tm.Config = config\n\n\treturn nil\n}", "func (p *Parser) FlagNames() map[string]int { return p.names }", "func processCommandLineFlags() {\n\tgetopt.HelpColumn = 35\n\tgetopt.DisplayWidth = 120\n\tgetopt.SetParameters(\"\")\n\tgetopt.Parse()\n\n\t// Lets check to see if the version command line flag was given. If it is\n\t// lets print out the version infomration and exit.\n\tif *bOptVer {\n\t\tprintOutputHeader()\n\t\tos.Exit(0)\n\t}\n\n\t// Lets check to see if the help command line flag was given. If it is lets\n\t// print out the help information and exit.\n\tif *bOptHelp {\n\t\tprintOutputHeader()\n\t\tgetopt.Usage()\n\t\tos.Exit(0)\n\t}\n}", "func (sdr SDR) HandleFlags() (err error) {\n\t// Catch any errors panicked while visiting flags.\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = r.(error)\n\t\t}\n\t}()\n\n\tflag.CommandLine.Visit(func(f *flag.Flag) {\n\t\tvar err error\n\t\tswitch f.Name {\n\t\tcase \"centerfreq\":\n\t\t\terr = sdr.SetCenterFreq(uint32(sdr.Flags.CenterFreq))\n\t\tcase \"samplerate\":\n\t\t\terr = sdr.SetSampleRate(uint32(sdr.Flags.SampleRate))\n\t\tcase \"tunergainmode\":\n\t\t\terr = sdr.SetGainMode(sdr.Flags.TunerGainMode)\n\t\tcase \"tunergain\":\n\t\t\terr = sdr.SetGain(uint32(sdr.Flags.TunerGain * 10.0))\n\t\tcase \"freqcorrection\":\n\t\t\terr = sdr.SetFreqCorrection(uint32(sdr.Flags.FreqCorrection))\n\t\tcase \"testmode\":\n\t\t\terr = sdr.SetTestMode(sdr.Flags.TestMode)\n\t\tcase \"agcmode\":\n\t\t\terr = sdr.SetAGCMode(sdr.Flags.AgcMode)\n\t\tcase \"directsampling\":\n\t\t\terr = sdr.SetDirectSampling(sdr.Flags.DirectSampling)\n\t\tcase \"offsettuning\":\n\t\t\terr = sdr.SetOffsetTuning(sdr.Flags.OffsetTuning)\n\t\tcase \"rtlxtalfreq\":\n\t\t\terr = sdr.SetRTLXtalFreq(uint32(sdr.Flags.RtlXtalFreq))\n\t\tcase \"tunerxtalfreq\":\n\t\t\terr = sdr.SetTunerXtalFreq(uint32(sdr.Flags.TunerXtalFreq))\n\t\tcase \"gainbyindex\":\n\t\t\terr = sdr.SetGainByIndex(uint32(sdr.Flags.GainByIndex))\n\t\t}\n\n\t\t// If we encounter an error, panic to catch in parent scope.\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t})\n\n\treturn\n}", "func InitByFlags() {\n\tif !flag.Parsed() {\n\t\tflag.Parse()\n\t}\n\talp := _flags.parse()\n\tif len(alp) == 0 {\n\t\treturn\n\t}\n\tpreset.Reset()\n\tfor _, p := range alp {\n\t\tpreset.AddPrinter(p.l, p.p)\n\t}\n}", "func parseFlags9TVSystem(flags byte) TVSystem {\n\treturn TVSystem(uint8(flags) & 0x01)\n}", "func parseFlags() {\n\tconfigPtr := flag.String(\"c\", \"\", \"Use config file.\")\n\tverPtr := flag.Bool(\"v\", false, \"Output version and exit.\")\n\thelpPtr := flag.Bool(\"h\", false, \"Output this help and exit.\")\n\tflag.Parse()\n\tif *configPtr == \"\" {\n\t\tselfDir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\t\tif err != nil {\n\t\t\tos.Exit(0)\n\t\t}\n\t\tConfigFile = selfDir + string(os.PathSeparator) + `aurora.toml`\n\t} else {\n\t\tConfigFile = *configPtr\n\t}\n\tif *verPtr {\n\t\tfmt.Printf(\"aurora version: %.1f\\r\\n\", Version)\n\t\tos.Exit(0)\n\t}\n\tif *helpPtr {\n\t\tfmt.Printf(\"aurora version: %.1f\\r\\nCopyright (c) 2016 - 2018 Ri Xu https://xuri.me All rights reserved.\\r\\n\\r\\nUsage: aurora [OPTIONS] [cmd [arg ...]]\\n -c <filename> Use config file. (default: aurora.toml)\\r\\n -h \\t\\t Output this help and exit.\\r\\n -v \\t\\t Output version and exit.\\r\\n\", Version)\n\t\tos.Exit(0)\n\t}\n}", "func GlobalFlags() []cli.Flag {\n\treturn []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"username\",\n\t\t\tUsage: \"The username with which to authenticate.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"apikey\",\n\t\t\tUsage: \"The API key with which to authenticate.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"authurl\",\n\t\t\tUsage: \"The endpoint to which authenticate.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"region\",\n\t\t\tUsage: \"The region to which authenticate.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"profile\",\n\t\t\tUsage: \"The config file profile to use for authentication.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"output\",\n\t\t\tUsage: \"Format in which to return output. Options: json, csv, table. Default is 'table'.\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"no-cache\",\n\t\t\tUsage: \"Don't get or set authentication credentials in the rack cache.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"log\",\n\t\t\tUsage: \"Print debug information from the command. Options are: debug, info\",\n\t\t},\n\t}\n}", "func (f *Flags) Parse() {\n\tf.parseApi()\n\tf.parseAuth()\n\tf.parseConsole()\n}", "func flagsForQuery(fs ...cli.Flag) []cli.Flag {\n\tresult := []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"sql\",\n\t\t\tUsage: \"sql text. use prefix @ from file. @/path/file.sql\",\n\t\t},\n\t\tcli.StringSliceFlag{\n\t\t\tName: \"param\",\n\t\t\tUsage: \"set params for query\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"format\",\n\t\t\tUsage: `Format output. Syntax: value[:options]\n\tvalue: raw(default) | table | xml | json. \n\tOptions: \n\t\twhen raw:\n\t\t\tUse template for each line: {ALIAS}{COLNUM}{ROW}{LINE}{COLUMN}{VALUE} \t\t\t\t\n\t\twhen table: \n\t\t\theader=true|y|false|n,border=thin|double|simple|none|false|n;\n\t\t\tcolumnN:name=string,width=auto|N,align=left|right,visible=y|n,caption=string;\n\t\t\t\twhere N(1,...)\n\t\t\t\n\t\t\tsample: \n\t\t\t\t--format=table:border=simple;column1:name=ID,visible=n;column2:name=FIELD1,caption=SAMPLE\n\t\twhen xml:\n\t\t\tfile=output_file\n\t\twhen json:\n\t\t\tfile=output_file\n\n`,\n\t\t\tValue: \"raw\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"immediate\",\n\t\t\tUsage: \"Whenever possible, output data directly (raw)\",\n\t\t},\n\t\tcli.IntFlag{\n\t\t\tName: \"timeout\",\n\t\t\tUsage: \"Timeout operation. Default 0\",\n\t\t\tValue: 0,\n\t\t},\n\t}\n\tresult = append(result, fs[:]...)\n\treturn result\n}", "func registerModelAirfiberFlags(depth int, cmdPrefix string, cmd *cobra.Command) error {\n\n\tif err := registerAirfiberFrameLength(depth, cmdPrefix, cmd); err != nil {\n\t\treturn err\n\t}\n\n\tif err := registerAirfiberMode(depth, cmdPrefix, cmd); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Configuration) ParseFlags(args []string) {\n\tflag.CommandLine.Parse(args)\n}", "func (p RProc) Flags() uint32 { return uint32(C._mrb_rproc_flags(p.p)) }", "func (v *VersionCommand) addFlags() {\n\t// TODO: add flags here\n}", "func ParseFlags(cmd string) (Flags, error) {\n\tgroups := clusterNameFlagRegex.FindAllStringSubmatch(cmd, -1)\n\tcmd, clusterName := extractParam(cmd, groups)\n\n\tcmd, filter, err := extractFilterParam(cmd)\n\tif err != nil {\n\t\treturn Flags{}, err\n\t}\n\ttokenized, err := shellwords.Parse(cmd)\n\tif err != nil {\n\t\treturn Flags{}, errors.New(cantParseCmd)\n\t}\n\treturn Flags{\n\t\tCleanCmd: cmd,\n\t\tFilter: filter,\n\t\tClusterName: clusterName,\n\t\tTokenizedCmd: tokenized,\n\t}, nil\n}", "func (c *cmdCreate) AddFlags(fs *flag.FlagSet) {\n\tfs.StringVar(&(c.fileName), \"f\", \"\", \"gateway app file\")\n\tfs.StringVar(&(c.pingport), \"pingport\", \"\", \"ping port\")\n}", "func (cmd *AddFirmwareCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tcc.Flags().StringVar(&cmd.Payload, \"payload\", \"\", \"Request body encoded in JSON\")\n\tcc.Flags().StringVar(&cmd.ContentType, \"content\", \"\", \"Request content type override, e.g. 'application/x-www-form-urlencoded'\")\n}", "func GlobalFlags() []cli.Flag {\n\treturn []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-address,vault-addr\",\n\t\t\tValue: \"http://127.0.0.1:8200\",\n\t\t\tEnvVar: \"VAULT_ADDR\",\n\t\t\tUsage: \"the address of the Vault server\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-token,token\",\n\t\t\tValue: \"\",\n\t\t\tEnvVar: \"VAULT_TOKEN\",\n\t\t\tUsage: \"Vault authentication token\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-auth-method,vault-method,method\",\n\t\t\tUsage: \"type of authentication\",\n\t\t\tValue: \"token\",\n\t\t\tEnvVar: \"VAULT_AUTH_METHOD\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-auth-path,vault-path,path\",\n\t\t\tUsage: \"remote path in Vault where the chosen auth method is mounted\",\n\t\t\tValue: \"\",\n\t\t\tEnvVar: \"VAULT_AUTH_PATH\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-username\",\n\t\t\tUsage: \"Vault username or RoleID\",\n\t\t\tValue: \"\",\n\t\t\tEnvVar: \"VAULT_USERNAME\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-password\",\n\t\t\tUsage: \"Vault password or SecretID\",\n\t\t\tValue: \"\",\n\t\t\tEnvVar: \"VAULT_PASSWORD\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-ssh-mount,mount\",\n\t\t\tUsage: \"Vault SSH signer mount point\",\n\t\t\tEnvVar: \"VAULT_SSH_MOUNT\",\n\t\t\tValue: \"ssh-client-signer\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vault-ssh-role,role\",\n\t\t\tUsage: \"Vault signing role\",\n\t\t\tEnvVar: \"VAULT_SSH_ROLE\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"http-proxy,httpproxy\",\n\t\t\tUsage: \"specify a URL to connect through a HTTP proxy\",\n\t\t\tValue: \"\",\n\t\t\tEnvVar: \"SSH_HTTP_PROXY\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"login,l\",\n\t\t\tUsage: \"SSH remote user\",\n\t\t\tEnvVar: \"SSH_USER\",\n\t\t},\n\t\tcli.IntFlag{\n\t\t\tName: \"ssh-port,sshport,P\",\n\t\t\tUsage: \"SSH remote port\",\n\t\t\tEnvVar: \"SSH_PORT\",\n\t\t\tValue: 22,\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"privkey,private,identity,i\",\n\t\t\tUsage: \"filesystem path to SSH private key\",\n\t\t\tEnvVar: \"IDENTITY\",\n\t\t\tValue: \"\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"vprivkey,vprivate,videntity\",\n\t\t\tUsage: \"Vault secret path to SSH private key\",\n\t\t\tEnvVar: \"VIDENTITY\",\n\t\t\tValue: \"\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"insecure\",\n\t\t\tUsage: \"do not check the remote SSH host key\",\n\t\t\tEnvVar: \"SSH_INSECURE\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"password\",\n\t\t\tUsage: \"enable SSH password authentication\",\n\t\t\tEnvVar: \"VSSH_SSH_PASSWORD\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"agent\",\n\t\t\tUsage: \"enable SSH agent authentication\",\n\t\t\tEnvVar: \"VSSH_SSH_AGENT\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"loglevel\",\n\t\t\tUsage: \"logging level\",\n\t\t\tValue: \"info\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"pager\",\n\t\t\tUsage: \"use external pager\",\n\t\t\tEnvVar: \"VSSH_EXTERNAL_PAGER\",\n\t\t},\n\t}\n}", "func ConfigFlagsProcess() (err error) {\n\n\t// Read if not yet read\n\tif Config.When == \"\" {\n\t\terr = ConfigRead()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Reset if requested\n\tif flagConfigReset {\n\t\tConfigReset()\n\t}\n\n\t// Set the flags as desired\n\tif flagConfigHTTP {\n\t\tConfig.Secure = false\n\t}\n\tif flagConfigHTTPS {\n\t\tConfig.Secure = true\n\t}\n\tif flagConfig.Hub == \"-\" {\n\t\tConfig.Hub = notehub.DefaultAPIService\n\t} else if flagConfig.Hub != \"\" {\n\t\tConfig.Hub = flagConfig.Hub\n\t}\n\tif flagConfig.Root == \"-\" {\n\t\tConfig.Root = \"\"\n\t} else if flagConfig.Root != \"\" {\n\t\tConfig.Root = flagConfig.Root\n\t}\n\tif flagConfig.Key == \"-\" {\n\t\tConfig.Key = \"\"\n\t} else if flagConfig.Key != \"\" {\n\t\tConfig.Key = flagConfig.Key\n\t}\n\tif flagConfig.Cert == \"-\" {\n\t\tConfig.Cert = \"\"\n\t} else if flagConfig.Cert != \"\" {\n\t\tConfig.Cert = flagConfig.Cert\n\t}\n\tif flagConfig.App == \"-\" {\n\t\tConfig.App = \"\"\n\t} else if flagConfig.App != \"\" {\n\t\tConfig.App = flagConfig.App\n\t}\n\tif flagConfig.Device == \"-\" {\n\t\tConfig.Device = \"\"\n\t} else if flagConfig.Device != \"\" {\n\t\tConfig.Device = flagConfig.Device\n\t}\n\tif flagConfig.Product == \"-\" {\n\t\tConfig.Product = \"\"\n\t} else if flagConfig.Product != \"\" {\n\t\tConfig.Product = flagConfig.Product\n\t}\n\tif flagConfig.Interface == \"-\" {\n\t\tconfigResetInterface()\n\t} else if flagConfig.Interface != \"\" {\n\t\tConfig.Interface = flagConfig.Interface\n\t}\n\tif flagConfig.Port != \"\" {\n\t\tConfig.Port = flagConfig.Port\n\t}\n\tif flagConfig.PortConfig != -1 {\n\t\tConfig.PortConfig = flagConfig.PortConfig\n\t}\n\n\t// Save if requested\n\tif flagConfigSave {\n\t\tConfigWrite()\n\t\tConfigShow()\n\t}\n\n\t// Override, just for this session, with env vars\n\tstr := os.Getenv(\"NOTE_INTERFACE\")\n\tif str != \"\" {\n\t\tConfig.Interface = str\n\t}\n\tstr = os.Getenv(\"NOTE_PORT\")\n\tif str != \"\" {\n\t\tConfig.Port = str\n\t\tstr := os.Getenv(\"NOTE_PORT_CONFIG\")\n\t\tstrint, err2 := strconv.Atoi(str)\n\t\tif err2 != nil {\n\t\t\tstrint = Config.PortConfig\n\t\t}\n\t\tConfig.PortConfig = strint\n\t}\n\n\t// Done\n\treturn nil\n\n}", "func PopulateFlags(jump *cli.App) {\n jump.Flags = []cli.Flag {\n cli.BoolFlag{\n Name: \"all\",\n Usage: \"function on all the checkpoints\",\n Destination: &flags.All,\n },\n cli.BoolFlag{\n Name: \"raw\",\n Usage: \"no cleaning of the name takes place\",\n Destination: &flags.Raw,\n },\n }\n}", "func FlagsForModule(name string) string {\n\tonce.Do(cmdLineOpener)\n\tvar ret string\n\tflagsAdded := make(map[string]bool) // Ensures duplicate flags aren't both added\n\t// Module flags come as moduleName.flag in /proc/cmdline\n\tprefix := strings.Replace(name, \"-\", \"_\", -1) + \".\"\n\tfor flag, val := range procCmdLine.AsMap {\n\t\tcanonicalFlag := strings.Replace(flag, \"-\", \"_\", -1)\n\t\tif !flagsAdded[canonicalFlag] && strings.HasPrefix(canonicalFlag, prefix) {\n\t\t\tflagsAdded[canonicalFlag] = true\n\t\t\t// They are passed to insmod space seperated as flag=val\n\t\t\tret += strings.TrimPrefix(canonicalFlag, prefix) + \"=\" + val + \" \"\n\t\t}\n\t}\n\treturn ret\n}", "func GlobalFlags() []cli.Flag {\n\treturn []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"username\",\n\t\t\tUsage: \"The username with which to authenticate.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"api-key\",\n\t\t\tUsage: \"The API key with which to authenticate.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"auth-tenant-id\",\n\t\t\tUsage: \"The tenant ID of the user to authenticate as. May only be provided as a command-line flag.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"auth-token\",\n\t\t\tUsage: \"The authentication token of the user to authenticate as. This must be used with the `auth-tenant-id` flag.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"auth-url\",\n\t\t\tUsage: \"The endpoint to which authenticate.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"region\",\n\t\t\tUsage: \"The region to which authenticate.\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"use-service-net\",\n\t\t\tUsage: \"Whether or not to use the internal Rackspace network\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"profile\",\n\t\t\tUsage: \"The config file profile to use for authentication.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"output\",\n\t\t\tUsage: \"Format in which to return output. Options: json, csv, table. Default is 'table'.\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"no-cache\",\n\t\t\tUsage: \"Don't get or set authentication credentials in the rack cache.\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"log\",\n\t\t\tUsage: \"Print debug information from the command. Options are: debug, info\",\n\t\t},\n\t\tcli.BoolFlag{\n\t\t\tName: \"no-header\",\n\t\t\tUsage: \"Don't return a header for CSV nor tabular output.\",\n\t\t},\n\t}\n}", "func (c *Config) RegisterFlags(fs *flag.FlagSet) {\n\t_ = fs.String(\"config\", \"\", \"config path (YAML format)\")\n\tfs.StringVar(&c.LogHandler, \"o\", \"\", \"[\"+logging.GetLogOutputs()+\"]\")\n\tfs.StringVar(&c.LogLevel, \"v\", \"error\", \"[\"+logging.GetLogLevels()+\"]\")\n\n\tif err := ff.Parse(fs, os.Args[1:],\n\t\tff.WithIgnoreUndefined(true),\n\t\tff.WithConfigFileFlag(\"config\"),\n\t\tff.WithConfigFileParser(ffyaml.Parser),\n\t\tff.WithEnvVarNoPrefix(),\n\t); err != nil {\n\t\tlog.WithError(err).Fatal(\"Unable to parse flags\")\n\t}\n}", "func Parse(config interface{}) { Define(config); flag.Parse() }", "func (c *DashboardLsCmd) RegisterFlags(fs *flag.FlagSet) {\n\tfs.StringVar(&c.Conf.UID, \"uid\", \"\", \"dashboard UID\")\n}", "func parseFlag() (*common.Config, error) {\n\tvar (\n\t\tlistenAddress *string\n\t\tmetricsPath *string\n\t\tnamespace *string\n\t\tversion *bool\n\t\tnginxUrls common.ArrFlags\n\t\tnginxPlusUrls common.ArrFlags\n\t)\n\n\tlistenAddress = flag.String(\"listen-address\", \":9001\", \"Address on which to expose metrics and web interface.\")\n\tmetricsPath = flag.String(\"metrics-path\", \"/metrics\", \"Path under which to expose metrics.\")\n\tnamespace = flag.String(\"namespace\", \"nginx\", \"The namespace of metrics.\")\n\tversion = flag.Bool(\"version\", false, \"The version of the exporter.\")\n\tflag.Var(&nginxUrls, \"nginx-stats-urls\", \"An array of Nginx status URLs to gather stats.\")\n\tflag.Var(&nginxPlusUrls, \"nginx-plus-stats-urls\", \"An array of Nginx Plus status URLs to gather stats.\")\n\n\tflag.Parse()\n\n\tif *version {\n\t\tfmt.Println(gitSummary)\n\t\tos.Exit(0)\n\t}\n\n\tif len(nginxUrls) == 0 && len(nginxPlusUrls) == 0 {\n\t\treturn nil, errors.New(\"no nginx or nginx plus stats url specified\")\n\t}\n\n\treturn common.NewConfig(*listenAddress, *metricsPath, *namespace, nginxUrls, nginxPlusUrls), nil\n}" ]
[ "0.659178", "0.6363545", "0.62750816", "0.6218536", "0.6185532", "0.6127482", "0.60785955", "0.60771954", "0.60717064", "0.6037068", "0.6019118", "0.60160184", "0.58816683", "0.5851896", "0.5839975", "0.5817036", "0.58019245", "0.5801116", "0.5773476", "0.5770226", "0.5734663", "0.573452", "0.5722366", "0.5704203", "0.5679307", "0.5676419", "0.56725323", "0.5658934", "0.5658168", "0.560548", "0.559764", "0.5583079", "0.5581466", "0.5577451", "0.5573952", "0.5565436", "0.5549657", "0.5534842", "0.5514061", "0.55114895", "0.54989624", "0.5498362", "0.54956937", "0.5475706", "0.5471996", "0.5464371", "0.5461618", "0.5459649", "0.54450285", "0.5442272", "0.54414165", "0.5438946", "0.5418399", "0.5391532", "0.53716385", "0.5368185", "0.5365487", "0.5360539", "0.5356321", "0.53441393", "0.5331513", "0.53304446", "0.5323218", "0.53197545", "0.53146714", "0.53128135", "0.5305644", "0.5296238", "0.52900773", "0.52812093", "0.52717966", "0.5263385", "0.52576834", "0.52529866", "0.5227687", "0.52220047", "0.5220758", "0.5219924", "0.52116823", "0.5203016", "0.51994735", "0.5192171", "0.51884514", "0.51849663", "0.51731825", "0.51709384", "0.516892", "0.5167984", "0.516165", "0.51588434", "0.5157589", "0.5155259", "0.5151371", "0.5147438", "0.5145549", "0.5139724", "0.5120702", "0.5116614", "0.51122475", "0.5106609", "0.50978845" ]
0.0
-1
Args returns the program argumets without the program name and flags
func (c *Config) Args() []string { if c.Ops == 0 { return os.Args[1:] } return os.Args[2:] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Args() []string\t{ return os.Args[flags.first_arg:len(os.Args)] }", "func Args() []string { return CommandLine.args }", "func main() {\n\t// os.Args provides access to raw command-line arguments. Note that the first value in this\n\t// slice is the path to the program, and os.Args[1:] holds the arguments to the program.\n\targsWithProg := os.Args\n\targsWithoutProg := os.Args[1:]\n\n\t// You can get individual args with normal indexing.\n\targ := os.Args[3]\n\n\tfmt.Println(argsWithProg)\n\tfmt.Println(argsWithoutProg)\n\tfmt.Println(arg)\n}", "func main() {\n\n argsWithProg := os.Args\n argsWithoutProg := os.Args[1:]\n\n arg := os.Args[3]\n\n fmt.Println(argsWithProg)\n fmt.Println(argsWithoutProg)\n fmt.Println(arg)\n}", "func (cli *CLI) Args() []string {\n\tif len(cli.Exec) > 1 {\n\t\treturn cli.Exec[1:]\n\t}\n\treturn []string{}\n}", "func (f *FlagSet) Args() []string { return f.args }", "func GetArgv() {\n var fd uint64;\n var errno uint64; \n var singleChar byte;\n var lastChar byte = 1; // needs to be != 0 at start\n\n fd = FileOpen(\"/proc/self/cmdline\", 0); //Open file that contains the program's arguments\n if fd == 0 { //Error check (the system may have been compiled with proc fs disabled)\n ExitError(\"Error opening /proc/self/cmdline. Currently GoGo is only supported on systems with /proc enabled.\", 1);\n } \n\n for singleChar = GetChar(fd);(singleChar != 0) || (lastChar != 0); singleChar = GetChar(fd) {\n if (singleChar == 0) {\n Argc = Argc +1;\n } else {\n CharAppend(&Argv[Argc], singleChar);\n }\n lastChar = singleChar;\n }\n\n errno = FileClose(fd);\n if errno != 0 {\n ExitError(\"Error closing file /proc/self/cmdline\",1);\n }\n}", "func main() {\n\tfmt.Println(strings.Join(os.Args, \" \"))\n}", "func GetArgs() *Args {\n\tappname = constant.APPNAME\n\tappversion = constant.APPVERSION\n\n\targs := &Args{}\n\tflag.BoolVar(&args.Help, \"h\", false, \"show help information\")\n\tflag.StringVar(&args.ConfigFile, \"c\", \"./queueman.json\", \"the configure file path\")\n\tflag.BoolVar(&args.Test, \"t\", false, `test configure in \"queueman.json\" file`)\n\tflag.BoolVar(&args.Stats, \"s\", false, \"show statistics information\")\n\tflag.Usage = printUsage\n\tflag.Parse()\n\n\tif args.Help {\n\t\tprintUsage()\n\t\treturn nil\n\t}\n\n\tif args.Test {\n\t\tprintTest(args, true)\n\t\treturn nil\n\t}\n\n\tprintTest(args, false)\n\n\t// when configure file is right\n\tif args.Stats {\n\t\tinfo := GetStats(args, \"\")\n\t\tfmt.Println(info)\n\t\tos.Exit(0)\n\t\treturn nil\n\t}\n\n\treturn args\n}", "func (a *ApplyImpl) Args() string {\n\targs := a.ApplyOptions.Args\n\tenableHelmDebug := a.GlobalImpl.Debug\n\n\tif enableHelmDebug {\n\t\targs = fmt.Sprintf(\"%s %s\", args, \"--debug\")\n\t}\n\n\treturn args\n}", "func getArguments() {\n\t// define pointers to the arguments which will be filled up when flag.Parse() is called\n\tlangFlag := flag.String(\"l\", string(auto), \"Which language to use. Args are: lua | wren | moon | auto\")\n\tdirFlag := flag.String(\"d\", \".\", \"The directory containing the main file and the subfiles\")\n\toutFlag := flag.String(\"o\", \"out\", \"The output file (sans extension)\")\n\twatchFlag := flag.Bool(\"w\", false, \"Whether to enable Watch mode, which automatically recompiles if a file has changed in the directory\")\n\tdefinesFlag := flag.String(\"D\", \"\", \"Used to pass in defines before compiling. Format is -D \\\"var1=value;var2=value;var3=value\\\"\")\n\n\t// begin parsing the flags\n\tflag.Parse()\n\n\t// these setup functions have to be performed in this particular order\n\t// because they depend on certain fields of Args to be set when they are called\n\t_setDir(*dirFlag)\n\t_setLanguage(*langFlag)\n\t_setOutputFile(*outFlag)\n\t_setDefines(*definesFlag)\n\n\tArgs.watchMode = *watchFlag\n\n\t// this gives all the non-flag command line args\n\tArgs.positional = flag.Args()\n}", "func (o MrScalarApplicationOutput) Args() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v MrScalarApplication) []string { return v.Args }).(pulumi.StringArrayOutput)\n}", "func (launcher *Launcher) GetArgs() []string {\n\tlauncher.Mutex.RLock()\n\targs := launcher.args\n\tlauncher.Mutex.RUnlock()\n\treturn args\n}", "func (p *Parser) RawArgs() []string { return p.fSet.Args() }", "func (p *Process) Args() []string {\n\targs := make([]string, len(p.Builder.Args))\n\tcopy(args, p.Builder.Args)\n\treturn args\n}", "func main() {\n\n\tvar argValues string //defining an argValues\n\tif len(os.Args) > 1 { //checking the argument values for ex: go run hello.go hello bhuppal kumar\n\t\targValues = strings.Join(os.Args[1:], \" \")\n\t}\n\tfmt.Println(argValues)\n}", "func GetCliArguments() (string, int, error) {\n\n\tvar rawurl string\n\tvar workers int\n\tflag.StringVar(&rawurl, \"url\", \"\", \"The URL to crawl\")\n\tflag.IntVar(&workers, \"workers\", 4, \"Number of goroutines to spawn concurrently\")\n\tflag.Parse()\n\n\tif workers < 1 || workers > 10 {\n\t\treturn \"\", -1, errors.New(\"workers must be less than 10 and greater than 0\")\n\t}\n\tcurrentURL, err := url.ParseRequestURI(NormalizeURL(rawurl))\n\tif err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\treturn currentURL.String(), workers, nil\n}", "func ParseArgs(cfg any, args []string, allArgs map[string]reflect.Value, errNotFound bool) ([]string, error) {\n\tvar nonFlags []string\n\tvar err error\n\tfor len(args) > 0 {\n\t\ts := args[0]\n\t\targs = args[1:]\n\t\tif len(s) == 0 || s[0] != '-' || len(s) == 1 {\n\t\t\tnonFlags = append(nonFlags, s)\n\t\t\tcontinue\n\t\t}\n\n\t\tif s[1] == '-' && len(s) == 2 { // \"--\" terminates the flags\n\t\t\t// f.argsLenAtDash = len(f.args)\n\t\t\tnonFlags = append(nonFlags, args...)\n\t\t\tbreak\n\t\t}\n\t\targs, err = ParseArg(s, args, allArgs, errNotFound)\n\t\tif err != nil {\n\t\t\treturn nonFlags, err\n\t\t}\n\t}\n\treturn nonFlags, nil\n}", "func (b *Benchmark) Args() []string {\n\targs := []string{b.executable}\n\n\t// Always set the output formatting to JSON for stdout, so that we can\n\t// parse and return the JSON-based Result instance.\n\targs = append(args, \"--benchmark_format=json\")\n\n\tif b.filter != \"\" {\n\t\targs = append(args, \"--benchmark_filter=\"+b.filter)\n\t}\n\n\tif b.outFile != \"\" {\n\t\targs = append(args, \"--benchmark_out=\"+b.outFile)\n\t\tswitch b.outResultFormat {\n\t\tcase Console:\n\t\t\targs = append(args, \"--benchmark_out_format=console\")\n\t\tcase JSON:\n\t\t\targs = append(args, \"--benchmark_out_format=json\")\n\t\tcase CSV:\n\t\t\targs = append(args, \"--benchmark_out_format=csv\")\n\t\t}\n\t}\n\n\tif len(b.extraArgs) > 0 {\n\t\targs = append(args, b.extraArgs...)\n\t}\n\treturn args\n}", "func Args(args string) []string {\n\tvar backtickMatch []string\n\n\tif strings.Contains(args, \"`\") {\n\t\tbacktickMatch = argsPattern.FindStringSubmatch(args)\n\t\targs = argsPattern.ReplaceAllString(args, \"---\")\n\t}\n\ts := strings.Split(args, \" \")\n\n\tif len(backtickMatch) > 0 {\n\t\tfor i, v := range s {\n\t\t\tif v == \"---\" {\n\t\t\t\ts[i] = backtickMatch[0]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn s\n}", "func getargs() (args []string) {\n\targs = []string{}\n\n\targs = append(args, \"--orientation\", \"Landscape\")\n\targs = append(args, \"--user-style-sheet\", \"style.css\")\n\targs = append(args, \"--page-width\", \"9in\")\n\targs = append(args, \"--page-height\", \"12in\")\n\targs = append(args, \"--zoom\", \"1.7\")\n\n\tproxy := os.Getenv(\"https_proxy\")\n\tif proxy != \"\" {\n\t\targs = append(args, \"--proxy\", proxy)\n\t}\n\n\treturn args\n}", "func getArgs() (string, string) {\n\tvar filePath = flag.String(\"file\", \"\", \"Bestand dat je wilt openen\")\n\tvar fields = flag.String(\"fields\", \"\", \"De velden die je wilt hebben\")\n\tflag.Parse()\n\treturn *filePath, *fields\n}", "func (c *cli) parseArgs(args []string) (*cliArgs, error) {\n\tparsedArgs := &cliArgs{}\n\n\tapp := kingpin.New(appName, \"\")\n\n\t// Do not call os.Exit\n\tapp.Terminate(nil)\n\n\t// Write output to stderr\n\tapp.Writer(c.stderr)\n\n\t// Add --version flag with to display build info\n\tapp.Version(fmt.Sprintf(\"%s version %s (%s) built on %s\", appName, version, commitHash, buildDate))\n\n\t// Add --config flag to specify path to the config\n\tapp.Flag(\"config\", \"Set the configuration file path\").\n\t\tShort('c').\n\t\tPlaceHolder(\"PATH\").\n\t\tDefault(filepath.Join(filepath.Dir(os.Args[0]), \"gevulot.toml\")).\n\t\tStringVar(&parsedArgs.configPath)\n\n\t// Add --verbose flag to enable debug output\n\tapp.Flag(\"verbose\", \"Enable debug output\").\n\t\tShort('v').\n\t\tBoolVar(&parsedArgs.isVerbose)\n\n\t// Expose --help and --version flags to our struct\n\tapp.HelpFlag.BoolVar(&parsedArgs.isHelp)\n\tapp.VersionFlag.BoolVar(&parsedArgs.isHelp)\n\n\t_, err := app.Parse(args)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn parsedArgs, nil\n}", "func parseArgs() {\n\tfirstArgWithDash := 1\n\tfor i := 1; i < len(os.Args); i++ {\n\t\tfirstArgWithDash = i\n\n\t\tif len(os.Args[i]) > 0 && os.Args[i][0] == '-' {\n\t\t\tbreak\n\t\t} else {\n\t\t\tfilePaths = append(filePaths, os.Args[i])\n\t\t}\n\t}\n\n\tflag.CommandLine.Parse(os.Args[firstArgWithDash:])\n}", "func (w *Wrapper) Args() []string {\n\treturn w.cmdFlags\n}", "func parseProgramArgs() {\n\tLocalFolderPath = flag.String(\"l\", \".\", \"Path to local directory to open, default is '.'\")\n\tdpRestURL = flag.String(\"r\", \"\", \"DataPower REST URL\")\n\tdpSomaURL = flag.String(\"s\", \"\", \"DataPower SOMA URL\")\n\tdpUsername = flag.String(\"u\", \"\", \"DataPower user username\")\n\tpassword := flag.String(\"p\", \"\", \"DataPower user password\")\n\tdpDomain = flag.String(\"d\", \"\", \"DataPower domain name\")\n\tproxy = flag.String(\"x\", \"\", \"URL of proxy server for DataPower connection\")\n\tdpConfigName = flag.String(\"c\", \"\", \"Name of DataPower connection configuration to save with given configuration params\")\n\tDebugLogFile = flag.Bool(\"debug\", false, \"Write debug dpcmder.log file in current dir\")\n\tTraceLogFile = flag.Bool(\"trace\", false, \"Write trace dpcmder.log file in current dir\")\n\thelpUsage = flag.Bool(\"h\", false, \"Show dpcmder usage with examples\")\n\thelpFull = flag.Bool(\"help\", false, \"Show dpcmder in-program help on console\")\n\tversion = flag.Bool(\"v\", false, \"Show dpcmder version\")\n\n\tflag.Parse()\n\tsetDpPasswordPlain(*password)\n}", "func (e envoyBootstrapArgs) args() []string {\n\targuments := []string{\n\t\t\"connect\",\n\t\t\"envoy\",\n\t\t\"-grpc-addr\", e.grpcAddr,\n\t\t\"-http-addr\", e.consulConfig.HTTPAddr,\n\t\t\"-admin-bind\", e.envoyAdminBind,\n\t\t\"-address\", e.envoyReadyBind,\n\t\t\"-proxy-id\", e.proxyID,\n\t\t\"-bootstrap\",\n\t}\n\n\tif v := e.gateway; v != \"\" {\n\t\targuments = append(arguments, \"-gateway\", v)\n\t}\n\n\tif v := e.siToken; v != \"\" {\n\t\targuments = append(arguments, \"-token\", v)\n\t}\n\n\tif v := e.consulConfig.CAFile; v != \"\" {\n\t\targuments = append(arguments, \"-ca-file\", v)\n\t}\n\n\tif v := e.consulConfig.CertFile; v != \"\" {\n\t\targuments = append(arguments, \"-client-cert\", v)\n\t}\n\n\tif v := e.consulConfig.KeyFile; v != \"\" {\n\t\targuments = append(arguments, \"-client-key\", v)\n\t}\n\n\tif v := e.namespace; v != \"\" {\n\t\targuments = append(arguments, \"-namespace\", v)\n\t}\n\n\treturn arguments\n}", "func (d *Dispatcher) GetArgs() []string {\n\treturn util.CopyStrSlice(d.args)\n}", "func SkipArgs() Option { return Option{skipArgs: true} }", "func main() {\n\targs := os.Args[1:]\n\t// if len(args) == 5 {\n\t// \tfmt.Println(\"There are 5 arguments\")\n\t// } else if len(args) == 2 {\n\t// \tfmt.Printf(\"There are %d arguments: %s\\n\", len(args), args)\n\t// } else {\n\t// \tfmt.Println(strings.TrimSpace(usage))\n\t// }\n\tif len(args) >= 2 {\n\t\tfmt.Printf(\"There are %d arguments: %s\\n\", len(args), strings.Join(args, \" \"))\n\t} else {\n\t\tfmt.Println(usage)\n\t}\n}", "func main() {\n\tfor i := 0; i < len(os.Args); i++ {\n\t\tfmt.Println(\"Argument at index\", i, \"is\", os.Args[i])\n\t}\n}", "func (f FFmpeg) Arguments() []string {\n\treturn []string{\n\t\t\"-i\",\n\t\tf.song.FileName,\n\t\t\"-acodec\",\n\t\tf.options.FFmpegCodec(),\n\t\tf.options.FFmpegFlags(),\n\t\tf.options.FFmpegQuality(),\n\t\t\"pipe:1.\" + f.options.Ext(),\n\t}\n}", "func (f *AccessReq) Args() []int {\n\targs := []int{f.PID, f.VAddr, f.Mod}\n\treturn args\n}", "func (a *Arguments) RawArgs() []string {\n\treturn a.args[a.index:]\n}", "func NArg() int\t{ return len(os.Args) - flags.first_arg }", "func argsInit() {\n\tArgs = make([]string, 0, 0)\n\tArgs = append(Args, os.Args...)\n\tExecFile = options.GetExecFileByPid(os.Getpid())\n\t// default opt Parser\n\t// do not include ExecFile\n\topts = options.NewOptParser(Args[1:])\n\tArgLine = options.ArgsToSpLine(Args)\n\tArgFullLine = options.CleanArgLine(os.Args[0] + \" \" + opts.String())\n\t//\n}", "func GetArgs() (cmd, port, timeout string) {\n\targs := os.Args\n\tif len(os.Args[1:]) != 6 {\n\t\tUsageError()\n\t}\n\n\tif args[1] != \"-script\" && args[3] != \"-port\" && args[5] != \"-timeout\" {\n\t\tUsageError()\n\t}\n\treturn args[2], args[4], args[6]\n}", "func printArgs() {\n\ts := os.Args[1:]\n\tfor i, v := range s {\n\t\tfmt.Println(i, v)\n\t}\n\n}", "func (c *OsCommand) GetArgs() []string {\n\treturn c.Cmd.Args\n}", "func stripFlags(rootCmd *cobra.Command, args []string) ([]string, error) {\n\tif err := rootCmd.ParseFlags(filterHelpOptions(args)); err != nil {\n\t\treturn []string{}, fmt.Errorf(\"error while parsing flags from args %v: %w\", args, err)\n\t}\n\treturn rootCmd.Flags().Args(), nil\n}", "func (me VidOptions) CmdArgs() []string {\n\n\targs := me.Options.CmdArgs()\n\n\targs = pushUInt(args, \"bitrate\", clampUInt(me.BitRate, 0, 25000000))\n\n\targs = pushBool(args, \"vstab\", me.VideoStabilization)\n\n\targs = pushUInt8(args, \"framerate\", clampUInt8(me.FrameRate, 2, 30))\n\n\targs = pushString(args, \"codec\", string(me.Codec))\n\n\targs = pushUInt(args, \"timeout\", me.Length)\n\treturn args\n}", "func main() {\n\tfmt.Println(os.Args[0])\n}", "func main() {\n\tfmt.Println(strings.Join(os.Args[1:], \" \"))\n}", "func altArgs() {\n\tvar s, sep string\n\tfor _, v := range os.Args[1:] {\n\t\ts += sep + v\n\t\tsep = \" \"\n\t}\n\tfmt.Println(s)\n}", "func PrintCommandLineArgs() {\n\tfor i := 0; i < len(os.Args); i++ {\n\t\tfmt.Printf(\"%+v\\n\", os.Args[i])\n\t}\n}", "func GetUinitArgs() []string {\n\tuinitargs, _ := Flag(\"uroot.uinitargs\")\n\treturn shlex.Argv(uinitargs)\n}", "func (g *GoTest) Args() []string {\n\targs := []string{\"test\"}\n\tif g.Timeout > 0 {\n\t\targs = append(args, fmt.Sprintf(\"-timeout=%s\", g.Timeout.String()))\n\t}\n\tif g.CoverProfile != \"\" {\n\t\targs = append(args, fmt.Sprintf(\"-coverprofile=%s\", g.CoverProfile))\n\t}\n\tif g.Race {\n\t\targs = append(args, \"-race\")\n\t}\n\treturn append(args, g.Packages...)\n}", "func Args(cmd, prefix, sep string) []string {\n\targs := make([]string, 0)\n\tfor _, part := range strings.SplitN(cmd, sep, -1) {\n\t\tif part != prefix && strings.HasPrefix(part, prefix) {\n\t\t\targs = append(args, part)\n\t\t}\n\t}\n\treturn args\n}", "func readargs() config {\n\tvar db string\n\tvar verarg bool\n\tvar nw uint\n\tflag.StringVar(&db, \"database\", \"\", \"database to use for determining forks; if unspecified, no fork detection is performed\")\n\tflag.UintVar(&nw, \"nworkers\", 4, \"number of concurrent workers\")\n\tflag.BoolVar(&verarg, \"version\", false, \"show version information\")\n\tflag.Usage = printusage\n\n\tflag.Parse()\n\n\tif verarg {\n\t\tprintversion()\n\t}\n\n\tif flag.NArg() > 1 {\n\t\tflag.Usage()\n\t}\n\n\trepostore := flag.Arg(0)\n\treturn config{Repostore: repostore, Database: db, NWorkers: uint(nw)}\n}", "func GetGlobArgs(args []string) ([]string, error) {\n\n\tvar a []string\n\n\tfor _, v := range args {\n\t\tfiles, err := filepath.Glob(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ta = append(a, files...)\n\t}\n\n\treturn a, nil\n}", "func (c *FromCommand) Args() map[string]string {\n\treturn c.cmd.args\n}", "func (adpt *DockerRunAdapter) Args() []string {\n\tspec := (*yaml.Option)(adpt)\n\n\treturn spec.Args\n}", "func ProcessArgs(cfg *Config) (u []string) {\n\tflag.Usage = func() {\n\t\tfmt.Println(\"Usage:\\nkdevpije user1,user2,alias3... [default|week|sprint]\")\n\t\tflag.PrintDefaults()\n\t}\n\tvar debugFlag = flag.Bool(\"debug\", false, \"Print logs to stderr\")\n\tvar reloadData = flag.Bool(\"reloadData\", false, \"Download list of employees again\")\n\tflag.Parse() // Scan the arguments list\n\n\tif !*debugFlag {\n\t\tlog.SetOutput(ioutil.Discard)\n\t}\n\tlog.Println(\"Processing arguments\")\n\tcfg.ReloadData = *reloadData\n\temps := flag.Arg(0)\n\tif emps == \"\" {\n\t\tflag.PrintDefaults()\n\t\treturn\n\t}\n\tu = strings.Split(emps, \",\")\n\tu = employees.ExpandFiveTimes(u, cfg.Aliases)\n\n\ttimeframe := flag.Arg(1)\n\tif timeframe == \"\" {\n\t\ttimeframe = \"default\"\n\t}\n\ttf, ok := cfg.Intervals[timeframe]\n\tif !ok {\n\t\ttf = 1\n\t}\n\tcfg.TimeFrame = tf\n\tcfg.PDConfig.TimeFrame = cfg.TimeFrame\n\tlog.Println(\"Processed config:\", cfg)\n\treturn\n}", "func AllArguments(c *cli.Context) []string {\n\tsl := []string{c.Args().First()}\n\tsl = append(sl, c.Args().Tail()...)\n\treturn sl\n}", "func (c Command) Args() [][]byte {\r\n\treturn c[1:]\r\n}", "func process_arguments() {\n\tfmt.Println(\"Processing arguments\")\n\tflag.Parse()\n}", "func Args(p Pack) map[string]interface{} {\n\treturn p.Args\n}", "func (s *RunnableCmd) Args() string {\n\tif s.cmd == nil {\n\t\treturn \"\"\n\t}\n\treturn strings.Join(s.cmd.Args, \" \")\n}", "func (err *RuleNotSatisfied) GetArgs() Args {\n\treturn err.Args\n}", "func (c *RunCommand) Args() map[string]string {\n\treturn c.cmd.args\n}", "func parseArgs() {\n\tflag.StringVar(&cmdline.Config, \"config\", cmdline.Config, \"Path to configutation file\")\n\tflag.StringVar(&cmdline.Host, \"host\", cmdline.Host, \"Host IP or name to bind to\")\n\tflag.IntVar(&cmdline.Port, \"port\", cmdline.Port, \"Port to bind to\")\n\tflag.StringVar(&cmdline.Maildirs, \"maildirs\", cmdline.Maildirs, \"Path to the top level of the user Maildirs\")\n\tflag.StringVar(&cmdline.Logfile, \"log\", cmdline.Logfile, \"Path to logfile\")\n\tflag.BoolVar(&cmdline.Debug, \"debug\", cmdline.Debug, \"Log debugging information\")\n\n\tflag.Parse()\n}", "func extraFlags(c *cli.Context, subCommand bool) ([]string, error) {\n\tvar a []string\n\n\tif c.NArg() < 1 {\n\t\treturn a, nil\n\t}\n\n\tif c.Args()[0] == \"--\" {\n\t\treturn c.Args()[1:], nil\n\t}\n\t// When we are called from a sub command we don't want the sub command bits\n\tif subCommand {\n\t\treturn a, nil\n\t}\n\treturn c.Args(), nil\n}", "func parseArgs(args []string) (*arguments, error) {\n\tif len(args) == 0 {\n\t\treturn nil, errors.Errorf(\"required input \\\" --src <Src_File> \\\" not found !\")\n\t}\n\n\tapp := kingpin.New(\"mircat\", \"Utility for processing Mir state event logs.\")\n\tsrc := app.Flag(\"src\", \"The input file to read (defaults to stdin).\").Default(os.Stdin.Name()).File()\n\t_, err := app.Parse(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &arguments{\n\t\tsrcFile: *src,\n\t}, nil\n}", "func EnvArgs() []string {\n\treturn []string{\n\t\t\"RPCUSER\",\n\t\t\"RPCPASS\",\n\t\t\"NETWORK=simnet\",\n\t\t\"DEBUG\",\n\t}\n}", "func bazelArgs(cmd string) ([]string, error) {\n\ttokens, err := shlex.Split(cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif tokens[0] == bazelBinaryName || tokens[0] == bazeliskBinaryName {\n\t\ttokens = tokens[1:]\n\t}\n\treturn tokens, nil\n}", "func (this *NowStr) MinArgs() int { return 0 }", "func main() {\n\tvar s, sep string\n\tfor i := 1; i < len(os.Args); i++ {\n\t\ts += sep + os.Args[i]\n\t\tsep = \" \"\n\t}\n\n\tfmt.Println(s)\n\n\taltArgs()\n\tjoinArgs()\n\n\t// Just using the Println function\n\tfmt.Println(os.Args[1:])\n}", "func ProcessArgsForPid(pid int) string {\n\treadPath := \"/proc/\" + strconv.Itoa(pid) + \"/cmdline\"\n\tfile, err := os.Open(readPath)\n\tif err != nil {\n\t\tlog.Printf(\"Pid %d: could not open File %s\", pid, readPath)\n\t\treturn \"\"\n\t}\n\tdefer file.Close()\n\n\tdata, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\tlog.Printf(\"Pid %d: could not read File %s\", pid, readPath)\n\t\treturn \"\"\n\t}\n\n\tif len(data) < 1 {\n\t\treturn \"\"\n\t}\n\n\tparts := strings.Split(string(bytes.TrimRight(data, string(\"\\x00\"))), string(byte(0)))\n\n\treturn strings.Join(parts[1:], \" \")\n}", "func rootCmdArgs(args []string) []string {\n\t// old flag: new flag\n\tlegacyFlagMap := map[string]string{\n\t\t\"-help\": \"--help\",\n\t\t\"-version\": \"--version\",\n\t\t\"-creds\": \"--creds\",\n\t\t\"-nkey\": \"--nkey\",\n\t\t\"-user\": \"--user\",\n\t\t\"-password\": \"--password\",\n\t\t\"-timeout\": \"--timeout\",\n\t\t\"-port\": \"--port\",\n\t\t\"-addr\": \"--addr\",\n\t\t\"-tlscert\": \"--tlscert\",\n\t\t\"-tlskey\": \"--tlskey\",\n\t\t\"-tlscacert\": \"--tlscacert\",\n\t\t\"-http_tlscert\": \"--http-tlscert\",\n\t\t\"--http_tlscert\": \"--http-tlscert\",\n\t\t\"-http_tlskey\": \"--http-tlskey\",\n\t\t\"--http_tlskey\": \"--http-tlskey\",\n\t\t\"-http_tlscacert\": \"--http-tlscacert\",\n\t\t\"--http_tlscacert\": \"--http-tlscacert\",\n\t\t\"-http_user\": \"--http-user\",\n\t\t\"--http_user\": \"--http-user\",\n\t\t\"-http_pass\": \"--http-pass\",\n\t\t\"--http_pass\": \"--http-pass\",\n\t\t\"-prefix\": \"--prefix\",\n\t\t\"-observe\": \"--observe\",\n\t\t\"-jetstream\": \"--jetstream\",\n\t}\n\tnewArgs := make([]string, 0)\n\n\tfor i, arg := range args {\n\t\tif arg == \"--\" {\n\t\t\treturn append(newArgs, args[i:]...)\n\t\t}\n\t\targSplit := strings.SplitN(arg, \"=\", 2)\n\t\tnewArg, exists := legacyFlagMap[argSplit[0]]\n\t\tif exists {\n\t\t\tlogger.Warnf(\"flag '%s' is deprecated and may be removed in a future relese, use '%s' instead\", argSplit[0], newArg)\n\t\t\tif len(argSplit) == 1 {\n\t\t\t\tnewArgs = append(newArgs, newArg)\n\t\t\t} else {\n\t\t\t\tnewArgs = append(newArgs, fmt.Sprintf(\"%s=%s\", newArg, argSplit[1]))\n\t\t\t}\n\t\t} else {\n\t\t\tnewArgs = append(newArgs, arg)\n\t\t}\n\t}\n\treturn newArgs\n}", "func (o GetAppTemplateContainerOutput) Args() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetAppTemplateContainer) []string { return v.Args }).(pulumi.StringArrayOutput)\n}", "func joinArgs() {\n\tfmt.Println(strings.Join(os.Args[1:], \" \"))\n}", "func (n *CommandNode) Args() []Expr { return n.args }", "func getArguments(args []string) (string, int, error) {\n\tif len(args) < 4 || len(args) > 5{\n\t\treturn \"\", 0, errors.New(\"Proper usage: ./downloader <url> -c numberOfThreads\")\n\t\t\t\n\t}\n\turl := args[1]\n\t\n\tif args[2] != \"-c\" {\n\t\treturn \"\", 0, errors.New(\"Proper usage: ./downloader <url> -c numberOfThreads\")\n\t}\n\tnumThreads, err := strconv.Atoi(args[3])\n\tif err != nil { \n\t\treturn \"\", 0, err\n\t}\n\treturn url, numThreads, nil\n}", "func (msg *Message) GetArgs() {\n\tif !strings.HasPrefix(msg.raw, \"|\") || strings.HasPrefix(msg.raw, \"||\") {\n\t\t// generic typeless message\n\t\tmsg.msgType = \"\"\n\t\tmsg.args = []string{strings.TrimPrefix(msg.raw, \"||\")}\n\t} else {\n\t\tmsgData := strings.Split(msg.raw, \"|\")\n\t\tmsg.msgType = msgData[1] // first should be \"\"\n\n\t\tswitch msg.msgType {\n\t\tcase \"c\", \"chat\": // certain messages can contain | in them\n\t\t\tmsg.args = append(msgData[2:3],\n\t\t\t\tstrings.TrimSpace(strings.Join(msgData[3:], \"|\")))\n\t\tcase \"c:\":\n\t\t\t// move the timestamp to the end\n\t\t\tmsg.args = append(msgData[3:4],\n\t\t\t\tstrings.TrimSpace(strings.Join(msgData[4:], \"|\")),\n\t\t\t\tmsgData[2])\n\t\tcase \"pm\":\n\t\t\t// PMs get treated differently so that they can be run through\n\t\t\t// commands the same way a normal chat message can be\n\t\t\tmsg.room = \"user:\" + msgData[2]\n\t\t\t// discard the bot's name\n\t\t\tmsg.args = append(msgData[2:3], msgData[4:]...)\n\t\tdefault:\n\t\t\tmsg.args = msgData[2:]\n\t\t}\n\t}\n}", "func (c *CmdReal) GetArgs() []string {\n\treturn c.cmd.Args\n}", "func argsWithoutCommands(cmdArgs []string, pluginCommandsParts []string) []string {\n\tret := make([]string, 0, len(cmdArgs))\n\tfor _, arg := range cmdArgs {\n\t\tif len(pluginCommandsParts) > 0 && pluginCommandsParts[0] == arg {\n\t\t\tpluginCommandsParts = pluginCommandsParts[1:]\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, arg)\n\t}\n\treturn ret\n}", "func validateProgramArgs() {\n\tif *version {\n\t\tshowVersion()\n\t}\n\n\tif *helpUsage {\n\t\tusage(0)\n\t}\n\n\tif *helpFull {\n\t\tshowHelp(0)\n\t}\n\n\tif *LocalFolderPath == \"\" ||\n\t\t(*dpUsername != \"\" && *dpRestURL == \"\" && *dpSomaURL == \"\") {\n\t\tusage(1)\n\t}\n\n}", "func ParseArgs() {\n\t// Set function to be called if parsing fails.\n\tflag.Usage = usage\n\n\t// Parse CLI arguments.\n\tflag.Parse()\n\n\t// Print usage text and exit if:\n\t// - browser is neither \"chrome\" or \"firefox\",\n\t// - env is neither \"dev\", \"uat\" or \"preprod\",\n\t// - headless is neither \"false\" or \"true\",\n\t// - displayAddress is not valid IP address,\n\t// - port is not a number between 1024-65535\n\tisHeadless, err := strconv.ParseBool(*headless)\n\tif !(validBrowserArg() && validEnvArg() && err == nil && validDisplayArg() && (*port >= 1024 && *port <= 65535)) {\n\t\tusage()\n\t\tos.Exit(2)\n\t}\n\n\t// Set conf global variable.\n\tconf = Conf{\n\t\tBrowser: Browser(*browser),\n\t\tEnv: Env(*env),\n\t\tHeadless: isHeadless,\n\t\tDisplayAddress: *displayAddress,\n\t\tPort: *port,\n\t\tWidth: *width,\n\t\tHeight: *height,\n\t}\n\n\t// Set caps global variable.\n\tSetCaps(conf)\n}", "func ParseArgs() {\n\tflag.Var(&color, \"color\", \"Background and border color\")\n\tflag.Var(&paddingTop, \"padding-top\", \"Value of top padding\")\n\tflag.Var(&paddingBottom, \"padding-bottom\", \"Value of bottom padding\")\n\tflag.Var(&borderWidth, \"border-width\", \"Border width of focused window\")\n\tflag.Var(&nameLimit, \"name-limit\", \"Maximum length of workspace name\")\n\tflag.Var(&commands, \"exec\", \"Commands to execute at startup\")\n\tflag.StringVar(&terminal, \"term\", \"xterm\", \"A command to launch terminal emulator\")\n\tflag.StringVar(&launcher, \"launcher\", \"rofi -show run\", \"A command to show application launcher\")\n\tflag.StringVar(&locker, \"lock\", \"slock\", \"A command to lock screen\")\n\tflag.BoolVar(\n\t\t&debug, \"debug\", false,\n\t\t\"Outputs debug information to Stderr\",\n\t)\n\tflag.Parse()\n}", "func (o FioSpecOutput) CmdLineArgs() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpec) *string { return v.CmdLineArgs }).(pulumi.StringPtrOutput)\n}", "func (parser *Parser) args() ([]*Expr, error) {\n\tparser.trace(\"ARGS\")\n\tdefer parser.untrace()\n\texpr, err := parser.expr()\n\tif err == ErrNoMatch {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmoreExpr, err := parser.moreArgs()\n\tif err == ErrNoMatch {\n\t\treturn []*Expr{expr}, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\texprs := append([]*Expr{expr}, moreExpr...)\n\treturn exprs, nil\n}", "func cmdAndArgs(args []string) (command string, argv []string) {\n\tif len(args) == 0 {\n\t\treturn\n\t}\n\tcommand = args[0]\n\targv = args[1:]\n\treturn\n}", "func (t Type) Args() []string {\n\treturn schemas[t%EvCount].Args\n}", "func parseArgs() {\n\tflag.StringVar(&masterPhrase, \"master\", \"\", \"The master phrase to use for password generation. Do NOT forget to escape any special characters contained in the master phrase (e.g. $, space etc).\")\n\tflag.StringVar(&masterPhraseFile, \"master-file\", \"\", \"The path to a file, containing the master phrase.\")\n\n\tflag.StringVar(&domain, \"domain\", \"\", \"The domain for which this password is intended\")\n\tflag.StringVar(&additionalInfo, \"additional-info\", \"\", \"Free text to add (e.g. index/timestamp/username if the previous password was compromized)\")\n\tflag.IntVar(&passLength, \"password-length\", 12, \"Define the length of the password.\")\n\tflag.BoolVar(&addSpecialChars, \"special-characters\", true, \"Whether to add a known set of special characters to the password\")\n\tflag.BoolVar(&addInfoToLog, \"log-info\", false, \"Whether to log the parameters that were used for generation to a file. Note that the password itself will NOT be stored!\")\n\n\tflag.Parse()\n}", "func noArgs(c *cli.Context) error {\r\n\t// Print app usage\r\n\tcli.ShowAppHelp(c)\r\n\r\n\t// It's possible to change the return status code and error here\r\n\t// cli.NewExitError creates a a new error and the return status code for\r\n\t// the application.\r\n\treturn cli.NewExitError(\"no commands provided\", 2)\r\n}", "func getEnterArgv(p *pod, imageID *types.Hash, cmdArgs []string) ([]string, error) {\n\tvar argv []string\n\tif len(cmdArgs) < 2 {\n\t\tstderr(\"No command specified, assuming %q\", defaultCmd)\n\t\targv = []string{defaultCmd}\n\t} else {\n\t\targv = cmdArgs[1:]\n\t}\n\n\treturn argv, nil\n}", "func (m *wasiSnapshotPreview1Impl) argsGet(pargv pointer, pargvBuf pointer) (err wasiErrno) {\n\tfor _, s := range m.args {\n\t\tbuf := m.bytes(pargvBuf)\n\t\tcopy(buf, s)\n\t\tbuf[len(s)] = 0\n\n\t\tm.putUint32(uint32(pargvBuf), pargv)\n\t\tpargvBuf, pargv = pargvBuf+pointer(len(s))+1, pargv+4\n\t}\n\treturn wasiErrnoSuccess\n}", "func (c *ScriptCommand) GetArgs() (map[string]string, error) {\n\targs, err := c.Config.GetArgs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\targs[\"i\"] = c.InputFile\n\treturn args, nil\n}", "func commandLineFiles(fnames []string) []string {\n if runtime.GOOS == \"windows\" {\n args := make([]string, 0, len(fnames))\n\n for _, fname := range fnames {\n if matches, err := filepath.Glob(fname); err != nil {\n // not a valid pattern\n args = append(args, fname)\n } else if matches != nil {\n // at least one match\n args = append(args, matches...)\n }\n }\n\n return args\n }\n\n // not a Windows OS\n return fnames\n}", "func genArgs(optionMap map[string]string) []string {\n\toptions := []string{}\n\tfor k, v := range optionMap {\n\t\tif v != \"\" {\n\t\t\tk = fmt.Sprintf(\"%s=%s\", k, v)\n\t\t}\n\t\toptions = append(options, k)\n\t}\n\treturn options\n}", "func CheckArgs() map[string]*string {\n\n\targs := make(map[string]*string)\n\n\tparser := argparse.NewParser(\"print\", \"Prints provided string to stdout\")\n\n\targs[\"git_path\"] = parser.String(\"p\", \"git_path\", &argparse.Options{Required: true, Help: \"Path to git repository\"})\n\targs[\"word_list\"] = parser.String(\"w\", \"word_list\", &argparse.Options{Required: true, Help: \"Path to word list. HTTPS/HTTP/FS\"})\n\n\terr := parser.Parse(os.Args)\n\tif err != nil {\n\t\tfmt.Print(parser.Usage(err))\n\t}\n\n\treturn args\n}", "func (sa StaticOption) OptionArgs() ([]string, error) { return []string{sa.value}, nil }", "func (c *caller) getArgs() interface{} {\n\treturn reflect.New(c.Args).Interface()\n}", "func parseArgs(conf *Config) {\n\tvar parser = flags.NewParser(conf, flags.Default)\n\n\t/*\n\t Input validation. Don't silently fail. Print the usage instead.\n\t We might do something with \"unparsed\" later, but the Args nested\n\t struct in Config slurps the rest of the arguments into command.\n\n\t There seems to be a bug where --help prints twice... I tried to\n\t mitigate it by overriding with my own --help. I think it's caused\n\t by the fact that I have required args? Not worth investing any more\n\t time\n\t*/\n\n\tunparsed, err := parser.Parse()\n\tif err != nil || len(unparsed) > 1 || conf.Help {\n\t\tprintHelp(parser)\n\t}\n}", "func (v version) Arguments(args []string) []string {\n\treturn append([]string{\"xp.runtime.Version\"}, args...)\n}", "func TestArgs(t *testing.T) {\n\tpatterns := []struct {\n\t\tname string\n\t\tin []string\n\t\tflags []pflag.Flag\n\t\targs []string\n\t}{\n\t\t{\"nil\", nil, nil, nil},\n\t\t{\"empty\", nil, nil, nil},\n\t\t{\"only one\", []string{\"arg1\"}, nil, []string{\"arg1\"}},\n\t\t{\"only two\", []string{\"arg1\", \"arg2\"}, nil, []string{\"arg1\", \"arg2\"}},\n\t\t{\"two with flags\",\n\t\t\t[]string{\n\t\t\t\t\"-v\",\n\t\t\t\t\"-n=44\",\n\t\t\t\t\"--leaf\", \"42\",\n\t\t\t\t\"--slice=a,b\",\n\t\t\t\t\"--nested-slice\", \"c,d\", \"arg1\", \"arg2\"},\n\t\t\tnil, []string{\"arg1\", \"arg2\"}},\n\t\t{\"terminated parsing\",\n\t\t\t[]string{\n\t\t\t\t\"-v\", \"-n=44\", \"--leaf\", \"42\", \"--\",\n\t\t\t\t\"--slice=a,b\", \"--nested-slice\", \"c,d\", \"arg1\"},\n\t\t\tnil,\n\t\t\t[]string{\"--slice=a,b\", \"--nested-slice\", \"c,d\", \"arg1\"}},\n\t\t{\"non flag after group\",\n\t\t\t[]string{\n\t\t\t\t\"--addon\", \"first string\",\n\t\t\t\t\"-ab\",\n\t\t\t\t\"stophere\",\n\t\t\t\t\"--addon\", \"second string\"},\n\t\t\tnil, []string{\"stophere\", \"--addon\", \"second string\"}},\n\t}\n\tfor _, p := range patterns {\n\t\tf := func(t *testing.T) {\n\t\t\tf := pflag.New(\n\t\t\t\tpflag.WithCommandLine(p.in),\n\t\t\t\tpflag.WithFlags(p.flags))\n\t\t\tassert.Equal(t, p.args, f.Args())\n\t\t\tassert.Equal(t, len(p.args), f.NArg())\n\t\t}\n\t\tt.Run(p.name, f)\n\t\t// test default to os.Args\n\t\tf = func(t *testing.T) {\n\t\t\toldArgs := os.Args\n\t\t\tos.Args = append([]string{\"flagTest\"}, p.in...)\n\t\t\tf := pflag.New(pflag.WithFlags(p.flags))\n\t\t\tos.Args = oldArgs\n\t\t\tassert.Equal(t, p.args, f.Args())\n\t\t\tassert.Equal(t, len(p.args), f.NArg())\n\t\t}\n\t\tt.Run(p.name+\"-oa\", f)\n\t}\n}", "func main() {\n\tapp := &cli.App{\n\t\tName: \"grrs\",\n\t\tUsage: \"like a grep, but written in go\",\n\t\tAction: func(c *cli.Context) error {\n\t\t\targs, err := cl.InitArgs(c.Args())\n\t\t\tcheck(err)\n\t\t\tlines, err := matches.InFile(args)\n\t\t\tcheck(err)\n\t\t\tfor _, line := range lines {\n\t\t\t\tfmt.Println(line)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\terr := app.Run(os.Args)\n\tcheck(errors.Wrap(err, strings.Join(os.Args, \", \")))\n}", "func kern_procargs(pid int,\n\texe func(string),\n\targv func(string),\n\tenv func(string, string)) error {\n\n\tmib := []C.int{C.CTL_KERN, C.KERN_PROCARGS2, C.int(pid)}\n\targmax := uintptr(C.ARG_MAX)\n\tbuf := make([]byte, argmax)\n\terr := sysctl(mib, &buf[0], &argmax, nil, 0)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tbbuf := bytes.NewBuffer(buf)\n\tbbuf.Truncate(int(argmax))\n\n\tvar argc int32\n\tbinary.Read(bbuf, binary.LittleEndian, &argc)\n\n\tpath, err := bbuf.ReadBytes(0)\n\tif exe != nil {\n\t\texe(string(chop(path)))\n\t}\n\n\t// skip trailing \\0's\n\tfor {\n\t\tc, _ := bbuf.ReadByte()\n\t\tif c != 0 {\n\t\t\tbbuf.UnreadByte()\n\t\t\tbreak // start of argv[0]\n\t\t}\n\t}\n\n\tfor i := 0; i < int(argc); i++ {\n\t\targ, err := bbuf.ReadBytes(0)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif argv != nil {\n\t\t\targv(string(chop(arg)))\n\t\t}\n\t}\n\n\tif env == nil {\n\t\treturn nil\n\t}\n\n\tdelim := []byte{61} // \"=\"\n\n\tfor {\n\t\tline, err := bbuf.ReadBytes(0)\n\t\tif err == io.EOF || line[0] == 0 {\n\t\t\tbreak\n\t\t}\n\t\tpair := bytes.SplitN(chop(line), delim, 2)\n\t\tenv(string(pair[0]), string(pair[1]))\n\t}\n\n\treturn nil\n}", "func CommandArgs(allArgs map[string]reflect.Value) {\n\tallArgs[\"config\"] = reflect.ValueOf(&ConfigFile)\n\tallArgs[\"cfg\"] = reflect.ValueOf(&ConfigFile)\n\tallArgs[\"help\"] = reflect.ValueOf(&Help)\n\tallArgs[\"h\"] = reflect.ValueOf(&Help)\n}", "func (e *ConsumerConfig) GetArgs() map[string]interface{}{\n\tif e.Args == nil{\n\t\treturn make(map[string]interface{})\n\t}\n\treturn e.Args\n}" ]
[ "0.7747981", "0.76030535", "0.7292448", "0.7067749", "0.67367816", "0.67255974", "0.6586831", "0.6570368", "0.6504001", "0.6480189", "0.6400025", "0.635086", "0.6348177", "0.62968546", "0.62840956", "0.62708867", "0.62696034", "0.6264619", "0.6264158", "0.6257549", "0.6251402", "0.6242922", "0.61601794", "0.6152315", "0.61509156", "0.61283064", "0.61004937", "0.6099901", "0.6099568", "0.6077277", "0.60670125", "0.60594773", "0.6048906", "0.60387784", "0.60336185", "0.6021881", "0.6019498", "0.59762824", "0.59458065", "0.5931623", "0.5927253", "0.59101284", "0.5901422", "0.58936", "0.58699614", "0.5866424", "0.5865542", "0.5854045", "0.58462346", "0.58105165", "0.581019", "0.58024436", "0.57884693", "0.5787115", "0.5780346", "0.57744414", "0.5773038", "0.5768624", "0.57487744", "0.5743187", "0.5741778", "0.5740441", "0.5728693", "0.5692739", "0.5681476", "0.56776345", "0.56758434", "0.5675022", "0.56687754", "0.5644514", "0.56384844", "0.5636693", "0.5627082", "0.5605265", "0.55937326", "0.5591749", "0.5588856", "0.55884445", "0.55870944", "0.5585416", "0.55838346", "0.555677", "0.5550989", "0.5543317", "0.55424654", "0.5537004", "0.55164903", "0.5507331", "0.5499387", "0.54809093", "0.54708743", "0.5470731", "0.546971", "0.546677", "0.5463122", "0.54511255", "0.54502636", "0.5446851", "0.54436123", "0.5440733" ]
0.6428583
10
Validate checks the flags for conflicts
func (c *Config) Validate() bool { switch c.Ops { case 0, 1, 2, 4, 8: return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (flags *Flags) Validate(args []string) error {\n\treturn nil\n}", "func (o *options) validateFlags() error {\n\tvar err error\n\n\tif len(o.name) == 0 {\n\t\treturn &util.ExitError{Message: \"-n, --name option is required.\", Code: 1}\n\t}\n\n\to.output, err = filepath.Abs(o.output)\n\tif err != nil {\n\t\treturn &util.ExitError{Message: fmt.Sprintf(\"-o, --output option invalid: %v.\", o.output), Code: 1}\n\t}\n\n\tif util.DirExists(o.output) {\n\t\treturn &util.ExitError{Message: fmt.Sprintf(\"-o, --output already exists and is a directory: %v.\", o.output), Code: 1}\n\t}\n\n\tif o.serviceaccount && o.certificate {\n\t\treturn &util.ExitError{Message: \"-c, --certificate and -s, --serviceaccount are mutually exclusive options.\", Code: 1}\n\t}\n\n\treturn nil\n}", "func (wf *WorkerFlags) validateAllFlags() error {\n\tif timeout := wf.Lookup(\"timeout\"); timeout != nil {\n\t\t_, err := strconv.Atoi(timeout.Value.String())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif configFile := wf.Lookup(\"config-file\"); configFile != nil {\n\t\tconfigFile := configFile.Value.String()\n\t\tif configFile != \"\" {\n\t\t\tif _, err := os.Stat(configFile); os.IsNotExist(err) {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif payloadFile := wf.Lookup(\"payload-file\"); payloadFile != nil {\n\t\tpayloadFile := payloadFile.Value.String()\n\t\tif payloadFile != \"\" {\n\t\t\tif _, err := os.Stat(payloadFile); os.IsNotExist(err) {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif priority := wf.Lookup(\"priority\"); priority != nil {\n\t\t_, err := strconv.Atoi(priority.Value.String())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif endat := wf.Lookup(\"end-at\"); endat != nil {\n\t\tendat := endat.Value.String()\n\t\tif endat != \"\" {\n\t\t\t_, err := time.Parse(time.RFC3339, endat)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif startat := wf.Lookup(\"start-at\"); startat != nil {\n\t\tstartat := startat.Value.String()\n\t\tif startat != \"\" {\n\t\t\t_, err := time.Parse(time.RFC3339, startat)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (f *flag) validate() error {\n\tif f.Type != \"string\" || len(f.Enum) == 0 {\n\t\treturn nil\n\t}\n\tval := f.cobraFlag.Value.String()\n\tfor _, validVal := range f.Enum {\n\t\tif val == validVal {\n\t\t\treturn nil\n\t\t}\n\t}\n\toptions := fmt.Sprintf(\"[%v]\", strings.Join(f.Enum, \", \"))\n\terrMsg := fmt.Sprintf(\"Invalid \\\"%s\\\" flag option: %s\\nAvailable options are: %s\\n\", f.Long, val, options)\n\treturn errors.New(errMsg)\n\t// ===== Sample Output =====\n\t// Invalid \"environment\" flag option: testing\n\t// Available options are: [development, staging, production]\n}", "func validateFlags() error {\n\t// if username == \"\" {\n\t// \treturn fmt.Errorf(\"username is required\")\n\t// }\n\n\tif host == \"\" {\n\t\treturn fmt.Errorf(\"host is required\")\n\t}\n\n\treturn nil\n}", "func (opts resourceOptions) validate() error {\n\t// Check that the required flags did not get a flag as their value.\n\t// We can safely look for a '-' as the first char as none of the fields accepts it.\n\t// NOTE: We must do this for all the required flags first or we may output the wrong\n\t// error as flags may seem to be missing because Cobra assigned them to another flag.\n\tif strings.HasPrefix(opts.Group, \"-\") {\n\t\treturn fmt.Errorf(groupPresent)\n\t}\n\tif strings.HasPrefix(opts.Version, \"-\") {\n\t\treturn fmt.Errorf(versionPresent)\n\t}\n\tif strings.HasPrefix(opts.Kind, \"-\") {\n\t\treturn fmt.Errorf(kindPresent)\n\t}\n\n\t// We do not check here if the GVK values are empty because that would\n\t// make them mandatory and some plugins may want to set default values.\n\t// Instead, this is checked by resource.GVK.Validate()\n\n\treturn nil\n}", "func ValidateFlags(args ...string) error {\n\tfor _, arg := range args {\n\t\tif arg == \"\" {\n\t\t\treturn errors.New(\"Missing flag\")\n\t\t}\n\t}\n\treturn nil\n}", "func EnsureFlagsValid(cmd *cobra.Command, generators map[string]Generator, generatorInUse string) error {\n\tAnnotateFlags(cmd, generators)\n\n\tallErrs := []error{}\n\tcmd.Flags().VisitAll(func(flag *pflag.Flag) {\n\t\t// If the flag hasn't changed, don't validate it.\n\t\tif !flag.Changed {\n\t\t\treturn\n\t\t}\n\t\t// Look into the flag annotations for the generators that can use it.\n\t\tif annotations := flag.Annotations[\"generator\"]; len(annotations) > 0 {\n\t\t\tannotationMap := map[string]struct{}{}\n\t\t\tfor _, ann := range annotations {\n\t\t\t\tannotationMap[ann] = struct{}{}\n\t\t\t}\n\t\t\t// If the current generator is not annotated, then this flag shouldn't\n\t\t\t// be used with it.\n\t\t\tif _, found := annotationMap[generatorInUse]; !found {\n\t\t\t\tallErrs = append(allErrs, fmt.Errorf(\"cannot use --%s with --generator=%s\", flag.Name, generatorInUse))\n\t\t\t}\n\t\t}\n\t})\n\treturn utilerrors.NewAggregate(allErrs)\n}", "func (b *Base) CheckFlags(args []string) (err error) {\n\treturn\n}", "func validateCreateFlags(createCmd *cobra.Command) error {\n\terr := createCmd.MarkPersistentFlagRequired(\"image-id\")\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = createCmd.MarkPersistentFlagRequired(\"instance-type\")\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = createCmd.MarkPersistentFlagRequired(\"ssh-key\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *AutoScalerConfig) ValidateFlags() error {\n\tvar errorsFound bool\n\tc.Target = strings.ToLower(c.Target)\n\tif !isTargetFormatValid(c.Target) {\n\t\terrorsFound = true\n\t}\n\tif c.ConfigMap == \"\" {\n\t\terrorsFound = true\n\t\tglog.Errorf(\"--configmap parameter cannot be empty\")\n\t}\n\tif c.Namespace == \"\" {\n\t\terrorsFound = true\n\t\tglog.Errorf(\"--namespace parameter not set and failed to fallback\")\n\t}\n\tif c.PollPeriodSeconds < 1 {\n\t\terrorsFound = true\n\t\tglog.Errorf(\"--poll-period-seconds cannot be less than 1\")\n\t}\n\n\t// Log all sanity check errors before returning a single error string\n\tif errorsFound {\n\t\treturn fmt.Errorf(\"failed to validate all input parameters\")\n\t}\n\treturn nil\n}", "func CheckBadCompilerFlags(ctx BaseModuleContext, prop string, flags []string) {\n\tfor _, flag := range flags {\n\t\tflag = strings.TrimSpace(flag)\n\n\t\tif !strings.HasPrefix(flag, \"-\") {\n\t\t\tctx.PropertyErrorf(prop, \"Flag `%s` must start with `-`\", flag)\n\t\t} else if strings.HasPrefix(flag, \"-I\") || strings.HasPrefix(flag, \"-isystem\") {\n\t\t\tctx.PropertyErrorf(prop, \"Bad flag `%s`, use local_include_dirs or include_dirs instead\", flag)\n\t\t} else if inList(flag, config.IllegalFlags) {\n\t\t\tctx.PropertyErrorf(prop, \"Illegal flag `%s`\", flag)\n\t\t} else if flag == \"--coverage\" {\n\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s`, use native_coverage instead\", flag)\n\t\t} else if flag == \"-fwhole-program-vtables\" {\n\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s`, use whole_program_vtables instead\", flag)\n\t\t} else if flag == \"-Weverything\" {\n\t\t\tif !ctx.Config().IsEnvTrue(\"ANDROID_TEMPORARILY_ALLOW_WEVERYTHING\") {\n\t\t\t\tctx.PropertyErrorf(prop, \"-Weverything is not allowed in Android.bp files. \"+\n\t\t\t\t\t\"Build with `m ANDROID_TEMPORARILY_ALLOW_WEVERYTHING=true` to experiment locally with -Weverything.\")\n\t\t\t}\n\t\t} else if strings.Contains(flag, \" \") {\n\t\t\targs := strings.Split(flag, \" \")\n\t\t\tif args[0] == \"-include\" {\n\t\t\t\tif len(args) > 2 {\n\t\t\t\t\tctx.PropertyErrorf(prop, \"`-include` only takes one argument: `%s`\", flag)\n\t\t\t\t}\n\t\t\t\tpath := filepath.Clean(args[1])\n\t\t\t\tif strings.HasPrefix(\"/\", path) {\n\t\t\t\t\tctx.PropertyErrorf(prop, \"Path must not be an absolute path: %s\", flag)\n\t\t\t\t} else if strings.HasPrefix(\"../\", path) {\n\t\t\t\t\tctx.PropertyErrorf(prop, \"Path must not start with `../`: `%s`. Use include_dirs to -include from a different directory\", flag)\n\t\t\t\t}\n\t\t\t} else if strings.HasPrefix(flag, \"-D\") && strings.Contains(flag, \"=\") {\n\t\t\t\t// Do nothing in this case.\n\t\t\t\t// For now, we allow space characters in -DNAME=def form to allow use cases\n\t\t\t\t// like -DNAME=\"value with string\". Later, this check should be done more\n\t\t\t\t// correctly to prevent multi flag cases like -DNAME=value -O2.\n\t\t\t} else {\n\t\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s` is not an allowed multi-word flag. Should it be split into multiple flags?\", flag)\n\t\t\t}\n\t\t}\n\t}\n}", "func verifyFlags(opt *options, fs *flag.FlagSet) {\n args := fs.Args()\n if len(args) > 0 {\n opt.Root = args[0]\n args = args[1:]\n }\n if len(args) > 0 {\n patterns := make([]string, len(args))\n for i := range args {\n patterns[i] = fmt.Sprintf(\"(%s)\", args[i])\n }\n opt.SpecPattern = strings.Join(patterns, \"|\")\n }\n}", "func Validate() error {\n\tmissingFields := []string{}\n\n\tfor name, value := range map[string]string{\n\t\t\"AppVersion\": AppVersion, \"VCSRef\": VCSRef, \"BuildVersion\": BuildVersion, \"Date\": Date,\n\t} {\n\t\tif value == \"\" {\n\t\t\tmissingFields = append(missingFields, name)\n\t\t}\n\t}\n\n\tif len(missingFields) == 0 {\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"missing build flags\")\n}", "func CheckBadLinkerFlags(ctx BaseModuleContext, prop string, flags []string) {\n\tfor _, flag := range flags {\n\t\tflag = strings.TrimSpace(flag)\n\n\t\tif !strings.HasPrefix(flag, \"-\") {\n\t\t\tctx.PropertyErrorf(prop, \"Flag `%s` must start with `-`\", flag)\n\t\t} else if strings.HasPrefix(flag, \"-l\") {\n\t\t\tif ctx.Host() {\n\t\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s`, use shared_libs or host_ldlibs instead\", flag)\n\t\t\t} else {\n\t\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s`, use shared_libs instead\", flag)\n\t\t\t}\n\t\t} else if strings.HasPrefix(flag, \"-L\") {\n\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s` is not allowed\", flag)\n\t\t} else if strings.HasPrefix(flag, \"-Wl,--version-script\") {\n\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s`, use version_script instead\", flag)\n\t\t} else if flag == \"--coverage\" {\n\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s`, use native_coverage instead\", flag)\n\t\t} else if strings.Contains(flag, \" \") {\n\t\t\targs := strings.Split(flag, \" \")\n\t\t\tif args[0] == \"-z\" {\n\t\t\t\tif len(args) > 2 {\n\t\t\t\t\tctx.PropertyErrorf(prop, \"`-z` only takes one argument: `%s`\", flag)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s` is not an allowed multi-word flag. Should it be split into multiple flags?\", flag)\n\t\t\t}\n\t\t}\n\t}\n}", "func (self *ToolOptions) Validate() error {\n\t/*\n\t\tif self.ExtraOptions != nil {\n\t\t\tif err := self.ExtraOptions.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t*/\n\n\tswitch {\n\tcase self.DBPath != \"\" && self.Host != \"\":\n\t\treturn fmt.Errorf(\"--dbpath is not allowed when --host is specified\")\n\t}\n\n\treturn nil\n}", "func (o *Options) validate(args []string) error {\n\tif len(args) != 0 {\n\t\treturn errors.New(\"arguments are not supported\")\n\t}\n\treturn nil\n}", "func flagsComplete() (allValid bool, err string) {\n\tallValid = true\n\tif srcAddress == \"\" {\n\t\terr = err + \"Invalid source address.\\n\"\n\t\tallValid = false\n\t}\n\n\treturn allValid, err\n}", "func Validate() error {\n\tfor validation, validationFuncs := range validations {\n\t\tfor _, validationFunc := range validationFuncs {\n\t\t\tif function, ok := flagValidationFuncs[validationFunc]; ok {\n\t\t\t\tif err := function(validation); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func CheckFlags(cmd *cobra.Command) []error {\n\tallFlagsSlice := []*pflag.Flag{}\n\n\tcmd.Flags().VisitAll(func(f *pflag.Flag) {\n\t\tallFlagsSlice = append(allFlagsSlice, f)\n\t})\n\tcmd.PersistentFlags().VisitAll(func(f *pflag.Flag) {\n\t\tallFlagsSlice = append(allFlagsSlice, f)\n\t})\n\n\tfmt.Fprintf(os.Stdout, \" ↳ checking %d flags\\n\", len(allFlagsSlice))\n\n\terrors := []error{}\n\n\t// check flags long names\n\tregex, err := regexp.Compile(`^[a-z]+[a-z\\-]*$`)\n\tif err != nil {\n\t\terrors = append(errors, fmt.Errorf(\"command %q: unable to compile regex to check flags\", cmd.CommandPath()))\n\t\treturn errors\n\t}\n\tfor _, flag := range allFlagsSlice {\n\t\tname := flag.Name\n\t\tif !regex.MatchString(name) {\n\t\t\terrors = append(errors, fmt.Errorf(\"command %q: flag name %q is invalid, long form of flag names can only contain lowercase characters or dash (must match %v)\", cmd.CommandPath(), name, regex))\n\t\t}\n\t}\n\n\treturn errors\n}", "func checkFlags() {\n\t// file flag is required\n\tif *filename == \"\" {\n\t\tlog.Fatalf(\"file is required\")\n\t}\n\n\tif *server == \"\" {\n\t\tlog.Fatalf(\"server is required\")\n\t}\n}", "func (c *showCommand) validate() error {\n\t// If entryID is given, it should be the only constraint\n\tif c.entryID != \"\" {\n\t\tif c.parentID != \"\" || c.spiffeID != \"\" || len(c.selectors) > 0 {\n\t\t\treturn errors.New(\"the -entryID flag can't be combined with others\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func CheckBadTidyFlags(ctx ModuleContext, prop string, flags []string) {\n\tfor _, flag := range flags {\n\t\tflag = strings.TrimSpace(flag)\n\n\t\tif !strings.HasPrefix(flag, \"-\") {\n\t\t\tctx.PropertyErrorf(prop, \"Flag `%s` must start with `-`\", flag)\n\t\t} else if strings.HasPrefix(flag, \"-fix\") {\n\t\t\tctx.PropertyErrorf(prop, \"Flag `%s` is not allowed, since it could cause multiple writes to the same source file\", flag)\n\t\t} else if strings.HasPrefix(flag, \"-checks=\") {\n\t\t\tctx.PropertyErrorf(prop, \"Flag `%s` is not allowed, use `tidy_checks` property instead\", flag)\n\t\t} else if strings.Contains(flag, \" \") {\n\t\t\tctx.PropertyErrorf(prop, \"Bad flag: `%s` is not an allowed multi-word flag. Should it be split into multiple flags?\", flag)\n\t\t}\n\t}\n}", "func validateQueryValidatorFlags(flagSet *pflag.FlagSet) error {\n\tmoniker, err := flagSet.GetString(FlagMoniker)\n\tif err != nil {\n\t\treturn err\n\t}\n\taddr, err := flagSet.GetString(FlagAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvalAddr, err := flagSet.GetString(FlagValAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif moniker == \"\" && addr == \"\" && valAddr == \"\" {\n\t\treturn fmt.Errorf(\"at least one of flags (--moniker, --val-addr, --addr) needs to be set\")\n\t}\n\n\treturn nil\n}", "func (o *dryrunOptions) validate() error {\n\tif o.userWPAName == \"\" && o.labelSelector == \"\" && !o.allWPA {\n\t\treturn fmt.Errorf(\"the watermarkpodautoscaler name or label-selector is required\")\n\t}\n\n\treturn nil\n}", "func (o *GrowManifestOptions) Validate() error {\n\tif o.BaseDir == \"\" {\n\t\treturn xerrors.New(\"must specify --base_dir\")\n\t}\n\n\tif o.StagingRepo == \"\" {\n\t\treturn xerrors.New(\"must specify --staging_repo\")\n\t}\n\n\tif o.FilterTag == latestTag {\n\t\treturn xerrors.Errorf(\n\t\t\t\"--filter_tag cannot be %q (anti-pattern)\", latestTag)\n\t}\n\treturn nil\n}", "func CheckRequiredFlags(flags *pflag.FlagSet) error {\n\trequiredError := false\n\tflagName := \"\"\n\n\tflags.VisitAll(func(flag *pflag.Flag) {\n\t\trequiredAnnotation := flag.Annotations[cobra.BashCompOneRequiredFlag]\n\t\tif len(requiredAnnotation) == 0 {\n\t\t\treturn\n\t\t}\n\t\tflagRequired := requiredAnnotation[0] == \"true\"\n\t\tif flagRequired && !flag.Changed {\n\t\t\trequiredError = true\n\t\t\tflagName = flag.Name\n\t\t}\n\t})\n\n\tif requiredError {\n\t\treturn errors.New(\"Required flag `\" + flagName + \"` has not been set\")\n\t}\n\n\treturn nil\n}", "func (ctl *CRSpecBuilderFromCobraFlags) CheckValuesFromFlags(flagset *pflag.FlagSet) error {\n\tif FlagWasSet(flagset, \"size\") {\n\t\tif !isValidSize(ctl.Size) {\n\t\t\treturn fmt.Errorf(\"size must be 'small', 'medium', 'large' or 'x-large'\")\n\t\t}\n\t}\n\tif FlagWasSet(flagset, \"expose-ui\") {\n\t\tisValid := util.IsExposeServiceValid(ctl.ExposeService)\n\t\tif !isValid {\n\t\t\treturn fmt.Errorf(\"expose ui must be '%s', '%s', '%s' or '%s'\", util.NODEPORT, util.LOADBALANCER, util.OPENSHIFT, util.NONE)\n\t\t}\n\t}\n\tif FlagWasSet(flagset, \"environs\") {\n\t\tfor _, environ := range ctl.Environs {\n\t\t\tif !strings.Contains(environ, \":\") {\n\t\t\t\treturn fmt.Errorf(\"invalid environ format - NAME:VALUE\")\n\t\t\t}\n\t\t}\n\t}\n\tif FlagWasSet(flagset, \"migration-mode\") {\n\t\tif val, _ := flagset.GetBool(\"migration-mode\"); !val {\n\t\t\treturn fmt.Errorf(\"--migration-mode cannot be set to false\")\n\t\t}\n\t}\n\tif FlagWasSet(flagset, \"seal-key\") {\n\t\tif len(ctl.SealKey) != 32 {\n\t\t\treturn fmt.Errorf(\"seal key should be of length 32\")\n\t\t}\n\t}\n\treturn nil\n}", "func (r Describe) validation(cmd *cobra.Command, args []string) error {\n\tif err := require.MaxArgs(args, 3); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (opts *Options) valid() (err error) {\n\tif opts.Threads <= 0 {\n\t\treturn errors.New(\"invalid number of threads\")\n\t}\n\n\tif len(opts.Range) > 0 && opts.Filename != \"\" {\n\t\treturn errors.New(\"only one source allowed but both range and filename specified\")\n\t}\n\n\tif len(opts.Range) == 0 && opts.Filename == \"\" {\n\t\treturn errors.New(\"neither file nor range specified, nothing to do\")\n\t}\n\n\topts.extract, err = compileRegexps(opts.Extract)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topts.extractPipe, err = splitShell(opts.ExtractPipe)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topts.hidePattern, err = compileRegexps(opts.HidePattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topts.showPattern, err = compileRegexps(opts.ShowPattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func checkFlags(c *Command) map[string]bool {\n\tnotMyFlags := make(map[string]bool)\n\t// visit all flags that were passed in via command line:\n\tflag.Visit(func(f *flag.Flag) {\n\t\tisNotMyFlag := true\n\t\tif c != nil {\n\t\t\tfor _, myFlag := range c.Flags {\n\t\t\t\tif f.Name == myFlag {\n\t\t\t\t\tisNotMyFlag = false // yes, f is among my flags\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif isNotMyFlag {\n\t\t\tfor pf := range privateFlags {\n\t\t\t\tif f.Name == pf {\n\t\t\t\t\tnotMyFlags[pf] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn notMyFlags\n}", "func ValidateFlags(searchRoot string, filterMode string, filters []string) bool {\n\tdirInfo, err := os.Stat(searchRoot)\n\tif err != nil {\n\t\tlog.Printf(\"error investigating -dir '%s': %v\", searchRoot, err)\n\t\treturn false\n\t}\n\n\tif !dirInfo.IsDir() {\n\t\tlog.Printf(\"-dir '%s': is not a directory\", searchRoot)\n\t\treturn false\n\t}\n\n\tif len(filters) > 0 && filterMode != FilterModeWhiteList && filterMode != FilterModeBlackList {\n\t\tlog.Printf(\"filtermode must be either '%s' or '%s'\", FilterModeWhiteList, FilterModeBlackList)\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (c Counter) Valid(options ...string) bool {\n\tv := reflect.ValueOf(c)\n\tfor i := 0; i < v.NumField(); i++ {\n\t\t// can't use \"!= 0\" check here, because such shell syntax may occur in rpm specfile:\n\t\t// case `value` in\n\t\t// *)\n\t\t// `command`\n\t\t//\t\t ;;\n\t\t// esac\n\t\t// there's no opening \"(\" here, so the parenteses counter will be negative, but it's still valid\n\t\tif ok, _ := slice.Contains(options, v.Type().Field(i).Name); !ok && v.Field(i).Int() > 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func validArgs(args *runtimeArgs) bool {\n\tflag.Usage = showHelp\n\n\targs.fg = flag.String(\"fg\", \"black\", \"foreground color\")\n\targs.bg = flag.String(\"bg\", \"green\", \"background color\")\n\n\tflag.Parse()\n\n\tif args.fg == nil || hue.StringToHue[*args.fg] == 0 {\n\t\tbadColor(*args.fg) // prints an error message w/ a list of supported colors\n\t\treturn false\n\t}\n\n\tif args.fg == nil || hue.StringToHue[*args.bg] == 0 {\n\t\tbadColor(*args.bg)\n\t\treturn false\n\t}\n\n\t// Get the remaining flags, which should\n\t// consist of a pattern, and optionally, one or more file names.\n\trem := flag.Args()\n\n\tswitch {\n\tcase len(rem) == 0:\n\t\tfmt.Println(\"Error: No pattern specified.\")\n\t\tshowHelp()\n\t\treturn false\n\tcase len(rem) == 1:\n\t\targs.pattern = &rem[0]\n\tcase len(rem) >= 2:\n\t\targs.pattern = &rem[0]\n\n\t\tfor i := 1; i < len(rem); i++ {\n\t\t\targs.files = append(args.files, &rem[i])\n\t\t}\n\t}\n\n\treturn true\n}", "func (o ModuleOptions) Validate(c *cobra.Command, args []string) error {\n\tif len(o.falcoVersion) == 0 {\n\t\treturn fmt.Errorf(\"missing Falco version: specify it via FALCOCTL_FALCO_VERSION env variable or via --falco-version flag\")\n\t}\n\treturn nil\n}", "func validateArgs() {\n\tif *optionsEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *inputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *outputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n}", "func validateCodeIntelUploadFlags() error {\n\tcodeintelUploadFlags.root = codeintel.SanitizeRoot(codeintelUploadFlags.root)\n\n\tif strings.HasPrefix(codeintelUploadFlags.root, \"..\") {\n\t\treturn errors.New(\"root must not be outside of repository\")\n\t}\n\n\tif codeintelUploadFlags.maxPayloadSizeMb < 25 {\n\t\treturn errors.New(\"max-payload-size must be at least 25 (MB)\")\n\t}\n\n\treturn nil\n}", "func (c *modAccountRun) validate(args []string) error {\n\tif len(args) < 2 {\n\t\treturn errors.New(\"not enough arguments\")\n\t}\n\n\tif len(args) > 2 {\n\t\treturn errors.New(\"too many arguments\")\n\t}\n\n\treturn nil\n}", "func CheckRequired(required []string) {\n\tseen := make(map[string]bool)\n\tflag.Visit(func(f *flag.Flag) { seen[f.Name] = true })\n\tfor _, req := range required {\n\t\tif !seen[req] {\n\t\t\tfmt.Fprintf(os.Stderr, \"missing required -%s argument\\n\", req)\n\t\t\tos.Exit(2)\n\t\t}\n\t}\n}", "func (o *ArchiveOptions) Validate(args []string, cxt *context.Context) error {\n\treturn nil\n}", "func (x *MultipleCommand) Validate(args []string) error {\n\tif x.ConfigFileName == config.InputFileName {\n\t\treturn errors.New(\"cannot receive config file and input file from same source\")\n\t}\n\n\treturn nil\n}", "func (opts *generateOptions) Validate() error {\n\tif opts.configFile == \"\" &&\n\t\tlen(opts.images) == 0 &&\n\t\tlen(opts.files) == 0 &&\n\t\tlen(opts.imageArchives) == 0 &&\n\t\tlen(opts.archives) == 0 &&\n\t\tlen(opts.archives) == 0 &&\n\t\tlen(opts.directories) == 0 {\n\t\treturn errors.New(\"to generate a SPDX BOM you have to provide at least one image or file\")\n\t}\n\n\tif opts.format != spdx.FormatTagValue && opts.format != spdx.FormatJSON {\n\t\treturn fmt.Errorf(\"unknown format provided, must be one of [%s, %s]: %s\",\n\t\t\tspdx.FormatTagValue, spdx.FormatJSON, opts.format)\n\t}\n\n\t// Check if specified local files exist\n\tfor _, col := range []struct {\n\t\tItems []string\n\t\tName string\n\t}{\n\t\t{opts.imageArchives, \"image archive\"},\n\t\t{opts.files, \"file\"},\n\t\t{opts.directories, \"directory\"},\n\t\t{opts.archives, \"archive\"},\n\t} {\n\t\t// Check if image archives exist\n\t\tfor i, iPath := range col.Items {\n\t\t\tif !isGlob(iPath) && !util.Exists(iPath) {\n\t\t\t\treturn fmt.Errorf(\"%s #%d not found (%s)\", col.Name, i+1, iPath)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (m *CreateStatusOption) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func validateProgramArgs() {\n\tif *version {\n\t\tshowVersion()\n\t}\n\n\tif *helpUsage {\n\t\tusage(0)\n\t}\n\n\tif *helpFull {\n\t\tshowHelp(0)\n\t}\n\n\tif *LocalFolderPath == \"\" ||\n\t\t(*dpUsername != \"\" && *dpRestURL == \"\" && *dpSomaURL == \"\") {\n\t\tusage(1)\n\t}\n\n}", "func (o PruneBuildsOptions) Validate() error {\n\tif o.KeepYoungerThan < 0 {\n\t\treturn fmt.Errorf(\"--keep-younger-than must be greater than or equal to 0\")\n\t}\n\tif o.KeepComplete < 0 {\n\t\treturn fmt.Errorf(\"--keep-complete must be greater than or equal to 0\")\n\t}\n\tif o.KeepFailed < 0 {\n\t\treturn fmt.Errorf(\"--keep-failed must be greater than or equal to 0\")\n\t}\n\treturn nil\n}", "func (o *Opts) Validate() error {\n\tvar e []string\n\tif o.Queue == 0 {\n\t\te = append(e, \"queue size must be greater than 0\")\n\t}\n\tif len(e) > 0 {\n\t\treturn fmt.Errorf(\"%s\", strings.Join(e, \"; \"))\n\t}\n\treturn nil\n}", "func (m *BuildFlagRevisionCoreAllOf0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDefaults(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateValues(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}", "func (o *conversionOptions) validate() error {\r\n\tif o.goalID == 0 && len(o.goalName) == 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute(s): %s or %s\", fieldID, fieldName)\r\n\t} else if o.goalID == 0 && o.tonicPowUserID > 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute: %s\", fieldID)\r\n\t} else if o.tonicPowUserID == 0 && len(o.tncpwSession) == 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute(s): %s or %s\", fieldVisitorSessionGUID, fieldUserID)\r\n\t}\r\n\treturn nil\r\n}", "func (DockerBuildArgs) validate() error {\n\treturn nil\n}", "func checkFlags(ci *ConnectionInfo) error {\n\n\tif len(os.Args) < 2 {\n\t\tusage()\n\t\tmsg := \"create or delete sub command is required\"\n\t\treturn errors.New(msg)\n\t}\n\n\tcreateCommand := flag.NewFlagSet(createArg, flag.ExitOnError)\n\tcreateNamePtr := createCommand.String(\"name\", \"\", \"name of instance to create. (Required)\")\n\tcreateSizePtr := createCommand.String(\"size\", \"\", \"size of instance to create. (Required)\")\n\tcreateHostGroupPtr := createCommand.Int(\"group\", 0, \"hostgroup_id to use. (Required)\")\n\tcreateHostProfilePtr := createCommand.String(\"profile\", \"0\", \"compute_profile_id to use. (Required)\")\n\n\tdeleteCommand := flag.NewFlagSet(deleteArg, flag.ExitOnError)\n\tdeleteNamePtr := deleteCommand.String(\"name\", \"\", \"name of instance to delete. (Required)\")\n\n\tswitch os.Args[1] {\n\tcase createArg:\n\t\terr := createCommand.Parse(os.Args[2:])\n\t\tlogerr(err)\n\tcase deleteArg:\n\t\terr := deleteCommand.Parse(os.Args[2:])\n\t\tlogerr(err)\n\t\tci.Action = deleteArg\n\tdefault:\n\t\tusage()\n\t\tos.Exit(1)\n\t}\n\n\tif createCommand.Parsed() {\n\t\tif *createNamePtr == \"\" {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"hostname needs to be provided\"\n\t\t\treturn errors.New(msg)\n\t\t}\n\n\t\tmatch, _ := regexp.MatchString(\"^[a-zA-Z0-9.]{1,20}$\", *createNamePtr)\n\n\t\tif !match {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"hostname needs to be alphanumerical and less than 15 characters\"\n\t\t\treturn errors.New(msg)\n\t\t}\n\n\t\tci.Hostname = *createNamePtr\n\t\tif *createSizePtr == \"\" {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"size needs to be provided\"\n\t\t\treturn errors.New(msg)\n\t\t}\n\n\t\tci.Group = *createHostGroupPtr\n\t\tif *createHostGroupPtr == 0 {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"hostgroup_id needs to be provided\"\n\t\t\treturn errors.New(msg)\n\t\t}\n\n\t\tci.Profile = *createHostProfilePtr\n\t\tif *createHostProfilePtr == \"\" {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"compute_profile_id needs to be provided\"\n\t\t\treturn errors.New(msg)\n\t\t}\n\t}\n\tif deleteCommand.Parsed() {\n\t\tif *deleteNamePtr == \"\" {\n\t\t\tdeleteCommand.PrintDefaults()\n\t\t\tmsg := \"hostname needs to be provided\"\n\t\t\treturn errors.New(msg)\n\t\t}\n\t\tci.Hostname = *deleteNamePtr\n\n\t}\n\tci.Size = *createSizePtr\n\n\treturn nil\n}", "func (o *options) validate() error {\n\treturn nil\n}", "func checkValid(args []string) bool {\n\tfor _, item := range args {\n\t\tif item == \"bug\" || item == \"fish\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *Options) Validate() error {\n\tif len(o.args) > 0 {\n\t\treturn errors.New(\"no argument is allowed\")\n\t}\n\tif o.useServicePrincipal && o.useUserPrincipal {\n\t\treturn errors.New(\"service principal and user principal cannot be used at the same time\")\n\t}\n\treturn nil\n}", "func validateWriteOptions(opts *cli.Options) error {\n\treturn nil\n}", "func (opts *Options) Validate() error {\n\tif opts.LockTimeout < 0 {\n\t\treturn errors.New(\"cannot have negative lock timeout\")\n\t}\n\n\tif opts.LockTimeout == 0 {\n\t\topts.LockTimeout = amboy.LockTimeout\n\t}\n\n\tif opts.PoolSize == 0 {\n\t\topts.PoolSize = runtime.NumCPU()\n\t}\n\n\tif opts.WaitInterval == 0 {\n\t\topts.WaitInterval = 100 * time.Millisecond\n\t}\n\n\tif opts.SchemaName == \"\" {\n\t\topts.SchemaName = \"amboy\"\n\t}\n\n\treturn nil\n}", "func (opt *Options) Valid() bool {\n\tif err := compile(opt.Regex, opt.Case); err != nil {\n\t\tfmt.Fprintln(Stderr, color.RedString(\"Find pattern: %s\", err.Error()))\n\t\treturn false\n\t}\n\n\tif err := compile(opt.Ignore, opt.Case); err != nil {\n\t\tfmt.Fprintln(Stderr, color.RedString(\"Ignore pattern: %s\", err.Error()))\n\t\treturn false\n\t}\n\n\tif opt.Regex == \"\" {\n\t\tfmt.Fprintln(Stderr, color.RedString(\"Find pattern cannot be empty.\"))\n\t\treturn false\n\t}\n\n\treturn true\n}", "func itValidatesLocketFlags(args ...string) {\n\tContext(\"Locket Flag Validation\", func() {\n\t\tIt(\"exits with status 3 when no locket flags are specified\", func() {\n\t\t\tcmd := exec.Command(cfdotPath, args...)\n\n\t\t\tsess, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)\n\t\t\tExpect(err).NotTo(HaveOccurred())\n\t\t\tEventually(sess.Exited).Should(BeClosed())\n\n\t\t\tExpect(sess.ExitCode()).To(Equal(3))\n\t\t})\n\t})\n}", "func validateOptions(opts *initClusterRegistryOptions) error {\n\topts.apiServerServiceType = v1.ServiceType(opts.apiServerServiceTypeString)\n\tif opts.apiServerServiceType != v1.ServiceTypeLoadBalancer && opts.apiServerServiceType != v1.ServiceTypeNodePort {\n\t\treturn fmt.Errorf(\"invalid %s: %s, should be either %s or %s\", apiserverServiceTypeFlag, opts.apiServerServiceType, v1.ServiceTypeLoadBalancer, v1.ServiceTypeNodePort)\n\t}\n\tif opts.apiServerAdvertiseAddress != \"\" {\n\t\tip := net.ParseIP(opts.apiServerAdvertiseAddress)\n\t\tif ip == nil {\n\t\t\treturn fmt.Errorf(\"invalid %s: %s, should be a valid ip address\", apiserverAdvertiseAddressFlag, opts.apiServerAdvertiseAddress)\n\t\t}\n\t\tif opts.apiServerServiceType != v1.ServiceTypeNodePort {\n\t\t\treturn fmt.Errorf(\"%s should be passed only with '%s=NodePort'\", apiserverAdvertiseAddressFlag, apiserverServiceTypeFlag)\n\t\t}\n\t}\n\n\tif opts.apiServerNodePortPort != 0 {\n\t\tif opts.apiServerServiceType != v1.ServiceTypeNodePort {\n\t\t\treturn fmt.Errorf(\"%s should be passed only with '%s=NodePort'\", apiserverPortFlag, apiserverServiceTypeFlag)\n\t\t}\n\t\topts.apiServerNodePortPortPtr = &opts.apiServerNodePortPort\n\t} else {\n\t\topts.apiServerNodePortPortPtr = nil\n\t}\n\tif opts.apiServerNodePortPort < 0 || opts.apiServerNodePortPort > 65535 {\n\t\treturn fmt.Errorf(\"Please provide a valid port number for %s\", apiserverPortFlag)\n\t}\n\n\treturn nil\n}", "func validate(c *cli.Context) error {\n\t// load configuration\n\tif len(c.String(\"org\")) == 0 {\n\t\terr := c.Set(\"org\", c.String(\"org\"))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to set context: %w\", err)\n\t\t}\n\t}\n\n\tif len(c.String(\"repo\")) == 0 {\n\t\terr := c.Set(\"repo\", c.String(\"repo\"))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to set context: %w\", err)\n\t\t}\n\t}\n\n\t// validate the user input in the command\n\tif len(c.String(\"org\")) == 0 {\n\t\treturn util.InvalidCommand(\"org\")\n\t}\n\n\tif len(c.String(\"repo\")) == 0 {\n\t\treturn util.InvalidCommand(\"repo\")\n\t}\n\n\treturn nil\n}", "func (o *overrideOpts) Validate() error {\n\tif err := o.validateAppName(); err != nil {\n\t\treturn err\n\t}\n\treturn o.validateCDKLang()\n}", "func (crc *CasbinRuleCreate) check() error {\n\tif _, ok := crc.mutation.PType(); !ok {\n\t\treturn &ValidationError{Name: \"p_type\", err: errors.New(\"ent: missing required field \\\"p_type\\\"\")}\n\t}\n\tif _, ok := crc.mutation.V0(); !ok {\n\t\treturn &ValidationError{Name: \"v0\", err: errors.New(\"ent: missing required field \\\"v0\\\"\")}\n\t}\n\tif _, ok := crc.mutation.V1(); !ok {\n\t\treturn &ValidationError{Name: \"v1\", err: errors.New(\"ent: missing required field \\\"v1\\\"\")}\n\t}\n\tif _, ok := crc.mutation.V2(); !ok {\n\t\treturn &ValidationError{Name: \"v2\", err: errors.New(\"ent: missing required field \\\"v2\\\"\")}\n\t}\n\tif _, ok := crc.mutation.V3(); !ok {\n\t\treturn &ValidationError{Name: \"v3\", err: errors.New(\"ent: missing required field \\\"v3\\\"\")}\n\t}\n\tif _, ok := crc.mutation.V4(); !ok {\n\t\treturn &ValidationError{Name: \"v4\", err: errors.New(\"ent: missing required field \\\"v4\\\"\")}\n\t}\n\tif _, ok := crc.mutation.V5(); !ok {\n\t\treturn &ValidationError{Name: \"v5\", err: errors.New(\"ent: missing required field \\\"v5\\\"\")}\n\t}\n\treturn nil\n}", "func conflictCheckForDevfileFlag(args []string, registryName string) error {\n\t// More than one arguments should not be allowed when --devfile is used\n\tif len(args) > 1 {\n\t\treturn &DevfileExistsExtraArgsError{len(args)}\n\t}\n\t// Check if both --devfile and --registry flag are used, in which case raise an error\n\tif registryName != \"\" {\n\t\treturn &DevfileFlagWithRegistryFlagError{}\n\t}\n\treturn nil\n}", "func (cfg *Config) validate() error {\n\tif cfg.Range&^rangebits != 0 && cfg.Range != 1 {\n\t\treturn ErrBadRange\n\t}\n\treturn nil\n}", "func (m *Arg) Validate() error {\n\tif m.Options != nil {\n\t\tfor _, r := range *m.Options {\n\t\t\tif err := r.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func verify(err error, str interface{}) {\n\tif err != nil {\n\t\tfmt.Printf(\"Error retrieving flag for %s \\n\", str)\n\t\tos.Exit(1)\n\t}\n}", "func parseAndValidateFlags(deployableUnitSet goldpushk.DeployableUnitSet, instances, services, canaries []string) (deployableUnits, canariedDeployableUnits []goldpushk.DeployableUnit, err error) {\n\t// Deduplicate inputs.\n\tinstances = util.SSliceDedup(instances)\n\tservices = util.SSliceDedup(services)\n\tcanaries = util.SSliceDedup(canaries)\n\n\t// Determine whether --instances or --services are set to \"all\".\n\tallInstances := containsWildcardValue(instances)\n\tallServices := containsWildcardValue(services)\n\n\t// If --instances or --services contain the special \"all\" value, they should\n\t// not contain any other values.\n\tif allInstances && len(instances) != 1 {\n\t\treturn nil, nil, errors.New(\"flag --instances should contain either \\\"all\\\" or a list of Gold instances, but not both\")\n\t}\n\tif allServices && len(services) != 1 {\n\t\treturn nil, nil, errors.New(\"flag --services should contain either \\\"all\\\" or a list of Gold services, but not both\")\n\t}\n\tif allInstances && allServices {\n\t\treturn nil, nil, errors.New(\"cannot set both --instances and --services to \\\"all\\\"\")\n\t}\n\n\t// Validate instances.\n\tif !allInstances {\n\t\tfor _, instanceStr := range instances {\n\t\t\tif !deployableUnitSet.IsKnownInstance(goldpushk.Instance(instanceStr)) {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"unknown Gold instance: \\\"%s\\\"\", instanceStr)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate services.\n\tif !allServices {\n\t\tfor _, serviceStr := range services {\n\t\t\tif !deployableUnitSet.IsKnownService(goldpushk.Service(serviceStr)) {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"unknown Gold service: \\\"%s\\\"\", serviceStr)\n\t\t\t}\n\t\t}\n\t}\n\n\t// This slice will be populated with the subset of the cartesian product of\n\t// flags --instances and --services that is found in the services map.\n\tvar servicesToDeploy []goldpushk.DeployableUnitID\n\n\t// Determines whether or not an instance/service pair should be canaried.\n\tisMarkedForCanarying := map[goldpushk.DeployableUnitID]bool{}\n\n\t// Determine the set of instances over which to iterate to compute the\n\t// cartesian product of flags --instances and --services.\n\tvar instanceIterationSet []goldpushk.Instance\n\tif containsWildcardValue(instances) {\n\t\t// Handle the \"all\" value.\n\t\tinstanceIterationSet = deployableUnitSet.KnownInstances()\n\t} else {\n\t\tfor _, instanceStr := range instances {\n\t\t\tinstanceIterationSet = append(instanceIterationSet, goldpushk.Instance(instanceStr))\n\t\t}\n\t}\n\n\t// Determine the set of services over which to iterate to compute the\n\t// cartesian product of flags --instances and --services.\n\tvar serviceIterationSet []goldpushk.Service\n\tif containsWildcardValue(services) {\n\t\t// Handle the \"all\" value.\n\t\tserviceIterationSet = deployableUnitSet.KnownServices()\n\t} else {\n\t\tfor _, serviceStr := range services {\n\t\t\tserviceIterationSet = append(serviceIterationSet, goldpushk.Service(serviceStr))\n\t\t}\n\t}\n\n\t// Iterate over the cartesian product of flags --instances and --services.\n\tfor _, instance := range instanceIterationSet {\n\t\tfor _, service := range serviceIterationSet {\n\t\t\tid := goldpushk.DeployableUnitID{\n\t\t\t\tInstance: instance,\n\t\t\t\tService: service,\n\t\t\t}\n\n\t\t\t// Skip if the current instance/service combination is not found in the services map.\n\t\t\tif _, ok := deployableUnitSet.Get(id); !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Save instance/service pair, which is not marked for canarying by default.\n\t\t\tservicesToDeploy = append(servicesToDeploy, id)\n\t\t\tisMarkedForCanarying[id] = false\n\t\t}\n\t}\n\n\t// Fail if --instances and --services didn't match any services in the services map.\n\tif len(servicesToDeploy) == 0 {\n\t\treturn nil, nil, errors.New(\"no known Gold services match the values supplied with --instances and --services\")\n\t}\n\n\t// Iterate over the --canaries flag.\n\tfor _, canaryStr := range canaries {\n\t\t// Validate format and extract substrings.\n\t\tcanaryStrSplit := strings.Split(canaryStr, \":\")\n\t\tif len(canaryStrSplit) != 2 || len(canaryStrSplit[0]) == 0 || len(canaryStrSplit[1]) == 0 {\n\t\t\treturn nil, nil, fmt.Errorf(\"invalid canary format: \\\"%s\\\"\", canaryStr)\n\t\t}\n\n\t\tinstance := goldpushk.Instance(canaryStrSplit[0])\n\t\tservice := goldpushk.Service(canaryStrSplit[1])\n\t\tinstanceServicePair := goldpushk.DeployableUnitID{\n\t\t\tInstance: instance,\n\t\t\tService: service,\n\t\t}\n\n\t\t// Validate canary subcomponents.\n\t\tif !deployableUnitSet.IsKnownInstance(instance) {\n\t\t\treturn nil, nil, fmt.Errorf(\"invalid canary - unknown Gold instance: \\\"%s\\\"\", canaryStr)\n\t\t}\n\t\tif !deployableUnitSet.IsKnownService(service) {\n\t\t\treturn nil, nil, fmt.Errorf(\"invalid canary - unknown Gold service: \\\"%s\\\"\", canaryStr)\n\t\t}\n\n\t\t// Canaries should match the services provided with --instances and --services.\n\t\tif _, ok := isMarkedForCanarying[instanceServicePair]; !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\"canary does not match any targeted services: \\\"%s\\\"\", canaryStr)\n\t\t}\n\n\t\t// Mark instance/service pair for canarying.\n\t\tisMarkedForCanarying[instanceServicePair] = true\n\t}\n\n\t// Sort services to deploy to generate a deterministic output.\n\tsort.Slice(servicesToDeploy, func(i, j int) bool {\n\t\ta := servicesToDeploy[i]\n\t\tb := servicesToDeploy[j]\n\t\treturn a.Instance < b.Instance || (a.Instance == b.Instance && a.Service < b.Service)\n\t})\n\n\t// Build outputs.\n\tfor _, instanceServicePair := range servicesToDeploy {\n\t\tdeployment, ok := deployableUnitSet.Get(instanceServicePair)\n\t\tif !ok {\n\t\t\tsklog.Fatalf(\"DeployableUnit \\\"%s\\\" not found in deployableUnitSet\", deployment.CanonicalName())\n\t\t}\n\n\t\tif isMarkedForCanarying[instanceServicePair] {\n\t\t\tcanariedDeployableUnits = append(canariedDeployableUnits, deployment)\n\t\t} else {\n\t\t\tdeployableUnits = append(deployableUnits, deployment)\n\t\t}\n\t}\n\n\t// If all services to be deployed are marked for canarying, it probably\n\t// indicates a user error.\n\tif len(deployableUnits) == 0 {\n\t\treturn nil, nil, errors.New(\"all targeted services are marked for canarying\")\n\t}\n\n\treturn deployableUnits, canariedDeployableUnits, nil\n}", "func (do *DescribeOptions) Validate() (err error) {\n\tisExists, err := component.Exists(do.Context.Client, do.componentName, do.Context.Application)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !isExists {\n\t\treturn fmt.Errorf(\"component %s does not exist\", do.componentName)\n\t}\n\n\treturn odoutil.CheckOutputFlag(do.outputFlag)\n}", "func (opt EditPullRequestOption) Validate(c *Client) error {\n\tif len(opt.Title) != 0 && len(strings.TrimSpace(opt.Title)) == 0 {\n\t\treturn fmt.Errorf(\"title is empty\")\n\t}\n\tif len(opt.Base) != 0 {\n\t\tif err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != nil {\n\t\t\treturn fmt.Errorf(\"can not change base gitea to old\")\n\t\t}\n\t}\n\treturn nil\n}", "func (o *Options) validate() error {\n\tif len(o.BindAddress) == 0 {\n\t\treturn fmt.Errorf(\"missing bind address\")\n\t}\n\n\tif o.Port == 0 {\n\t\treturn fmt.Errorf(\"missing port\")\n\t}\n\n\tif len(o.ServerCertDir) == 0 {\n\t\treturn fmt.Errorf(\"missing server tls cert path\")\n\t}\n\n\treturn nil\n}", "func (m *OverrideCheck) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (CommandOverride) validate() error {\n\treturn nil\n}", "func (opts *Options) Validate() error {\n\tif len(opts.VersionFile) == 0 {\n\t\topts.VersionFile = \"version.go\"\n\t}\n\tif len(opts.BuildPath) == 0 {\n\t\topts.BuildPath = \".\"\n\t}\n\tif len(opts.MainFile) > 0 {\n\t\tif filepath.Ext(opts.MainFile) != \".go\" {\n\t\t\treturn fmt.Errorf(\"%s is not a .go file\", opts.MainFile)\n\t\t}\n\t\topts.BuildPath = filepath.Dir(opts.MainFile)\n\t\tif len(opts.BuildPath) > 0 {\n\t\t\topts.BuildPath = \"./\" + opts.BuildPath\n\t\t}\n\t}\n\tif len(opts.Root) == 0 {\n\t\treturn fmt.Errorf(\"root can not be empty\")\n\t}\n\treturn nil\n}", "func itValidatesBBSFlags(args ...string) {\n\tContext(\"BBS Flag Validation\", func() {\n\t\tIt(\"exits with status 3 when no bbs flags are specified\", func() {\n\t\t\tcmd := exec.Command(cfdotPath, args...)\n\n\t\t\tsess, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)\n\t\t\tExpect(err).NotTo(HaveOccurred())\n\t\t\tEventually(sess.Exited).Should(BeClosed())\n\n\t\t\tExpect(sess.ExitCode()).To(Equal(3))\n\t\t})\n\t})\n}", "func (o DeleteOptions) Validate(c *cobra.Command, args []string) error {\n\treturn nil\n}", "func (ctl *Ctl) CheckSpecFlags() error {\n\tencryptPassLength := len(ctl.EncryptionPassword)\n\tif encryptPassLength > 0 && encryptPassLength < 16 {\n\t\treturn fmt.Errorf(\"flag EncryptionPassword is %d characters. Must be 16 or more characters\", encryptPassLength)\n\t}\n\tglobalSaltLength := len(ctl.EncryptionGlobalSalt)\n\tif globalSaltLength > 0 && globalSaltLength < 16 {\n\t\treturn fmt.Errorf(\"flag EncryptionGlobalSalt is %d characters. Must be 16 or more characters\", globalSaltLength)\n\t}\n\treturn nil\n}", "func (opts *Options) Validate() error {\n\tif len(opts.GitHubToken) == 0 {\n\t\topts.GitHubToken = envy.Get(\"GITHUB_TOKEN\", \"\")\n\t\tif len(opts.GitHubToken) == 0 {\n\t\t\treturn fmt.Errorf(\"you must set a GITHUB_TOKEN\")\n\t\t}\n\t}\n\tif len(opts.Version) == 0 {\n\t\topts.Version = \"v0.0.1\"\n\t}\n\n\tif !strings.HasPrefix(opts.Version, \"v\") {\n\t\topts.Version = \"v\" + opts.Version\n\t}\n\n\tv, err := semver.NewVersion(strings.TrimPrefix(opts.Version, \"v\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\topts.semVersion = v\n\tif len(opts.Branch) == 0 {\n\t\topts.Branch = \"master\"\n\t}\n\treturn nil\n}", "func (fm *FieldModelFlagsSimple) Verify() bool { return true }", "func (acc *AccessControlCreate) check() error {\n\tif _, ok := acc.mutation.ServiceID(); !ok {\n\t\treturn &ValidationError{Name: \"service_id\", err: errors.New(\"ent: missing required field \\\"service_id\\\"\")}\n\t}\n\tif _, ok := acc.mutation.OpenAuth(); !ok {\n\t\treturn &ValidationError{Name: \"open_auth\", err: errors.New(\"ent: missing required field \\\"open_auth\\\"\")}\n\t}\n\tif _, ok := acc.mutation.BlackList(); !ok {\n\t\treturn &ValidationError{Name: \"black_list\", err: errors.New(\"ent: missing required field \\\"black_list\\\"\")}\n\t}\n\tif _, ok := acc.mutation.WhiteList(); !ok {\n\t\treturn &ValidationError{Name: \"white_list\", err: errors.New(\"ent: missing required field \\\"white_list\\\"\")}\n\t}\n\tif _, ok := acc.mutation.WhiteHostName(); !ok {\n\t\treturn &ValidationError{Name: \"white_host_name\", err: errors.New(\"ent: missing required field \\\"white_host_name\\\"\")}\n\t}\n\tif _, ok := acc.mutation.ClientipFlowLimit(); !ok {\n\t\treturn &ValidationError{Name: \"clientip_flow_limit\", err: errors.New(\"ent: missing required field \\\"clientip_flow_limit\\\"\")}\n\t}\n\tif _, ok := acc.mutation.ServiceFlowLimit(); !ok {\n\t\treturn &ValidationError{Name: \"service_flow_limit\", err: errors.New(\"ent: missing required field \\\"service_flow_limit\\\"\")}\n\t}\n\treturn nil\n}", "func ValidateCommonArguments(flags *flag.FlagSet) (*CommonArguments, error) {\n\tversion, err := flags.GetString(\"version\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdebug, err := flags.GetBool(\"debug\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttimeout, err := flags.GetInt(\"timeout\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &CommonArguments{\n\t\tVersion: version,\n\t\tDebug: debug,\n\t\tTimeout: time.Duration(timeout) * time.Second,\n\t}, nil\n}", "func (o *ChonkOptions) Validate() error {\n\tif len(o.args) > 0 {\n\t\treturn fmt.Errorf(\"no arguments expected\")\n\t}\n\n\treturn nil\n}", "func (c layout) validate() error {\n\tlog.Println(\"[CONFIG] Validating...\")\n\tvar stateNames = make(map[string]struct{})\n\tfor _, state := range c.States {\n\t\t// Address must be given\n\t\tif state.Address == \"\" {\n\t\t\treturn fmt.Errorf(\"[CONFIG] no address: '%s'\", state.Name)\n\t\t}\n\t\t// Address must be unique\n\t\tif _, exists := stateNames[state.Address]; exists {\n\t\t\treturn fmt.Errorf(\"[CONFIG] statename conflict, please check: '%s'\", state.Name)\n\t\t}\n\t}\n\treturn nil\n}", "func (x *fastReflection_FlagOptions) IsValid() bool {\n\treturn x != nil\n}", "func (o *addBaseOptions) Validate(args []string) error {\n\tif len(args) != 1 {\n\t\treturn errors.New(\"must specify a base directory\")\n\t}\n\to.baseDirectoryPaths = args[0]\n\treturn nil\n}", "func (gs GenesisState) Validate() error {\n\t// Check for duplicated index in proposedUpgrade\n\tproposedUpgradeIndexMap := make(map[string]struct{})\n\n\tfor _, elem := range gs.ProposedUpgradeList {\n\t\tindex := string(ProposedUpgradeKey(elem.Plan.Name))\n\t\tif _, ok := proposedUpgradeIndexMap[index]; ok {\n\t\t\treturn fmt.Errorf(\"duplicated index for proposedUpgrade\")\n\t\t}\n\n\t\tproposedUpgradeIndexMap[index] = struct{}{}\n\t}\n\t// Check for duplicated index in approvedUpgrade\n\tapprovedUpgradeIndexMap := make(map[string]struct{})\n\n\tfor _, elem := range gs.ApprovedUpgradeList {\n\t\tindex := string(ApprovedUpgradeKey(elem.Plan.Name))\n\t\tif _, ok := approvedUpgradeIndexMap[index]; ok {\n\t\t\treturn fmt.Errorf(\"duplicated index for approvedUpgrade\")\n\t\t}\n\n\t\tapprovedUpgradeIndexMap[index] = struct{}{}\n\t}\n\t// Check for duplicated index in rejectedUpgrade\n\trejectedUpgradeIndexMap := make(map[string]struct{})\n\n\tfor _, elem := range gs.RejectedUpgradeList {\n\t\tindex := string(RejectedUpgradeKey(elem.Plan.Name))\n\t\tif _, ok := rejectedUpgradeIndexMap[index]; ok {\n\t\t\treturn fmt.Errorf(\"duplicated index for rejectedUpgrade\")\n\t\t}\n\t\trejectedUpgradeIndexMap[index] = struct{}{}\n\t}\n\t// this line is used by starport scaffolding # genesis/types/validate\n\n\treturn nil\n}", "func (h NLBHealthCheckArgs) validate() error {\n\tif h.isEmpty() {\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (r OverrideRule) validate() error {\n\tfor _, s := range invalidTaskDefOverridePathRegexp {\n\t\tre := regexp.MustCompile(fmt.Sprintf(`^%s$`, s))\n\t\tif re.MatchString(r.Path) {\n\t\t\treturn fmt.Errorf(`\"%s\" cannot be overridden with a custom value`, s)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *selection) validate() error {\n\tif s.hasAntiAffinityLabel() && s.hasPreferAntiAffinityLabel() {\n\t\treturn errors.New(\"invalid selection: both antiAffinityLabel and preferAntiAffinityLabel policies can not be together\")\n\t}\n\treturn nil\n}", "func (arc *AppointmentResultsCreate) check() error {\n\tif _, ok := arc.mutation.CauseAppoint(); !ok {\n\t\treturn &ValidationError{Name: \"causeAppoint\", err: errors.New(\"ent: missing required field \\\"causeAppoint\\\"\")}\n\t}\n\tif v, ok := arc.mutation.CauseAppoint(); ok {\n\t\tif err := appointmentresults.CauseAppointValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"causeAppoint\", err: fmt.Errorf(\"ent: validator failed for field \\\"causeAppoint\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := arc.mutation.Advice(); !ok {\n\t\treturn &ValidationError{Name: \"advice\", err: errors.New(\"ent: missing required field \\\"advice\\\"\")}\n\t}\n\tif v, ok := arc.mutation.Advice(); ok {\n\t\tif err := appointmentresults.AdviceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"advice\", err: fmt.Errorf(\"ent: validator failed for field \\\"advice\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := arc.mutation.DateAppoint(); !ok {\n\t\treturn &ValidationError{Name: \"dateAppoint\", err: errors.New(\"ent: missing required field \\\"dateAppoint\\\"\")}\n\t}\n\tif _, ok := arc.mutation.TimeAppoint(); !ok {\n\t\treturn &ValidationError{Name: \"timeAppoint\", err: errors.New(\"ent: missing required field \\\"timeAppoint\\\"\")}\n\t}\n\tif _, ok := arc.mutation.AddtimeSave(); !ok {\n\t\treturn &ValidationError{Name: \"addtimeSave\", err: errors.New(\"ent: missing required field \\\"addtimeSave\\\"\")}\n\t}\n\tif _, ok := arc.mutation.HourBeforeAppoint(); !ok {\n\t\treturn &ValidationError{Name: \"hourBeforeAppoint\", err: errors.New(\"ent: missing required field \\\"hourBeforeAppoint\\\"\")}\n\t}\n\tif v, ok := arc.mutation.HourBeforeAppoint(); ok {\n\t\tif err := appointmentresults.HourBeforeAppointValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hourBeforeAppoint\", err: fmt.Errorf(\"ent: validator failed for field \\\"hourBeforeAppoint\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := arc.mutation.MinuteBeforeAppoint(); !ok {\n\t\treturn &ValidationError{Name: \"minuteBeforeAppoint\", err: errors.New(\"ent: missing required field \\\"minuteBeforeAppoint\\\"\")}\n\t}\n\tif v, ok := arc.mutation.MinuteBeforeAppoint(); ok {\n\t\tif err := appointmentresults.MinuteBeforeAppointValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"minuteBeforeAppoint\", err: fmt.Errorf(\"ent: validator failed for field \\\"minuteBeforeAppoint\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "func (v Versioning) Validate() error {\n\t// Not supported yet\n\t// switch v.MFADelete {\n\t// case Enabled, Disabled:\n\t// default:\n\t// \treturn Errorf(\"unsupported MFADelete state %s\", v.MFADelete)\n\t// }\n\tswitch v.Status {\n\tcase Enabled, Suspended:\n\tdefault:\n\t\treturn Errorf(\"unsupported Versioning status %s\", v.Status)\n\t}\n\treturn nil\n}", "func (f FIFOTopicAdvanceConfigOrBool) validate() error {\n\tif f.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn f.Advanced.validate()\n}", "func (gto *GetOptions) Validate() (err error) {\n\treturn\n}", "func (v *Validator) ensureValid(states map[string]map[string]*ParameterValidationState) {\n\tfor section, options := range *v {\n\t\toptionStates := states[section]\n\n\t\tfor option, constraints := range options {\n\t\t\tstate := optionStates[option]\n\n\t\t\tif state.Present && state.TypeError == nil {\n\t\t\t\tstate.ValidationError = constraints.Validator(state.Value)\n\t\t\t}\n\t\t}\n\t}\n}", "func CheckFlags(sampler config.Sampler) (int, bool) {\n\tif helpConfig {\n\t\tsampler.Sample(os.Stdout, nil, nil)\n\t\treturn 0, false\n\t}\n\tif version {\n\t\tfmt.Printf(VersionInfo())\n\t\treturn 0, false\n\t}\n\tif configFile == \"\" {\n\t\tfmt.Fprintln(os.Stderr, \"Err: Missing config file\")\n\t\tflag.Usage()\n\t\treturn 1, false\n\t}\n\treturn 0, true\n}", "func (o *initJobOpts) Validate() error {\n\t// If this app is pending creation, we'll skip validation.\n\tif !o.wsPendingCreation {\n\t\tif err := validateWorkspaceApp(o.wsAppName, o.appName, o.store); err != nil {\n\t\t\treturn err\n\t\t}\n\t\to.appName = o.wsAppName\n\t}\n\tif o.dockerfilePath != \"\" && o.image != \"\" {\n\t\treturn fmt.Errorf(\"--%s and --%s cannot be specified together\", dockerFileFlag, imageFlag)\n\t}\n\tif o.dockerfilePath != \"\" {\n\t\tif _, err := o.fs.Stat(o.dockerfilePath); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.timeout != \"\" {\n\t\tif err := validateTimeout(o.timeout); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.retries < 0 {\n\t\treturn errors.New(\"number of retries must be non-negative\")\n\t}\n\treturn nil\n}", "func mutuallyExclusiveArgs(required bool, flags ...string) cli.BeforeFunc {\n\treturn func(c *cli.Context) error {\n\t\tprovidedCount := 0\n\t\tfor _, flag := range flags {\n\t\t\tif c.IsSet(flag) {\n\t\t\t\tprovidedCount++\n\t\t\t}\n\t\t}\n\n\t\tif providedCount > 1 {\n\t\t\treturn errors.Errorf(\"only one of (%s) can be set\", strings.Join(flags, \" | \"))\n\t\t}\n\n\t\tif required && providedCount == 0 {\n\t\t\treturn errors.Errorf(\"one of (%s) must be set\", strings.Join(flags, \" | \"))\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func (pu *PendingloanbindingUpdate) check() error {\n\tif v, ok := pu.mutation.WalletID(); ok {\n\t\tif err := pendingloanbinding.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 := pu.mutation.NameLB(); ok {\n\t\tif err := pendingloanbinding.NameLBValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"NameLB\", err: fmt.Errorf(\"ent: validator failed for field \\\"NameLB\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.CAWalletID(); ok {\n\t\tif err := pendingloanbinding.CAWalletIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"CAWalletID\", err: fmt.Errorf(\"ent: validator failed for field \\\"CAWalletID\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.CAPort(); ok {\n\t\tif err := pendingloanbinding.CAPortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"CAPort\", err: fmt.Errorf(\"ent: validator failed for field \\\"CAPort\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.MainBranch(); ok {\n\t\tif err := pendingloanbinding.MainBranchValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"MainBranch\", err: fmt.Errorf(\"ent: validator failed for field \\\"MainBranch\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "func (cmd *Command) validate() error {\n\tif len(cmd.Command) == 0 || len(cmd.Command) > 32 {\n\t\treturn errCommandLength(cmd.Command)\n\t}\n\tfor x := 0; x < len(cmd.Command); x++ {\n\t\tb := cmd.Command[x]\n\t\tif b >= 'a' && b <= 'z' {\n\t\t\tcontinue\n\t\t}\n\t\tif b >= '0' && b <= '9' {\n\t\t\tcontinue\n\t\t}\n\t\tif b == '_' {\n\t\t\tcontinue\n\t\t}\n\t\treturn errCommandValue(cmd.Command)\n\t}\n\tif len(cmd.Description) < 3 || len(cmd.Description) > 256 {\n\t\treturn errDescLength(cmd.Command)\n\t}\n\tif cmd.Handler == nil {\n\t\treturn errHandlerNil(cmd.Command)\n\t}\n\treturn nil\n}", "func (f *BigQueryTablesCreateFlags) Validate() error {\n\tif err := f.DataCoordinates.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := f.Authentication.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cv checkValidator) validateDiff(ctx *sql.Context, diff tree.ThreeWayDiff) (int, error) {\n\tconflictCount := 0\n\n\tvar valueTuple val.Tuple\n\tvar valueDesc val.TupleDesc\n\tswitch diff.Op {\n\tcase tree.DiffOpLeftDelete, tree.DiffOpRightDelete, tree.DiffOpConvergentDelete:\n\t\t// no need to validate check constraints for deletes\n\t\treturn 0, nil\n\tcase tree.DiffOpDivergentDeleteConflict, tree.DiffOpDivergentModifyConflict:\n\t\t// Don't bother validating divergent conflicts, just let them get reported as conflicts\n\t\treturn 0, nil\n\tcase tree.DiffOpLeftAdd, tree.DiffOpLeftModify:\n\t\tvalueTuple = diff.Left\n\t\tvalueDesc = cv.tableMerger.leftSch.GetValueDescriptor()\n\tcase tree.DiffOpRightAdd, tree.DiffOpRightModify:\n\t\tvalueTuple = diff.Right\n\t\tvalueDesc = cv.tableMerger.rightSch.GetValueDescriptor()\n\tcase tree.DiffOpConvergentAdd, tree.DiffOpConvergentModify:\n\t\t// both sides made the same change, just take the left\n\t\tvalueTuple = diff.Left\n\t\tvalueDesc = cv.tableMerger.leftSch.GetValueDescriptor()\n\tcase tree.DiffOpDivergentModifyResolved:\n\t\tvalueTuple = diff.Merged\n\t\tvalueDesc = cv.tableMerger.leftSch.GetValueDescriptor()\n\t}\n\n\tfor checkName, checkExpression := range cv.checkExpressions {\n\t\t// If the row came from the right side of the merge, then remap it (if necessary) to the final schema.\n\t\t// This isn't necessary for left-side changes, because we already migrated the primary index data to\n\t\t// the merged schema, and we skip keyless tables, since their value tuples require different mapping\n\t\t// logic and we don't currently support merges to keyless tables that contain schema changes anyway.\n\t\tnewTuple := valueTuple\n\t\tif !cv.valueMerger.keyless && (diff.Op == tree.DiffOpRightAdd || diff.Op == tree.DiffOpRightModify) {\n\t\t\tnewTupleBytes := remapTuple(valueTuple, valueDesc, cv.valueMerger.rightMapping)\n\t\t\tnewTuple = val.NewTuple(cv.valueMerger.syncPool, newTupleBytes...)\n\t\t}\n\n\t\trow, err := buildRow(ctx, diff.Key, newTuple, cv.sch, cv.tableMerger)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tresult, err := checkExpression.Eval(ctx, row)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// MySQL treats NULL as TRUE for a check constraint\n\t\tif result == nil {\n\t\t\tresult = true\n\t\t}\n\n\t\t// Coerce into a boolean; technically, this shouldn't be\n\t\t// necessary, since check constraint expressions should always\n\t\t// be of a boolean type, but Dolt has allowed this previously.\n\t\t// https://github.com/dolthub/dolt/issues/6411\n\t\tbooleanResult, err := types.ConvertToBool(result)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"unable to convert check constraint expression (%s) into boolean value: %v\", checkName, err.Error())\n\t\t}\n\n\t\tif booleanResult {\n\t\t\t// If a check constraint returns TRUE (or NULL), then the check constraint is fulfilled\n\t\t\t// https://dev.mysql.com/doc/refman/8.0/en/create-table-check-constraints.html\n\t\t\tcontinue\n\t\t} else {\n\t\t\tconflictCount++\n\t\t\tmeta, err := newCheckCVMeta(cv.sch, checkName)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tif err = cv.insertArtifact(ctx, diff.Key, newTuple, meta); err != nil {\n\t\t\t\treturn conflictCount, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn conflictCount, nil\n}", "func (o *Options) Validate() []error {\n\tvar errs []error\n\terr := validateShowHiddenMetricsVersion(parseVersion(version.Get()), o.ShowHiddenMetricsForVersion)\n\tif err != nil {\n\t\terrs = append(errs, err)\n\t}\n\n\tif err := validateAllowMetricLabel(o.AllowListMapping); err != nil {\n\t\terrs = append(errs, err)\n\t}\n\n\tif len(errs) == 0 {\n\t\treturn nil\n\t}\n\treturn errs\n}", "func (o *deleteAppOpts) Validate() error {\n\treturn nil\n}" ]
[ "0.72560006", "0.69643456", "0.67343974", "0.66286486", "0.6615408", "0.66127414", "0.6602542", "0.6525564", "0.6356149", "0.633105", "0.6318529", "0.62671256", "0.6212336", "0.6191846", "0.6187307", "0.6179687", "0.6124491", "0.60763955", "0.6031797", "0.60196304", "0.60124415", "0.6007051", "0.5979651", "0.5977241", "0.5975475", "0.5927063", "0.5881304", "0.5851077", "0.5841534", "0.5819952", "0.58124775", "0.5788027", "0.5784296", "0.57818884", "0.5761287", "0.57499164", "0.57348657", "0.570452", "0.5696518", "0.569112", "0.56905985", "0.5645997", "0.5637207", "0.5629495", "0.5628142", "0.56271356", "0.5619962", "0.56139594", "0.5597809", "0.55950415", "0.55902344", "0.55820036", "0.55761987", "0.557245", "0.557085", "0.5556922", "0.5539288", "0.552553", "0.5523744", "0.55145925", "0.5512578", "0.54895186", "0.54786843", "0.5477939", "0.5477673", "0.546966", "0.5449953", "0.5448205", "0.54410356", "0.54378927", "0.5437565", "0.5433492", "0.5421627", "0.54177123", "0.5409849", "0.540442", "0.5394859", "0.5380809", "0.5376673", "0.5371589", "0.53656125", "0.53629845", "0.5361546", "0.5360307", "0.53593755", "0.5350035", "0.5346892", "0.5340977", "0.5339157", "0.5335785", "0.53330696", "0.53289753", "0.53245616", "0.53225636", "0.53097034", "0.5300612", "0.5294255", "0.52928483", "0.5283159", "0.52819353", "0.527839" ]
0.0
-1
Handler returns the handler function for the operation specified by the flag
func (c *Config) Handler() func(string, []string) error { if c.Add { return addKubeconfig } if c.Set { return setKubeconfig } if c.List { return listKubeconfigs } if c.Remove { return removeKubeconfig } return func(string, []string) error { return nil } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func selectFlagHandler(mapHandler http.HandlerFunc) http.HandlerFunc {\n\tif multiFlagTester() { // check if multiple flags are being used i.e. multiFlagTester returns a true or false boolean\n\t\terrMsgHandler(fmt.Sprintf(\"Cannot use multiple flags at once. Please choose only yaml or json or sql \\n\"), nil)\n\t}\n\n\tif flag.NFlag() != 0 && !reflect.DeepEqual(*jsonFilename, \"\") { // if json filename is used THEN yaml/sql flag would be empty string\n\t\tjsonHandler := jsonFlagHandler(jsonFilename, mapHandler)\n\t\tfmt.Printf(\"Now using the JSON flag with the file: %s\\n\", *jsonFilename)\n\t\treturn jsonHandler\n\t}\n\n\tif flag.NFlag() != 0 && !reflect.DeepEqual(*yamlFilename, \"\") { // if yaml filename is used THEN json/sql flags would be empty string\n\t\tyamlHandler := yamlFlagHandler(yamlFilename, mapHandler)\n\t\treturn yamlHandler\n\t}\n\n\tif flag.NFlag() != 0 && !reflect.DeepEqual(*sqlDatabasePath, \"\") { // if sql flag is used THEN yaml/json flags would be empty string\n\t\tsqlHandler := sqlFlagHandler(sqlDatabasePath, mapHandler)\n\t\treturn sqlHandler\n\t}\n\n\t// defaults to yamlHandler when no flags are selected i.e. 'flag.NFlag() returns 0'\n\t*yamlFilename = \"pathsData.yaml\"\n\tfmt.Printf(\"No file flags was set. Defaulting to file: %s\\n\", *yamlFilename)\n\tyamlHandler := yamlFlagHandler(yamlFilename, mapHandler)\n\treturn yamlHandler\n}", "func (h *simpleOperation) Handler() func(c Context) {\n\treturn h.handler\n}", "func operationHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tLoggingClient.Error(err.Error())\n\t\treturn\n\t}\n\n\to := models.Operation{}\n\tif err = o.UnmarshalJSON(b); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tLoggingClient.Error(\"error during decoding: %s\", err.Error())\n\t\treturn\n\t}\n\n\tsend, err := invokeOperation(o.Action, o.Services)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\tLoggingClient.Error(err.Error())\n\t\treturn\n\t}\n\n\tpkg.Encode(send, w, LoggingClient)\n}", "func Handler(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tvar buf bytes.Buffer\n\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": \"Okay so your other function also executed successfully!\",\n\t})\n\tif err != nil {\n\t\treturn events.APIGatewayProxyResponse{StatusCode: 404}, err\n\t}\n\tjson.HTMLEscape(&buf, body)\n\n\tresp := events.APIGatewayProxyResponse{\n\t\tStatusCode: 200,\n\t\tIsBase64Encoded: false,\n\t\tBody: buf.String(),\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"world-handler\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "func handler(w http.ResponseWriter, r *http.Request) {\n\thandlerReal(false, w, r)\n}", "func (f HandlerFunc) Serve(in Invocation) (interface{}, error) {\n\treturn f(in)\n}", "func handler(name string, options *ProcessorOptions) (IntrinsicHandler, bool) {\n\n\t// Check if we have a handler for this intrinsic type in the instrinsic handler\n\t// overrides in the options provided to Process()\n\tif options != nil {\n\t\tif h, ok := options.IntrinsicHandlerOverrides[name]; ok {\n\t\t\treturn h, true\n\t\t}\n\t}\n\n\tif h, ok := defaultIntrinsicHandlers[name]; ok {\n\t\treturn h, true\n\t}\n\n\treturn nil, false\n\n}", "func Handler(rc *Context, s storage.Store, storeExecutor kvs) {\r\n\r\n\t// Make sure all resources are cleanup after leaving\r\n\tcancelFunc := rc.CtxCancel\r\n\tdefer cancelFunc()\r\n\r\n\t// Err channel shared across\r\n\terrc := make(chan error, 1)\r\n\r\n\t// Execution call\r\n\tout := make(chan interface{}, 1)\r\n\r\n\tgo func() {\r\n\t\tdefer close(out)\r\n\t\tdefer close(errc)\r\n\r\n\t\tinb := <-httpExtractor(rc, errc)\r\n\r\n\t\tlogging.MsgFields(\r\n\t\t\trc.uID,\r\n\t\t\t\"HttpExtractor\",\r\n\t\t\tlogging.Input,\r\n\t\t\tlogging.Field{{logging.Payload, inb}})\r\n\r\n\t\tif rc.Cancelled() {\r\n\t\t\tlogging.Msg(\r\n\t\t\t\trc.uID,\r\n\t\t\t\t\"Handler\",\r\n\t\t\t\tlogging.Cancelled,\r\n\t\t\t\t\"kvs execution was cancelled from another goroutine\")\r\n\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tres, err := storeExecutor(s, inb)\r\n\r\n\t\tif err != nil {\r\n\t\t\terrc <- err\r\n\t\t\tcancelFunc()\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tselect {\r\n\t\tcase out <- res:\r\n\t\tcase <-rc.Ctx.Done():\r\n\t\t\treturn\r\n\t\t}\r\n\t}()\r\n\r\n\tHTTPResponse(rc, out, errc)\r\n}", "func svcHandler()", "func Handler(c *clevergo.Context) error {\n\tname := strings.TrimPrefix(c.Params.String(\"name\"), \"/\")\n\tif handler, ok := handlers[name]; ok {\n\t\treturn handler(c)\n\t}\n\treturn index(c)\n}", "func boolGetHandler(get func() bool) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tjsonResult(w, get())\n\t}\n}", "func (node *Node) GET(functionKeys ...string) *Handler {\n\n\th := &Handler{}\n\t\n\tif len(functionKeys) > 0 {\n\t\th.functionKey = functionKeys[0]\n\t}\n\n\tnode.addHandler(\"GET\", h)\n\n\treturn h\n}", "func (r *Route) getHandler(method string, ex *routeExecution) {\n\t// check specific method match\n\tif h, ok := r.handlers[method]; ok {\n\t\tex.handler = h\n\t\treturn\n\t}\n\n\t// if this is a HEAD we can fall back on GET\n\tif method == http.MethodHead {\n\t\tif h, ok := r.handlers[http.MethodGet]; ok {\n\t\t\tex.handler = h\n\t\t\treturn\n\t\t}\n\t}\n\n\t// check the ANY handler\n\tif h, ok := r.handlers[methodAny]; ok {\n\t\tex.handler = h\n\t\treturn\n\t}\n\n\t// last ditch effort is to generate our own method not allowed handler\n\t// this is regenerated each time in case routes are added during runtime\n\t// not generated if a previous handler is already set\n\tif ex.handler == nil {\n\t\tex.handler = r.methodNotAllowed()\n\t}\n\treturn\n}", "func (s *simpleBackgroundOperation) Handler() func(bc BackgroundContext) {\n\treturn s.handler\n}", "func (h *LambdaHandler) handler(ctx context.Context, ev events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\treturn h.gorillaMuxLambda.ProxyWithContext(ctx, ev)\n}", "func boolHandler(set func(bool) error, get func() bool) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\n\t\tval, err := strconv.ParseBool(vars[\"value\"])\n\t\tif err != nil {\n\t\t\tjsonError(w, http.StatusBadRequest, err)\n\t\t\treturn\n\t\t}\n\n\t\terr = set(val)\n\t\tif err != nil {\n\t\t\tjsonError(w, http.StatusNotAcceptable, err)\n\t\t\treturn\n\t\t}\n\n\t\tjsonResult(w, get())\n\t}\n}", "func execute(fhandler *flowHandler, request []byte) ([]byte, error) {\n\tvar result []byte\n\tvar err error\n\n\tpipeline := fhandler.getPipeline()\n\n\tcurrentNode, _ := pipeline.GetCurrentNodeDag()\n\n\t// trace node - mark as start of node\n\tfhandler.tracer.startNodeSpan(currentNode.GetUniqueId(), fhandler.id)\n\n\t// Execute all operation\n\tfor _, operation := range currentNode.Operations() {\n\n\t\tswitch {\n\t\t// If function\n\t\tcase operation.Function != \"\":\n\t\t\tfmt.Printf(\"[Request `%s`] Executing function `%s`\\n\",\n\t\t\t\tfhandler.id, operation.Function)\n\t\t\tif result == nil {\n\t\t\t\tresult, err = executeFunction(pipeline, operation, request)\n\t\t\t} else {\n\t\t\t\tresult, err = executeFunction(pipeline, operation, result)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"Node(%s), Function(%s), error: function execution failed, %v\",\n\t\t\t\t\tcurrentNode.GetUniqueId(), operation.Function, err)\n\t\t\t\tif operation.FailureHandler != nil {\n\t\t\t\t\terr = operation.FailureHandler(err)\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t// If callback\n\t\tcase operation.CallbackUrl != \"\":\n\t\t\tfmt.Printf(\"[Request `%s`] Executing callback `%s`\\n\",\n\t\t\t\tfhandler.id, operation.CallbackUrl)\n\t\t\tif result == nil {\n\t\t\t\terr = executeCallback(pipeline, operation, request)\n\t\t\t} else {\n\t\t\t\terr = executeCallback(pipeline, operation, result)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"Node(%s), Callback(%s), error: callback failed, %v\",\n\t\t\t\t\tcurrentNode.GetUniqueId(), operation.CallbackUrl, err)\n\t\t\t\tif operation.FailureHandler != nil {\n\t\t\t\t\terr = operation.FailureHandler(err)\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\n\t\t// If modifier\n\t\tdefault:\n\t\t\tfmt.Printf(\"[Request `%s`] Executing modifier\\n\", fhandler.id)\n\t\t\tif result == nil {\n\t\t\t\tresult, err = operation.Mod(request)\n\t\t\t} else {\n\t\t\t\tresult, err = operation.Mod(result)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"Node(%s), error: Failed at modifier, %v\",\n\t\t\t\t\tcurrentNode.GetUniqueId(), err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif result == nil {\n\t\t\t\tresult = []byte(\"\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Printf(\"[Request `%s`] Completed execution of Node %s\\n\", fhandler.id, currentNode.GetUniqueId())\n\n\treturn result, nil\n}", "func (f *Function) OnResult(fn func(interface{})) { f.resHandler = fn }", "func (node *Node) GET(functions ...interface{}) *Handler {\n\n\thandler := &Handler{}\n\n\tif len(functions) > 0 { handler.function = functions[0].(func (req web.RequestInterface) *web.ResponseStatus) }\n\n\tnode.addHandler(\"GET\", handler)\n\n\treturn handler\n}", "func Handler(ctx context.Context, req events.APIGatewayRequest) (events.APIGatewayResponse, error) {\n\treturn GinFaas.ProxyWithContext(ctx, req)\n}", "func Handler(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\t// If no name is provided in the HTTP request body, throw an error\n\treturn chiLambda.Proxy(req)\n}", "func (m* Manager) GetHandler(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\tfuncName := r.FormValue(\"funcName\")\n\n\tres, err := m.platformManager.GetFunction(funcName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonRet, err := json.Marshal(res)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"application/json;charset=utf-8\")\n\tw.Write(jsonRet)\n\treturn\n}", "func (t *targetrunner) bucketHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\tt.httpbckget(w, r)\n\tcase http.MethodDelete:\n\t\tt.httpbckdelete(w, r)\n\tcase http.MethodPost:\n\t\tt.httpbckpost(w, r)\n\tcase http.MethodHead:\n\t\tt.httpbckhead(w, r)\n\tdefault:\n\t\tinvalhdlr(w, r)\n\t}\n}", "func (ic *Context) SyscallHandler(_ *vm.VM, id uint32) error {\n\tf := ic.GetFunction(id)\n\tif f == nil {\n\t\treturn errors.New(\"syscall not found\")\n\t}\n\tcf := ic.VM.Context().GetCallFlags()\n\tif !cf.Has(f.RequiredFlags) {\n\t\treturn fmt.Errorf(\"missing call flags: %05b vs %05b\", cf, f.RequiredFlags)\n\t}\n\tif !ic.VM.AddGas(f.Price * ic.BaseExecFee()) {\n\t\treturn errors.New(\"insufficient amount of gas\")\n\t}\n\treturn f.Func(ic)\n}", "func Handler(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\t// Log body and pass to the DAO\n\tfmt.Printf(\"Received body: %v\\n\", req)\n\n\trequest := new(vm.GeneralRequest)\n\tresponse := request.Validate(req.Body)\n\tif response.Code != 0 {\n\t\treturn events.APIGatewayProxyResponse{Body: response.Marshal(), StatusCode: 500}, nil\n\t}\n\n\trequest.Date = time.Now().Unix()\n\n\tvar mainTable = \"main\"\n\tif value, ok := os.LookupEnv(\"dynamodb_table_main\"); ok {\n\t\tmainTable = value\n\t}\n\n\t// insert data into the DB\n\tdal.Insert(mainTable, request)\n\n\t// Log and return result\n\tfmt.Println(\"Wrote item: \", request)\n\treturn events.APIGatewayProxyResponse{Body: response.Marshal(), StatusCode: 200}, nil\n}", "func handler(fct C.jerry_value_t, this C.jerry_value_t, args C.uintptr_t, length int) C.jerry_value_t {\n\t// The function pointer.\n\tfctPtr := jerry_value_t_To_uint32_t(fct)\n\tif Jerry_value_is_function(fctPtr) {\n\t\tproValue := Jerry_get_object_property(fctPtr, \"name\")\n\t\tdefer Jerry_release_value(proValue)\n\t\tname, err := jsToGo(proValue)\n\n\t\tif err == nil {\n\t\t\tparams := make([]interface{}, 0)\n\t\t\tfor i := 0; i < length; i++ {\n\t\t\t\t// Create function parmeters.\n\t\t\t\tval, err := jsToGo((Uint32_t)(SwigcptrUint32_t(C.uintptr_t(args))))\n\t\t\t\tif err == nil {\n\t\t\t\t\tparams = append(params, val)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Panicln(err)\n\t\t\t\t\tjsError := createError(JERRY_ERROR_COMMON, err.Error())\n\t\t\t\t\treturn uint32_t_To_Jerry_value_t(jsError)\n\t\t\t\t}\n\t\t\t\targs += 4 // 32 bits integer.\n\t\t\t}\n\n\t\t\t// This is the owner of the function.\n\t\t\tthisPtr := jerry_value_t_To_uint32_t(this)\n\t\t\tif Jerry_value_is_object(thisPtr) {\n\t\t\t\tpropUuid_ := Jerry_get_object_property(thisPtr, \"uuid_\")\n\t\t\t\tdefer Jerry_release_value(propUuid_)\n\t\t\t\tuuid, err := jsToGo(propUuid_)\n\t\t\t\tif err == nil {\n\t\t\t\t\tresult, err := GoJavaScript.CallGoFunction(uuid.(string), name.(string), params...)\n\t\t\t\t\tif err == nil && result != nil {\n\t\t\t\t\t\tjsVal := goToJs(result)\n\t\t\t\t\t\treturn uint32_t_To_Jerry_value_t(jsVal)\n\t\t\t\t\t} else if err != nil {\n\t\t\t\t\t\tlog.Panicln(err)\n\t\t\t\t\t\tjsError := createError(JERRY_ERROR_COMMON, err.Error())\n\t\t\t\t\t\treturn uint32_t_To_Jerry_value_t(jsError)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlog.Panicln(\"---> uuid not found!\")\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// There is no function owner I will simply call go function.\n\t\t\t\tresult, err := GoJavaScript.CallGoFunction(\"\", name.(string), params...)\n\t\t\t\tif err == nil && result != nil {\n\t\t\t\t\tjsVal := goToJs(result)\n\t\t\t\t\treturn uint32_t_To_Jerry_value_t(jsVal)\n\t\t\t\t} else if err != nil {\n\t\t\t\t\tlog.Panicln(err)\n\t\t\t\t\tjsError := createError(JERRY_ERROR_COMMON, err.Error())\n\t\t\t\t\treturn uint32_t_To_Jerry_value_t(jsError)\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else if err != nil {\n\t\t\tlog.Panicln(err)\n\t\t\tjsError := createError(JERRY_ERROR_COMMON, err.Error())\n\t\t\treturn uint32_t_To_Jerry_value_t(jsError)\n\t\t}\n\t}\n\n\t// here i will retrun a null value\n\treturn uint32_t_To_Jerry_value_t(Jerry_create_undefined())\n}", "func (r *router) handle(c *Context){\n\tn, params := r.getRoute(c.Method, c.Path)\n\tif n != nil {\n\t\tc.Params = params\n\t\t// connection between Context and Router!\n\t\t// it's important\n\t\tkey := c.Method + \"-\" + n.pattern\n\t\t// 两种函数都放到一起了\n\t\tc.handlers = append(c.handlers, r.handlers[key])\n\t\t//r.handlers[key](c)\n\t}else{\n\t\tc.handlers = append(c.handlers, func(c *Context){\n\t\t\tc.String(http.StatusNotFound, \"404 NOT FOUND%s\\n\", c.Path)\n\t\t})\n\t}\n\t//放在这里一起执行, 中间执行, 其逻辑导致\"并行\"效果\n\tc.Next()\n}", "func (a Application) Handler(event json.RawMessage, ctx *apex.Context) (interface{}, error) {\n\tlog.Println(string(event))\n\treq, err := ParseRequest(a.ID, bytes.NewReader(event))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := NewResponse()\n\n\tswitch req.Type() {\n\tcase \"LaunchRequest\":\n\t\tif a.LaunchHandler != nil {\n\t\t\ta.LaunchHandler(req, res)\n\t\t}\n\tcase \"IntentRequest\":\n\t\tif a.IntentHandler != nil {\n\t\t\ta.IntentHandler(req, res)\n\t\t}\n\tcase \"SessionEndedRequest\":\n\t\tif a.SessionEndedHandler != nil {\n\t\t\ta.SessionEndedHandler(req, res)\n\t\t}\n\tdefault:\n\t\treturn nil, errors.New(\"invalid request type\")\n\t}\n\n\treturn res, nil\n}", "func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (Response, error) {\n\tvar buf bytes.Buffer\n\n\tvar message string\n\tmessage = req.Path\n\n\tlog.Print(fmt.Sprint(\"Called with path: \", req.Path))\n\tstatusCode := 200\n\n\t// Could use a third party routing library at this point, but being hacky for now\n\titems := strings.Split(req.Path, \"/\")\n\tvar item string\n\tif len(items) > 1 {\n\t\titem = strings.Join(items[2:], \"/\")\n\t}\n\n\t// If we actually have an action to take\n\tif len(items) >= 1 {\n\t\tswitch items[1] {\n\t\tcase \"list\":\n\t\t\titems, err := List()\n\t\t\tif err != nil {\n\t\t\t\tstatusCode = 500\n\t\t\t\tmessage = fmt.Sprint(err)\n\t\t\t} else {\n\t\t\t\tmessage = strings.Join(items, \"\\n\")\n\t\t\t}\n\t\tcase \"add\":\n\t\t\t// Should probably be doing this on PUT or POST only\n\t\t\terr := Add(item)\n\t\t\tif err != nil {\n\t\t\t\tstatusCode = 500\n\t\t\t\tmessage = fmt.Sprint(err)\n\t\t\t} else {\n\t\t\t\tmessage = \"Added\"\n\t\t\t}\n\n\t\tcase \"complete\":\n\t\t\t// Should only be doing this on POST, but demo\n\t\t\terr := Complete(item)\n\t\t\tif err != nil {\n\t\t\t\tstatusCode = 500\n\t\t\t\tmessage = fmt.Sprint(err)\n\t\t\t} else {\n\t\t\t\tmessage = \"Completed\"\n\t\t\t}\n\t\t}\n\t}\n\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": message,\n\t})\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\tjson.HTMLEscape(&buf, body)\n\n\tresp := Response{\n\t\tStatusCode: statusCode,\n\t\tIsBase64Encoded: false,\n\t\tBody: buf.String(),\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"hello-handler\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "func (client *Client) Do(funcname string, data []byte, flag byte) (handle string, err error) {\n var datatype uint32\n if flag & JOB_LOW == JOB_LOW {\n if flag & JOB_BG == JOB_BG {\n datatype = common.SUBMIT_JOB_LOW_BG\n } else {\n datatype = common.SUBMIT_JOB_LOW\n }\n } else if flag & JOB_HIGH == JOB_HIGH {\n if flag & JOB_BG == JOB_BG {\n datatype = common.SUBMIT_JOB_HIGH_BG\n } else {\n datatype = common.SUBMIT_JOB_HIGH\n }\n } else if flag & JOB_BG == JOB_BG {\n datatype = common.SUBMIT_JOB_BG\n } else {\n datatype = common.SUBMIT_JOB\n }\n\n uid := strconv.Itoa(int(client.ai.Id()))\n l := len(funcname) + len(uid) + len(data) + 2\n rel := make([]byte, 0, l)\n rel = append(rel, []byte(funcname)...) // len(funcname)\n rel = append(rel, '\\x00') // 1 Byte\n rel = append(rel, []byte(uid)...) // len(uid)\n rel = append(rel, '\\x00') // 1 Byte\n rel = append(rel, data...) // len(data)\n client.writeJob(newJob(common.REQ, datatype, rel))\n // Waiting for JOB_CREATED\n select {\n case job := <-client.jobCreated:\n return string(job.Data), nil\n case <-time.After(client.TimeOut):\n return \"\", common.ErrJobTimeOut\n }\n return\n}", "func helloHandler() string { return \"Hello\" }", "func (mf MiddlewareFunc) Run(req *Request, handler Handler) (*Response, error) {\n\treturn mf(req, handler)\n}", "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\treturn helpers.Response(\"Not Implemented\", http.StatusOK)\n}", "func Handler(w http.ResponseWriter, r *http.Request) {\n\thandler.Submit(w, r)\n}", "func (task *TaskType) RunHandler() (interface{}, error) {\n\tvar response interface{}\n\tvar err error\n\n\tresponse, err = requestHandler[task.Name](task)\n\n\tutils.Log.Info(fmt.Sprintf(\"Proccessing of task %s completed\", task.Name))\n\n\tif err != nil {\n\t\tutils.Log.Error(fmt.Sprintf(\"Failed to process request: %s: \", task.Name), err)\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "func (s *Feature) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\r\n\r\n\t\r\n\r\n\t// Retrieve the requested Smart Contract function and arguments\r\n\tfunction, args := APIstub.GetFunctionAndParameters()\r\n\r\n\t// Route to the appropriate handler function to interact with the ledger appropriately\r\n\tif function == \"initData\" {\r\n\t\treturn initData(APIstub)\r\n\t} else if function == \"getByQuery\" {\r\n\t\treturn s.getByQuery(APIstub, args)\r\n\t} else if function == \"createFeature\" {\r\n\t\treturn createFeature(APIstub, args)\r\n\t} else if function == \"deleteFeature\" {\r\n\t\treturn deleteFeature(APIstub, args)\r\n\t}\r\n\r\n\treturn shim.Error(\"Invalid Smart Contract function name: \" + function)\r\n}", "func Handler(ctx context.Context) (Response, error) {\n\t_, span := tracer.Start(ctx, \"handler\")\n\tdefer span.End()\n\tvar buf bytes.Buffer\n\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": \"Go Serverless v1.0! Your function executed successfully!\",\n\t})\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\tjson.HTMLEscape(&buf, body)\n\n\tresp := Response{\n\t\tStatusCode: 200,\n\t\tIsBase64Encoded: false,\n\t\tBody: buf.String(),\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"hello-handler\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "func storageHandler(gateway Gatewayer) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tswitch r.Method {\n\t\tcase http.MethodGet:\n\t\t\tgetStorageValuesHandler(w, r, gateway)\n\t\tcase http.MethodPost:\n\t\t\taddStorageValueHandler(w, r, gateway)\n\t\tcase http.MethodDelete:\n\t\t\tremoveStorageValueHandler(w, r, gateway)\n\t\tdefault:\n\t\t\tresp := NewHTTPErrorResponse(http.StatusMethodNotAllowed, \"\")\n\t\t\twriteHTTPResponse(w, resp)\n\t\t}\n\t}\n}", "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\n\tserver := os.Getenv(\"SERVER\")\n\n\t//Get the path parameter that was sent\n\tpath := request.Path\n\n\turl := \"http://\" + server + path\n\tresp, err := http.Get(url)\n if err != nil {\n\t\tlog.Fatalln(err)\n }\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n if err != nil {\n\t\tlog.Fatalln(err)\n }\n\n\n\t//Generate message that want to be sent as body\n\t//message := fmt.Sprintf(\" { \\\"Message\\\" : \\\"Hello %s \\\" } \", url)\n\n\t//Returning response with AWS Lambda Proxy Response\n\treturn events.APIGatewayProxyResponse{Body: string(body), StatusCode: 200}, nil\n}", "func (f *Fastglue) handler(h FastRequestHandler) func(*fasthttp.RequestCtx) {\n\treturn func(ctx *fasthttp.RequestCtx) {\n\t\treq := &Request{\n\t\t\tRequestCtx: ctx,\n\t\t\tContext: f.context,\n\t\t}\n\n\t\t// Apply \"before\" middleware.\n\t\tfor _, p := range f.before {\n\t\t\tif p(req) == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t_ = h(req)\n\n\t\t// Apply \"after\" middleware.\n\t\tfor _, p := range f.after {\n\t\t\tif p(req) == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}\n}", "func HandlerOption(handler, handlerType string) server.HandlerOption {\n\tif len(handler) == 0 {\n\t\treturn emptyOption()\n\t}\n\n\tif len(handlerType) == 0 {\n\t\treturn emptyOption()\n\t}\n\n\treturn server.EndpointMetadata(\n\t\thandler,\n\t\tmap[string]string{metaKey: handlerType},\n\t\t)\n}", "func AccessHandler(f func(r *http.Request, status, size int, duration time.Duration)) func(next httpserver.Handler) httpserver.Handler {\n\treturn func(next httpserver.Handler) httpserver.Handler {\n\t\treturn httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {\n\t\t\tstart := time.Now()\n\t\t\tlw := mutil.WrapWriter(w)\n\t\t\tstatus, err := next.ServeHTTP(lw, r)\n\t\t\tf(r, lw.Status(), lw.BytesWritten(), time.Since(start))\n\t\t\treturn status, err\n\t\t})\n\t}\n}", "func handlerWrapper(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\thandler := panicRecover(f)\n\thandler = stopwatch(handler)\n\thandler = i18nLoad(handler)\n\n\treturn handler\n}", "func handlerGzWrapper(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\thandler := panicRecover(f)\n\thandler = gzipWrapper(handler)\n\thandler = stopwatch(handler)\n\thandler = i18nLoad(handler)\n\n\treturn handler\n}", "func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\t// If no name is provided in the HTTP request body, throw an error\n\t// requestUser := userDetails.GetUser(&req)\n\t// ctxWithUser := context.WithValue(ctx, api.DceCtxKey, *requestUser)\n\t// return muxLambda.ProxyWithContext(ctxWithUser, req)\n\treturn muxLambda.ProxyWithContext(ctx, req)\n}", "func (client *Client) Do(funcname string, data []byte,\n\tflag byte, h ResponseHandler) (handle string, err error) {\n\thandle, err = client.DoWithId(funcname, data, flag, h, IdGen.Id())\n\treturn\n}", "func (s *Server) handleRequestOption(p *packet.Packet) {\n\tvar m method\n\n\tswitch p.Request.Method {\n\tcase \"OPTIONS\":\n\t\tm = &optionsMethod{}\n\n\tcase \"DESCRIBE\":\n\t\tm = &describeMethod{\n\t\t\tSession: s.session,\n\t\t}\n\n\tcase \"SETUP\":\n\t\tport, err := s.availablePorts.Request()\n\n\t\tif err != nil {\n\t\t\ts.internalServerError(p, \"server doesn't have available ports to transfer\")\n\t\t\treturn\n\t\t}\n\n\t\tm = &setupMethod{\n\t\t\tActiveSessions: s.activeSessions,\n\t\t\tServerPortMin: int(port),\n\t\t\tServerPortMax: int(port + 1),\n\t\t}\n\n\tcase \"PLAY\":\n\t\tm = &playMethod{\n\t\t\tActiveSessions: s.activeSessions,\n\t\t}\n\n\tcase \"PAUSE\":\n\t\tm = &pauseMethod{\n\t\t\tActiveSessions: s.activeSessions,\n\t\t}\n\n\tcase \"TEARDOWN\":\n\t\tm = &teardownMethod{\n\t\t\tActiveSessions: s.activeSessions,\n\t\t\tAvailablePorts: s.availablePorts,\n\t\t}\n\n\tcase \"RECORD\":\n\t\tm = &recordMethod{}\n\n\tcase \"ANNOUNCE\":\n\t\tm = &announceMethod{}\n\n\tcase \"GET_PARAMETER\":\n\t\tm = &getParameterMethod{}\n\n\tcase \"SET_PARAMETER\":\n\t\tm = &setParameterMethod{}\n\t}\n\n\tif m == nil {\n\t\ts.unsupportedMethod(p)\n\t\treturn\n\t}\n\n\tif err := m.Verify(p, s.handler); err != nil {\n\t\tif err, ok := err.(*methodError); ok {\n\t\t\tif err.methodNotAllowed() {\n\t\t\t\ts.methodNotAllowed(p)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tm.Handle(p)\n\t}\n}", "func (r *Router) handle(c *Ctx) {\n\tvar handler HandlerFunc\n\treq := c.Request()\n\tw := c.Writer()\n\tpath := req.URL.Path\n\tmethod := req.Method\n\tres := r.trie.Match(path)\n\n\tif res.Node == nil {\n\t\t// FixedPathRedirect or TrailingSlashRedirect\n\t\tif res.TSR != \"\" || res.FPR != \"\" {\n\t\t\treq.URL.Path = res.TSR\n\t\t\tif res.FPR != \"\" {\n\t\t\t\treq.URL.Path = res.FPR\n\t\t\t}\n\t\t\tcode := 301\n\t\t\tif method != \"GET\" {\n\t\t\t\tcode = 307\n\t\t\t}\n\t\t\thttp.Redirect(w, req, req.URL.String(), code)\n\t\t\treturn\n\t\t}\n\t\tif r.noRoute == nil {\n\t\t\thttp.Error(w, fmt.Sprintf(`\"%s\" not implemented`, path), 501)\n\t\t\treturn\n\t\t}\n\t\thandler = r.noRoute\n\t} else {\n\t\t// ok := false\n\t\thd := res.Node.GetHandler(method)\n\t\thandler, _ = hd.(HandlerFunc)\n\t\t// handler = r.wrapHandler(hd)\n\t\t// if !ok {\n\t\t// \tpanic(\"handler error\")\n\t\t// }\n\t\tif handler == nil {\n\t\t\t// OPTIONS support\n\t\t\tif method == http.MethodOptions {\n\t\t\t\tw.Header().Set(\"Allow\", res.Node.GetAllow())\n\t\t\t\tw.WriteHeader(204)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif r.noMethod == nil {\n\t\t\t\t// If no route handler is returned, it's a 405 error\n\t\t\t\tw.Header().Set(\"Allow\", res.Node.GetAllow())\n\t\t\t\thttp.Error(w, fmt.Sprintf(`\"%s\" not allowed in \"%s\"`, method, path), 405)\n\t\t\t\treturn\n\t\t\t}\n\t\t\thandler = r.noMethod\n\t\t}\n\t}\n\n\tif len(res.Params) != 0 {\n\t\tc.params = res.Params\n\t}\n\tc.handlers = append(c.handlers, handler)\n\tc.Next()\n}", "func (mf Func) Process(h http.Handler) http.Handler {\n\treturn mf(h)\n}", "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\nfmt.Println(\"invoke is running \" + function)\n\n// Handle different functions\nif function == \"create\" {\n return t.create(stub,args)\n } else if function == \"acceptpkg\"{\n return t.acceptpkg(stub,args)\n } else if function == \"deliverpkg\"{\n return t.deliverpkg(stub,args)\n } else if function == \"updatetemp\" {\n return t.updatetemp(stub, args)\n }\n\nfmt.Println(\"invoke did not find func: \" + function)\nreturn nil, errors.New(\"Received unknown function invocation: \" + function)\n\n}", "func (f5 *BigIP) handleDelete(msg comm.Message) comm.Message {\n\tswitch f5.UpdateMode {\n\tcase vsUpdateMode:\n\t\tm := f5.handleVSDelete(msg)\n\t\treturn m\n\tcase policyUpdateMode:\n\t\tm := f5.handleGlobalPolicyDelete(msg)\n\t\treturn m\n\tdefault:\n\t\tmsg.Error = fmt.Sprintf(\"unsupported updateMode %v\", f5.UpdateMode)\n\t\treturn msg\n\t}\n}", "func (p Service) Handler(w http.ResponseWriter, r *http.Request) {\n\n\tif r.Method != \"GET\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tif strings.HasSuffix(r.URL.Path, \"/login\") {\n\t\tp.loginHandler(w, r)\n\t\treturn\n\t}\n\tif strings.HasSuffix(r.URL.Path, \"/callback\") {\n\t\tp.authHandler(w, r)\n\t\treturn\n\t}\n\tif strings.HasSuffix(r.URL.Path, \"/logout\") {\n\t\tp.LogoutHandler(w, r)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusNotFound)\n}", "func checksumHandler(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error) {\n\tquery := r.URL.Query().Get(\"algo\")\n\n\tval, err := c.FI.Checksum(query)\n\tif err == errInvalidOption {\n\t\treturn http.StatusBadRequest, err\n\t} else if err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\tw.Write([]byte(val))\n\treturn 0, nil\n}", "func statusHandler(minioFlags minioDetails) func(w http.ResponseWriter, req *http.Request) {\n\treturn func(res http.ResponseWriter, req *http.Request) {\n\t\t//logg request - start\n\t\tt1 := time.Now()\n\t\tminioStatus := minioChecker(minioFlags.minioEndpoint)\n\t\tmapboxStatus := mapboxChecker()\n\t\tif (minioStatus != false) && (mapboxStatus != false) {\n\t\t\tdata, _ := json.Marshal(healthStatus{OverallHealth: \"UP\", Minio: \"UP\", Connectivity: \"UP\"})\n\t\t\twriteJSONResponse(res, http.StatusOK, data)\n\t\t} else if (minioStatus != true) && (mapboxStatus != false) {\n\t\t\tdata, _ := json.Marshal(healthStatus{OverallHealth: \"DOWN\", Minio: \"DOWN\", Connectivity: \"UP\"})\n\t\t\twriteJSONResponse(res, http.StatusServiceUnavailable, data)\n\t\t} else if (minioStatus != false) && (mapboxStatus != true) {\n\t\t\tdata, _ := json.Marshal(healthStatus{OverallHealth: \"DOWN\", Minio: \"UP\", Connectivity: \"DOWN\"})\n\t\t\twriteJSONResponse(res, http.StatusServiceUnavailable, data)\n\t\t} else {\n\t\t\tdata, _ := json.Marshal(healthStatus{OverallHealth: \"DOWN\", Minio: \"DOWN\", Connectivity: \"DOWN\"})\n\t\t\twriteJSONResponse(res, http.StatusServiceUnavailable, data)\n\t\t}\n\t\tt2 := time.Now()\n\t\tlog.Printf(\"[%s] %q %v\", req.Method, req.URL.String(), t2.Sub(t1))\n\t}\n}", "func handler(w http.ResponseWriter, r *http.Request) {\n\toperation, key, value, ttl, err := service.SHttpRequestParamParser(r)\n\tswitch operation {\n\tcase \"set\":\n\t\tif err != nil{\n\t\t\tfmt.Fprintf(w, \"%s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tevicted := storage.GetCache().Set(key, value, ttl)\n\t\tfmt.Fprintf(w, strconv.FormatBool(evicted))\n\tcase \"get\":\n\t\tvalue, exist := storage.GetCache().Get(key)\n\t\tif !exist {\n\t\t\tfmt.Fprintf(w, \"%s\", \"value for this key does not exist\")\n\t\t\treturn\n\t\t}\n\t\tfmt.Fprintf(w, \"%s\", value)\n\tcase \"remove\":\n\t\tok := storage.GetCache().Del(key)\n\t\tfmt.Fprintf(w, \"%s\", strconv.FormatBool(ok))\n\tcase \"keys\":\n\t\tlistOfKeys := storage.GetCache().Keys()\n\t\tkeys := util.ListOfObjectsToConcatString(listOfKeys)\n\t\tfmt.Fprintf(w, \"%s\", keys)\n\tcase \"capacity\":\n\t\tcapacity := storage.GetCache().Cap()\n\t\tfmt.Fprintf(w, \"%d\", capacity)\n\tdefault:\n\t\tfmt.Fprintf(w, \"%s\", \"unknown operation\")\n\t}\n}", "func Handler(handler HTTPHandlerFunc) fasthttp.RequestHandler {\n\treturn func(ctx *fasthttp.RequestCtx) {\n\t\tc, cancel := context.WithCancel(context.Background())\n\t\tdefer cancel()\n\t\thandler(c, ctx)\n\t}\n}", "func (s *Server) HandleOperation(action string, messageType string, requestFactory RequestFactoryFunc, operationHandlerFunc OperationHandlerFunc) {\n\t_, ok := s.handlers[action]\n\tif !ok {\n\t\ts.handlers[action] = make(map[string]*operationHandler) // is this good??\n\t}\n\n\ts.handlers[action][messageType] = &operationHandler{\n\t\thandler: operationHandlerFunc,\n\t\trequestFactory: requestFactory,\n\t}\n}", "func myTagHandler(handler dbTagHandler, dbb TagInfoer) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\thandler(w, r, dbb)\n\t}\n}", "func (t *targetrunner) bucketHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\tt.httpbckget(w, r)\n\tcase http.MethodDelete:\n\t\tt.httpbckdelete(w, r)\n\tcase http.MethodPost:\n\t\tt.httpbckpost(w, r)\n\tcase http.MethodHead:\n\t\tt.httpbckhead(w, r)\n\tdefault:\n\t\tcmn.InvalidHandlerWithMsg(w, r, \"invalid method for /buckets path\")\n\t}\n}", "func (t *targetrunner) bucketHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\tt.httpbckget(w, r)\n\tcase http.MethodDelete:\n\t\tt.httpbckdelete(w, r)\n\tcase http.MethodPost:\n\t\tt.httpbckpost(w, r)\n\tcase http.MethodHead:\n\t\tt.httpbckhead(w, r)\n\tdefault:\n\t\tcmn.InvalidHandlerWithMsg(w, r, \"invalid method for /buckets path\")\n\t}\n}", "func (r *experimentalRoute) Handler() httputils.APIFunc {\n\treturn r.handler\n}", "func myRetrieveHandler(handler dbRetrieveHandler, dbb RetrieveInfoer) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\thandler(w, r, dbb)\n\t}\n}", "func SimpleHandler(f func(t Task, stop <-chan bool) bool) HandlerFunc {\n\treturn func(t Task) Handler {\n\t\treturn &simpleHandler{\n\t\t\ttask: t,\n\t\t\tstop: make(chan bool),\n\t\t\tf: f,\n\t\t}\n\t}\n}", "func (res *Resource) actionHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, storage store.Get) {\n\tid := pat.Param(ctx, \"id\")\n\n\tresponse, err := storage(ctx, id)\n\tif err != nil && reflect.ValueOf(err).IsNil() == false {\n\t\tSendHandler(ctx, w, r, err)\n\t\treturn\n\t}\n\n\tSendHandler(ctx, w, r, response)\n}", "func Handler(ctx context.Context) (*events.APIGatewayProxyResponse, error) {\n\tresp := events.APIGatewayProxyResponse{\n\t\tStatusCode: 200,\n\t\tIsBase64Encoded: false,\n\t\tBody: \"OK\",\n\t\tHeaders: map[string]string{\"Content-Type\": \"text/plain\"},\n\t}\n\treturn &resp, nil\n}", "func Handler(ctx context.Context, payload events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tvar resp []byte\n\n\tswitch path := payload.Path; path {\n\tcase PRODUCT_PATH:\n\t\tswitch method := payload.HTTPMethod; method {\n\t\tcase GET:\n\t\t\tfmt.Printf(\"GET method for products.\\n\")\n\t\tcase POST:\n\t\t\tnewStock, err := event.CreateStock(payload.Body)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tresp, _ = json.Marshal(newStock)\n\t\tcase PUT:\n\t\t\tfmt.Printf(\"PUT method for products.\\n\")\n\t\tcase DELETE:\n\t\t\tfmt.Printf(\"DELETE method for products.\\n\")\n\t\t}\n\n\tcase STORE_PATH:\n\t\tswitch method := payload.HTTPMethod; method {\n\t\tcase GET:\n\t\t\tfmt.Printf(\"GET method for stocks.\\n\")\n\t\tcase POST:\n\t\t\tnewStockLoc, err := event.CreateStockLocation(payload.Body)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tresp, _ = json.Marshal(newStockLoc)\n\t\tcase PUT:\n\t\t\tfmt.Printf(\"PUT method for stocks.\\n\")\n\t\tcase DELETE:\n\t\t\tfmt.Printf(\"DELETE method for stocks.\\n\")\n\t\t}\n\tdefault:\n\t\tfmt.Printf(\"panik: %s.\\n\", path)\n\t}\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: string(resp),\n\t\tStatusCode: 200,\n\t}, nil\n}", "func Handler(ctx context.Context, request events.APIGatewayProxyRequest,\n\tdynamoDB *dynamodb.DynamoDB, cfg config.Configuration) (\n\tevents.APIGatewayProxyResponse, error) {\n\n\t//Instantiate item API Handler\n\tih, err := item.New(dynamoDB, cfg.AWS.DynamoDB.Table.Store)\n\tif err != nil {\n\t\treturn web.GetResponse(ctx, err.Error(), http.StatusInternalServerError)\n\t}\n\n\tlog.Debug().Msgf(\"Executing method %s for path: %s with body: %v\",\n\t\trequest.HTTPMethod, request.Path, request.Body)\n\n\tswitch request.HTTPMethod {\n\tcase http.MethodGet:\n\n\t\treturn getItems(ctx, request, ih)\n\n\t}\n\n\t//APIGateway would not allow the function to get to this point\n\t//Since all the supported http methods are in the switch\n\treturn web.GetResponse(ctx, struct{}{}, http.StatusMethodNotAllowed)\n\n}", "func (ro *Route) handler(uri []string, httpMethod string, ids idMap) (*handler, error) {\n\n\t//log.Println(\"Route Handling\", uri, \"in the\", ro)\n\n\t// Check if is trying to request some Handler of this Route\n\tif len(uri) == 0 {\n\t\th, exist := ro.Handlers[httpMethod]\n\t\tif !exist {\n\t\t\treturn nil, fmt.Errorf(\"Method %s not found in the %s\", httpMethod, ro)\n\t\t}\n\t\treturn h, nil\n\t}\n\n\t// Check if is trying to request some Action Handler of this Route\n\tif len(uri) == 1 {\n\n\t\th, exist := ro.Handlers[httpMethod+uri[0]]\n\t\tif exist {\n\t\t\treturn h, nil\n\t\t}\n\n\t\t// It is not an error, cause could have an resources with this name, not an action\n\t\t//log.Println(\"Action \" + httpMethod + uri[0] + \" NOT FOUND\")\n\t}\n\n\t// If we are in a Slice Route, get its ID and search in the Elem Route\n\tif ro.IsSlice {\n\t\t// Add its ID to the Map\n\t\tid := &ID{id: uri[0]}\n\t\tids[ro.Elem.Value.Type()] = reflect.ValueOf(id)\n\n\t\treturn ro.Elem.handler(uri[1:], httpMethod, ids)\n\t}\n\n\t// If we are in an Elem Route, the only possibility is to have a Child with this Name\n\tchild, exist := ro.Children[uri[0]]\n\tif exist {\n\t\treturn child.handler(uri[1:], httpMethod, ids)\n\t}\n\n\treturn nil, fmt.Errorf(\"Not exist any Child '%s' or Action '%s' in the %s\", uri[0], httpMethod+strings.Title(uri[0]), ro)\n}", "func (r *queryImpl) Handler(p schema.QueryHandlerFieldResolverParams) (interface{}, error) {\n\tctx := contextWithNamespace(p.Context, p.Args.Namespace)\n\tres, err := r.svc.HandlerClient.FetchHandler(ctx, p.Args.Name)\n\treturn handleFetchResult(res, err)\n}", "func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request))", "func (hm *Mux) Handle(e *colog.Entry) error {\n\tvar opPl opPayload\n\n\terr := e.Get(&opPl)\n\tif err != nil {\n\t\treturn ErrWrongOp\n\t}\n\n\thm.l.Lock()\n\th, ok := hm.handlers[opPl.Op]\n\thm.l.Unlock()\n\n\tif !ok {\n\t\treturn ErrWrongOp\n\t}\n\n\treturn h(e)\n}", "func (jm *JWTMiddleware) handler(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tpath := r.URL.Path\n\tif skip := jm.skipper(path); skip {\n\t\tnext(w, r)\n\t\treturn\n\t}\n\n\tjm.HandlerWithNext(w, r, next)\n}", "func (h HandlerFunc) Handle(e Event) { h(e) }", "func Handler(opts ...Option) http.Handler {\n\treturn handlerFrom(compile(opts))\n}", "func (c ControlHandlerFunc) Handle(req Request, res *Response) error {\n\t*res = c(req)\n\treturn nil\n}", "func H(fn interface{}) Handler {\n\tswitch h := fn.(type) {\n\tcase Handler:\n\t\treturn h\n\tcase func(*Context):\n\t\treturn h\n\tcase http.Handler:\n\t\treturn func(c *Context) {\n\t\t\th.ServeHTTP(c.Writer, c.Request)\n\t\t}\n\tcase http.HandlerFunc:\n\t\treturn func(c *Context) {\n\t\t\th.ServeHTTP(c.Writer, c.Request)\n\t\t}\n\tcase func(http.ResponseWriter, *http.Request):\n\t\treturn func(c *Context) {\n\t\t\th(c.Writer, c.Request)\n\t\t}\n\tcase nil:\n\t\tpanic(\"input function can't be nil\")\n\t}\n\n\tt := reflect.TypeOf(fn)\n\tif t.Kind() != reflect.Func {\n\t\tpanic(\"can not warp \" + t.String() + \"to api.Handler\")\n\t}\n\n\treturn func(ctx *Context) {\n\t\tvs, err := ctx.Invoke(fn)\n\t\tif err != nil {\n\t\t\t// validate failed.\n\t\t\tctx.Reply(http.StatusBadRequest, err)\n\t\t\treturn\n\t\t}\n\t\t// do nothing if fn does not have return values\n\t\tif len(vs) > 0 {\n\t\t\tctx.ReplyValues(vs)\n\t\t}\n\t}\n}", "func Handler(config *Config) func(c *cli.Context) error {\n\treturn func(c *cli.Context) error {\n\t\tmanager, err := NewManager(config)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to initialize cluster manager. %s\", err)\n\t\t}\n\n\t\treturn Start(c.Context, config, manager)\n\t}\n}", "func Handler(service e2e.Service, hooks *twirp.ServerHooks) *handler.Server {\n\tes := NewExecutableSchema(Config{Resolvers: &Resolver{service}})\n\tsrv := handler.New(es)\n\tsrv.AddTransport(transport.POST{})\n\tsrv.Use(extension.Introspection{})\n\tif hooks == nil {\n\t\treturn srv\n\t}\n\tsrv.AroundFields(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) {\n\t\tf := graphql.GetFieldContext(ctx)\n\t\tparent := f.Parent.Path().String()\n\t\tif parent != \"\" {\n\t\t\treturn next(ctx)\n\t\t}\n\t\tctx = ctxsetters.WithMethodName(ctx, f.Field.Name)\n\t\tif hooks.RequestRouted != nil {\n\t\t\tctx, err = hooks.RequestRouted(ctx)\n\t\t\tif err != nil {\n\t\t\t\tif terr, ok := err.(twirp.Error); ok && hooks.Error != nil {\n\t\t\t\t\tctx = hooks.Error(ctx, terr)\n\t\t\t\t}\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tres, err = next(ctx)\n\t\tif terr, ok := err.(twirp.Error); ok && hooks.Error != nil {\n\t\t\tctx = hooks.Error(ctx, terr)\n\t\t}\n\t\treturn res, err\n\t})\n\treturn srv\n}", "func Handler(ctx context.Context) (Response, error) {\n\tapp := usecase.NewNotifyUsecase()\n\terr := app.Run()\n\tif err != nil {\n\t\tapp.Error(err)\n\t}\n\n\treturn Response{}, nil\n}", "func Handler(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tif ginLambda == nil {\n\t\t// stdout and stderr are sent to AWS CloudWatch Logs\n\t\tlog.Printf(\"Gin cold start\")\n\t\tr := gin.Default()\n\t\tr.GET(\"/companies\", listCompanies)\n\t\tr.GET(\"/companies/:id\", getCompanyData)\n\t\tr.POST(\"/companies\", createCompany)\n\n\t\tginLambda = ginadapter.New(r)\n\t}\n\n\treturn ginLambda.Proxy(req)\n}", "func (b *RouteBuilder) Handler(function RouteFunction) *RouteBuilder {\n\tb.function = function\n\treturn b\n}", "func MethodHandler(fieldKey string) func(next httpserver.Handler) httpserver.Handler {\n\treturn func(next httpserver.Handler) httpserver.Handler {\n\t\treturn httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {\n\t\t\tlog := zerolog.Ctx(r.Context())\n\t\t\tlog.UpdateContext(func(c zerolog.Context) zerolog.Context {\n\t\t\t\treturn c.Str(fieldKey, r.Method)\n\t\t\t})\n\t\t\treturn next.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func (mux *ServeMux) Handler(r *Request) (h Handler, pattern string)", "func Handler(w http.ResponseWriter, r *http.Request) {\n\n\tdefer catchPanic(w, r)\n\n\tif basePath := \"/Foogazi\"; strings.Contains(r.URL.Path, basePath) && r.Method == \"GET\" {\n\n\t\ttools.ShortenPath(basePath, r)\n\n\t\tw.Write([]byte(\"Hello\"))\n\t\treturn\n\t}\n\tif basePath := \"/Foo\"; strings.Contains(r.URL.Path, basePath) {\n\n\t\tif basePath := \"/Foo/Bar\"; strings.Contains(r.URL.Path, basePath) && r.Method == \"GET\" {\n\n\t\t\ttools.ShortenPath(basePath, r)\n\n\t\t\tw.Write([]byte(r.URL.Path))\n\t\t\treturn\n\t\t}\n\n\t\ttools.ShortenPath(basePath, r)\n\n\t\tw.Write([]byte(\"Hello world\"))\n\t\treturn\n\t}\n\tif basePath := \"/hello\"; strings.Contains(r.URL.Path, basePath) && r.Method == \"GET\" {\n\n\t\ttools.ShortenPath(basePath, r)\n\n\t\tw.Write([]byte(\"Hello World\"))\n\t\treturn\n\t}\n\tif basePath := \"/hello_POST\"; strings.Contains(r.URL.Path, basePath) && r.Method == \"POST\" {\n\n\t\ttools.ShortenPath(basePath, r)\n\t\tprintln(\"Request to Hello_post\")\n\t\tw.Write([]byte(\"Hello World\"))\n\t\treturn\n\t}\n}", "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\tlog.Printf(\"Processing Lambda request %s\\n\", request.RequestContext.RequestID)\n\n\tuser, err := apigateway.GetOrCreateAuthenticatedUser(context.TODO(), &request)\n\tif err != nil {\n\t\treturn apigateway.ResponseUnsuccessful(401), errAuth\n\t}\n\n\tr := &SetUpRequest{}\n\terr = json.Unmarshal([]byte(request.Body), r)\n\tif err != nil {\n\t\tfmt.Printf(\"Could not parse body: %v.\\n\", request.Body)\n\t\treturn events.APIGatewayProxyResponse{StatusCode: 500}, errParse\n\t}\n\n\tid, ok := request.PathParameters[\"id\"]\n\tif !ok || id == \"\" {\n\t\treturn apigateway.ResponseUnsuccessful(400), errMissingParameter\n\t}\n\n\tobjID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn apigateway.ResponseUnsuccessful(400), errInvalidParameter\n\t}\n\n\tsetup, err := theilliminationgame.LoadGameSetUp(&objID)\n\tif err != nil {\n\t\tfmt.Printf(\"Error finding games: '%v'.\\n\", err)\n\t\treturn apigateway.ResponseUnsuccessful(500), err\n\t}\n\n\tvar result string\n\n\tif r.UpdateType == \"join\" {\n\t\tsetup.JoinGame(user)\n\t} else if r.UpdateType == \"option_add\" {\n\t\tresult = string(setup.AddOption(user, r.Option))\n\t} else if r.UpdateType == \"detailedoption_add\" {\n\t\tresult = string(setup.AddDetailedOption(user, r.Option, r.Description, r.Link))\n\t} else if r.UpdateType == \"option_update\" {\n\t\tif r.Updates == nil {\n\t\t\treturn apigateway.ResponseUnsuccessfulString(400, \"No Updates\"), err\n\t\t}\n\t\tsetup.UpdateOption(user, r.OptionIndex, r.Updates)\n\t} else if r.UpdateType == \"deactivate\" {\n\t\tsetup.Deactivate(user)\n\t} else if r.UpdateType == \"addtag\" {\n\t\tsetup.AddTag(user, *r.Tag)\n\t} else if r.UpdateType == \"removetag\" {\n\t\tsetup.RemoveTag(user, *r.Tag)\n\t} else {\n\t\tresult = \"Unknown update type\"\n\t}\n\n\tsetup, _ = theilliminationgame.LoadGameSetUp(&objID)\n\n\tresponse := &GameUpdateResponse{\n\t\tResult: result,\n\t\tGame: setup.Summary(user),\n\t}\n\n\tresp := apigateway.ResponseSuccessful(response)\n\treturn resp, nil\n}", "func Handler(request events.APIGatewayProxyRequest) (resp Response, err error) {\n\tvar buf bytes.Buffer\n\tvar message string\n\tvar person Person\n\tresp = Response{\n\t\tStatusCode: http.StatusOK,\n\t\tIsBase64Encoded: false,\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"delete-handler\",\n\t\t},\n\t}\n\n\terr = json.Unmarshal([]byte(request.Body), &person)\n\tif err != nil {\n\t\treturn Response{StatusCode: http.StatusBadRequest}, err\n\t}\n\n\tif person.Id > 0 {\n\t\tif err := connectDB(); err != nil {\n\t\t\treturn Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\t_, err := db.Exec(fmt.Sprintf(`DELETE FROM Persons WHERE PersonID = %d`, person.Id))\n\t\tif err != nil {\n\t\t\treturn Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\tmessage = fmt.Sprintf(\"Removed %d.\", person.Id)\n\t}else if person.Name != \"\" {\n\t\tif err := connectDB(); err != nil {\n\t\t\treturn Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\t_, err := db.Exec(fmt.Sprintf(`DELETE FROM Persons WHERE Name = '%s'`, person.Name))\n\t\tif err != nil {\n\t\t\treturn Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\tmessage = fmt.Sprintf(\"Removed %s.\", person.Name)\n\t} else {\n\t\tresp.StatusCode = http.StatusBadRequest\n\t\tmessage = \"parameters are invalid\"\n\t}\n\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": message,\n\t})\n\tif err != nil {\n\t\treturn Response{StatusCode: http.StatusInternalServerError}, err\n\t}\n\n\tjson.HTMLEscape(&buf, body)\n\n\tresp.Body = buf.String()\n\n\treturn resp, nil\n}", "func (a *Asock) AddHandler(name string, argmode string, df DispatchFunc) error {\n\tif _, ok := a.d[name]; ok {\n\t\treturn fmt.Errorf(\"handler '%v' already exists\", name)\n\t}\n\tif argmode != \"split\" && argmode != \"nosplit\" {\n\t\treturn fmt.Errorf(\"invalid argmode '%v'\", argmode)\n\t}\n\ta.d[name] = &dispatchFunc{df, argmode}\n\ta.help = \"\"\n\tfor cmd := range a.d {\n\t\ta.help = a.help + cmd + \" \"\n\t}\n\treturn nil\n}", "func (h *Handler) Accept() {\n}", "func (kv *KVPaxos) handler(op Op) string {\n\tid, _ := kv.ids[op.Me]\n\tval, _ := kv.replies[op.Me]\n\tfor id != op.Id {\n\t\tkv.seq += 1\n\t\tok, value := kv.px.Status(kv.seq)\n\t\tif !ok {\n\t\t\t// if falling behind, then call start\n\t\t\tkv.px.Start(kv.seq, op)\n\t\t\t// check status for value\n\t\t\tok, value = kv.px.Status(kv.seq)\n\t\t\t// wait for instance to complete agreement\n\t\t\tto := 10 * time.Millisecond\n\t\t\tfor !ok {\n\t\t\t\ttime.Sleep(to)\n\t\t\t\tok, value = kv.px.Status(kv.seq)\n\t\t\t\tif to < 10*time.Second {\n\t\t\t\t\tto *= 2\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toop := value.(Op)\n\t\t// handle oop\n\t\tval, _ = kv.kvs[oop.Key]\n\t\tkv.replies[oop.Me] = val\n\t\tkv.ids[oop.Me] = oop.Id\n\t\tif oop.DoPut { // if it is put, then update kv map\n\t\t\tif oop.DoHash {\n\t\t\t\th := hash(val + oop.Value) // use the hash in test file\n\t\t\t\tkv.kvs[oop.Key] = strconv.Itoa(int(h))\n\t\t\t} else {\n\t\t\t\tkv.kvs[oop.Key] = oop.Value\n\t\t\t}\n\t\t}\n\t\tid = oop.Id // check uuid\n\t\tkv.px.Done(kv.seq) // call done after one instance is processed\n\t}\n\treturn val\n}", "func TestHandlerFunc(t *testing.T) {\n\tvar h Handler\n\tcalled := false\n\n\th = HandlerFunc(func(*Job) {\n\t\tcalled = true\n\t})\n\n\th.Work(nil)\n\n\tif !called {\n\t\tt.Fail()\n\t}\n}", "func TestUpdateOperationHandler(t *testing.T) {\n\tt.Run(\"Methods\", testUpdateOperationHandlerMethods)\n\tt.Run(\"Get\", testUpdateOperationHandlerGet)\n\tt.Run(\"Delete\", testUpdateOperationHandlerGet)\n\tt.Run(\"Errors\", testUpdateOperationHandlerErrors)\n}", "func HandlerFunc(log func(message string, time time.Time, level LogLevel, call CallStack, context ContextMap) error) LogHandler {\n\treturn remoteHandler(log)\n}", "func operacionesMidd(f func(int, int) int) func(int, int) int {\n\n\treturn func(a, b int) int {\n\t\t//Hago lo que necesito hacer\n\t\tfmt.Println(\"Soy el mensaje del Middleware\")\n\t\t//Devuelvo la funcion para que haga su trabajo :)\n\t\treturn f(a, b)\n\t}\n}", "func CallHandlerFunction(handlerSymbol interface{}, ctx context.Context, input interface{}) (interface{}, error) {\n\tif err := ValidateHandler(handlerSymbol); err != nil {\n\t\treturn nil, err\n\t}\n\n\traw_json, err := json.Marshal(input)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"JSON Marshall Error: %v\", err)\n\t}\n\n\treflection := CreateTaskReflection(handlerSymbol)\n\treturn CallHandler(reflection, ctx, raw_json)\n}", "func HandlerFunc(s *search.SearchServer, authToken string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\t// ifs its a get request, it can only be a query request, so hand it off\n\t\tif r.Method == \"GET\" {\n\t\t\tqueryHandler(s, w, r)\n\t\t\treturn\n\t\t}\n\n\t\tif r.Method != \"POST\" {\n\t\t\trespondWithError(w, r, \"unsupport HTTP method\")\n\t\t\treturn\n\t\t}\n\n\t\tparams := r.URL.Query()\n\n\t\tif authToken != \"\" {\n\t\t\ttoken := params.Get(\"authtoken\")\n\t\t\tif token != authToken {\n\t\t\t\trespondWithError(w, r, \"Auth token invalid\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\taction := params.Get(\"action\")\n\t\tswitch action {\n\t\tcase \"create\":\n\t\t\tcreateHandler(s, w, r)\n\t\tcase \"destroy\":\n\t\t\tdestroyHandler(s, w, r)\n\t\tcase \"index\":\n\t\t\tindexHandler(s, w, r)\n\t\tcase \"remove\":\n\t\t\tremoveHandler(s, w, r)\n\t\tdefault:\n\t\t\trespondWithError(w, r, \"Unknown action specified\")\n\t\t}\n\t}\n}", "func indexHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"indexHandler is called\")\n\n\tw.WriteHeader(http.StatusOK)\n}", "func indexHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"indexHandler is called\")\n\n\tw.WriteHeader(http.StatusOK)\n}", "func handler() http.Handler {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", router)\n\treturn header.GetGzip(mux)\n}", "func Handle(manipulatorFn func([][]string) string) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n // Allow only POST request as we are accepting a file\n if r.Method != http.MethodPost {\n w.WriteHeader(http.StatusMethodNotAllowed)\n w.Write([]byte(\"Method not Allowed\"))\n return\n }\n records, err := ParseFile(r)\n if err != nil {\n w.WriteHeader(http.StatusUnprocessableEntity)\n w.Write([]byte(fmt.Sprintf(\"error %s\", err.Error())))\n return\n }\n w.Write([]byte(manipulatorFn(records)))\n })\n}", "func (s *ShellTask) Handler() util.Handler {\n\treturn util.Handler(func(ctx context.Context) (any, error) {\n\t\treturn s.Process(ctx)\n\t})\n}" ]
[ "0.62430245", "0.6131205", "0.5915906", "0.5888019", "0.5807336", "0.5794625", "0.53793585", "0.5366787", "0.53664374", "0.53597254", "0.53481925", "0.5305378", "0.5277263", "0.5257421", "0.5250425", "0.52455723", "0.5235877", "0.52252084", "0.5219276", "0.5217583", "0.5215974", "0.5195756", "0.519453", "0.5189858", "0.51877683", "0.51834345", "0.51812434", "0.5176259", "0.5168195", "0.51635474", "0.51499885", "0.51483136", "0.514381", "0.51434016", "0.5134797", "0.51291287", "0.51289177", "0.51089793", "0.510888", "0.51076657", "0.5083506", "0.5078125", "0.5072136", "0.50711703", "0.5064409", "0.5043526", "0.50404114", "0.503933", "0.5037827", "0.50345767", "0.50310993", "0.5030363", "0.50279546", "0.5025833", "0.5023508", "0.5020697", "0.50166893", "0.5008523", "0.5007121", "0.5007121", "0.49979356", "0.49935222", "0.49837232", "0.49833214", "0.49829307", "0.49785542", "0.49772874", "0.49762443", "0.49717414", "0.49591112", "0.4953797", "0.4953176", "0.4952273", "0.49495247", "0.4949493", "0.49451178", "0.4942705", "0.49422833", "0.493925", "0.49374872", "0.49342728", "0.49185732", "0.49035683", "0.48977438", "0.48967895", "0.48964614", "0.4892686", "0.48855096", "0.4885377", "0.4885297", "0.48831135", "0.48809975", "0.48807326", "0.4880365", "0.48774412", "0.48702437", "0.48702437", "0.4867482", "0.48667416", "0.48657995" ]
0.5092925
40
configPath returns the full path to the config directory (creates it if doesn't exists)
func configPath() (string, error) { configPath := strings.TrimSpace(os.Getenv(confPathVar)) if len(configPath) == 0 { homeDir, err := os.UserHomeDir() if err != nil { return "", err } configPath = homeDir + "/" + defaultConfigDir } if exists(configPath) { return configPath, nil } return configPath, os.Mkdir(configPath, confDirFileMode) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func configPath() (string, error) {\n\thome, err := sys.GetHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(home, \".keeper\", \"config.json\"), nil\n}", "func GetConfigPath() (p string, err error) {\n\td, err := GetPassDir()\n\tif err == nil {\n\t\tp = filepath.Join(d, ConfigFileName)\n\t}\n\treturn\n}", "func (c Calendars) configPath() (string, error) {\n\tconfDir, err := configDirectory()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filepath.Join(confDir, \"calendars.txt\"), nil\n}", "func (a *Application) GetConfigPath() string {\n\treturn filepath.Join(a.GetHomeDir(), DefaultApplicationConfigPath)\n}", "func (c *Config) ConfigPath() string {\n\treturn filepath.Join(c.Dir, \"config.ini\")\n}", "func (c *Config) ConfigPath() string {\n\tif c.options.ConfigPath == \"\" {\n\t\tif fs.PathExists(filepath.Join(c.StoragePath(), \"settings\")) {\n\t\t\treturn filepath.Join(c.StoragePath(), \"settings\")\n\t\t}\n\n\t\treturn filepath.Join(c.StoragePath(), \"config\")\n\t}\n\n\treturn fs.Abs(c.options.ConfigPath)\n}", "func ConfigPath() string {\n\tif path, err := homedir.Expand(MKtmpioCfgFile); err == nil {\n\t\treturn path\n\t}\n\treturn \"\"\n}", "func ConfigPath() string {\n\treturn defaultConfig.ConfigPath()\n}", "func ConfigPath() (string, error) {\n\tconfigOnce.Do(func() {\n\t\t// getting home directory.\n\t\thome, err := homedir.Dir()\n\t\tif err != nil {\n\t\t\tconfigErr = fmt.Errorf(\"[err] ConfigPath %w\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// make config directory\n\t\tpath := filepath.Join(home, \".findgs\")\n\t\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\t\tif suberr := os.MkdirAll(path, os.ModePerm); suberr != nil {\n\t\t\t\tconfigErr = fmt.Errorf(\"[err] NewSearcher %w\", suberr)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tconfigPath = path\n\t})\n\treturn configPath, configErr\n}", "func GetConfigPath(configPath string) string {\n\tif configPath == \"docker\" {\n\t\treturn \"./config/config-docker\"\n\t}\n\treturn \"./config/config-local\"\n}", "func getCfgPath(name string) string {\n\treturn configDir + \"/\" + name + \".conf\"\n}", "func getConfigPath() (string, error) {\n\thome, homeErr := os.UserHomeDir()\n\tif homeErr == nil {\n\t\tif _, err := os.Stat(filepath.Join(home, \".bin\", \"config.json\")); !os.IsNotExist(err) {\n\t\t\treturn filepath.Join(path.Join(home, \".bin\")), nil\n\t\t}\n\t}\n\n\tc := os.Getenv(\"XDG_CONFIG_HOME\")\n\tif _, err := os.Stat(c); !os.IsNotExist(err) {\n\t\treturn filepath.Join(c, \"bin\"), nil\n\t}\n\n\tif homeErr != nil {\n\t\treturn \"\", homeErr\n\t}\n\tc = filepath.Join(home, \".config\")\n\tif _, err := os.Stat(c); !os.IsNotExist(err) {\n\t\treturn filepath.Join(c, \"bin\"), nil\n\t}\n\n\treturn filepath.Join(home, \".bin\"), nil\n}", "func configDirPath() string {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\tlogging.LogFatal(\"config/configDirPath() - Can't find current user: \", err)\n\t}\n\n\t// println(\"usr.HomeDir: \", usr.HomeDir)\n\tconfigDirPath := paths.GetFilePath(usr.HomeDir, configDirName)\n\n\treturn configDirPath\n}", "func PathConfig(homeDir string) string {\n\treturn fmt.Sprintf(\"%s/%s\", homeDir, ConfigSubDir)\n}", "func getConfigFilePath() string {\n\t// get current system user\n\tu, err := user.Current()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn path.Join(u.HomeDir, configFileName)\n}", "func GetConfigPath() (string, error) {\n\tvar carriageReturn string\n\tconfigFile := \"/api.conf\"\n\tdir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\tif err != nil {\n\t\tos.Exit(EXIT_FLAG_ERROR)\n\t}\n\tconfigPath := dir + configFile\n\tif _, err := os.Stat(configPath); err == nil {\n\t\treturn configPath, nil\n\t}\n\tvar cmdName string\n\tif runtime.GOOS == \"windows\" {\n\t\tcmdName = \"where\"\n\t\tcarriageReturn = \"\\r\\n\"\n\t} else {\n\t\tcmdName = \"which\"\n\t\tcarriageReturn = \"\\n\"\n\t}\n\tresponse, err := GetCommandOutput(cmdName, 2*time.Second, os.Args[0])\n\tpath := string(bytes.Split(response, []byte(carriageReturn))[0])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// check if is a symlink\n\tfile, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif file.Mode()&os.ModeSymlink == os.ModeSymlink {\n\t\t// This is a symlink\n\t\tpath, err = filepath.EvalSymlinks(path)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn filepath.Dir(path) + configFile, nil\n}", "func (i *Instance) ConfigPath() string {\n\treturn i.appDataDir\n}", "func ConfigPath(ctx *types.SystemContext) string {\n\tconfPath := systemRegistriesConfPath\n\tif ctx != nil {\n\t\tif ctx.SystemRegistriesConfPath != \"\" {\n\t\t\tconfPath = ctx.SystemRegistriesConfPath\n\t\t} else if ctx.RootForImplicitAbsolutePaths != \"\" {\n\t\t\tconfPath = filepath.Join(ctx.RootForImplicitAbsolutePaths, systemRegistriesConfPath)\n\t\t}\n\t}\n\treturn confPath\n}", "func ConfigDir() string {\n\treturn configDir\n}", "func ConfigDirPath(envContainer EnvContainer) (string, error) {\n\treturn xdgDirPath(envContainer, \"XDG_CONFIG_HOME\", \".config\")\n}", "func getConfigFilePath() string {\n\tpathList := [5]string{\n\t\t\"config.json\",\n\t\t\"../config.json\",\n\t\t\"../../config.json\",\n\t\t\"../../../config.json\",\n\t\t\"../../../../config.json\",\n\t}\n\n\t_, b, _, _ := runtime.Caller(0)\n\tfilePath := filepath.Dir(b)\n\tfilePath = filepath.Join(filePath, \"../config.json\")\n\n\tpath, err := os.Getwd()\n\tif err == nil {\n\t\tfor _, configPath := range pathList {\n\t\t\tprocessFilePath := filepath.Join(path, configPath)\n\t\t\texist, _ := exists(processFilePath)\n\t\t\tif exist == true {\n\t\t\t\tfilePath = processFilePath\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn filePath\n}", "func ConfigFilePath() string {\n\treturn ConfigDir + \"/\" + ConfigFile\n}", "func (c Config) GetConfigDirPath() (string, error) {\n\t// Get home directory.\n\thome := os.Getenv(homeKey)\n\tif home != \"\" {\n\t\treturn filepath.Join(home, \".mstreamb0t\"), nil\n\t}\n\tu, err := user.Current()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(u.HomeDir, \".mstreamb0t\"), nil\n}", "func GetConfigPath(fileName string) string {\n\tif len(fileName) > 0 {\n\t\tfilepath, err := filepath.Abs(fileName)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"WARNING: No chef configuration file found at %s \\n\", fileName)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif !doesDirExist(filepath) {\n\t\t\tfmt.Printf(\"WARNING: No chef configuration file found at %s \\n\", fileName)\n\t\t\tos.Exit(1)\n\t\t}\n\t\treturn filepath\n\t}\n\tex, err := os.Getwd()\n\tif err != nil {\n\t\treturn GetDefaultConfigPath()\n\t}\n\n\treturn filepath.Join(ex, configPath)\n\n}", "func configPath() string {\n\tenv := os.Getenv(configPathEnv)\n\tif env == \"\" {\n\t\treturn defaultConfigFile\n\t}\n\treturn env\n}", "func getConfigFolderPath() string {\n\tsep := string(filepath.Separator)\n\twd, _ := os.Getwd()\n\n\twdPath := strings.Split(wd, sep)\n\tindexOfSrc := lastIndexOf(wdPath, \"src\")\n\tindexOfBin := lastIndexOf(wdPath, \"bin\")\n\n\tcfgPath := \"\"\n\tvar pathEl []string\n\tif indexOfBin > -1 && indexOfBin > indexOfSrc {\n\t\tpathEl = wdPath[:indexOfBin] // take up to bin (exclusive)\n\t} else if indexOfSrc > -1 {\n\t\tpathEl = wdPath[:indexOfSrc] // take up to src (exclusive)\n\t}\n\n\tif len(pathEl) > 0 {\n\t\tcfgPath = strings.Join(pathEl, sep) + sep\n\t\tcfgPath += \"config\" + sep\n\t}\n\n\treturn cfgPath\n}", "func (a AppConfig) ConfigDir() string {\n\tconfigDirMutex.RLock()\n\tdefer configDirMutex.RUnlock()\n\treturn configDir\n}", "func (s *Scope) configDir() (string, error) {\n\tp, err := s.dataDir()\n\tif err != nil {\n\t\treturn p, err\n\t}\n\n\treturn filepath.Join(p, \"Config\"), nil\n}", "func Path() string {\n\tconfigPath := os.Getenv(EnvironmentPrefix() + configDir)\n\tif configPath == \"\" {\n\t\tconfigPath = config\n\t}\n\treturn configPath\n}", "func getConfigPath(path string) (file string) {\r\n\treturn fmt.Sprintf(\"%s/%s\", path, \"app.ini\")\r\n}", "func ConfigDir() string {\n\treturn filepath.Join(userSettingsDir, \"kopia\")\n}", "func GetConfigDir() string {\n\treturn configDir\n}", "func PathCfgDir() string {\n\tdir := os.Getenv(ENV_CFG_DIR)\n\tif dir != \"\" {\n\t\treturn dir\n\t}\n\thomeDir, err := Home()\n\tif err != nil {\n\t\tlog.Fatal(\"can not fetch home directory\")\n\t}\n\treturn filepath.Join(homeDir, DEFAULT_CFG_DIR)\n}", "func ConfigurationPath(profile string) (string, error) {\n\tpath, err := ConfigurationDirectoryPath()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tp, err := path_helper.Fullpath(filepath.Join(path, profile+\".toml\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn p, nil\n}", "func GetConfigPath() string {\n\treturn os.Getenv(CONFIGPATHVAR)\n}", "func getConfigFilePath() (string, error) {\n var err error\n configPath := configdir.LocalConfig(\"road-trip\")\n err = configdir.MakePath(configPath) // Ensure it exists.\n if err != nil {\n return \"\", errors.New(\"Cannot access folder: '\" + configPath + \"' to store config file.\")\n }\n\n return configPath + string(os.PathSeparator) + \"player.yaml\", nil\n}", "func ConfigDir() string {\n\tdir := \".\"\n\tswitch goos {\n\tcase \"darwin\":\n\t\tdir = path.Join(envFunc(\"HOME\"), \"Library\", \"Application Support\", \"shade\")\n\tcase \"linux\", \"freebsd\":\n\t\tdir = path.Join(envFunc(\"HOME\"), \".shade\")\n\tdefault:\n\t\tlog.Printf(\"TODO: ConfigDir on GOOS %q\", goos)\n\t}\n\treturn dir\n}", "func getConfigPath() (string, error) {\n\treturn \"./veille.yaml\", nil\n}", "func getMcConfigPath() (string, error) {\n\tdir, err := getMcConfigDir()\n\tif err != nil {\n\t\treturn \"\", NewIodine(iodine.New(err, nil))\n\t}\n\treturn filepath.Join(dir, mcConfigFile), nil\n}", "func path() string {\n\tif len(configPath) != 0 {\n\t\treturn configPath\n\t}\n\treturn \"config/database.yml\"\n}", "func (w *Writer) configPath(configDigest digest.Digest) string {\n\treturn configDigest.Hex() + \".json\"\n}", "func UserConfigDir() (string, error)", "func getSSHConfigPath(homeDir string) (string, error) {\n\tfp := path.Join(homeDir, \"/.ssh/config\")\n\tif ok := fileExists(fp); !ok {\n\t\tnewConfigFile, err := os.Create(fp)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tdefer newConfigFile.Close()\n\t}\n\treturn fp, nil\n}", "func GetConfigFolder() string {\n\treturn filepath.Join(helper.Home(), configPath)\n}", "func GetConfigFilePath() string {\n\tpath, _ := osext.ExecutableFolder()\n\tpath = fmt.Sprintf(\"%s/eremetic.yml\", path)\n\tif _, err := os.Open(path); err == nil {\n\t\treturn path\n\t}\n\tglobalPath := \"/etc/eremetic/eremetic.yml\"\n\tif _, err := os.Open(globalPath); err == nil {\n\t\treturn globalPath\n\t}\n\n\treturn \"\"\n}", "func getConfFilePath(root, clusterName string) string {\n\treturn fmt.Sprintf(\"%s/%s.config\", root, clusterName)\n}", "func configDir() (string, error) {\n\tif dc := os.Getenv(\"DOCKER_CONFIG\"); dc != \"\" {\n\t\treturn dc, nil\n\t}\n\tif h := dockerUserHomeDir(); h != \"\" {\n\t\treturn filepath.Join(dockerUserHomeDir(), \".docker\"), nil\n\t}\n\treturn \"\", errNoHomeDir\n}", "func (cfg *Configurator) ConfigFilePath() string {\n\treturn cfg.configFilePath\n}", "func GetConfigDirectory() string {\n\tconfigBase := os.Getenv(\"CONFIG_BASE\")\n\tif configBase == \"\" {\n\t\tdir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\t\tif err != nil {\n\t\t\tconfigBase = \".\"\n\t\t} else {\n\t\t\tconfigBase = filepath.Join(dir, \"..\", \"conf\")\n\t\t}\n\t}\n\n\treturn configBase\n}", "func (c *ConfigFile) ConfigDir() string {\n\trw, err := NewConfigReadWriter(c.version)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn rw.ConfigDir(c)\n}", "func (c *Context) KubeConfigPath() string {\n\t// TODO(bentheelder): Windows?\n\t// configDir matches the standard directory expected by kubectl etc\n\tconfigDir := filepath.Join(os.Getenv(\"HOME\"), \".kube\")\n\t// note that the file name however does not, we do not want to overwite\n\t// the standard config, though in the future we may (?) merge them\n\tfileName := fmt.Sprintf(\"kind-config-%s\", c.name)\n\treturn filepath.Join(configDir, fileName)\n}", "func configDirPathEnsureExists() string {\n\tconfigDirPath := configDirPath()\n\n\t_, err := os.Stat(configDirPath)\n\tif err != nil {\n\t\terr = os.Mkdir(configDirPath, os.ModePerm)\n\t\tif err != nil {\n\t\t\tlogging.LogFatal(\"config/configDirPathEnsureExists() - Can't create configuration directory: \", err)\n\t\t}\n\t}\n\n\treturn configDirPath\n}", "func ConfigPath() string {\n\n\tif flagConfig == nil {\n\t\tpanic(\"ConfigPath called before init\")\n\t}\n\n\tif !flag.Parsed() {\n\t\tpanic(\"ConfigPath called before flag.Parse\")\n\t}\n\n\treturn *flagConfig\n}", "func configLocation() string {\n\tif configFileLocation == \"\" {\n\t\thome, err := homedir.Dir()\n\t\terrorExit(err)\n\t\treturn fmt.Sprintf(\"%s/%s\", home, configFileLocation)\n\t}\n\treturn configFileLocation\n}", "func getVMConfigPath(configDir, vmName string) string {\n\treturn filepath.Join(configDir, fmt.Sprintf(\"%s.json\", vmName))\n}", "func (cc *CollectdConfig) ConfigFilePath() string {\n\treturn filepath.Join(cc.InstanceConfigDir(), \"collectd.conf\")\n}", "func (tc *TestConfig) Path() string {\n\treturn tc.configPath\n}", "func DetermineConfigFilePath() string {\n\tdir := util.ExeDirectory()\n\tr := lookForConfigFile(dir)\n\tif len(r) != 0 {\n\t\treturn r\n\t}\n\n\tdir, err := homedir.Dir()\n\tif err != nil {\n\t\tlog.Printf(\"failed to get home dir: %v\\n\", err)\n\t\treturn \"\"\n\t}\n\treturn lookForConfigFile(dir)\n}", "func (a AppConfig) ServiceConfigPath(id ServiceID) string {\n\treturn fmt.Sprintf(\"%s/%s\", a.ConfigDir(), a.ServiceConfigID(id))\n}", "func SetConfigPath(p string) {\n\tconfigPath = p\n}", "func (conf blah) Path() string {\n\treturn configPath\n}", "func GetConfigRootDir() string {\n\tconfigFile := viper.GetString(\"viper.config_file\")\n\tif configFile == \"\" {\n\t\tcwd, _ := os.Getwd()\n\t\treturn cwd\n\t}\n\n\treturn path.Dir(configFile)\n}", "func GetConfDir() string {\n\treturn fileutil.GetConfDir()\n}", "func GetDefaultConfigPath() string {\n\thomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn filepath.Join(\"/etc/chef\", configPath)\n\t}\n\tif !checkChefDirExists(homeDir) {\n\t\tfmt.Printf(\"WARNING: No chef configuration file found at %s\", homeDir)\n\t\tos.Exit(1)\n\t}\n\treturn filepath.Join(homeDir, configPath)\n\n}", "func ProjectConfigPath(c context.Context) string {\n\treturn svcconfig.ProjectConfigPath(cfgclient.CurrentServiceName(c))\n}", "func InConfigDir(filename string) (string, error) {\n\tcdir := *configdir\n\n\tif cdir == \"\" {\n\t\tif runtime.GOOS == \"linux\" {\n\t\t\t// It is more common on Linux to expect application related directories\n\t\t\t// in all lowercase. The lantern wrapper also expects a lowercased\n\t\t\t// directory.\n\t\t\tcdir = appdir.General(\"lantern\")\n\t\t} else {\n\t\t\t// In OSX and Windows, they prefer to see the first letter in uppercase.\n\t\t\tcdir = appdir.General(\"Lantern\")\n\t\t}\n\t}\n\n\tlog.Debugf(\"Placing configuration in %v\", cdir)\n\tif _, err := os.Stat(cdir); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\t// Create config dir\n\t\t\tif err := os.MkdirAll(cdir, 0750); err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"Unable to create configdir at %s: %s\", cdir, err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn filepath.Join(cdir, filename), nil\n}", "func UserConfigDir(tc Context) (string, error) {\n\treturn os.UserConfigDir()\n}", "func GetConfigFilePath(override string) string {\n\tif len(override) > 0 {\n\t\treturn override\n\t}\n\tglobalPath := \"/etc/fusion/fusion.yml\"\n\tif _, err := os.Open(globalPath); err == nil {\n\t\treturn globalPath\n\t}\n\n\treturn \"\"\n}", "func GetClusterConfigPath(cluster string) (string, error) {\n\thome, err := GetHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn home + \"/.kcm/\" + cluster + \"/config\", nil\n}", "func (s *Scope) configDir() (string, error) {\n\tswitch s.Type {\n\tcase System:\n\t\treturn defaultConfigDirs[0], nil\n\n\tcase User:\n\t\tpath := os.Getenv(\"XDG_CONFIG_HOME\")\n\t\tif path == \"\" {\n\t\t\treturn expandUser(\"~/.config\"), nil\n\t\t}\n\t\treturn path, nil\n\n\tcase CustomHome:\n\t\treturn filepath.Join(s.CustomHome, \".config\"), nil\n\t}\n\n\treturn \"\", ErrInvalidScope\n}", "func (g *GenericVaultBackend) EncryptionConfigPath() string {\n\treturn filepath.Join(g.Path(), \"encryption-config\")\n}", "func getConfigFile() (string, error) {\n\tconfigDir, err := os.UserConfigDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tappDir := configDir + \"/whatphone\"\n\tif _, err := os.Stat(appDir); os.IsNotExist(err) {\n\t\terr = os.Mkdir(appDir, 0744)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn appDir + \"/config.json\", nil\n}", "func wslConfigFilePath() (string, error) {\n\thome, err := userHomeDirectory()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn path.Join(home, wslConfigFile), nil\n}", "func findConfigDir() (string, error) {\n\n\tvar p []string = []string{} // The directories in which we looked, for error message\n\tvar configDir string // The directory in which we found the configuration\n\n\t// Look for the developer's private configuration.\n\tif dir, err := os.Getwd(); err == nil {\n\t\tcfgdir := path.Join(dir, kCONFIG_DIR_DEV)\n\t\tcfgpath := path.Join(cfgdir, kCONFIG_FILENAME)\n\t\tp = append(p, cfgdir)\n\t\tif _, err := os.Stat(cfgpath); err == nil {\n\t\t\tconfigDir = cfgdir\n\t\t}\n\t}\n\n\t// If not found, look for the production configuration.\n\tif configDir == \"\" {\n\t\tcfgdir := kCONFIG_DIR_PROD\n\t\tcfgpath := path.Join(cfgdir, kCONFIG_FILENAME)\n\t\tp = append(p, cfgdir)\n\t\tif _, err := os.Stat(cfgpath); err == nil {\n\t\t\tconfigDir = cfgdir\n\t\t}\n\t}\n\n\t// Report an error if no configuration file was found.\n\tif configDir == \"\" {\n\t\treturn \"\", fmt.Errorf(\"Unable to locate configuration file %q in path %s\",\n\t\t\tkCONFIG_FILENAME, strings.Join(p, \":\"))\n\t} else {\n\t\treturn configDir, nil\n\t}\n}", "func Path(sys string) (string, error) {\n\n\tvar paths []string\n\n\t// if CHEAT_CONFIG_PATH is set, return it\n\tif os.Getenv(\"CHEAT_CONFIG_PATH\") != \"\" {\n\n\t\t// expand ~\n\t\texpanded, err := homedir.Expand(os.Getenv(\"CHEAT_CONFIG_PATH\"))\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to expand ~: %v\", err)\n\t\t}\n\n\t\treturn expanded, nil\n\n\t\t// OSX config paths\n\t} else if sys == \"darwin\" {\n\n\t\tpaths = []string{\n\t\t\tpath.Join(os.Getenv(\"XDG_CONFIG_HOME\"), \"/cheat/conf.yml\"),\n\t\t\tpath.Join(os.Getenv(\"HOME\"), \".config/cheat/conf.yml\"),\n\t\t\tpath.Join(os.Getenv(\"HOME\"), \".cheat/conf.yml\"),\n\t\t}\n\n\t\t// Linux config paths\n\t} else if sys == \"linux\" {\n\n\t\tpaths = []string{\n\t\t\tpath.Join(os.Getenv(\"XDG_CONFIG_HOME\"), \"/cheat/conf.yml\"),\n\t\t\tpath.Join(os.Getenv(\"HOME\"), \".config/cheat/conf.yml\"),\n\t\t\tpath.Join(os.Getenv(\"HOME\"), \".cheat/conf.yml\"),\n\t\t\t\"/etc/cheat/conf.yml\",\n\t\t}\n\n\t\t// Windows config paths\n\t} else if sys == \"windows\" {\n\n\t\tpaths = []string{\n\t\t\tfmt.Sprintf(\"%s/cheat/conf.yml\", os.Getenv(\"APPDATA\")),\n\t\t\tfmt.Sprintf(\"%s/cheat/conf.yml\", os.Getenv(\"PROGRAMDATA\")),\n\t\t}\n\n\t\t// Unsupported platforms\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"unsupported os: %s\", sys)\n\t}\n\n\t// check if the config file exists on any paths\n\tfor _, p := range paths {\n\t\tif _, err := os.Stat(p); err == nil {\n\t\t\treturn p, nil\n\t\t}\n\t}\n\n\t// we can't find the config file if we make it this far\n\treturn \"\", fmt.Errorf(\"could not locate config file\")\n}", "func getConfigFilePath() string {\n\tvar configFile string\n\tflag.StringVar(&configFile, \"config\", \"./config.json\", \"JSON config file path\")\n\tflag.Parse()\n\n\tlog.Printf(\"Using config file %s\", configFile)\n\n\treturn configFile\n}", "func CephConfFilePath(configDir, clusterName string) string {\n\tconfFile := fmt.Sprintf(\"%s.config\", clusterName)\n\treturn path.Join(configDir, clusterName, confFile)\n}", "func ConfigDirectory() (dir string, e error) {\r\n\tdir, e = SystemDirectory()\r\n\tif s, ok := os.LookupEnv(\"PROGRAMDATA\"); ok {\r\n\t\tdir, e = s, nil\r\n\t}\r\n\treturn\r\n}", "func SetConfigPath(path string) {\n\tconfigPath = path\n}", "func mustGetConfigDir() string {\n\thomeDir, err := homedir.Dir()\n\tif err != nil {\n\t\tlog.Fatal(\"Unable to get the home directory\", err)\n\t}\n\treturn filepath.Join(homeDir, globalMnmConfigDir)\n}", "func (stim *Stim) ConfigGetCacheDir(subDir string) string {\n\n\tcachePath := stim.ConfigGetString(\"cache-path\")\n\tcacheSubPath := filepath.Join(cachePath, subDir)\n\n\terr := utils.CreateDirIfNotExist(cacheSubPath, utils.UserGroupMode)\n\tif err != nil {\n\t\tstim.log.Fatal(\"Error creating cache directory at {}\", cacheSubPath)\n\t}\n\n\treturn cacheSubPath\n}", "func (s EngineState) DockerComposeConfigPath() string {\n\tfor _, ms := range s.ManifestStates {\n\t\tif ms.Manifest.IsDC() {\n\t\t\treturn ms.Manifest.DCInfo().ConfigPath\n\t\t}\n\t}\n\treturn \"\"\n}", "func getUserConfigFolderPath() string {\n\n\tuserName := getUserName()\n\n if userName == \"\" {\n return \"\"\n }\n\n\tcfgFolder := getConfigFolderPath()\n\tsep := string(filepath.Separator)\n\n\tpath := cfgFolder + userName + sep\n\n\treturn path\n}", "func Dir() string {\n\treturn configDir\n}", "func KubeConfigPath() string {\n\tkubeconfigEnv := os.Getenv(\"KUBECONFIG\")\n\tif kubeconfigEnv == \"\" {\n\t\thome := os.Getenv(\"HOMEDRIVE\") + os.Getenv(\"HOMEPATH\")\n\t\tif home == \"\" {\n\t\t\tfor _, h := range []string{\"HOME\", \"USERPROFILE\"} {\n\t\t\t\tif home = os.Getenv(h); home != \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tkubeconfigPath := filepath.Join(home, \".kube\", \"config\")\n\t\treturn kubeconfigPath\n\t}\n\treturn kubeconfigEnv\n}", "func GetPathRelativeToConfig(configuration *viper.Viper, key string) string {\n\tconfigFile := configuration.ConfigFileUsed()\n\tp := configuration.GetString(key)\n\tif p == \"\" || filepath.IsAbs(p) {\n\t\treturn p\n\t}\n\treturn filepath.Clean(filepath.Join(filepath.Dir(configFile), p))\n}", "func (s *SoftHSMSetup) GetConfigFilename() string {\n\treturn s.statedir + \"/softhsm2.conf\"\n}", "func mockConfigDir() (string, error) {\n\treturn \"/tmp/CONFIG/datamaps/\", nil\n}", "func NewConfig() *Config {\n\treturn &Config{\n\t\toutputPath: \"/tmp/\",\n\t}\n}", "func configDir() (string, error) {\n\t// At the moment (go1.8.3), os.user.Current() just produces: \"user: Current not implemented on YOUROS/YOURARCH\"\n\t// Apparently this is due to lack of support with cross-compiled binaries? Therefore we DIY it here.\n\n\t// DC/OS CLI allows users to manually override the config dir (default ~/.dcos) with a DCOS_DIR envvar:\n\tconfigDir := config.DcosConfigRootDir // proxy for DCOS_DIR envvar\n\tif len(configDir) != 0 {\n\t\treturn configDir, nil\n\t}\n\n\t// OSX/Linux: $HOME/.dcos/\n\thomeDir := os.Getenv(\"HOME\")\n\tif len(homeDir) != 0 {\n\t\treturn path.Join(homeDir, dcosConfigDirName), nil\n\t}\n\n\t// Windows: ${HOMEDRIVE}${HOMEPATH}/.dcos/ or $USERPROFILE/.dcos/\n\thomeDrive := os.Getenv(\"HOMEDRIVE\")\n\thomePath := os.Getenv(\"HOMEPATH\")\n\tif len(homeDrive) != 0 && len(homePath) != 0 {\n\t\treturn path.Join(homeDrive + homePath, dcosConfigDirName), nil\n\t}\n\thomeDir = os.Getenv(\"USERPROFILE\")\n\tif len(homeDir) != 0 {\n\t\treturn path.Join(homeDir, dcosConfigDirName), nil\n\t}\n\n\t// If we get here, it means that we couldn't figure out the user's home directory.\n\t// Shouldn't happen in practice.\n\treturn \"\", fmt.Errorf(\"Unable to resolve CLI config directory: DCOS_DIR, HOME, HOMEDRIVE+HOMEPATH, or USERPROFILE\")\n}", "func getConfFilePath(profile string) string {\n\tpwd, e := os.Getwd()\n\tutil.LogPanic(e)\n\n\tpath := pwd + defaultConfPath\n\tif profile != \"\" {\n\t\tpath += \"-\" + profile\n\t}\n\treturn path + defaultConfFilesSuffix\n}", "func getDefaultConfigPath() (string, error) {\n\tfile := \"efc-agent.conf\"\n\tetcfile := \"/etc/efc-agent/efc-agent.conf\"\n\treturn getPath(file, etcfile)\n}", "func (c *client) GetTKGConfigPath() (string, error) {\n\ttkgDir, err := c.GetTKGDirectory()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(tkgDir, constants.TKGConfigFileName), nil\n}", "func filePath() []byte {\n\tconfigFileName := \"config.dev.json\"\n\tif isProd() {\n\t\tconfigFileName = \"config.prod.json\"\n\t}\n\treturn []byte(fmt.Sprintf(\"%s/%s\", directoryPath, configFileName))\n}", "func (g *Generator) ConfigWorkingDir() string {\n\treturn g.image.Config.WorkingDir\n}", "func (config *SQLConfiguration) GetPath() string {\n\tvar path, defaultFile, customFile string\n\tpath = \"database/\"\n\tdefaultFile = path + \"default.json\"\n\tcustomFile = path + \"custom.json\"\n\tif _, err := os.Open(\"conf/\" + customFile); err == nil {\n\t\treturn customFile\n\t}\n\treturn defaultFile\n}", "func (c *client) GetProvidersConfigFilePath() (string, error) {\n\tprovidersDir, err := c.GetTKGProvidersDirectory()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filepath.Join(providersDir, constants.LocalProvidersConfigFileName), nil\n}", "func GetUserConfigFilePath() string {\n\treturn strings.Replace(DefaultConfigFile, \"~/\", getHome()+\"/\", 1)\n}", "func GenerateWorkDirConfig() Config {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to generate WD config: %s\", dir)\n\t}\n\tc := makeConfig()\n\tc.DBPath = filepath.Join(dir, \"users.db\")\n\treturn c\n}", "func FindProjectConfigFilePath() (string, error) {\n\tif cwd, err := os.Getwd(); err == nil {\n\t\tvar configFilePath string\n\t\tfor cwd != \".\" && cwd != string(filepath.Separator) {\n\t\t\tfor _, filename := range [2]string{\"outrigger.yml\", \".outrigger.yml\"} {\n\t\t\t\tconfigFilePath = filepath.Join(cwd, filename)\n\t\t\t\tif _, e := os.Stat(configFilePath); !os.IsNotExist(e) {\n\t\t\t\t\treturn configFilePath, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcwd = filepath.Dir(cwd)\n\t\t}\n\t} else {\n\t\treturn \"\", err\n\t}\n\n\treturn \"\", errors.New(\"no outrigger configuration file found\")\n}" ]
[ "0.8150866", "0.7730704", "0.7705843", "0.7655836", "0.76476586", "0.76372105", "0.7603077", "0.75548154", "0.7487704", "0.7369483", "0.7368857", "0.73669976", "0.733971", "0.7332822", "0.73314613", "0.7289326", "0.72733855", "0.7258255", "0.7245482", "0.7215005", "0.71929896", "0.71904343", "0.7167444", "0.7149146", "0.71390826", "0.71247935", "0.71037775", "0.7093888", "0.7088289", "0.708313", "0.7064805", "0.6975702", "0.69724333", "0.69713265", "0.6966677", "0.6954288", "0.6915451", "0.6878067", "0.6864321", "0.685268", "0.68218446", "0.6801836", "0.675582", "0.6751046", "0.6747579", "0.6718724", "0.66759133", "0.66741854", "0.66404575", "0.66152364", "0.6586046", "0.6585859", "0.6576143", "0.65654695", "0.65248424", "0.6517885", "0.6507424", "0.6495996", "0.6491989", "0.6475492", "0.64652723", "0.64567924", "0.6448398", "0.6429596", "0.6402517", "0.6398389", "0.63885206", "0.6387909", "0.6387025", "0.63323295", "0.63308626", "0.6329691", "0.6308597", "0.6306989", "0.6303164", "0.6287202", "0.62849885", "0.6261275", "0.6256722", "0.6237408", "0.62362576", "0.6235189", "0.62049574", "0.61953783", "0.6188606", "0.6174153", "0.6145725", "0.6144507", "0.614131", "0.61310405", "0.61143005", "0.61091673", "0.6069591", "0.6066317", "0.60644674", "0.6039238", "0.60361975", "0.6033405", "0.602954", "0.5988738" ]
0.8208066
0
Helpers ouput prints set KUBECONFIG variable
func output(linkPath string) error { fmt.Printf("export %s=%s\n", kubeConfigVar, linkPath) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cfg *Config) Print() {\n fmt.Println(\"assigned key:\", cfg.ConsumerKey)\n}", "func printKubeConfigHelpOutput() {\n\tfmt.Println(\"No authentication context was found. This plugin looks for a configuration in one of the following places:\")\n\tfmt.Printf(\"\\t(1) The --kubeconfig flag passed to this plugin.\\n\")\n\tfmt.Printf(\"\\t(2) The KUBECONFIG environment variable.\\n\")\n\tfmt.Printf(\"\\t(3) The .kube directory in your home directory.\\n\")\n\tfmt.Println(\"Configuration file precedence is as listed above.\")\n}", "func (f *EnvFlags) Kubeconfig() string {\n\treturn f.kubeconfig\n}", "func (ts *Tester) Kubeconfig() (string, error) {\n\treturn ts.cfg.KubeConfigPath, nil\n}", "func ConfigShow() error {\n\n\tfmt.Printf(\"\\nCurrently saved values:\\n\")\n\n\tif Config.Secure {\n\t\tfmt.Printf(\" -https\\n\")\n\t} else {\n\t\tfmt.Printf(\" -http\\n\")\n\t}\n\n\tif Config.Hub != \"\" && Config.Hub != notehub.DefaultAPIService {\n\t\tfmt.Printf(\" -hub %s\\n\", Config.Hub)\n\t}\n\tif Config.App != \"\" {\n\t\tfmt.Printf(\" -app %s\\n\", Config.App)\n\t}\n\tif Config.Product != \"\" {\n\t\tfmt.Printf(\" -product %s\\n\", Config.Product)\n\t}\n\tif Config.Device != \"\" {\n\t\tfmt.Printf(\" -device %s\\n\", Config.Device)\n\t}\n\tif Config.Root != \"\" {\n\t\tfmt.Printf(\" -root %s\\n\", Config.Root)\n\t}\n\tif Config.Cert != \"\" {\n\t\tfmt.Printf(\" -cert %s\\n\", Config.Cert)\n\t}\n\tif Config.Key != \"\" {\n\t\tfmt.Printf(\" -key %s\\n\", Config.Key)\n\t}\n\tif Config.Interface != \"\" {\n\t\tfmt.Printf(\" -interface %s\\n\", Config.Interface)\n\t\tif Config.Port == \"\" {\n\t\t\tfmt.Printf(\" -port -\\n\")\n\t\t\tfmt.Printf(\" -portconfig -\\n\")\n\t\t} else {\n\t\t\tfmt.Printf(\" -port %s\\n\", Config.Port)\n\t\t\tfmt.Printf(\" -portconfig %d\\n\", Config.PortConfig)\n\t\t}\n\t}\n\n\treturn nil\n\n}", "func printConfig() {\r\n\tfmt.Println(\"\\n--- Application configuration ---\")\r\n\tfor key, value := range appConfig {\r\n\t\tfmt.Println(fmt.Sprintf(\"\\tkey: %s, value: %v\", key, value));\r\n\t}\r\n\tfmt.Println(\"---------------------------------\")\r\n}", "func printConfig() {\n\n\tvar m map[string]string\n\n\tm[\"LogPath\"] = conf.Conf.LogPath\n\n\tutil.Logf(\"Configuration >> %v\", m)\n}", "func printConfiguration(clustercfg *kubeadmapi.ClusterConfiguration, w io.Writer, printer output.Printer) {\n\t// Short-circuit if cfg is nil, so we can safely get the value of the pointer below\n\tif clustercfg == nil {\n\t\treturn\n\t}\n\n\tcfgYaml, err := configutil.MarshalKubeadmConfigObject(clustercfg, kubeadmapiv1.SchemeGroupVersion)\n\tif err == nil {\n\t\tprinter.Fprintln(w, \"[upgrade/config] Configuration used:\")\n\n\t\tscanner := bufio.NewScanner(bytes.NewReader(cfgYaml))\n\t\tfor scanner.Scan() {\n\t\t\tprinter.Fprintf(w, \"\\t%s\\n\", scanner.Text())\n\t\t}\n\t}\n}", "func genKubeconfig(contexts ...string) string {\n\tvar sb strings.Builder\n\tsb.WriteString(`---\napiVersion: v1\nkind: Config\nclusters:\n`)\n\tfor _, ctx := range contexts {\n\t\tsb.WriteString(`- cluster:\n server: ` + ctx + `\n name: ` + ctx + `\n`)\n\t}\n\tsb.WriteString(\"contexts:\\n\")\n\tfor _, ctx := range contexts {\n\t\tsb.WriteString(`- context:\n cluster: ` + ctx + `\n user: ` + ctx + `\n name: ` + ctx + `\n`)\n\t}\n\n\tsb.WriteString(\"users:\\n\")\n\tfor _, ctx := range contexts {\n\t\tsb.WriteString(`- name: ` + ctx + `\n`)\n\t}\n\tsb.WriteString(\"preferences: {}\\n\")\n\tif len(contexts) > 0 {\n\t\tsb.WriteString(\"current-context: \" + contexts[0] + \"\\n\")\n\t}\n\n\treturn sb.String()\n}", "func PrintConfiguration() {\n\t// 打印配置的时候密码不显示\n\tif !Config.Verbose {\n\t\tConfig.OnlineDSN.Password = \"********\"\n\t\tConfig.TestDSN.Password = \"********\"\n\t}\n\tdata, _ := yaml.Marshal(Config)\n\tfmt.Print(string(data))\n}", "func (o ClusterOutput) Kubeconfig() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.AnyOutput { return v.Kubeconfig }).(pulumi.AnyOutput)\n}", "func printConfig(config enigma) {\n\tfmt.Printf(\"\\n\\n Enigma configuration:\")\n\n\tfmt.Printf(\"\\n\\n\\t Rotor configuration:\\n\\t\\t\")\n\tfor _, rotor := range config.rotors {\n\t\tfmt.Printf(\"%v \", rotor)\n\t}\n\n\tfmt.Printf(\"\\n\\n\\t Rotor position configuration:\\n\\t\\t\")\n\tfor _, position := range config.positions {\n\t\tfmt.Printf(\"%v \", position)\n\t}\n\n\tfmt.Printf(\"\\n\\n\\t Plugboard configuration:\\n\")\n\tfmt.Printf(\"\\t\\t%v\", config.plugboard)\n\tfmt.Printf(\"\\n\\t\\t%v\", formatPlugboard(config.plugboard))\n\n\tfmt.Printf(\"\\n\\n\\n\")\n}", "func (s GetPlaybackConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c Conf) String() string {\n\treturn fmt.Sprint(\"ConfigOverrides:\", c.ConfigOverrides, \"\\n\")\n}", "func (keys *GlobalOptionsKey) KubeconfigAPIURL() string {\n\treturn viper.GetString(keys.kubeconfigAPIURL)\n}", "func (s ConfigureLogsForPlaybackConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o ClusterOutput) KubeconfigJson() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringOutput { return v.KubeconfigJson }).(pulumi.StringOutput)\n}", "func KubeConfig() string {\n\tkubeconfig := os.Getenv(\"KUBECONFIG\")\n\tif len(kubeconfig) == 0 {\n\t\tkubeconfig = filepath.Join(UserHome, \".kube\", \"config\")\n\t}\n\treturn kubeconfig\n}", "func (s *StockImpl) KubeconfigKubelet() asset.Asset { return s.kubeconfigKubelet }", "func (o KafkaConnectorOutput) Config() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *KafkaConnector) pulumi.StringMapOutput { return v.Config }).(pulumi.StringMapOutput)\n}", "func ShowEnv() {\n\tfmt.Printf(\"CLUSTERID=%s\\n\", env.ClusterID)\n\tfmt.Printf(\"NAMESPACE=%s\\n\", env.Namespace)\n}", "func PrintConfig() {\n\tfor k, v := range config {\n\t\tfmt.Printf(\"%s: %v\\n\", k, v)\n\t}\n}", "func (s *StockImpl) KubeconfigAdmin() asset.Asset { return s.kubeconfig }", "func (p *Provider) KubeConfig(name string, internal bool) (string, error) {\n\treturn kubeconfig.Get(p.ic(name), !internal)\n}", "func PrintConfig() {\n\tfmt.Println(\"LocalFolderPath: \", *LocalFolderPath)\n\tfmt.Println(\"dpRestURL: \", *dpRestURL)\n\tfmt.Println(\"dpSomaURL: \", *dpSomaURL)\n\tfmt.Println(\"dpUsername: \", *dpUsername)\n\tfmt.Println(\"DpPassword: \", strings.Repeat(\"*\", len(*dpPassword)))\n\tfmt.Println(\"dpDomain: \", *dpDomain)\n\tfmt.Println(\"proxy: \", *proxy)\n\tfmt.Println(\"dpConfigName: \", *dpConfigName)\n\tfmt.Println(\"helpUsage: \", *helpUsage)\n\tfmt.Println(\"helpFull: \", *helpFull)\n\tfmt.Println(\"version: \", *version)\n}", "func TestPrintFromConfig(t *testing.T) {\n\tPrintFromConfig()\n}", "func (o KubernetesAddonOutput) Config() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *KubernetesAddon) pulumi.StringOutput { return v.Config }).(pulumi.StringOutput)\n}", "func CloudProviderConfig(folderPath string, p *vspheretypes.Platform) (string, error) {\n\tbuf := new(bytes.Buffer)\n\n\tfmt.Fprintln(buf, \"[Global]\")\n\tprintIfNotEmpty(buf, \"secret-name\", \"vsphere-creds\")\n\tprintIfNotEmpty(buf, \"secret-namespace\", \"kube-system\")\n\tprintIfNotEmpty(buf, \"insecure-flag\", \"1\")\n\tfmt.Fprintln(buf, \"\")\n\n\tfmt.Fprintln(buf, \"[Workspace]\")\n\tprintIfNotEmpty(buf, \"server\", p.VCenter)\n\tprintIfNotEmpty(buf, \"datacenter\", p.Datacenter)\n\tprintIfNotEmpty(buf, \"default-datastore\", p.DefaultDatastore)\n\tprintIfNotEmpty(buf, \"folder\", folderPath)\n\tprintIfNotEmpty(buf, \"resourcepool-path\", p.ResourcePool)\n\tfmt.Fprintln(buf, \"\")\n\n\tfmt.Fprintf(buf, \"[VirtualCenter %q]\\n\", p.VCenter)\n\tprintIfNotEmpty(buf, \"datacenters\", p.Datacenter)\n\n\treturn buf.String(), nil\n}", "func (d *dexterOIDChttp) showK8sConfig(w http.ResponseWriter, token *oauth2.Token) error {\n\tidToken := token.Extra(\"id_token\").(string)\n\n\tparsed, err := jwt.ParseSigned(idToken)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to parse token: %s\", err)\n\t}\n\n\tcustomClaim := &customClaim{}\n\tclaims := &jwt.Claims{}\n\n\terr = parsed.UnsafeClaimsWithoutVerification(claims, customClaim)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get user details from token: %s\", err)\n\t}\n\n\t// Use e-mail claim if configuration wasn't discovered in kubeconfig\n\tauthName := customClaim.Email\n\tif d.authName != \"\" {\n\t\tauthName = d.authName\n\t}\n\n\t// construct the authinfo struct\n\tauthInfo := &clientCmdApi.AuthInfo{\n\t\tAuthProvider: &clientCmdApi.AuthProviderConfig{\n\t\t\tName: \"oidc\",\n\t\t\tConfig: map[string]string{\n\t\t\t\t\"client-id\": d.clientID,\n\t\t\t\t\"client-secret\": d.clientSecret,\n\t\t\t\t\"id-token\": idToken,\n\t\t\t\t\"idp-issuer-url\": claims.Issuer,\n\t\t\t\t\"refresh-token\": token.RefreshToken,\n\t\t\t},\n\t\t},\n\t}\n\n\t// contruct the config snippet\n\tconfig := &clientCmdApi.Config{\n\t\tAuthInfos: map[string]*clientCmdApi.AuthInfo{authName: authInfo},\n\t}\n\n\tif d.kubeConfig != \"\" {\n\t\t// write the config\n\t\ttempKubeConfig, err := ioutil.TempFile(\"\", \"\")\n\t\tdefer os.Remove(tempKubeConfig.Name())\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create tempfile: %s\", err)\n\t\t}\n\n\t\t// write snipped to temporary file\n\t\tclientcmd.WriteToFile(*config, tempKubeConfig.Name())\n\n\t\t// setup the order for the file load\n\t\tloadingRules := clientcmd.ClientConfigLoadingRules{\n\t\t\tPrecedence: []string{tempKubeConfig.Name(), d.kubeConfig},\n\t\t}\n\n\t\t// merge the configs\n\t\tconfig, err = loadingRules.Load()\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to merge configurations: %s\", err)\n\t\t}\n\t}\n\n\t// create a JSON representation\n\tjson, err := k8sRuntime.Encode(clientCmdLatest.Codec, config)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to runtime encode config: %s\", err)\n\t}\n\n\tdata := strings.Replace(string(json), \"your-email\", authName, -1)\n\n\t// convert JSON to YAML\n\toutput, err := yaml.JSONToYAML([]byte(data))\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to convert JSON to YAML: %s\", err)\n\t}\n\n\t// show the result\n\t//log.Infof(\"Here's the config snippet that would be merged with your config: \\n%v\", string(output))\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(output))\n\n\treturn nil\n}", "func (c Config) String() string {\n\tb, _ := json.MarshalIndent(c, \"\", \" \")\n\treturn fmt.Sprintf(\"config: \\n%v\\n\", string(b))\n}", "func (c Config) String() string {\n\tb, _ := json.MarshalIndent(c, \"\", \" \")\n\treturn fmt.Sprintf(\"config: \\n%v\\n\", string(b))\n}", "func (config *EnvoyCPConfig) String() string {\n\n\t// We must remove db password from configuration before showing\n\tredactedConfig := config\n\tredactedConfig.Database.Password = \"[redacted]\"\n\n\tconfigAsYAML, err := yaml.Marshal(redactedConfig)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(configAsYAML)\n}", "func (c Config) String() string {\n\treturn fmt.Sprintf(\"\"+\n\t\t\"ConfigOptions: %v,\"+\n\t\t\" DefaultClient: %v,\"+\n\t\t\" Clients: %v,\"+\n\t\t\"\", c.ConfigOptions, c.DefaultClient, c.Clients)\n}", "func Kubeconfig() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"kubeconfig\",\n\t\tShort: \"Download credentials for the Kubernetes cluster selected via 'okteto context'\",\n\t\tArgs: utils.NoArgsAccepted(\"https://okteto.com/docs/reference/cli/#kubeconfig\"),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\n\t\t\terr := contextCMD.UpdateKubeconfigCMD().RunE(cmd, args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn err\n\t\t},\n\t}\n\treturn cmd\n}", "func (c *Configurations) Print() {\n\t// Reading variables using the model\n\tfmt.Println(\"Reading variables using the model.\")\n\tfmt.Println(\"Region is\\t\", c.S3config.Region)\n\tfmt.Println(\"Bucket is\\t\\t\", c.S3config.Bucket)\n\n\t// Reading variables without using the model\n\tfmt.Println(\"\\nReading variables without using the model.\")\n\tfmt.Println(\"Region is\\t\", viper.GetString(\"s3config.region\"))\n\tfmt.Println(\"Bucket is\\t\\t\", viper.GetString(\"s3config.bucket\"))\n}", "func (s PutPlaybackConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s PutPlaybackConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c Config) Print() {\n\tif c.JsonLogging {\n\t\tc.PrintJsonConfigArgs()\n\t} else {\n\t\tc.PrintHumanConfigArgs()\n\t}\n}", "func (s QuickConnectConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s KmsEncryptionConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func Kubeconfig(relpath string) string {\n\tkubeconfig := os.Getenv(\"KUBECONFIG\")\n\tif kubeconfig != \"\" {\n\t\treturn kubeconfig\n\t}\n\n\t// For Bazel sandbox we search a different location:\n\t// Attempt to use the relpath, using the linked file - pilot/kube/platform/config\n\tkubeconfig, _ = os.Getwd()\n\tkubeconfig = kubeconfig + relpath\n\tif _, err := os.Stat(kubeconfig); err == nil {\n\t\treturn kubeconfig\n\t}\n\n\t// Fallback to the user's default config\n\tlog.Println(\"Using user home k8s config - might affect real cluster ! Not found: \", kubeconfig)\n\tusr, err := user.Current()\n\tif err == nil {\n\t\tkubeconfig = usr.HomeDir + \"/.kube/config\"\n\t}\n\n\treturn kubeconfig\n}", "func SetupKubeconfig(t *testing.T, terraformDir string) {\n terraformOptions := test_structure.LoadTerraformOptions(t, terraformDir)\n kubeconfig := terraform.Output(t, terraformOptions, \"kubeconfig\")\n kubeconfigFile := CreateTempFile(t, []byte(kubeconfig))\n kubectlOptions := k8s.NewKubectlOptions(\"\", kubeconfigFile.Name(), \"default\")\n test_structure.SaveKubectlOptions(t, terraformDir, kubectlOptions)\n}", "func printConfig(ctx context.BenchCtx, tarantoolConnection *tarantool.Connection) {\n\tfmt.Printf(\"%s\\n\", tarantoolConnection.Greeting().Version)\n\tfmt.Printf(\"Parameters:\\n\")\n\tfmt.Printf(\"\\tURL: %s\\n\", ctx.URL)\n\tfmt.Printf(\"\\tuser: %s\\n\", ctx.User)\n\tfmt.Printf(\"\\tconnections: %d\\n\", ctx.Connections)\n\tfmt.Printf(\"\\tsimultaneous requests: %d\\n\", ctx.SimultaneousRequests)\n\tfmt.Printf(\"\\tduration: %d seconds\\n\", ctx.Duration)\n\tfmt.Printf(\"\\tkey size: %d bytes\\n\", ctx.KeySize)\n\tfmt.Printf(\"\\tdata size: %d bytes\\n\", ctx.DataSize)\n\tfmt.Printf(\"\\tinsert: %d percentages\\n\", ctx.InsertCount)\n\tfmt.Printf(\"\\tselect: %d percentages\\n\", ctx.SelectCount)\n\tfmt.Printf(\"\\tupdate: %d percentages\\n\\n\", ctx.UpdateCount)\n\n\tfmt.Printf(\"Data schema\\n\")\n\tw := tabwriter.NewWriter(os.Stdout, 1, 1, 1, ' ', 0)\n\tfmt.Fprintf(w, \"|\\tkey\\t|\\tvalue\\n\")\n\tfmt.Fprintf(w, \"|\\t------------------------------\\t|\\t------------------------------\\n\")\n\tfmt.Fprintf(w, \"|\\trandom(%d)\\t|\\trandom(%d)\\n\", ctx.KeySize, ctx.DataSize)\n\tw.Flush()\n}", "func (c SetterConfig) Show() {\n\tfmt.Println(\"GithubToken: \", c.GithubToken)\n\tfmt.Println(\"SchemesListFile: \", c.SchemesListFile)\n\tfmt.Println(\"TemplatesListFile: \", c.TemplatesListFile)\n\tfmt.Println(\"SchemesCachePath: \", c.SchemesCachePath)\n\tfmt.Println(\"TemplatesCachePath: \", c.TemplatesCachePath)\n\tfmt.Println(\"DryRun: \", c.DryRun)\n\n\tfor app, appConfig := range c.Applications {\n\t\tfmt.Println(\" App: \", app)\n\t\tfmt.Println(\" Enabled: \", appConfig.Enabled)\n\t\tfmt.Println(\" Hook: \", appConfig.Hook)\n\t\tfmt.Println(\" Comment_Prefix: \", appConfig.Comment_Prefix)\n\t\tfor k, v := range appConfig.Files {\n\t\t\tfmt.Println(\" \", k, \" \", v)\n\t\t}\n\t}\n}", "func newCmdConfigShow(ctx api.Context) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"show <name>\",\n\t\tShort: \"Print the configuration file related to the current cluster\",\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcluster, err := ctx.Cluster()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tconf := cluster.Config()\n\n\t\t\t// Show a given config key from the store.\n\t\t\tif len(args) == 1 {\n\t\t\t\tkey := args[0]\n\t\t\t\tif val := conf.Get(key); val != nil {\n\t\t\t\t\tfmt.Fprintf(ctx.Out(), \"%v\\n\", val)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"unknown key \\\"%s\\\"\", key)\n\t\t\t}\n\n\t\t\t// Show all config keys present in the store.\n\t\t\tfor _, key := range conf.Keys() {\n\t\t\t\tif val := conf.Get(key); val != nil {\n\n\t\t\t\t\t// The ACS token should be masked when printing the whole config as it is sensitive data.\n\t\t\t\t\tif key == \"core.dcos_acs_token\" {\n\t\t\t\t\t\tval = \"********\"\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Fprintf(ctx.Out(), \"%s %v\\n\", key, val)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n}", "func main() {\n\tprovider := &dummyProvider{\n\t\tsettings: map[string]string{},\n\t}\n\tsettings.SetProvider(provider)\n\toutput := map[string]string{}\n\tfor key, name := range provider.settings {\n\t\tvalue := os.Getenv(key)\n\t\tif value == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\toutput[name] = value\n\t}\n\tdata, _ := json.Marshal(output)\n\tos.Stdout.Write(data)\n}", "func PrintConfig() {\n\tvar configuration = ParseConfig()\n\tconfigJSON, err := json.MarshalIndent(configuration, \"\", \" \")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(string(configJSON))\n}", "func (c CloudConfig) String() (string, error) {\n\tbytes, err := yaml.Marshal(c)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"#cloud-config\\n\\n%s\", string(bytes)), nil\n}", "func createKubeconfig(clusterName, username, clusterControlPlaceAddress, caBasebase64, crtBase64, privateKeyBase64 string) (kubeconfigYAML string) {\n\tcertificate_tpl := `---\napiVersion: v1\nkind: Config\ncurrent-context: %s\nclusters:\n - name: %s\n cluster:\n server: %s\n certificate-authority-data: %s\ncontexts:\n - context:\n cluster: %s\n user: %s\n name: %s@%s\nusers:\n - name: %s\n user:\n client-certificate-data: %s\n client-key-data: %s`\n\n\treturn fmt.Sprintf(certificate_tpl,\n\t\tclusterName,\n\t\tclusterName,\n\t\tclusterControlPlaceAddress,\n\t\tcaBasebase64,\n\t\tclusterName,\n\t\tusername,\n\t\tusername,\n\t\tclusterName,\n\t\tusername,\n\t\tcrtBase64,\n\t\tprivateKeyBase64,\n\t)\n}", "func String() string {\n\tallSettings := viper.AllSettings()\n\ty, err := yaml.Marshal(&allSettings)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"Failed to marshall config to string: %s\", err.Error()))\n\t}\n\treturn fmt.Sprintf(\"%s\\n\", y)\n}", "func (v *configVar) String() string {\n\treturn fmt.Sprint(*v)\n}", "func (component *Component) KubeConfig(cluster *cluster.Cluster, apiServerEndpoint, name string) (string, error) {\n\tclientCertificate, err := component.ClientCertificate(\n\t\tcluster.CertificateAuthorities.APIServerClient,\n\t\tname,\n\t\t\"kubernetes-admin\",\n\t\t[]string{\"system:masters\"},\n\t\t[]string{},\n\t)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tkubeConfig, err := cluster.KubeConfigWithClientCertificate(apiServerEndpoint, clientCertificate)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn kubeConfig, nil\n}", "func KubeConfig(config string) SecretOption {\n\treturn func(o *secret) {\n\t\to.kubeConfig = config\n\t}\n}", "func (c *Config) String() string {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\tvar buf bytes.Buffer\n\tfor key, val := range c.v {\n\t\tbuf.WriteString(key + \": \" + val + \"\\n\")\n\t}\n\n\treturn buf.String()\n}", "func (s KinesisVideoStreamConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (opt Options) PrintConfig(w io.Writer) error {\n\tt1, _ := template.New(\"webhook\").Funcs(sprig.TxtFuncMap()).Parse(webhook)\n\terr := t1.Execute(w, opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt2, _ := template.New(\"csr\").Funcs(sprig.TxtFuncMap()).Parse(csr)\n\terr = t2.Execute(w, opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt3, _ := template.New(\"deployment\").Funcs(sprig.TxtFuncMap()).Parse(webhookDeployment)\n\terr = t3.Execute(w, opt)\n\treturn err\n}", "func (s QueueQuickConnectConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func dumpConfig(ctx *cli.Context) error {\n\t_, cfg := makeConfigNode(ctx)\n\tcomment := \"\"\n\n\tif cfg.Kowala.Genesis != nil {\n\t\tcfg.Kowala.Genesis = nil\n\t\tcomment += \"# Note: this config doesn't contain the genesis block.\\n\\n\"\n\t}\n\n\tout, err := tomlSettings.Marshal(&cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tio.WriteString(os.Stdout, comment)\n\tos.Stdout.Write(out)\n\treturn nil\n}", "func TerminalWithKubeconfig(path string) {\n\tos.Setenv(\"KUBECONFIG\", path)\n\tfmt.Printf(\"test\")\n\tout, err := exec.Command(\"gnome-terminal\").Output()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"Out %s\\n\", out)\n}", "func (conf *Config) Print() {\n\tlog.Info().Str(\"app\", version.AppVersion).Str(\"commit\", version.Commit).Msg(\"version\")\n\tlog.Info().Int(\"port\", conf.Port).Msg(\"gRPC port\")\n\tlog.Info().Str(\"URL\", conf.SystemModelAddress).Msg(\"systemModelAddress\")\n\tlog.Info().Str(\"URL\", conf.EdgeInventoryProxyAddress).Msg(\"edgeInventoryProxyAddress\")\n\tlog.Info().Str(\"prefix\", conf.AppClusterPrefix).Msg(\"appClusterPrefix\")\n\tlog.Info().Int(\"port\", conf.AppClusterPort).Msg(\"appClusterPort\")\n\tlog.Info().Bool(\"tls\", conf.UseTLS).Bool(\"skipServerCertValidation\", conf.SkipServerCertValidation).Str(\"cert\", conf.CACertPath).Str(\"cert\", conf.ClientCertPath).Msg(\"TLS parameters\")\n\tlog.Info().Dur(\"CacheTTL\", conf.CacheTTL).Msg(\"selected TTL for the stats cache in milliseconds\")\n}", "func (c *Config) Print() error {\n\tenc := json.NewEncoder(os.Stdout)\n\tenc.SetIndent(\"\", \" \")\n\tif err := enc.Encode(c); err != nil {\n\t\treturn errors.New(fmt.Sprint(\"error reporting configuration:\", err))\n\t}\n\treturn nil\n}", "func (conf *Config) Print() {\n\tlog.Info().Str(\"app\", version.AppVersion).Str(\"commit\", version.Commit).Msg(\"version\")\n\tlog.Info().Int(\"port\", conf.Port).Msg(\"metrics endpoint port\")\n\tlog.Info().Str(\"namespace\", conf.Namespace).Str(\"subsystem\", conf.Subsystem).Str(\"name\", conf.Name).Msg(\"metric name\")\n\tlog.Info().Str(\"label\", conf.LabelName).Msg(\"label name\")\n\tlog.Info().Str(\"file\", conf.LabelFile).Msg(\"label values file\")\n}", "func (kr *KRun) initUsingKubeConfig() error {\n\t// Explicit kube config - use it\n\tkc := os.Getenv(\"KUBECONFIG\")\n\tif kc == \"\" {\n\t\tkc = os.Getenv(\"HOME\") + \"/.kube/config\"\n\t}\n\tif _, err := os.Stat(kc); err == nil {\n\t\tcf, err := clientcmd.LoadFromFile(kc)\n\t\t//config := clientcmd.NewNonInteractiveClientConfig(cf, cf.CurrentContext, nil, nil)\n\t\tif strings.HasPrefix(cf.CurrentContext, \"gke_\") {\n\t\t\tparts := strings.Split(cf.CurrentContext, \"_\")\n\t\t\tif len(parts) > 3 {\n\t\t\t\t// TODO: if env variable with cluster name/location are set - use that for context\n\t\t\t\tkr.ProjectId = parts[1]\n\t\t\t\tkr.ClusterLocation = parts[2]\n\t\t\t\tkr.ClusterName = parts[3]\n\t\t\t}\n\t\t}\n\t\tif strings.HasPrefix(cf.CurrentContext, \"connectgateway_\") {\n\t\t\tparts := strings.Split(cf.CurrentContext, \"_\")\n\t\t\tif len(parts) > 2 {\n\t\t\t\t// TODO: if env variable with cluster name/location are set - use that for context\n\t\t\t\tkr.ProjectId = parts[1]\n\t\t\t\tkr.ClusterName = parts[2]\n\t\t\t}\n\t\t}\n\n\t\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkr.Client, err = kubernetes.NewForConfig(config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif Debug {\n\t\t\tlog.Println(\"Using Kubeconfig\", cf.CurrentContext, kc)\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (kr *KRun) initUsingKubeConfig() error {\n\t// Explicit kube config - use it\n\tkc := os.Getenv(\"KUBECONFIG\")\n\tif kc == \"\" {\n\t\tkc = os.Getenv(\"HOME\") + \"/.kube/config\"\n\t}\n\tif _, err := os.Stat(kc); err == nil {\n\t\tcf, err := clientcmd.LoadFromFile(kc)\n\t\t//config := clientcmd.NewNonInteractiveClientConfig(cf, cf.CurrentContext, nil, nil)\n\t\tif strings.HasPrefix(cf.CurrentContext, \"gke_\") {\n\t\t\tparts := strings.Split(cf.CurrentContext, \"_\")\n\t\t\tif len(parts) > 3 {\n\t\t\t\t// TODO: if env variable with cluster name/location are set - use that for context\n\t\t\t\tkr.ProjectId = parts[1]\n\t\t\t\tkr.ClusterLocation = parts[2]\n\t\t\t\tkr.ClusterName = parts[3]\n\t\t\t}\n\t\t}\n\t\tif strings.HasPrefix(cf.CurrentContext, \"connectgateway_\") {\n\t\t\tparts := strings.Split(cf.CurrentContext, \"_\")\n\t\t\tif len(parts) > 2 {\n\t\t\t\t// TODO: if env variable with cluster name/location are set - use that for context\n\t\t\t\tkr.ProjectId = parts[1]\n\t\t\t\tkr.ClusterName = parts[2]\n\t\t\t}\n\t\t}\n\n\t\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkr.Client, err = kubernetes.NewForConfig(config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif Debug {\n\t\t\tlog.Println(\"Using Kubeconfig\", cf.CurrentContext, kc)\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func Sprint(val value.Value) string {\n\treturn val.Sprint(ivyCfg)\n}", "func (r *Rkt) KubeletOptions() map[string]string {\n\treturn map[string]string{\n\t\t\"container-runtime\": \"remote\",\n\t\t\"container-runtime-endpoint\": fmt.Sprintf(\"unix://%s\", r.SocketPath()),\n\t\t\"image-service-endpoint\": fmt.Sprintf(\"unix://%s\", r.SocketPath()),\n\t\t\"runtime-request-timeout\": \"15m\",\n\t}\n}", "func sessionConfigurationPayloadDisplay(data *messages.SignalConfigs) {\n\tvar result string = \"\\n\"\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"session-id\", data.MitigatingConfig.SessionId)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"heartbeat-interval\", data.MitigatingConfig.HeartbeatInterval)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"missing-hb-allowed\", data.MitigatingConfig.MissingHbAllowed)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-retransmit\", data.MitigatingConfig.MaxRetransmit)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"ack-timeout\", data.MitigatingConfig.AckTimeout)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"ack-random-factor\", data.MitigatingConfig.AckRandomFactor)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"heartbeat-interval-idle\", data.IdleConfig.HeartbeatInterval)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"missing-hb-allowed-idle\", data.IdleConfig.MissingHbAllowed)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-retransmit-idle\", data.IdleConfig.MaxRetransmit)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"ack-timeout-idle\", data.IdleConfig.AckTimeout)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"ack-random-factor-idle\", data.IdleConfig.AckRandomFactor)\n\tlog.Infoln(result)\n}", "func (c *Cluster) DefineKubeconfig(filename string, sa *ServiceAccount, verbose bool) (string, string, error) {\n\t// var f string\n\tvar fullFilename string\n\tvar err error\n\n\tif filename == \"\" {\n\t\t// Todo: prepopulate with something from sa\n\t\toutputFilePrompt := promptui.Prompt{\n\t\t\tLabel: \"Where would you like to output the kubeconfig\",\n\t\t\tDefault: \"kubeconfig-sa\",\n\t\t}\n\t\t// There's some weirdness here. Can't get an err?\n\t\t// TODO: Better catch ^C\n\t\tfilename, err = outputFilePrompt.Run()\n\t\tif err != nil || len(filename) < 2 {\n\t\t\treturn \"\", \"Output file not given\", err\n\t\t}\n\t}\n\n\tif filename[0] == byte('/') {\n\t\tfullFilename = filename\n\t} else {\n\t\tfullFilename = filepath.Join(os.Getenv(\"PWD\"), filename)\n\t}\n\n\treturn fullFilename, \"\", err\n}", "func (c *Config) Print(out string) {\n\tfmt.Print(c.Style(out))\n}", "func (cfg *Config) String() string { return fmt.Sprintf(\"%T:%+v\", cfg, *cfg) }", "func (a *App) printConfig() {\n\ta.appConfig.Print(a.maskedKeys)\n\n\tcomponentsByID := lo.KeyBy(a.options.components, func(c *Component) string {\n\t\treturn c.Identifier()\n\t})\n\n\tenabledComponents := []string{}\n\tdisabledComponents := []string{}\n\tfor componentID, enabled := range a.componentsEnabledState {\n\t\tcomponent, exists := componentsByID[componentID]\n\t\tif !exists {\n\t\t\tcontinue\n\t\t}\n\n\t\tif enabled {\n\t\t\tenabledComponents = append(enabledComponents, component.Name)\n\t\t} else {\n\t\t\tdisabledComponents = append(disabledComponents, component.Name)\n\t\t}\n\t}\n\n\tgetList := func(a []string) string {\n\t\tsort.Strings(a)\n\n\t\treturn \"\\n - \" + strings.Join(a, \"\\n - \")\n\t}\n\n\tif len(enabledComponents) > 0 || len(disabledComponents) > 0 {\n\t\tif len(enabledComponents) > 0 {\n\t\t\tfmt.Printf(\"\\nThe following components are enabled: %s\\n\", getList(enabledComponents))\n\t\t}\n\t\tif len(disabledComponents) > 0 {\n\t\t\tfmt.Printf(\"\\nThe following components are disabled: %s\\n\", getList(disabledComponents))\n\t\t}\n\t\tfmt.Println()\n\t}\n}", "func (s VpcConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c *Config) String() string {\n\tout, _ := yaml.Marshal(c)\n\treturn string(out)\n}", "func (wc *WorkerConfig) LogConfig() {\n\tstrategy := \"Docker\"\n\tif wc.UseECS {\n\t\tstrategy = \"ECS\"\n\t}\n\n\tlog.Printf(\"--- Configuration ---\")\n\tlog.Printf(\"Block: %s\", *wc.Block)\n\tlog.Printf(\"Timeout: %d seconds\", wc.Timeout)\n\tlog.Printf(\"Leading zeros: %d\", wc.LeadingZeros)\n\tlog.Printf(\"Workers: %d\", wc.Workers)\n\tlog.Printf(\"Deployment strategy: %s\", strategy)\n\tlog.Printf(\"---------------------\")\n}", "func (conf *Config) Print() {\n\tconf.printPostgresConfig()\n\tconf.printMongoConfig()\n\n\tconf.printRabbitMQConfig()\n\tconf.printRedisConfig()\n\n\tconf.printAPIGatewayConfig()\n\tconf.printEntryCacheConfig()\n\tconf.printEntryStoreConfig()\n\tconf.printAssetConfig()\n\tconf.printEntryScanConfig()\n\tconf.printEventConfig()\n\tconf.printPushNotificationConfig()\n\tconf.printEmailConfig()\n\tconf.printProgramConfig()\n\tconf.printBOControllerConfig()\n\tconf.printBOEntryStoreConfig()\n\n\tconf.printSendgridConfig()\n\n\tconf.printEnvironmentConfig()\n\tconf.printTokenSecretKey()\n\tconf.printCryptoPassphase()\n}", "func (cfg *Config) Display() string {\n\tb, _ := json.MarshalIndent(cfg, \"\", \" \")\n\treturn string(b)\n}", "func (e EvalConfig) String() string {\n\tvar b bytes.Buffer\n\tif e.Scheduler != nil {\n\t\tfmt.Fprintf(&b, \"scheduler %T\", e.Scheduler)\n\t}\n\tif e.Snapshotter != nil {\n\t\tfmt.Fprintf(&b, \" snapshotter %T\", e.Snapshotter)\n\t}\n\tif e.Repository != nil {\n\t\trepo := fmt.Sprintf(\"%T\", e.Repository)\n\t\tif u := e.Repository.URL(); u != nil {\n\t\t\trepo += fmt.Sprintf(\",url=%s\", u)\n\t\t}\n\t\tfmt.Fprintf(&b, \" repository %s\", repo)\n\t}\n\tif e.Assoc != nil {\n\t\tfmt.Fprintf(&b, \" assoc %s\", e.Assoc)\n\t}\n\tif e.Predictor != nil {\n\t\tfmt.Fprintf(&b, \" predictor %T\", e.Predictor)\n\t}\n\n\tvar flags []string\n\tif e.CacheMode == infra2.CacheOff {\n\t\tflags = append(flags, \"nocache\")\n\t} else {\n\t\tif e.CacheMode.Reading() {\n\t\t\tflags = append(flags, \"cacheread\")\n\t\t}\n\t\tif e.CacheMode.Writing() {\n\t\t\tflags = append(flags, \"cachewrite\")\n\t\t}\n\t}\n\tif e.RecomputeEmpty {\n\t\tflags = append(flags, \"recomputeempty\")\n\t} else {\n\t\tflags = append(flags, \"norecomputeempty\")\n\t}\n\tif e.BottomUp {\n\t\tflags = append(flags, \"bottomup\")\n\t} else {\n\t\tflags = append(flags, \"topdown\")\n\t}\n\tif e.PostUseChecksum {\n\t\tflags = append(flags, \"postusechecksum\")\n\t}\n\tfmt.Fprintf(&b, \" flags %s\", strings.Join(flags, \",\"))\n\tfmt.Fprintf(&b, \" flowconfig %s\", e.Config)\n\tfmt.Fprintf(&b, \" cachelookuptimeout %s\", e.CacheLookupTimeout)\n\tfmt.Fprintf(&b, \" imagemap %v\", e.ImageMap)\n\tif e.DotWriter != nil {\n\t\tfmt.Fprintf(&b, \" dotwriter(%T)\", e.DotWriter)\n\t}\n\treturn b.String()\n}", "func KubeConfigSecretName(cluster string) string {\n\treturn fmt.Sprintf(\"%s-kubeconfig\", cluster)\n}", "func (s PlaybackConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "func GetInitPromConfig() string {\n\treturn `\n global:\n scrape_interval: 5s\n evaluation_interval: 5s\n alerting:\n alertmanagers:\n - static_configs:\n - targets:\n - alertmanager-erik-spark-master-service:9093\n\n rule_files:\n - \"simple_rule.yml\"\n\n scrape_configs:\n\n `\n}", "func Print(c *configapi.Config) error {\n\tdata, err := yaml.Marshal(c)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tfmt.Printf(\"%s\", string(data))\n\treturn nil\n}", "func setKubectlConfig(environment string) {\n\tcurrentEnvConfig := setupEnvConfigViper(environment)\n\tvar namespace = currentEnvConfig.GetString(\"general.namespace\")\n\n\tvar contextCluster string\n\tif environment == \"local\" {\n\t\tcontextCluster = \"minikube\"\n\t} else {\n\t\tgcloudCluster := currentEnvConfig.GetString(\"gcp.cluster\")\n\t\tgcloudProject := currentEnvConfig.GetString(\"gcp.project\")\n\t\tgcloudZone := currentEnvConfig.GetString(\"gcp.compute_zone\")\n\n\t\tgcloudCmd := fmt.Sprintf(\"container clusters get-credentials %s --project=%s --zone=%s\", gcloudCluster, gcloudProject, gcloudZone)\n\n\t\t// To use argo as a deployment tool in CircleCI, gcloud has to be invoked as sudo with explicit binary path\n\t\t// CircleCI 2.0 does not have this stipulation, identified by presence of CIRCLE_STAGE var\n\t\tif projectConfig.GetString(\"CIRCLECI\") == \"true\" && len(projectConfig.GetString(\"CIRCLE_STAGE\")) == 0 {\n\t\t\tgcloudCmd = fmt.Sprintf(\"sudo /opt/google-cloud-sdk/bin/gcloud %s\", gcloudCmd)\n\t\t} else {\n\t\t\tgcloudCmd = fmt.Sprintf(\"gcloud %s\", gcloudCmd)\n\t\t}\n\n\t\tif _, err := util.ExecCmdChain(gcloudCmd); err != nil {\n\t\t\tcolor.Red(\"Error getting kubectl cluster credentials via gcloud! %s\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tcontextCluster = fmt.Sprintf(\"gke_%s_%s_%s\", gcloudProject, gcloudZone, gcloudCluster)\n\t}\n\n\tcolor.Cyan(\"Recreating kubectl context and setting to active...\")\n\n\tcontextName := namespace\n\t// Setup a kubectl context and switch to it\n\tutil.ExecCmd(\"kubectl\", \"config\", \"delete-context\", contextName)\n\tutil.ExecCmd(\"kubectl\", \"config\", \"set-context\", contextName, fmt.Sprintf(\"--cluster=%s\", contextCluster), fmt.Sprintf(\"--user=%s\", contextCluster), fmt.Sprintf(\"--namespace=%s\", namespace))\n\tutil.ExecCmd(\"kubectl\", \"config\", \"use-context\", contextName)\n\tcolor.Cyan(\"Created new %s kubectl context and set to active.\", contextName)\n}", "func (s UserQuickConnectConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s KendraConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "func KubeConfig(apiServerHost string) (*rest.Config, error) {\n\tvar err error\n\tvar cfg *rest.Config\n\n\tif len(apiServerHost) > 0 {\n\t\tcfg = new(rest.Config)\n\t\tcfg.Host = apiServerHost\n\t} else if cfg, err = rest.InClusterConfig(); err != nil {\n\t\tapiCfg, err := clientcmd.NewDefaultClientConfigLoadingRules().Load()\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error loading cluster config: %s\", err.Error())\n\t\t}\n\n\t\tcfg, err = clientcmd.NewDefaultClientConfig(*apiCfg, &clientcmd.ConfigOverrides{}).ClientConfig()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error loading cluster client config: %s\", err.Error())\n\t\t}\n\t}\n\tcfg.UserAgent = util.CertManagerUserAgent\n\n\treturn cfg, nil\n}", "func (p KopsProvisioner) patch(sc *kapp.StackConfig, providerImpl provider.Provider,\n\tdryRun bool) error {\n\tconfigExists, err := p.clusterConfigExists(sc, providerImpl)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif !configExists {\n\t\treturn nil\n\t}\n\n\tproviderVars := provider.GetVars(providerImpl)\n\tprovisionerValues := providerVars[PROVISIONER_KEY].(map[interface{}]interface{})\n\tkopsConfig, err := getKopsConfig(provisionerValues)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// get the kops config\n\targs := []string{\n\t\t\"get\",\n\t\t\"cluster\",\n\t\t\"-o\",\n\t\t\"yaml\",\n\t}\n\n\targs = parameteriseValues(args, kopsConfig.Params.Global)\n\n\tvar stdoutBuf bytes.Buffer\n\tvar stderrBuf bytes.Buffer\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel() // The cancel should be deferred so resources are cleaned up\n\n\tcmd := exec.CommandContext(ctx, KOPS_PATH, args...)\n\tcmd.Env = os.Environ()\n\tcmd.Stdout = &stdoutBuf\n\tcmd.Stderr = &stderrBuf\n\n\tlog.Debug(\"Downloading config for kops cluster...\")\n\n\terr = cmd.Run()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed to get Kops cluster config: %s\", stderrBuf.String())\n\t}\n\n\tlog.Debugf(\"Downloaded config for kops cluster:\\n%s\", stdoutBuf.String())\n\n\tkopsYamlConfig := map[string]interface{}{}\n\terr = yaml.Unmarshal(stdoutBuf.Bytes(), kopsYamlConfig)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error parsing kops config\")\n\t}\n\tlog.Debugf(\"Yaml kopsYamlConfig:\\n%s\", kopsYamlConfig)\n\n\tspecs, err := convert.MapInterfaceInterfaceToMapStringInterface(\n\t\tprovisionerValues[\"specs\"].(map[interface{}]interface{}))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tclusterSpecs := specs[\"cluster\"]\n\n\tspecValues := map[string]interface{}{\"spec\": clusterSpecs}\n\n\tlog.Debugf(\"Spec to merge in:\\n%s\", specValues)\n\n\t// patch in the configured spec\n\tmergo.Merge(&kopsYamlConfig, specValues, mergo.WithOverride)\n\n\tlog.Debugf(\"Merged config is:\\n%s\", kopsYamlConfig)\n\n\tyamlBytes, err := yaml.Marshal(&kopsYamlConfig)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tyamlString := string(yamlBytes[:])\n\tlog.Debugf(\"Merged config:\\n%s\", yamlString)\n\n\t// if the merged values are the same as the original, skip replacing the config\n\n\t// write the merged data to a temp file because we can't pipe it into kops\n\ttmpfile, err := ioutil.TempFile(\"\", \"kops.*.txt\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer os.Remove(tmpfile.Name()) // clean up\n\n\tif _, err := tmpfile.Write([]byte(yamlString)); err != nil {\n\t\ttmpfile.Close()\n\t\tlog.Fatal(err)\n\t}\n\tif err := tmpfile.Close(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// update the cluster\n\n\tlog.Debugf(\"Patching kops cluster config...\")\n\targs2 := []string{\n\t\t\"replace\",\n\t\t\"-f\",\n\t\ttmpfile.Name(),\n\t}\n\n\targs2 = parameteriseValues(args2, kopsConfig.Params.Global)\n\n\tcmd2 := exec.CommandContext(ctx, KOPS_PATH, args2...)\n\tcmd2.Env = os.Environ()\n\tcmd2.Stdout = &stdoutBuf\n\tcmd2.Stderr = &stderrBuf\n\terr = cmd2.Run()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed to patch Kops cluster config: %s\", stderrBuf.String())\n\t}\n\n\tlog.Info(\"Config of Kops cluster patched.\")\n\n\tlog.Debug(\"Patching instance group configs...\")\n\n\tigSpecs := specs[\"instanceGroups\"].(map[interface{}]interface{})\n\n\tfor instanceGroupName, newSpec := range igSpecs {\n\t\tspecValues := map[string]interface{}{\"spec\": newSpec}\n\t\tp.patchInstanceGroup(kopsConfig, instanceGroupName.(string), specValues)\n\t}\n\n\tlog.Debugf(\"Applying kops cluster config...\")\n\targs3 := []string{\n\t\t\"update\",\n\t\t\"cluster\",\n\t\t\"--yes\",\n\t}\n\n\targs3 = parameteriseValues(args3, kopsConfig.Params.Global)\n\n\tlog.Infof(\"Running Kops cluster update... Executing: %s %s\", KOPS_PATH,\n\t\tstrings.Join(args3, \" \"))\n\n\tcmd3 := exec.Command(KOPS_PATH, args3...)\n\tcmd3.Env = os.Environ()\n\tcmd3.Stdout = &stdoutBuf\n\tcmd3.Stderr = &stderrBuf\n\terr = cmd3.Run()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed to apply Kops cluster config: %s\", stderrBuf.String())\n\t}\n\n\treturn nil\n}", "func KubeConfigFn(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {\n\tvar path, clusterCtxName string\n\tvar provider *starlarkstruct.Struct\n\n\tif err := starlark.UnpackArgs(\n\t\tidentifiers.kubeCfg, args, kwargs,\n\t\t\"cluster_context?\", &clusterCtxName,\n\t\t\"path?\", &path,\n\t\t\"capi_provider?\", &provider,\n\t); err != nil {\n\t\treturn starlark.None, fmt.Errorf(\"%s: %s\", identifiers.kubeCfg, err)\n\t}\n\n\t// check if only one of the two options are present\n\tif (len(path) == 0 && provider == nil) || (len(path) != 0 && provider != nil) {\n\t\treturn starlark.None, errors.New(\"need either path or capi_provider\")\n\t}\n\n\tif len(path) == 0 {\n\t\tval := provider.Constructor()\n\t\tif constructor, ok := val.(starlark.String); ok {\n\t\t\tconstStr := constructor.GoString()\n\t\t\tif constStr != identifiers.capvProvider && constStr != identifiers.capaProvider {\n\t\t\t\treturn starlark.None, errors.New(\"unknown capi provider\")\n\t\t\t}\n\t\t}\n\n\t\tpathVal, err := provider.Attr(\"kube_config\")\n\t\tif err != nil {\n\t\t\treturn starlark.None, errors.Wrap(err, \"could not find the kubeconfig attribute\")\n\t\t}\n\t\tpathStr, ok := pathVal.(starlark.String)\n\t\tif !ok {\n\t\t\treturn starlark.None, errors.New(\"could not fetch kubeconfig\")\n\t\t}\n\t\tpath = pathStr.GoString()\n\t}\n\n\tpath, err := util.ExpandPath(path)\n\tif err != nil {\n\t\treturn starlark.None, err\n\t}\n\n\tstructVal := starlarkstruct.FromStringDict(starlark.String(identifiers.kubeCfg), starlark.StringDict{\n\t\t\"cluster_context\": starlark.String(clusterCtxName),\n\t\t\"path\": starlark.String(path),\n\t})\n\n\treturn structVal, nil\n}", "func OutputEnvironment(conf *ClusterConfiguration) {\n\tfmt.Printf(\"Environment variables to access cluster:\\n\\n\")\n\n\tfmt.Printf(\"export CIAO_CONTROLLER=\\\"%s\\\"\\n\", conf.ServerHostname)\n\tfmt.Printf(\"export CIAO_ADMIN_CLIENT_CERT_FILE=\\\"%s\\\"\\n\", conf.AuthAdminCertPath)\n}", "func (s ConfigureLogsForPlaybackConfigurationInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func writeKubeconfig(cfg *rest.Config) {\n\ttemplate := `# Kubeconfig file for Calico CNI plugin. Installed by calico/node.\napiVersion: v1\nkind: Config\nclusters:\n- name: local\n cluster:\n server: %s\n certificate-authority-data: \"%s\"\nusers:\n- name: calico\n user:\n token: %s\ncontexts:\n- name: calico-context\n context:\n cluster: local\n user: calico\ncurrent-context: calico-context`\n\n\t// Replace the placeholders.\n\tdata := fmt.Sprintf(template, cfg.Host, string(base64.StdEncoding.EncodeToString(cfg.CAData)), cfg.BearerToken)\n\n\t// Write the filled out config to disk.\n\tif err := ioutil.WriteFile(kubeconfigPath, []byte(data), 0600); err != nil {\n\t\tlogrus.WithError(err).Error(\"Failed to write CNI plugin kubeconfig file\")\n\t\treturn\n\t}\n\tlogrus.WithField(\"path\", kubeconfigPath).Info(\"Wrote updated CNI kubeconfig file.\")\n}", "func readVsphereConfCredentialsInMultiVcSetup(cfg string) (e2eTestConfig, error) {\n\tvar config e2eTestConfig\n\n\tvirtualCenters := make([]string, 0)\n\tuserList := make([]string, 0)\n\tpasswordList := make([]string, 0)\n\tportList := make([]string, 0)\n\tdataCenterList := make([]string, 0)\n\n\tkey, value := \"\", \"\"\n\tlines := strings.Split(cfg, \"\\n\")\n\tfor index, line := range lines {\n\t\tif index == 0 {\n\t\t\t// Skip [Global].\n\t\t\tcontinue\n\t\t}\n\t\twords := strings.Split(line, \" = \")\n\t\tif strings.Contains(words[0], \"topology-categories=\") {\n\t\t\twords = strings.Split(line, \"=\")\n\t\t}\n\n\t\tif len(words) == 1 {\n\t\t\tif strings.Contains(words[0], \"Snapshot\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif strings.Contains(words[0], \"Labels\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\twords = strings.Split(line, \" \")\n\t\t\tif strings.Contains(words[0], \"VirtualCenter\") {\n\t\t\t\tvalue = words[1]\n\t\t\t\tvalue = strings.TrimSuffix(value, \"]\")\n\t\t\t\tvalue = trimQuotes(value)\n\t\t\t\tconfig.Global.VCenterHostname = value\n\t\t\t\tvirtualCenters = append(virtualCenters, value)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tkey = words[0]\n\t\tvalue = trimQuotes(words[1])\n\t\tvar strconvErr error\n\t\tswitch key {\n\t\tcase \"insecure-flag\":\n\t\t\tif strings.Contains(value, \"true\") {\n\t\t\t\tconfig.Global.InsecureFlag = true\n\t\t\t} else {\n\t\t\t\tconfig.Global.InsecureFlag = false\n\t\t\t}\n\t\tcase \"cluster-id\":\n\t\t\tconfig.Global.ClusterID = value\n\t\tcase \"cluster-distribution\":\n\t\t\tconfig.Global.ClusterDistribution = value\n\t\tcase \"user\":\n\t\t\tconfig.Global.User = value\n\t\t\tuserList = append(userList, value)\n\t\tcase \"password\":\n\t\t\tconfig.Global.Password = value\n\t\t\tpasswordList = append(passwordList, value)\n\t\tcase \"datacenters\":\n\t\t\tconfig.Global.Datacenters = value\n\t\t\tdataCenterList = append(dataCenterList, value)\n\t\tcase \"port\":\n\t\t\tconfig.Global.VCenterPort = value\n\t\t\tportList = append(portList, value)\n\t\tcase \"cnsregistervolumes-cleanup-intervalinmin\":\n\t\t\tconfig.Global.CnsRegisterVolumesCleanupIntervalInMin, strconvErr = strconv.Atoi(value)\n\t\t\tif strconvErr != nil {\n\t\t\t\treturn config, fmt.Errorf(\"invalid value for cnsregistervolumes-cleanup-intervalinmin: %s\", value)\n\t\t\t}\n\t\tcase \"topology-categories\":\n\t\t\tconfig.Labels.TopologyCategories = value\n\t\tcase \"global-max-snapshots-per-block-volume\":\n\t\t\tconfig.Snapshot.GlobalMaxSnapshotsPerBlockVolume, strconvErr = strconv.Atoi(value)\n\t\t\tif strconvErr != nil {\n\t\t\t\treturn config, fmt.Errorf(\"invalid value for global-max-snapshots-per-block-volume: %s\", value)\n\t\t\t}\n\t\tcase \"csi-fetch-preferred-datastores-intervalinmin\":\n\t\t\tconfig.Global.CSIFetchPreferredDatastoresIntervalInMin, strconvErr = strconv.Atoi(value)\n\t\t\tif strconvErr != nil {\n\t\t\t\treturn config, fmt.Errorf(\"invalid value for csi-fetch-preferred-datastores-intervalinmin: %s\", value)\n\t\t\t}\n\t\tcase \"targetvSANFileShareDatastoreURLs\":\n\t\t\tconfig.Global.TargetvSANFileShareDatastoreURLs = value\n\t\tcase \"query-limit\":\n\t\t\tconfig.Global.QueryLimit, strconvErr = strconv.Atoi(value)\n\t\t\tif strconvErr != nil {\n\t\t\t\treturn config, fmt.Errorf(\"invalid value for query-limit: %s\", value)\n\t\t\t}\n\t\tcase \"list-volume-threshold\":\n\t\t\tconfig.Global.ListVolumeThreshold, strconvErr = strconv.Atoi(value)\n\t\t\tif strconvErr != nil {\n\t\t\t\treturn config, fmt.Errorf(\"invalid value for list-volume-threshold: %s\", value)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn config, fmt.Errorf(\"unknown key %s in the input string\", key)\n\t\t}\n\t}\n\n\tconfig.Global.VCenterHostname = strings.Join(virtualCenters, \",\")\n\tconfig.Global.User = strings.Join(userList, \",\")\n\tconfig.Global.Password = strings.Join(passwordList, \",\")\n\tconfig.Global.VCenterPort = strings.Join(portList, \",\")\n\tconfig.Global.Datacenters = strings.Join(dataCenterList, \",\")\n\n\treturn config, nil\n}", "func (opt KubeletRunConfig) MakeNodeConfig(imageRunHelper *run.Runner, out io.Writer) (string, error) {\n\tbinds := append(opt.ContainerBinds)\n\tenv := []string{}\n\tif len(opt.HTTPProxy) > 0 {\n\t\tenv = append(env, fmt.Sprintf(\"HTTP_PROXY=%s\", opt.HTTPProxy))\n\t}\n\tif len(opt.HTTPSProxy) > 0 {\n\t\tenv = append(env, fmt.Sprintf(\"HTTPS_PROXY=%s\", opt.HTTPSProxy))\n\t}\n\tif len(opt.NoProxy) > 0 {\n\t\tenv = append(env, fmt.Sprintf(\"NO_PROXY=%s\", strings.Join(opt.NoProxy, \",\")))\n\t}\n\tif opt.UseSharedVolume {\n\t\tbinds = append(binds, fmt.Sprintf(\"%[1]s:%[1]s:shared\", opt.HostVolumesDir))\n\t\tenv = append(env, \"OPENSHIFT_CONTAINERIZED=false\")\n\t} else {\n\t\tbinds = append(binds, \"/:/rootfs:ro\")\n\t\tbinds = append(binds, fmt.Sprintf(\"%[1]s:%[1]s:rslave\", opt.HostVolumesDir))\n\t}\n\tenv = append(env, opt.Environment...)\n\tbinds = append(binds, fmt.Sprintf(\"%[1]s:%[1]s\", opt.DockerRoot))\n\n\t// Kubelet needs to be able to write to\n\t// /sys/devices/virtual/net/vethXXX/brport/hairpin_mode, so make this rw, not ro.\n\tbinds = append(binds, \"/sys/devices/virtual/net:/sys/devices/virtual/net:rw\")\n\n\tfmt.Fprintf(out, \"Running kubelet\\n\")\n\tcreateConfigCmd := []string{\n\t\t\"kubelet\",\n\t}\n\tcreateConfigCmd = append(createConfigCmd, opt.Args...)\n\n\t_, err := imageRunHelper.Image(opt.NodeImage).\n\t\tName(\"origin\"). // TODO figure out why the rest of cluster-up relies on this name\n\t\tPrivileged().\n\t\tDiscardContainer().\n\t\tHostNetwork().\n\t\tHostPid().\n\t\tBind(binds...).\n\t\tEnv(env...).\n\t\tEntrypoint(\"hyperkube\").\n\t\tCommand(createConfigCmd...).Start()\n\tif err != nil {\n\t\treturn \"\", errors.NewError(\"could not create OpenShift configuration: %v\", err).WithCause(err)\n\t}\n\n\treturn \"\", nil\n}", "func (ts *tester) createClient() (cli k8s_client.EKS, err error) {\n\tfmt.Print(ts.cfg.EKSConfig.Colorize(\"\\n\\n[yellow]*********************************\\n\"))\n\tfmt.Printf(ts.cfg.EKSConfig.Colorize(\"[light_green]createClient [default](%q)\\n\"), ts.cfg.EKSConfig.ConfigPath)\n\tts.cfg.EKSConfig.AuthenticationAPIVersion =\"client.authentication.k8s.io/v1alpha1\"\n\n\tif ts.cfg.EKSConfig.AWSIAMAuthenticatorPath != \"\" && ts.cfg.EKSConfig.AWSIAMAuthenticatorDownloadURL != \"\" {\n\t\ttpl := template.Must(template.New(\"tmplKUBECONFIG\").Parse(tmplKUBECONFIG))\n\t\tbuf := bytes.NewBuffer(nil)\n\t\tif err = tpl.Execute(buf, kubeconfig{\n\t\t\tClusterAPIServerEndpoint: ts.cfg.EKSConfig.Status.ClusterAPIServerEndpoint,\n\t\t\tClusterCA: ts.cfg.EKSConfig.Status.ClusterCA,\n\t\t\tAWSIAMAuthenticatorPath: ts.cfg.EKSConfig.AWSIAMAuthenticatorPath,\n\t\t\tClusterName: ts.cfg.EKSConfig.Name,\n\t\t\tAuthenticationAPIVersion: ts.cfg.EKSConfig.AuthenticationAPIVersion,\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tts.cfg.Logger.Info(\"writing KUBECONFIG with aws-iam-authenticator\", zap.String(\"kubeconfig-path\", ts.cfg.EKSConfig.KubeConfigPath))\n\t\tif err = ioutil.WriteFile(ts.cfg.EKSConfig.KubeConfigPath, buf.Bytes(), 0777); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err = aws_s3.Upload(\n\t\t\tts.cfg.Logger,\n\t\t\tts.cfg.S3API,\n\t\t\tts.cfg.EKSConfig.S3.BucketName,\n\t\t\tpath.Join(ts.cfg.EKSConfig.Name, \"kubeconfig.yaml\"),\n\t\t\tts.cfg.EKSConfig.KubeConfigPath,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tts.cfg.Logger.Info(\"wrote KUBECONFIG with aws-iam-authenticator\", zap.String(\"kubeconfig-path\", ts.cfg.EKSConfig.KubeConfigPath))\n\t} else {\n\t\targs := []string{\n\t\t\tts.cfg.EKSConfig.AWSCLIPath,\n\t\t\t\"eks\",\n\t\t\tfmt.Sprintf(\"--region=%s\", ts.cfg.EKSConfig.Region),\n\t\t\t\"update-kubeconfig\",\n\t\t\tfmt.Sprintf(\"--name=%s\", ts.cfg.EKSConfig.Name),\n\t\t\tfmt.Sprintf(\"--kubeconfig=%s\", ts.cfg.EKSConfig.KubeConfigPath),\n\t\t\t\"--verbose\",\n\t\t}\n\t\tif ts.cfg.EKSConfig.ResolverURL != \"\" {\n\t\t\targs = append(args, fmt.Sprintf(\"--endpoint=%s\", ts.cfg.EKSConfig.ResolverURL))\n\t\t}\n\t\tcmd := strings.Join(args, \" \")\n\t\tts.cfg.Logger.Info(\"writing KUBECONFIG with 'aws eks update-kubeconfig'\",\n\t\t\tzap.String(\"kubeconfig-path\", ts.cfg.EKSConfig.KubeConfigPath),\n\t\t\tzap.String(\"cmd\", cmd),\n\t\t)\n\t\tretryStart, waitDur := time.Now(), 3*time.Minute\n\t\tvar output []byte\n\t\tfor time.Since(retryStart) < waitDur {\n\t\t\tselect {\n\t\t\tcase <-ts.cfg.Stopc:\n\t\t\t\treturn nil, errors.New(\"update-kubeconfig aborted\")\n\t\t\tcase <-time.After(5 * time.Second):\n\t\t\t}\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)\n\t\t\toutput, err = exec.New().CommandContext(ctx, args[0], args[1:]...).CombinedOutput()\n\t\t\tcancel()\n\t\t\tout := string(output)\n\t\t\tfmt.Fprintf(ts.cfg.LogWriter, \"\\n'%s' output:\\n\\n%s\\n\\n\", cmd, out)\n\t\t\tif err != nil {\n\t\t\t\tts.cfg.Logger.Warn(\"'aws eks update-kubeconfig' failed\", zap.Error(err))\n\t\t\t\tif !strings.Contains(out, \"Cluster status not active\") || !strings.Contains(err.Error(), \"exit\") {\n\t\t\t\t\treturn nil, fmt.Errorf(\"'aws eks update-kubeconfig' failed (output %q, error %v)\", out, err)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tts.cfg.Logger.Info(\"'aws eks update-kubeconfig' success\", zap.String(\"kubeconfig-path\", ts.cfg.EKSConfig.KubeConfigPath))\n\t\t\tif err = aws_s3.Upload(\n\t\t\t\tts.cfg.Logger,\n\t\t\t\tts.cfg.S3API,\n\t\t\t\tts.cfg.EKSConfig.S3.BucketName,\n\t\t\t\tpath.Join(ts.cfg.EKSConfig.Name, \"kubeconfig.yaml\"),\n\t\t\t\tts.cfg.EKSConfig.KubeConfigPath,\n\t\t\t); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tts.cfg.Logger.Warn(\"failed 'aws eks update-kubeconfig'\", zap.Error(err))\n\t\t\treturn nil, err\n\t\t}\n\n\t\tts.cfg.Logger.Info(\"ran 'aws eks update-kubeconfig'\")\n\t\tfmt.Fprintf(ts.cfg.LogWriter, \"\\n\\n'%s' output:\\n\\n%s\\n\\n\", cmd, strings.TrimSpace(string(output)))\n\t}\n\n\tts.cfg.Logger.Info(\"creating k8s client\")\n\tkcfg := &k8s_client.EKSConfig{\n\t\tLogger: ts.cfg.Logger,\n\t\tRegion: ts.cfg.EKSConfig.Region,\n\t\tClusterName: ts.cfg.EKSConfig.Name,\n\t\tKubeConfigPath: ts.cfg.EKSConfig.KubeConfigPath,\n\t\tKubectlPath: ts.cfg.EKSConfig.KubectlPath,\n\t\tServerVersion: ts.cfg.EKSConfig.Version,\n\t\tEncryptionEnabled: ts.cfg.EKSConfig.Encryption.CMKARN != \"\",\n\t\tS3API: ts.cfg.S3API,\n\t\tS3BucketName: ts.cfg.EKSConfig.S3.BucketName,\n\t\tS3MetricsRawOutputDirKubeAPIServer: path.Join(ts.cfg.EKSConfig.Name, \"metrics-kube-apiserver\"),\n\t\tMetricsRawOutputDirKubeAPIServer: filepath.Join(filepath.Dir(ts.cfg.EKSConfig.ConfigPath), ts.cfg.EKSConfig.Name+\"-metrics-kube-apiserver\"),\n\t\tClients: ts.cfg.EKSConfig.Clients,\n\t\tClientQPS: ts.cfg.EKSConfig.ClientQPS,\n\t\tClientBurst: ts.cfg.EKSConfig.ClientBurst,\n\t\tClientTimeout: ts.cfg.EKSConfig.ClientTimeout,\n\t}\n\tif ts.cfg.EKSConfig.IsEnabledAddOnClusterVersionUpgrade() {\n\t\tkcfg.UpgradeServerVersion = ts.cfg.EKSConfig.AddOnClusterVersionUpgrade.Version\n\t}\n\tif ts.cfg.EKSConfig.Status != nil {\n\t\tkcfg.ClusterAPIServerEndpoint = ts.cfg.EKSConfig.Status.ClusterAPIServerEndpoint\n\t\tkcfg.ClusterCADecoded = ts.cfg.EKSConfig.Status.ClusterCADecoded\n\t}\n\tcli, err = k8s_client.NewEKS(kcfg)\n\tif err != nil {\n\t\tts.cfg.Logger.Warn(\"failed to create k8s client\", zap.Error(err))\n\t} else {\n\t\tts.cfg.Logger.Info(\"created k8s client\")\n\t}\n\treturn cli, err\n}", "func getAzureCloudProviderConfig(machine *actuators.MachineScope) string {\n\treturn fmt.Sprintf(`{\n\"cloud\":\"AzurePublicCloud\",\n\"tenantId\": \"%[1]s\",\n\"subscriptionId\": \"%[2]s\",\n\"aadClientId\": \"%[3]s\",\n\"aadClientSecret\": \"%[4]s\",\n\"resourceGroup\": \"%[5]s\",\n\"location\": \"%[6]s\",\n\"vmType\": \"standard\",\n\"subnetName\": \"%[7]s\",\n\"securityGroupName\": \"%[8]s\",\n\"vnetName\": \"%[9]s\",\n\"vnetResourceGroup\": \"%[5]s\",\n\"routeTableName\": \"%[10]s\",\n\"primaryAvailabilitySetName\": \"\",\n\"primaryScaleSetName\": \"\",\n\"cloudProviderBackoff\": true,\n\"cloudProviderBackoffRetries\": 6,\n\"cloudProviderBackoffExponent\": 1.5,\n\"cloudProviderBackoffDuration\": 5,\n\"cloudProviderBackoffJitter\": 1.0,\n\"cloudProviderRatelimit\": true,\n\"cloudProviderRateLimitQPS\": 3.0,\n\"cloudProviderRateLimitBucket\": 10,\n\"useManagedIdentityExtension\": false,\n\"userAssignedIdentityID\": \"\",\n\"useInstanceMetadata\": true,\n\"loadBalancerSku\": \"Standard\",\n\"excludeMasterFromStandardLB\": true,\n\"providerVaultName\": \"\",\n\"maximumLoadBalancerRuleCount\": 250,\n\"providerKeyName\": \"k8s\",\n\"providerKeyVersion\": \"\"\n}`,\n\t\tos.Getenv(\"AZURE_TENANT_ID\"),\n\t\tos.Getenv(\"AZURE_SUBSCRIPTION_ID\"),\n\t\tos.Getenv(\"AZURE_CLIENT_ID\"),\n\t\tos.Getenv(\"AZURE_CLIENT_SECRET\"),\n\t\tmachine.Scope.ClusterConfig.ResourceGroup,\n\t\tmachine.Scope.ClusterConfig.Location,\n\t\tazure.GenerateNodeSubnetName(machine.Scope.Cluster.Name),\n\t\tazure.GenerateNodeSecurityGroupName(machine.Scope.Cluster.Name),\n\t\tazure.GenerateVnetName(machine.Scope.Cluster.Name),\n\t\tazure.GenerateNodeRouteTableName(machine.Scope.Cluster.Name),\n\t)\n}", "func (s PipelineOutputConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func PrintKubeSecret(ctx context.Context, in resources.Resource) error {\n\tbaseSecretClient, err := secretBaseClient(ctx, in)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkubeSecret, err := baseSecretClient.ToKubeSecret(ctx, in)\n\traw, err := yaml.Marshal(kubeSecret)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(string(raw))\n\treturn nil\n}", "func (keys *GlobalOptionsKey) GardenerKubeconfig() string {\n\treturn viper.GetString(keys.gardenerKubeconfig)\n}", "func dumpConfig(ctx *cli.Context) error {\n\tcfg := makeAllConfigs(ctx)\n\tcomment := \"\"\n\n\tout, err := toml.Settings.Marshal(&cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdump := os.Stdout\n\tif ctx.NArg() > 0 {\n\t\tdump, err = os.OpenFile(ctx.Args().Get(0), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer dump.Close()\n\t}\n\tdump.WriteString(comment)\n\tdump.Write(out)\n\n\treturn nil\n}", "func RunThis(){\n fmt.Println(\"spotify_1 client \",Constants[\"spotify_client_ID\"]);\n}", "func ShowConfig() bool {\n\tif *showConfig {\n\t\tout, _ := yaml.Marshal(viper.AllSettings())\n\t\tfmt.Println(out)\n\t}\n\treturn *showConfig\n\n}", "func (k *K8S) Config(map[string]string, string, string) (map[string]interface{}, error) {\n\treturn nil, nil\n}" ]
[ "0.60512763", "0.58645564", "0.5825986", "0.5794957", "0.5774909", "0.57036245", "0.5696021", "0.5679471", "0.5620906", "0.56113076", "0.55421877", "0.5492314", "0.5364762", "0.53563535", "0.5316505", "0.53119415", "0.53116775", "0.5309687", "0.52871495", "0.52864796", "0.5277905", "0.527649", "0.5236698", "0.52193", "0.5217028", "0.520698", "0.5205489", "0.520444", "0.5190459", "0.5183712", "0.5183712", "0.5173824", "0.5149178", "0.51341015", "0.512957", "0.51230305", "0.51230305", "0.5115909", "0.5112972", "0.5107666", "0.5103687", "0.5095716", "0.5082174", "0.5079676", "0.5079592", "0.5075078", "0.50689775", "0.50635356", "0.50624037", "0.50565904", "0.5045988", "0.5043873", "0.503731", "0.5034993", "0.5026359", "0.5020384", "0.50202817", "0.50176567", "0.5014479", "0.5013361", "0.50084233", "0.50005686", "0.49992824", "0.49992824", "0.49873447", "0.49740103", "0.49724138", "0.4967049", "0.49644774", "0.49583825", "0.4956811", "0.49536029", "0.4942425", "0.49384594", "0.49356243", "0.49313092", "0.4916869", "0.49148753", "0.49106646", "0.4910462", "0.4897271", "0.48953345", "0.4888661", "0.48872045", "0.48859134", "0.48807332", "0.48738837", "0.4873244", "0.48678517", "0.48589095", "0.4854401", "0.48495", "0.48478785", "0.48472574", "0.4841475", "0.48388624", "0.48385805", "0.48326632", "0.4829793", "0.48246795", "0.4819672" ]
0.0
-1
remove removes the link for the config directory
func remove(linkPath string) error { kubeConfigPath, err := os.Readlink(linkPath) if err != nil { return err } if err = os.Remove(linkPath); err != nil { return err } fmt.Printf("%s -> %s removed\n", path.Base(linkPath), kubeConfigPath) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (config *Config) Remove(url string) error {\n\tdep, ok := config.DependencyLocks[url]\n\tif !ok {\n\t\tdep, ok = config.Dependencies[url]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"dependency %v is not part of the project\", url)\n\t\t}\n\t}\n\tif err := dep.remove(config.Destination); err != nil {\n\t\treturn err\n\t}\n\tdelete(config.Dependencies, url)\n\tdelete(config.DependencyLocks, url)\n\treturn nil\n}", "func deleteConfig() error {\n\thomepath, err := homedir.Dir()\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigpath := path.Join(homepath, ghub.ConfigName) + \".\" + ghub.ConfigType\n\tfmt.Printf(\"Deleting config file %s\\n\", configpath)\n\treturn deleteFile(configpath)\n}", "func (d FileConfigurator) RemoveConfig(currentNode node.Node) error {\n\tidentityPath := filepath.Join(currentNode.NodeDirectory(), ConfigsDirectory)\n\tfmt.Printf(\"Removing directory %q\\n\", identityPath)\n\treturn os.RemoveAll(identityPath)\n}", "func Remove(configPath string, kind Kind) error {\n\tif kind == Daemon {\n\t\terr := isRoot()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err := run(\"unload\", configPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.Remove(configPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d *Driver) Remove(id string) error {\n\tlogrus.Debugf(\"secureoverlay2: Remove called w. id: %s\", id)\n\td.locker.Lock(id)\n\tdefer d.locker.Unlock(id)\n\tdir := d.dir(id)\n\tlid, err := ioutil.ReadFile(path.Join(dir, \"link\"))\n\tif err == nil {\n\t\tif err := os.RemoveAll(path.Join(d.home, linkDir, string(lid))); err != nil {\n\t\t\tlogrus.Errorf(\"secureoverly2: Failed to remove link: %v\", err)\n\t\t}\n\t}\n\n\tif err := os.RemoveAll(dir); err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tlogrus.Debug(\"secureoverlay2: Remove returns\")\n\treturn nil\n}", "func (e *EndpointPopulator) RemoveConfig(project string) error {\n\treturn nil\n}", "func remove(destination string) (err error) {\n err = os.Remove(destination)\n return\n}", "func (app *App) Remove(config *AppRemoveConfig) error {\n\tvar newGopathRepos []string\n\tvar removedPaths []string\n\tfileGOPATHS := app.ReposPath + GOPATHS_GOPATHS_FILE\n\tif config.All {\n\t\tapp.Info.Repos = []string{}\n\t\treturn setInfo(fileGOPATHS, app.Info)\n\t}\n\n\tfor _, path := range config.Paths {\n\t\tabsPath, err := abs(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tremovedPaths = append(removedPaths, absPath)\n\t}\n\tfor _, curRepos := range app.Info.Repos {\n\t\tif isElem(curRepos, removedPaths) {\n\t\t\tcontinue\n\t\t}\n\t\tnewGopathRepos = append(newGopathRepos, curRepos)\n\t}\n\tapp.Info.Repos = newGopathRepos\n\tif err := setInfo(fileGOPATHS, app.Info); err != nil {\n\t\treturn err\n\t}\n\t// TODO: fix some configura\n\tgopath, err := app.BuildGOPATH()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn app.SetGOPATH(gopath)\n}", "func Uninstall(cfg *config.Config, v *Version) error {\n\tparent := filepath.Dir(v.URI)\n\n\tlog.Printf(\"[info] removing %q\\n\", parent)\n\n\treturn os.RemoveAll(parent)\n}", "func remove(path string) {\n\tif err := os.RemoveAll(path); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (ucc *UpdateClientConfig) Remove(url string) error {\n\tif url == \"\" {\n\t\treturn ErrorsUCEmptyURL\n\t}\n\n\tif !ucc.exist() {\n\t\treturn ErrorsUCRepoNotExist\n\t}\n\n\tif err := ucc.Load(); err != nil {\n\t\treturn err\n\t}\n\tfound := false\n\tfor i := range ucc.Repos {\n\t\tif ucc.Repos[i] == url {\n\t\t\tfound = true\n\t\t\tucc.Repos = append(ucc.Repos[:i], ucc.Repos[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn ErrorsUCRepoNotExist\n\t}\n\n\treturn ucc.save()\n}", "func (c *Client) LinkRemove(bucket, key, lbucket, lkey string) error {\n\tobj, err := c.FetchObject(bucket, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(obj.GetContent()) == 0 {\n\t\treturn ErrNoContent\n\t}\n\n\tfor i, k := range obj.GetContent()[0].GetLinks() {\n\t\tif string(k.GetBucket()) == lbucket && string(k.GetKey()) == lkey {\n\t\t\tobj.Content[0].Links[i] = obj.Content[0].Links[len(obj.Content[0].Links)-1]\n\t\t\tobj.Content[0].Links = obj.Content[0].Links[0 : len(obj.Content[0].Links)-1]\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif _, err := c.StoreObject(bucket, key, obj.GetContent()[0]); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (self *Repository) Remove(path string) error { return nil }", "func (self *Repository) Remove(path string) error { return nil }", "func unlinkat(directory int, path string, flags int) error {\n\treturn unix.Unlinkat(directory, path, flags)\n}", "func removeVolumeConfig(volumeID string) error {\n\tvolumeFile := path.Join(VolumeDir, volumeID+\".conf\")\n\tif utils.IsFileExisting(volumeFile) {\n\t\ttimeStr := time.Now().Format(\"2006-01-02-15:04:05\")\n\t\tremoveFile := path.Join(VolumeDirRemove, volumeID+\"-\"+timeStr+\".conf\")\n\t\tif err := os.Rename(volumeFile, removeFile); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func Remove(options types.RemoveOptions, config config.Store) error {\n\tapp := &AppImage{}\n\n\tindexFile := fmt.Sprintf(\"%s.json\", path.Join(config.IndexStore, options.Executable))\n\tlogger.Debugf(\"Checking if %s exists\", indexFile)\n\tif !helpers.CheckIfFileExists(indexFile) {\n\t\tfmt.Printf(\"%s is not installed \\n\", tui.Yellow(options.Executable))\n\t\treturn nil\n\t}\n\n\tbar := tui.NewProgressBar(7, \"r\")\n\n\tlogger.Debugf(\"Unmarshalling JSON from %s\", indexFile)\n\tindexBytes, err := ioutil.ReadFile(indexFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbar.Add(1)\n\n\terr = json.Unmarshal(indexBytes, app)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif app.IconPath != \"\" {\n\t\tlogger.Debugf(\"Removing thumbnail, %s\", app.IconPath)\n\t\tos.Remove(app.IconPath)\n\t}\n\tbar.Add(1)\n\n\tif app.IconPathHicolor != \"\" {\n\t\tlogger.Debugf(\"Removing symlink to hicolor theme, %s\", app.IconPathHicolor)\n\t\tos.Remove(app.IconPathHicolor)\n\t}\n\tbar.Add(1)\n\n\tif app.DesktopFile != \"\" {\n\t\tlogger.Debugf(\"Removing desktop file, %s\", app.DesktopFile)\n\t\tos.Remove(app.DesktopFile)\n\t}\n\tbar.Add(1)\n\n\tbinDir := path.Join(xdg.Home, \".local\", \"bin\")\n\tbinFile := path.Join(binDir, options.Executable)\n\n\tif helpers.CheckIfFileExists(binFile) {\n\t\tbinAbsPath, err := filepath.EvalSymlinks(binFile)\n\t\tif err == nil && strings.HasPrefix(binAbsPath, config.LocalStore) {\n\t\t\t// this link points to config.LocalStore, where all AppImages are stored\n\t\t\t// I guess we need to remove them, no asking and all\n\t\t\t// make sure we remove the file first to prevent conflicts in future\n\t\t\t_ = os.Remove(binFile)\n\t\t}\n\t}\n\tbar.Add(1)\n\n\tlogger.Debugf(\"Removing appimage, %s\", app.Filepath)\n\t_ = os.Remove(app.Filepath)\n\tbar.Add(1)\n\n\tlogger.Debugf(\"Removing index file, %s\", indexFile)\n\t_ = os.Remove(indexFile)\n\tbar.Add(1)\n\n\tbar.Finish()\n\tfmt.Printf(\"\\n\")\n\tfmt.Printf(\"✅ %s removed successfully\\n\", app.Executable)\n\tlogger.Debugf(\"Removing all files completed successfully\")\n\n\treturn bar.Finish()\n}", "func (ucc *UpdateClientConfig) Remove(url string) error {\n\tparts := repoRegexp.FindStringSubmatch(url)\n\tif len(parts) != 6 {\n\t\treturn ErrorsUCInvalidURL\n\t}\n\n\tif !ucc.exist() {\n\t\treturn ErrorsUCRepoNotExist\n\t}\n\n\tif err := ucc.Load(); err != nil {\n\t\treturn err\n\t}\n\tfound := false\n\tfor i := range ucc.Repos {\n\t\tif ucc.Repos[i] == url {\n\t\t\tfound = true\n\t\t\tucc.Repos = append(ucc.Repos[:i], ucc.Repos[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn ErrorsUCRepoNotExist\n\t}\n\n\treturn ucc.save()\n}", "func (w *wrapper) Unlink(path string) int {\n\treturn convertError(w.underlying.Remove(path))\n}", "func (r *templateRouter) cleanUpServiceAliasConfig(cfg *ServiceAliasConfig) {\n\terr := r.certManager.DeleteCertificatesForConfig(cfg)\n\tif err != nil {\n\t\tlog.Error(err, \"error deleting certificates for route, the route will still be deleted but files may remain in the container\", \"host\", cfg.Host)\n\t}\n}", "func (c *runningConfig) Rmdir(target string) error {\n\tif !strings.HasSuffix(target, string(os.PathSeparator)) {\n\t\ttarget += string(os.PathSeparator)\n\t}\n\n\titems, err := c.bucket.List(target, \"\", \"\", pagesize)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing path %s - %v\", target, err)\n\t}\n\tfor len(items.Contents) > 0 {\n\t\tfor _, target := range items.Contents {\n\t\t\terr = c.bucket.Del(target.Key)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error removing remote %s - %v\", target.Key, err)\n\t\t\t}\n\t\t}\n\t\t// check to make sure everything is gone\n\t\titems, err = c.bucket.List(target, \"\", \"\", pagesize)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error listing path %s - %v\", target, err)\n\t\t}\n\t}\n\treturn nil\n}", "func RemoveConfigFile() {\n\tpath := GetUserConfigPath()\n\n\terr := os.Remove(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn\n\t\t}\n\t}\n\tExpect(err).ShouldNot(HaveOccurred())\n}", "func (m *InMemoryConfigWriter) Remove(name string) error {\n\tm.mux.Lock()\n\tdefer m.mux.Unlock()\n\n\tdelete(m.files, name)\n\treturn nil\n}", "func (l *LinuxConfig) UninstallConfig() error {\n\tfilename := installPath + l.DeviceName\n\n\t// See if a conf is installed\n\tif _, err := os.Stat(filename); os.IsNotExist(err) {\n\t\treturn err\n\t}\n\n\t// Remove the unused conf file\n\tif err := os.Remove(filename); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (fs Fs) removeLink(op *awol.Op, dir *inode, name string) bool {\n\tif dir.Kind != INODE_KIND_DIR {\n\t\tpanic(\"remove on non-dir inode\")\n\t}\n\tblocks := dir.NBytes / disk.BlockSize\n\tfor b := uint64(0); b < blocks; b++ {\n\t\tde := decodeDirEnt(fs.inodeRead(dir, b))\n\t\tif !de.Valid {\n\t\t\tcontinue\n\t\t}\n\t\tif de.Name == name {\n\t\t\tfs.inodeWrite(op, dir, b, encodeDirEnt(&DirEnt{\n\t\t\t\tValid: false,\n\t\t\t\tName: \"\",\n\t\t\t\tI: 0,\n\t\t\t}))\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (fsys *FS) Unlink(filePath string) (errc int) {\n\tdefer fs.Trace(filePath, \"\")(\"errc=%d\", &errc)\n\tleaf, parentDir, errc := fsys.lookupParentDir(filePath)\n\tif errc != 0 {\n\t\treturn errc\n\t}\n\treturn translateError(parentDir.Remove(leaf))\n}", "func remove(srcInfo *ExtFileInfo) (newpath string, err error) {\n\t// first get the free space of C:\n\t// C: need have at least 10G free space\n\tif freeSpace := mustGetFreeSpace(\"C:\"); freeSpace < (10*1024*1024*1024 + srcInfo.RealSize) {\n\t\treturn \"\", fmt.Errorf(\"Not enough free space for C:// (%s free now), maybe you can hard delete it.\", transSize(freeSpace))\n\t}\n\thomePath, err := Home()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\trecyclerBin := filepath.Join(homePath, \".ft-trash\")\n\tif err := MakeDir(recyclerBin, 0755); err != nil {\n\t\treturn \"\", err\n\t}\n\treg := regexp.MustCompile(`\\\\([A-Z]):\\\\`)\n\tdestinationPath := reg.ReplaceAllString(filepath.Join(recyclerBin, srcInfo.AbsPath), `\\$1\\`)\n\tdestinationPathDir := filepath.Dir(destinationPath)\n\tif err := MakeDir(destinationPathDir, 0755); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := move(srcInfo, destinationPath); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn destinationPath, nil\n}", "func (fs *githubFs) remove(name string) error {\n\tnormalName := strings.TrimPrefix(name, \"/\")\n\tentry := fs.findEntry(name)\n\tif entry == nil {\n\t\treturn afero.ErrFileNotFound\n\t}\n\tresp, _, err := fs.client.Repositories.DeleteFile(context.TODO(), fs.user, fs.repo, normalName, &github.RepositoryContentFileOptions{\n\t\tMessage: Convstring(commitMessage),\n\t\tSHA: Convstring(entry.GetSHA()),\n\t\tBranch: Convstring(fs.branch.GetName()),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn fs.updateTree(resp.Tree.GetSHA())\n}", "func (c *runningConfig) delete(remote string) error {\n\terr := c.bucket.Del(remote)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete %s - %v\", remote, err)\n\t}\n\treturn nil\n}", "func removeServerInConfig(server string) {\n\tfor k, v := range selfConf.Servers {\n\t\tif v == server {\n\t\t\tselfConf.Servers = selfConf.Servers[:k+copy(selfConf.Servers[k:], selfConf.Servers[k+1:])]\n\t\t}\n\t}\n}", "func unlinkDir(dir string) error {\n\treturn syscall.Unlink(dir)\n}", "func (r *GitRegistry) Remove() error {\n\t// delete path on system\n\tlogrus.WithField(\"path\", r.Data().Path).Info(\"Removing at path\")\n\terr := os.RemoveAll(r.Data().Path)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (e *entry) remove() {\n\tif e.logical != noAnchor {\n\t\tlog.Fatalf(\"may not remove anchor %q\", e.str)\n\t}\n\t// TODO: need to set e.prev.level to e.level if e.level is smaller?\n\te.elems = nil\n\tif !e.skipRemove {\n\t\tif e.prev != nil {\n\t\t\te.prev.next = e.next\n\t\t}\n\t\tif e.next != nil {\n\t\t\te.next.prev = e.prev\n\t\t}\n\t}\n\te.skipRemove = false\n}", "func (t *Topology) RemoveLink(idx uint, idy uint) error {\n\treturn nil\n}", "func cleanup(config *Config) {\n\twriteErr := config.WriteConfig(configPath)\n\tif writeErr != nil {\n\t\tError.Println(writeErr.Error())\n\t\treturn\n\t}\n}", "func RemoveConfig(name ...string) {\n\tgroup := DefaultGroupName\n\tif len(name) > 0 {\n\t\tgroup = name[0]\n\t}\n\tconfigs.Remove(group)\n\tinstances.Remove(group)\n\n\tintlog.Printf(`RemoveConfig: %s`, group)\n}", "func resetConfigDir(configDirPath string) {\n\tdirsToClean := []string{\n\t\tfilepath.Join(configDirPath, \"manifests\"),\n\t\tfilepath.Join(configDirPath, \"pki\"),\n\t}\n\tfmt.Printf(\"Deleting contents of config directories: %v\\n\", dirsToClean)\n\tfor _, dir := range dirsToClean {\n\t\tcleanDir(dir)\n\t}\n\n\tfilesToClean := []string{\n\t\tfilepath.Join(configDirPath, \"admin.conf\"),\n\t\tfilepath.Join(configDirPath, \"kubelet.conf\"),\n\t}\n\tfmt.Printf(\"Deleting files: %v\\n\", filesToClean)\n\tfor _, path := range filesToClean {\n\t\terr := os.RemoveAll(path)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"failed to remove file: [%v]\\n\", err)\n\t\t}\n\t}\n}", "func deleteExistingScorecardConfig(bundleDir, filename string) error {\n\tscorecardConfigPath := filepath.Join(bundleDir, defaultManifestDir, filename)\n\treturn os.RemoveAll(scorecardConfigPath)\n}", "func remove(ymlfile string, packageName string) error {\n\tappFS := afero.NewOsFs()\n\tyf, _ := afero.ReadFile(appFS, ymlfile)\n\tfi, err := os.Stat(ymlfile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar out []byte\n\ti := 0\n\tlines := bytes.Split(yf, []byte(\"\\n\"))\n\tfor _, line := range lines {\n\t\ti++\n\t\t// trim the line to detect the start of the list of packages\n\t\t// but do not write the trimmed string as it may cause an\n\t\t// unneeded file diff to the yml file\n\t\tsline := bytes.TrimLeft(line, \" \")\n\t\tif bytes.HasPrefix(sline, []byte(\"- \"+packageName)) {\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, line...)\n\t\tif i < len(lines) {\n\t\t\tout = append(out, []byte(\"\\n\")...)\n\t\t}\n\t}\n\terr = afero.WriteFile(appFS, ymlfile, out, fi.Mode())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Server) remove(pkg string) string {\n\ts.Lock()\n\tdefer s.Unlock()\n\tdeps := s.registry[pkg]\n\tif deps != nil {\n\t\tif len(deps.parent)>0 { \n\t\t\treturn FAIL \n\t\t} else {\n\t\t\t//remove pkg\n\t\t\tdelete(s.registry,pkg)\n\t\t\t//clean its dependencies parent\n\t\t\tfor cn,_ := range deps.children {\n\t\t\t\tc := s.registry[cn]\n\t\t\t\tdelete(c.parent,pkg)\n\t\t\t}\n\t\t}\n\t}\n\treturn OK\n}", "func (m *hostConfiguredContainer) removeConfigurationContainer() error {\n\ts, err := m.configContainer.Status()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking if container exists: %w\", err)\n\t}\n\n\tif s.ID == \"\" {\n\t\treturn nil\n\t}\n\n\treturn m.configContainer.Delete()\n}", "func (s *HeadsUpServerController) removeFromAPIServerConfig() error {\n\tnewConfig, err := s.configAccess.GetStartingConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewConfig = newConfig.DeepCopy()\n\tif err := model.ValidateAPIServerName(s.apiServerName); err != nil {\n\t\treturn err\n\t}\n\n\tname := string(s.apiServerName)\n\tdelete(newConfig.Contexts, name)\n\tdelete(newConfig.AuthInfos, name)\n\tdelete(newConfig.Clusters, name)\n\n\treturn clientcmd.ModifyConfig(s.configAccess, *newConfig, true)\n}", "func DeleteConfig(changeId, id, path, userMech, userId, message string) error {\n\tconfigs, err := DefaultRepository.ReadConfig([]string{id})\n\tif err != nil || len(configs) != 1 {\n\t\treturn fmt.Errorf(\"Error getting config with id: %v\", id)\n\t}\n\n\tvar decoded map[string]interface{}\n\terr = json.Unmarshal(configs[0].Body, &decoded)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error decoding config: %v\", err)\n\t}\n\n\tif path != \"\" {\n\t\t// Walk until we find the node we want\n\t\t// return early if we can't find it\n\t\tparts := strings.Split(path, \"/\")\n\t\tnode := decoded\n\t\tok := true\n\t\tfor _, part := range parts[:len(parts)-1] {\n\t\t\tnode, ok = node[part].(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn ErrPathNotFound\n\t\t\t}\n\t\t}\n\t\tdelete(node, parts[len(parts)-1])\n\t} else {\n\t\t// No path, drop everything\n\t\tdecoded = make(map[string]interface{})\n\t}\n\n\tencoded, err := json.Marshal(decoded)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error encoding config: %v\", err)\n\t}\n\n\toldConfig, err := readConfigAtPath(configs[0].Body, path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error reading config at path %s : %s \", path, err.Error())\n\t}\n\n\terr = DefaultRepository.UpdateConfig(&ChangeSet{\n\t\tId: id,\n\t\tBody: encoded,\n\t\tTimestamp: time.Now(),\n\t\tUserMech: userMech,\n\t\tUserId: userId,\n\t\tMessage: message,\n\t\tChangeId: changeId,\n\t\tPath: path,\n\t\tOldConfig: oldConfig,\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error saving config: %v\", err)\n\t}\n\n\treturn nil\n}", "func RemoveConfig(name ...string) {\n\tgroup := DEFAULT_GROUP_NAME\n\tif len(name) > 0 {\n\t\tgroup = name[0]\n\t}\n\tconfigs.Remove(group)\n\tinstances.Remove(group)\n}", "func (d *Deployment) Remove(version string) error {\n\n\t// Removing the currently linked version is not permitted.\n\tif d.GetCurrentLink() == version {\n\t\treturn fmt.Errorf(\"Removing current version not permitted: %q\", version)\n\t}\n\n\t// Remove the artifact and HMAC.\n\tif artifactPath, exists := makeArtifactPath(d.artifactDir, d.appName, version, d.acfg.Extension); exists {\n\t\tos.Remove(artifactPath)\n\t}\n\tif hmacPath, exists := makeHMACPath(d.artifactDir, d.appName, version, d.acfg.Extension); exists {\n\t\tos.Remove(hmacPath)\n\t}\n\n\t// Remove the extracted files.\n\tif versionDir, exists := makeReleasePath(d.releaseDir, version); exists {\n\t\treturn os.RemoveAll(versionDir)\n\t}\n\n\treturn nil\n}", "func Remove(clusterName, explicitPath string) error {\n\treturn kubeconfig.RemoveKIND(clusterName, explicitPath)\n}", "func removePage(id string) {\n\terr := os.Remove(pagesDir + id + \".html\")\n\tif err != nil {\n\t\tlog.Printf(\"Error removing page: %s\\n\", err)\n\t}\n}", "func (c *ClusterController) removeNetworkFromConfig(name string, configMap *corev1.ConfigMapList) error {\n\tlabelSelector := metav1.LabelSelector{MatchLabels: map[string]string{\"app\": \"onos\", \"type\": \"config\"}}\n\tpods, err := c.kubeclient.CoreV1().Pods(c.clusterID).List(metav1.ListOptions{\n\t\tLabelSelector: labels.Set(labelSelector.MatchLabels).String(),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdataMap := configMap.Items[0].BinaryData[\"config\"]\n\tm := make(map[string]interface{})\n\terr = yaml.Unmarshal(dataMap, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnumDevices := m[\"numdevices\"].(int)\n\n\tfor _, pod := range pods.Items {\n\t\tfor i := 0; i < numDevices; i++ {\n\t\t\tvar buf bytes.Buffer\n\t\t\tbuf.WriteString(name)\n\t\t\tbuf.WriteString(\"-s\")\n\t\t\tbuf.WriteString(strconv.Itoa(i))\n\t\t\tdeviceName := buf.String()\n\t\t\tif err = c.removeNetworkFromPod(deviceName, pod); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func removeTempRepos() {\n\tos.RemoveAll(\"/tmp/github.com\")\n}", "func (service HomesyncServerService) Remove(info foldermonitor.FileInfo) {\n\tform := url.Values{}\n\tform.Add(\"pathToDelete\", info.RelativePath)\n\n\treq, _ := http.NewRequest(\"POST\", service.BaseUrl+\"api/delete\", strings.NewReader(form.Encode()))\n\treq.Header.Add(\"username\", service.Username)\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tclient := &http.Client{}\n\t_, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (c *DQLConfig) Remove(name string) error {\n\t// remove from DQLConfig\n\tdelete(c.Schemas, name)\n\n\t// remove from ServerlessConfig\n\ts, err := c.ReadServerlessConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.RemoveFunction(name).Write()\n}", "func RemoveUserConfig(db Database, userHash string) error {\n\tcriteria := make(map[string]interface{})\n\tcriteria[\"UserHash\"] = userHash\n\treturn db.DeleteRecord(pconst.DbConfig, pconst.TbAccess, criteria)\n}", "func DisConfDel(c *gin.Context) {\n\tpath := disconfDir + \"\" + c.Query(\"path\")\n\terr := os.RemoveAll(path)\n\tif err != nil {\n\t\tlogrus.Error(\"error remove all files in the path.\")\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, struct {\n\t\tMessage string\n\t}{\"disconf del is ok.\"})\n}", "func (reg *registry) Remove(ctx context.Context, name reference.Named) error {\n\troot, err := pathFor(repositoriesRootPathSpec{})\n\tif err != nil {\n\t\treturn err\n\t}\n\trepoDir := path.Join(root, name.Name())\n\treturn reg.driver.Delete(ctx, repoDir)\n}", "func (e *entry) remove() {\n\te.prev.next = e.next\n\te.next.prev = e.prev\n\te.prev = nil\n\te.next = nil\n}", "func removeIfFile(uri string) {\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif u.Scheme != \"file\" {\n\t\treturn\n\t}\n\n\tos.Remove(u.Path)\n}", "func (g *Generator) RemoveConfigLabel(label string) {\n\tdelete(g.image.Config.Labels, label)\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\n\tv := mux.Vars(r)\n\tidentifier := v[\"identifier\"]\n\n\tjsonpath := path.Join(a.ConfigDir, fmt.Sprintf(\"%s.json\", identifier))\n\tjsonpathexists := true\n\n\tconfigpath := path.Join(a.ConfigDir, fmt.Sprintf(\"%s.conf\", identifier))\n\tconfigpathexists := true\n\n\tif _, err = os.Stat(jsonpath); os.IsNotExist(err) {\n\t\tjsonpathexists = false\n\t}\n\tif err != nil && !os.IsNotExist(err) {\n\t\terr = errors.Wrapf(err, \"error checking file %s\", jsonpath)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif _, err = os.Stat(configpath); os.IsNotExist(err) {\n\t\tconfigpathexists = false\n\t}\n\tif err != nil && !os.IsNotExist(err) {\n\t\terr = errors.Wrapf(err, \"error checking file %s\", configpath)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif jsonpathexists {\n\t\tif err = os.Remove(jsonpath); err != nil {\n\t\t\terr = errors.Wrapf(err, \"error removing file %s\", jsonpath)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif configpathexists {\n\t\tif err = os.Remove(configpath); err != nil {\n\t\t\terr = errors.Wrapf(err, \"error removing file %s\", configpath)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif jsonpathexists || configpathexists {\n\t\tif err = a.SignalContainers(); err != nil {\n\t\t\terr = errors.Wrap(err, \"error HUPing container(s)\")\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (pm *PathMap) remove(path string) {\n\t// Separate the first component and the rest in the path\n\tcomponents := strings.SplitN(path, svnSep, 2)\n\tcomponent := components[0]\n\tif len(components) == 1 {\n\t\t// The path to delete is at pm's toplevel\n\t\tdelete(pm.dirs, component)\n\t\tdelete(pm.blobs, component)\n\t} else {\n\t\t// Try to go down a level\n\t\tsubtree, ok := pm.dirs[component]\n\t\tif !ok {\n\t\t\t// A component in the path doesn't exist as a directory; bail out\n\t\t\tif logEnable(logWARN) {\n\t\t\t\tlogit(\"component %q to be deleted is missing\", component)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\t// The component exists. Unshare it so that\n\t\t// it can be modified without messing with other PathMaps\n\t\tsubtree = subtree._unshare()\n\t\tpm.dirs[component] = subtree\n\t\t// Now ask the subdir to do the removal, using the rest of the path\n\t\tsubtree.remove(components[1])\n\t\t// Do not keep empty subdirectories around\n\t\tif subtree.isEmpty() {\n\t\t\tdelete(pm.dirs, component)\n\t\t}\n\t}\n}", "func (x *Rest) ConfigurationRemove(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.ActionRemove\n\trequest.Configuration.ID = strings.ToLower(params.ByName(`ID`))\n\n\tif _, err := uuid.FromString(request.Configuration.ID); err != nil {\n\t\tx.replyBadRequest(&w, &request, err)\n\t\treturn\n\t}\n\n\t// request body may contain request flag overrides, API protocol v1\n\t// has no request body support\n\tif request.Version != msg.ProtocolOne {\n\t\tcReq := v2.NewConfigurationRequest()\n\t\tif err := decodeJSONBody(r, &cReq); err != nil {\n\t\t\tx.replyBadRequest(&w, &request, err)\n\t\t\treturn\n\t\t}\n\n\t\tif err := resolveFlags(&cReq, &request); err != nil {\n\t\t\tx.replyBadRequest(&w, &request, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tx.somaSetFeedbackURL(&request)\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_w`)\n\thandler.Intake() <- request\n\tresult := <-request.Reply\n\tx.respond(&w, &result)\n}", "func (plugin *Plugin) Del(args *cniSkel.CmdArgs) error {\n\t// Parse network configuration.\n\tnetConfig, err := config.New(args, false)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to parse netconfig from args: %v.\", err)\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Executing DEL with netconfig: %+v.\", netConfig)\n\n\t// Derive names from CNI network config.\n\tpatNetNSName := fmt.Sprintf(patNetNSNameFormat, netConfig.BranchVlanID)\n\ttapBridgeName := fmt.Sprintf(tapBridgeNameFormat, netConfig.BranchVlanID)\n\ttapLinkName := args.IfName\n\ttargetNetNSName := args.Netns\n\n\t// Delete the tap link and veth pair from the target netns.\n\tplugin.deleteTapVethLinks(targetNetNSName, tapLinkName, tapBridgeName)\n\n\t// Search for the PAT network namespace.\n\tpatNetNS, err := netns.GetNetNSByName(patNetNSName)\n\tif err != nil {\n\t\t// Log and ignore the failure. DEL can be called multiple times and thus must be idempotent.\n\t\tlog.Errorf(\"Failed to find netns %s, ignoring: %v.\", patNetNSName, err)\n\t\treturn nil\n\t}\n\tlastVethLinkDeleted := false\n\n\t// In PAT network namespace...\n\terr = patNetNS.Run(func() error {\n\t\t// Check whether there are any remaining veth links connected to this bridge.\n\t\tifaces, _ := net.Interfaces()\n\t\tlog.Infof(\"Number of remaining links: %v.\", len(ifaces))\n\t\tif len(ifaces) == 4 {\n\t\t\t// Only VLAN link, bridge, dummy and loopback remain.\n\t\t\tlastVethLinkDeleted = true\n\t\t}\n\n\t\treturn nil\n\t})\n\n\t// If all veth links connected to this PAT bridge are deleted, clean up the PAT network\n\t// namespace and all virtual interfaces in it. Otherwise, leave it running.\n\tif lastVethLinkDeleted && netConfig.CleanupPATNetNS {\n\t\tlog.Infof(\"Deleting PAT network namespace: %v.\", patNetNSName)\n\t\terr = patNetNS.Close()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to delete netns: %v.\", err)\n\t\t}\n\t} else {\n\t\tlog.Infof(\"Skipping PAT netns deletion. Last veth link deleted: %t, cleanup PAT netns: %t.\",\n\t\t\tlastVethLinkDeleted, netConfig.CleanupPATNetNS)\n\t}\n\n\treturn nil\n}", "func (api *API) DeleteConfig(request *restful.Request, response *restful.Response) {\n\n\tparams := request.PathParameters()\n\tk, err := setup(params)\n\tif err != nil {\n\t\tapi.writeError(http.StatusBadRequest, err.Error(), response)\n\t\treturn\n\t}\n\n\tglog.V(2).Infof(\"Deleting config from Istio registry: %+v\", k)\n\t// TODO: incorrect use with new registry\n\tif err = api.registry.Delete(k.Kind, k.Name); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *model.ItemNotFoundError:\n\t\t\tapi.writeError(http.StatusNotFound, err.Error(), response)\n\t\tdefault:\n\t\t\tapi.writeError(http.StatusInternalServerError, err.Error(), response)\n\t\t}\n\t\treturn\n\t}\n\tresponse.WriteHeader(http.StatusOK)\n}", "func (m *MinikubeRunner) Remove(f assets.CopyableFile) error {\n\t_, err := m.SSH(fmt.Sprintf(\"rm -rf %s\", filepath.Join(f.GetTargetDir(), f.GetTargetName())))\n\treturn err\n}", "func Disconnect(configFile string) error {\n\tcfg, err := loadConfigFromFile(configFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif cfg.Caching.CacheDirectory != \"\" {\n\t\tif err = os.RemoveAll(cfg.Caching.CacheDirectory); err != nil {\n\t\t\tlog.Warningf(\"unable to to remove cache directory: %v\", err)\n\t\t}\n\t}\n\n\treturn os.Remove(configFile)\n}", "func (s *SSHRunner) Remove(f assets.CopyableFile) error {\n\tdst := path.Join(f.GetTargetDir(), f.GetTargetName())\n\tklog.Infof(\"rm: %s\", dst)\n\n\tsess, err := s.session()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"getting ssh session\")\n\t}\n\n\tdefer sess.Close()\n\treturn sess.Run(fmt.Sprintf(\"sudo rm %s\", dst))\n}", "func (s *Service) RemoveURL(url string) error {\n\tindex := s.indexOfURL(url)\n\n\tif index == -1 {\n\t\treturn fmt.Errorf(\"URL '%s' is not registered\", url)\n\t}\n\n\turls := s.URLs\n\turls[index] = urls[len(urls)-1]\n\ts.URLs = urls[:len(urls)-1]\n\n\treturn nil\n}", "func Unlink(mountDirectory, outDirectory string) error {\n\tif fi, err := os.Stat(mountDirectory); err != nil {\n\t\treturn err\n\t} else {\n\t\tif !fi.IsDir() {\n\t\t\treturn NotADirectory\n\t\t}\n\t}\n\tif fi, err := os.Stat(outDirectory); err != nil {\n\t\treturn err\n\t} else {\n\t\tif !fi.IsDir() {\n\t\t\treturn NotADirectory\n\t\t}\n\t}\n\tfis, err := ioutil.ReadDir(mountDirectory)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, fi := range fis {\n\t\tif !fi.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\terr := unmount(path.Join(mountDirectory, fi.Name()))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = os.RemoveAll(path.Join(mountDirectory, fi.Name()))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\toutFis, err := ioutil.ReadDir(outDirectory)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, fi := range outFis {\n\t\tif _, err := os.Lstat(path.Join(outDirectory, fi.Name())); err == nil {\n\t\t\terr := os.Remove(path.Join(outDirectory, fi.Name()))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t} else if os.IsNotExist(err) {\n\t\t\tcontinue\n\t\t}\n\t\tswitch {\n\t\tcase fi.IsDir():\n\t\t\terr = os.RemoveAll(path.Join(outDirectory, fi.Name()))\n\t\tcase !fi.IsDir():\n\t\t\terr = os.Remove(path.Join(outDirectory, fi.Name()))\n\t\tdefault:\n\t\t\tpanic(\"unhandled case\")\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func removeFile(n string) {\n\terr := os.Remove(n)\n\tif err != nil {\n\t\tglog.Fatal(\"CleanupFiles \", err)\n\t}\n}", "func (ucc *UpdateClientConfig) Remove(proto, url string) error {\n\tif url == \"\" {\n\t\treturn errors.New(\"Proto and URL cannot be empty\")\n\t}\n\n\tfound := false\n\tfor i := range ucc.Repos {\n\t\tif ucc.Repos[i].Proto == proto && ucc.Repos[i].URL == url {\n\t\t\tfound = true\n\t\t\tucc.Repos = append(ucc.Repos[:i], ucc.Repos[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn ErrorsUCRepoNotExist\n\t}\n\n\treturn ucc.save()\n}", "func (e *Exporter) removeInstallationReference(chiName string) {\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\tdelete(e.chInstallations, chiName)\n}", "func (o OfflineNotaryRepository) RemoveDelegationPaths(data.RoleName, []string) error {\n\treturn nil\n}", "func (gs *LocalConf) Remove(group, repo string) (err error) {\n\tif gs == nil {\n\t\treturn errors.New(\"null.receiver\")\n\t}\n\n\tcd(\"group:%s repo:%s\", group, repo)\n\n\tfor _, g := range gs.Groups {\n\t\tif group == g.Name {\n\t\t\tnrepos := make([]string, 0, len(g.Repos))\n\t\t\tfor _, j := range g.Repos {\n\t\t\t\tif j == repo {\n\t\t\t\t\tcd(\"matched.continue:%s\", j)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnrepos = append(nrepos, j)\n\t\t\t}\n\t\t\tg.Repos = nrepos\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (c *ServerConn) RemoveDir(path string) error {\n\t_, _, err := c.cmd(StatusRequestedFileActionOK, \"RMD %s\", path)\n\treturn err\n}", "func (s *Manager) RemoveDatabaseConfig(ctx context.Context, project, dbAlias string) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update database config\n\tdelete(projectConfig.Modules.Crud, dbAlias)\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func (t *Link) RemoveRel(index int) {\n\tcopy(t.rel[index:], t.rel[index+1:])\n\tt.rel[len(t.rel)-1] = nil\n\tt.rel = t.rel[:len(t.rel)-1]\n\n}", "func (m Config) DelImage(name string, isForce bool) {\n\t//check exists image\n\tif _, ok := m.Images[name]; ok {\n\t\t//insert image\n\t\tdelete(m.Images, name)\n\t} else {\n\t\tfmt.Println(\"Image not found.:\", name)\n\t\texit(1)\n\t\treturn\n\t}\n\treturn\n}", "func (n *Node) Remove(source string) error {\n\tcmd := n.Command(\"rm\", source)\n\tif err := cmd.Run(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove file\")\n\t}\n\treturn nil\n}", "func (_m *Resolver) RemoveAddonsConfigurationURLs(ctx context.Context, name string, namespace string, urls []string) (*gqlschema.AddonsConfiguration, error) {\n\tvar r0 *gqlschema.AddonsConfiguration\n\tvar r1 error\n\tr1 = _m.err\n\n\treturn r0, r1\n}", "func DelStaticPath(url string) *HttpServer {\n\tif !strings.HasPrefix(url, \"/\") {\n\t\turl = \"/\" + url\n\t}\n\tif url != \"/\" {\n\t\turl = strings.TrimRight(url, \"/\")\n\t}\n\tdelete(BConfig.WebConfig.StaticDir, url)\n\treturn BeeApp\n}", "func removeData(){\n\tos.RemoveAll(\"Logs\")\n\tos.RemoveAll(\"files\")\n\t//os.Mkdir(\"files\",0777)\n}", "func (m *wasiSnapshotPreview1Impl) pathRemoveDirectory(pfd wasiFd, ppath list) (err wasiErrno) {\n\tpath, err := m.loadPath(ppath)\n\tif err != wasiErrnoSuccess {\n\t\treturn err\n\t}\n\n\tdir, err := m.files.getDirectory(pfd, wasiRightsPathRemoveDirectory)\n\tif err != wasiErrnoSuccess {\n\t\treturn err\n\t}\n\n\tif ferr := dir.Rmdir(path); ferr != nil {\n\t\treturn fileErrno(ferr)\n\t}\n\treturn wasiErrnoSuccess\n}", "func Remove(pkgname string, p *confparse.IniParser) error {\n\ttestdb, testdir, err := getInstallConf(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdb, err := backends.NewBolt(path.Join(testdir, testdb))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\tlist, err := db.Get([]byte(pkgname))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = futils.RemoveList(testdir, strings.Split(string(list), \"\\n\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdb.Del([]byte(pkgname))\n\n\treturn nil\n}", "func (l *List) remove(n *Node) {\n\tn.prev.next = n.next\n\tn.next.prev = n.prev\n\tn.next = nil\n\tn.prev = nil\n\tn.list = nil\n\tl.Size--\n}", "func (f *Dir) Remove(c *PuddleClient) error {\n\t// Examine the target directory\n\tchildren, _, err := c.zk.Children(f.FileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, childName := range children {\n\t\tchildName = filepath.Join(f.FileName, childName)\n\t\tcodedBytes, _, err := c.zk.Get(childName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error: when zookeeper is trying to find target, %v\", err)\n\t\t}\n\t\tvar target *iNode\n\t\terr = decodeMsgPack(codedBytes, &target)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error: when decoding... %v\", err)\n\t\t}\n\t\terr = target.Remove(c)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error: remove error, %v\", err)\n\t\t}\n\t}\n\t// Last, **this** directory metadata should be removed from zookeeper\n\treturn c.zk.Delete(f.FileName, -1)\n}", "func (m *wasiSnapshotPreview1Impl) pathUnlinkFile(pfd wasiFd, ppath list) (err wasiErrno) {\n\tpath, err := m.loadPath(ppath)\n\tif err != wasiErrnoSuccess {\n\t\treturn err\n\t}\n\n\tdir, err := m.files.getDirectory(pfd, wasiRightsPathUnlinkFile)\n\tif err != wasiErrnoSuccess {\n\t\treturn err\n\t}\n\n\tif ferr := dir.UnlinkFile(path); ferr != nil {\n\t\treturn fileErrno(ferr)\n\t}\n\treturn wasiErrnoSuccess\n}", "func (r *Repository) Remove(id digest.Digest) error {\n\t_, path := r.Path(id)\n\treturn os.Remove(path)\n}", "func (m *Model) localRemove(path *shared.RelativePath) error {\n\t// get stin for notify\n\tstin, exists := m.StaticInfos[path.SubPath()]\n\tif !exists {\n\t\tm.log(\"LocalRemove: stin is missing!\")\n\t\treturn shared.ErrIllegalFileState\n\t}\n\t// sanity check\n\tif m.IsRemoved(stin.Identification) {\n\t\t// shouldn't happen but let's be sure; warn at least\n\t\tm.warn(\"LocalRemove: file removal already begun!\")\n\t}\n\t// direct remove (removes file/dir AND from m.Tracked and m.Static)\n\terr := m.directRemove(path)\n\tif err != nil {\n\t\tm.log(\"LocalRemove: failed to directly remove file!\")\n\t\treturn err\n\t}\n\t// write peers to check and own peer to done\n\terr = m.UpdateRemovalDir(stin.Identification, m.SelfID)\n\tif err != nil {\n\t\tm.log(\"failed to update removal dir for\", stin.Identification)\n\t\treturn err\n\t}\n\t// update removal dir here so that creations etc are sent before notify below!\n\terr = m.updateLocal(m.RootPath + \"/\" + shared.TINZENITEDIR + \"/\" + shared.REMOVEDIR + \"/\" + stin.Identification)\n\tif err != nil {\n\t\tm.warn(\"partial update on local remove failed!\")\n\t\t// but continue on because the changes will be synchronized later then anyway\n\t}\n\t// update version\n\tstin.Version.Increase(m.SelfID)\n\t// send notify\n\tnotifyObj := &shared.ObjectInfo{\n\t\tIdentification: stin.Identification,\n\t\tName: path.LastElement(),\n\t\tPath: path.SubPath(),\n\t\tContent: stin.Content,\n\t\tVersion: stin.Version,\n\t\tDirectory: stin.Directory}\n\tm.notify(shared.OpRemove, notifyObj)\n\treturn nil\n}", "func (c *Config) Remove(name string) (group Group, err error) {\n\tc.init()\n\tgroup, ok := c.Groups[name]\n\tif !ok {\n\t\terr = fmt.Errorf(\"group %v is not exists\", name)\n\t\treturn\n\t}\n\tcopy := c.copy()\n\tdelete(copy.Includes, group.Filename)\n\terr = copy.Save()\n\tif err == nil {\n\t\tc.Includes = copy.Includes\n\t\tdelete(c.Groups, name)\n\t}\n\treturn\n}", "func (veth *vEth) removeVethLink() (err error) {\n\tvethNs, err := ns.GetNS(veth.nsName)\n\n\tif err != nil {\n\t\tlogger(fmt.Sprintf(\"%v\", err))\n\t}\n\tdefer vethNs.Close()\n\n\terr = vethNs.Do(func(_ ns.NetNS) error {\n\t\tlink, err := netlink.LinkByName(veth.linkName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to lookup %q in %q: %v\", veth.linkName, vethNs.Path(), err)\n\t\t}\n\n\t\terr = netlink.LinkDel(link)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to remove link %q in %q: %v\", veth.linkName, vethNs.Path(), err)\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn\n}", "func removeSecretDir(dir string) error {\n\treturn os.RemoveAll(dir)\n}", "func (e Engine) Delete(config dvid.StoreConfig) error {\n\tpath, _, err := parseConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Delete the directory if it exists\n\tif _, err := os.Stat(path); !os.IsNotExist(err) {\n\t\tif err := os.RemoveAll(path); err != nil {\n\t\t\treturn fmt.Errorf(\"Can't delete old append-only log directory %q: %v\", path, err)\n\t\t}\n\t}\n\treturn nil\n}", "func Remove(bankName string) error {\n\tconfig, err := getConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i, bank := range config.Banks {\n\t\tif bank.Name == bankName {\n\t\t\tconfig.Banks = append(config.Banks[:i], config.Banks[i+1:]...)\n\t\t}\n\t}\n\n\terr = setConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func RemoveImage(config RemoveConfig) error {\n\terr := config.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilePath, err := config.TargetDetails.FilePath(config.FileExtension)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(config.FileExtension) != 0 {\n\t\tos.Remove(filePath)\n\n\t\treturn nil\n\t}\n\n\tdirPath := path.Dir(filePath)\n\n\tinfos, err := ioutil.ReadDir(dirPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilenamePrefix := path.Base(filePath)\n\n\tfor _, info := range infos {\n\t\tif info.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(info.Name(), filenamePrefix) {\n\t\t\tos.Remove(path.Join(dirPath, info.Name()))\n\t\t}\n\t}\n\n\treturn nil\n}", "func RemoveHvacConfig(db Database, mac string) error {\n\tcriteria := make(map[string]interface{})\n\tcriteria[\"Mac\"] = mac\n\treturn db.DeleteRecord(pconst.DbConfig, pconst.TbHvacs, criteria)\n}", "func Remove(base string) (err error) {\n\thooksFolder := filepath.Join(base, hooksPath())\n\n\t// The hooks folder must exist.\n\texists, err := helper.DoesPathExistErr(hooksFolder)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif !exists {\n\t\treturn fmt.Errorf(\"the hooks folder does not exist\")\n\t}\n\n\tif err = EnsureRemoveComment(preCommitFilepath(base), defaultBashComment); err != nil {\n\t\treturn\n\t}\n\n\tif err = EnsureRemoveComment(postCommitFilepath(base), defaultBashComment); err != nil {\n\t\treturn\n\t}\n\n\tklog.InfoS(\"Removed gogit replace lines\",\n\t\t\"from-pre-commit\", preCommitFilepath(base),\n\t\t\"from-post-commit\", postCommitFilepath(base),\n\t)\n\n\treturn nil\n}", "func cmdDel(args *skel.CmdArgs) error {\n\tconf, err := parseConfig(args.StdinData)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_ = conf\n\n\t// Do your delete here\n\n\treturn nil\n}", "func SharedFolderRemove(username, path string)error{\n\tspl := strings.Split(path, \"/\")\n\tfullPath := filepath.Join(getSharedFolderHome(spl[0]), sanitizeInputPath(strings.Join(spl[1:], \"/\")))\n\t\n\treturn os.RemoveAll(fullPath)\n}", "func Unlinkat(dirfd int, path string) (err error) {\n\treturn unlinkat(dirfd, path, 0)\n}", "func (f LocalFS) Remove() error {\n\t// extra security check to ensure we only remove a directory that looks like a plugin\n\tif _, err := os.Stat(filepath.Join(f.basePath, \"plugin.json\")); os.IsNotExist(err) {\n\t\tif _, err = os.Stat(filepath.Join(f.basePath, \"dist/plugin.json\")); os.IsNotExist(err) {\n\t\t\treturn ErrUninstallInvalidPluginDir\n\t\t}\n\t}\n\treturn os.RemoveAll(f.basePath)\n}", "func (m *RestConfigModel) RemoveConfigByKey(key string) {\n\tm.initOptionalConfigs()\n\tdelete(m.optionalConfigs, key)\n}" ]
[ "0.6430494", "0.634057", "0.6336236", "0.6326346", "0.6195072", "0.6060087", "0.6044562", "0.6010889", "0.59952074", "0.59094226", "0.58753157", "0.5869244", "0.58613324", "0.58613324", "0.58580506", "0.5838797", "0.5814586", "0.58075273", "0.5775417", "0.57713187", "0.57467693", "0.5740067", "0.5702198", "0.5700593", "0.5688913", "0.5685627", "0.56839156", "0.56496197", "0.56405663", "0.56323683", "0.56296015", "0.5602097", "0.55435556", "0.5534594", "0.55252945", "0.5521735", "0.55208087", "0.55159676", "0.5510705", "0.5501442", "0.54724777", "0.54504514", "0.5443388", "0.54418045", "0.54406595", "0.543842", "0.54383373", "0.54375845", "0.54306906", "0.5428977", "0.5422836", "0.5412479", "0.5407242", "0.5397115", "0.5392704", "0.53864706", "0.53819317", "0.53780687", "0.5374597", "0.537016", "0.5366717", "0.5366074", "0.535885", "0.5353822", "0.5352966", "0.5348468", "0.5333306", "0.53299236", "0.53293204", "0.53291506", "0.5304812", "0.53040653", "0.5303726", "0.5297397", "0.52897066", "0.5285357", "0.5285234", "0.52774197", "0.5273097", "0.52456295", "0.52434295", "0.52329993", "0.5228708", "0.52269137", "0.52260816", "0.5220274", "0.52150875", "0.5208334", "0.5206008", "0.5197284", "0.519637", "0.5183909", "0.51837623", "0.51831657", "0.5177967", "0.5158636", "0.5155909", "0.51532173", "0.5152595", "0.51443994" ]
0.80864173
0
exists returns true of the given path exists
func exists(path string) bool { _, err := os.Stat(path) return !os.IsNotExist(err) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func pathExists(path string) (exists bool) {\n\texists = true\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\texists = false\n\t}\n\treturn\n}", "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\tif os.IsExist(err) {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "func exists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func exists(path string) (bool, error) {\n\tif path == \"\" {\n\t\treturn false, nil\n\t}\n\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif !os.IsNotExist(err) {\n\t\treturn false, err\n\t}\n\n\treturn false, nil\n}", "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func exists(path string) (bool) {\n\t_, err := os.Stat(path)\n\tif err == nil { return true }\n\tif os.IsNotExist(err) {return false}\n\treturn true\n}", "func exists(path string) (bool) {\n\t_, err := os.Stat(path)\n\tif err == nil { return true }\n\tif os.IsNotExist(err) {return false}\n\treturn true\n}", "func exists(path string) (bool) {\n\t_, err := os.Stat(path)\n\tif err == nil { return true }\n\tif os.IsNotExist(err) {return false}\n\treturn true\n}", "func exists(path string) bool {\n\tif _, err := os.Stat(path); err != nil {\n\t\treturn os.IsExist(err)\n\t}\n\treturn true\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func PathExists(path string) bool {\n _, err := os.Stat(path)\n if err == nil {\n return true\n }\n return false\n}", "func exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil { return true, nil }\n\tif os.IsNotExist(err) { return false, nil }\n\treturn true, err\n}", "func pathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "func pathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil || os.IsExist(err)\n}", "func exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\tpanic(err)\n}", "func pathExists(p string) bool {\n\tif _, err := os.Lstat(p); err != nil && os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func pathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func PathExists(p string) bool {\n\tif st, err := os.Stat(p); err == nil && st != nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func Exists(path string) bool {\n _, err := os.Stat(path)\n if err == nil { return true }\n if os.IsNotExist(err) { return false }\n return false\n}", "func (mzk *MockZK) Exists(path string) (bool, *zk.Stat, error) {\n\tmzk.Args = append(mzk.Args, []interface{}{\n\t\t\"exists\",\n\t\tpath,\n\t})\n\treturn mzk.ExistsFn(path)\n}", "func Exists(path string) error {\n\t_, err := os.Stat(realPath(path))\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tif os.IsNotExist(err) {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func PathExists(path string) bool {\n\t// note: the err is either IsNotExist or something else\n\t// if it's something else, you have bigger issues...\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func pathExists(path string) bool {\n\t_, err := os.Stat(path)\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn os.IsNotExist(err)\n}", "func exists(filePath string) (exists bool) {\n _,err := os.Stat(filePath)\n if err != nil {\n exists = false\n } else {\n exists = true\n }\n return\n}", "func Exists(path string) bool {\n\tif _, err := os.Stat(path); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func (f *fileSystem) Exists(prefix, path string) bool {\n\tpth := strings.TrimPrefix(path, prefix)\n\tif pth == \"/\" {\n\t\treturn false\n\t}\n\t_, ok := f.Files[pth]\n\treturn ok\n}", "func (mounter *csiProxyMounterV1Beta) ExistsPath(path string) (bool, error) {\n\tklog.V(4).Infof(\"Exists path: %s\", path)\n\tisExistsResponse, err := mounter.FsClient.PathExists(context.Background(),\n\t\t&fs.PathExistsRequest{\n\t\t\tPath: normalizeWindowsPath(path),\n\t\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn isExistsResponse.Exists, err\n}", "func exists(filePath string) bool {\n\t_, err := os.Stat(filePath)\n\treturn err == nil\n}", "func PathExists(path string) (bool, error) {\r\n\tif _, err := os.Stat(path); err != nil {\r\n\t\tif os.IsNotExist(err) {\r\n\t\t\treturn false, nil\r\n\t\t}\r\n\t\treturn true, err\r\n\t}\r\n\treturn true, nil\r\n}", "func Exists(path string) bool {\n\tif _, err := os.Stat(path); err == nil {\n\t\treturn true\n\t}\n\t// else, doesn't exist\n\treturn false\n}", "func PathExists(path string) bool {\n\tif path == \"\" {\n\t\treturn false\n\t}\n\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "func exists(path string) (bool, bool, error) {\n\tinfo, err := os.Stat(path)\n\tif err != nil {\n\t\treturn false, false, err\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, false, nil\n\t}\n\tif info.IsDir() {\n\t\treturn true, true, nil\n\t}\n\treturn true, false, err\n}", "func PathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (l *localFileSystem) Exists(prefix string, filepath string) bool {\n\tif p := strings.TrimPrefix(filepath, prefix); len(p) <= len(filepath) {\n\t\tp = path.Join(l.root, p)\n\t\t/*if !l.physfs {\n\t\t\treturn existsFile(l, p)\n\t\t} else {*/\n\t\tfmt.Println(\"Exists: \" + p)\n\t\treturn physfs.Exists(p)\n\t\t//}\n\t}\n\treturn false\n}", "func (z *ZkPlus) Exists(path string) (bool, *zk.Stat, error) {\n\tz.forPath(path).Log(logkey.ZkMethod, \"Exists\")\n\treturn z.blockOnConn().Exists(z.realPath(path))\n}", "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "func Exists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path) //os.Stat获取文件信息\n\tif err != nil && os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "func isPathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func exists(f string) (bool, error) {\n\t_, err := os.Stat(f)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"cannot get stats for path `%s`: %v\", f, err)\n\t}\n\treturn true, nil\n}", "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "func Exists(path string) bool {\n\tif _, err := os.Stat(path); !os.IsNotExist(err) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (helpers *Helpers) Exists(pathToCheck string) bool {\n\t_, err := os.Stat(pathToCheck)\n\tif err != nil && os.IsNotExist(err) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (f FileManager) Exists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func PathExists(path string) bool {\n\t_, err := os.Lstat(path)\n\tif err != nil && os.IsNotExist(err) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (f *file) pathIsExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true // ignoring error\n}", "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\tpanic(err)\n}", "func Exists(fs Fs, path string) (bool, error) {\n\t_, err := fs.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "func (p *Path) Exists() bool {\n\t_, err := os.Stat(p.Path)\n\treturn err == nil || os.IsExist(err)\n}", "func exists(p string) bool {\n\tif _, err := os.Stat(p); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (fs *FileSystem) PathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func PathExist(path string) bool {\n\t_, err := os.Lstat(path)\n\treturn err == nil\n}", "func Exists(path string) (bool, error) {\n\tif _, err := os.Stat(path); 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\treturn true, nil\n}", "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil { return true, nil }\n\tif os.IsNotExist(err) { return false, nil }\n\treturn false, err\n}", "func (fs *FS) Exists(fpath string) bool {\n\t_, err := os.Stat(fpath)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "func PathExists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t} else if os.IsNotExist(err) {\n\t\treturn false, nil\n\t} else if IsCorruptedMnt(err) {\n\t\treturn true, err\n\t}\n\treturn false, err\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn !os.IsNotExist(err)\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn !os.IsNotExist(err)\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn !os.IsNotExist(err)\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn !os.IsNotExist(err)\n}", "func Exists(path string) bool {\n\t_, err := os.Stat(path)\n\treturn !os.IsNotExist(err)\n}", "func Exists(fPath string) bool {\n\t_, err := os.Stat(fPath)\n\treturn !os.IsNotExist(err) // err would be not-exists\n}", "func DoesExist(pth string) bool {\n\tif _, err := os.Stat(pth); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func Exists(path string) (bool, error) {\n\tif path == \"\" {\n\t\treturn false, nil\n\t}\n\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\n\tif !os.IsNotExist(err) {\n\t\treturn false, errors.Wrap(err, \"cannot determine if path exists, error ambiguous\")\n\t}\n\n\treturn false, nil\n}", "func fileExists(path string) bool {\n _, err := os.Stat(path)\n return err == nil\n}", "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\n\treturn false, err\n}", "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func Exists(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}", "func PathExist(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil || os.IsExist(err)\n}", "func exists(components ...string) bool {\n\t_, err := os.Stat(path.Join(components...))\n\treturn err == nil\n}", "func isPathExist(path string) bool {\n\t_, err := os.Stat(path)\n\treturn err == nil || os.IsExist(err)\n}", "func (f *Fs) Exists(path string) (bool, error) {\n\treturn afero.Exists(f.AferoFs, path)\n}", "func PathExists(path string) bool {\n\treturn fsutil.PathExists(path)\n}", "func Exists(ctx context.Context, readBucket ReadBucket, path string) (bool, error) {\n\t_, err := readBucket.Stat(ctx, path)\n\tif err != nil {\n\t\tif IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "func PathExist(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "func PathExist(path string) bool {\n\t_, err := os.Stat(path)\n\tif err != nil && os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}" ]
[ "0.82395744", "0.82297695", "0.82128656", "0.8199086", "0.814344", "0.814344", "0.8139873", "0.8139873", "0.8129652", "0.8129652", "0.8129652", "0.8129652", "0.8129652", "0.81099635", "0.81099635", "0.81099635", "0.8109622", "0.8096654", "0.8096654", "0.8096654", "0.8096654", "0.8087069", "0.8068666", "0.8067053", "0.8067053", "0.8051953", "0.8030176", "0.802329", "0.8016629", "0.8016629", "0.8016629", "0.801162", "0.801162", "0.7975979", "0.7975784", "0.79671395", "0.7923915", "0.788011", "0.7873856", "0.78718036", "0.78621763", "0.78553474", "0.78514326", "0.78482425", "0.78443336", "0.7839682", "0.7835238", "0.7823407", "0.781855", "0.7818127", "0.78148526", "0.7812586", "0.77956414", "0.77929074", "0.7787611", "0.778734", "0.77848035", "0.7780581", "0.7778052", "0.7768099", "0.7763949", "0.7750464", "0.7744632", "0.7729815", "0.7721367", "0.7718867", "0.76993597", "0.7698214", "0.7693948", "0.76833427", "0.76780945", "0.766708", "0.7659008", "0.76453215", "0.76315266", "0.76302737", "0.75878704", "0.7584927", "0.7580585", "0.7580585", "0.7580585", "0.7580585", "0.7580585", "0.7576966", "0.75747526", "0.7571119", "0.7567033", "0.75637245", "0.7556172", "0.7556172", "0.7556172", "0.7552042", "0.7536191", "0.7534536", "0.7518373", "0.75108296", "0.75096786", "0.7498672", "0.7488109" ]
0.8078389
23
listSymDir returns a list of symlinks which the given directory contains
func listSymDir(dir string) ([]fs.FileInfo, error) { files, err := ioutil.ReadDir(dir) if err != nil { return nil, err } var res []fs.FileInfo for _, file := range files { if !file.IsDir() && (file.Mode()&fs.ModeSymlink == fs.ModeSymlink) { res = append(res, file) } } return res, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ListSymlink(root string) (entries []*FilePathInfo, err error) {\n\treturn listCondEntries(root, func(info os.FileInfo) (bool, error) { return isSymlinkFi(&info), nil })\n}", "func ListDir(root string) (entries []*FilePathInfo, err error) {\n\treturn listCondEntries(root, func(info os.FileInfo) (bool, error) { return isDirFi(&info), nil })\n}", "func (fs EmbedFs) ListDir(path string) ([]string, error) {\n\tresult := []string{}\n\n\tfor _, entry := range fs.files {\n\t\trootName := filepath.Join(\"/\", entry.name)\n\t\tif strings.HasPrefix(rootName, filepath.Join(path, \"/\")) {\n\t\t\tresult = append(result, entry.name)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func (rfs *RootFileSystem) ListDirectory(path string) ([]string, error) {\n\t// As a test, simply return the names of things at this path. Later on we'll return a structure that defines names, types and stats\n\n\tdn, _ := rfs.ChangeCache.GetDirectoryNode(rfs.SuperBlock.RootDirectory)\n\n\tvar dnReal *DirectoryNode\n\tvar err error\n\n\tif path == \"/\" {\n\t\tdnReal = dn\n\t} else {\n\t\tparts := strings.Split(path, \"/\")\n\t\tdnReal, err = dn.findDirectoryNode(parts[1:], rfs)\n\t\t// And now get the names of things and add them to \"entries\"\n\t\t// for now, don't do the continuation\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tsize := len(dnReal.Folders) + len(dnReal.Files)\n\tentries := make([]string, size)\n\tpoint := 0\n\tfor name, _ := range dnReal.Folders {\n\t\tentries[point] = name\n\t\tpoint++\n\t}\n\tfor name, _ := range dnReal.Files {\n\t\tentries[point] = name\n\t\tpoint++\n\t}\n\treturn entries, nil\n}", "func (m *Maildir) getDirListing(dir string) ([]string, error) {\n\tfilter := \"*\"\n\tsearchPath := path.Join(m.path, dir, filter)\n\tfilePaths, err := filepath.Glob(searchPath)\n\t// remove maildir path so that only key remains\n\tfor i := 0; i < len(filePaths); i++ {\n\t\tfilePaths[i] = strings.Replace(filePaths[i], m.path, \"\", 1)\n\t}\n\treturn filePaths, err\n}", "func (disk Disk) ListDir(dirname string) ([]os.FileInfo, *probe.Error) {\n\tdisk.lock.Lock()\n\tdefer disk.lock.Unlock()\n\n\tdir, err := os.Open(filepath.Join(disk.path, dirname))\n\tif err != nil {\n\t\treturn nil, probe.NewError(err)\n\t}\n\tdefer dir.Close()\n\tcontents, err := dir.Readdir(-1)\n\tif err != nil {\n\t\treturn nil, probe.NewError(err)\n\t}\n\tvar directories []os.FileInfo\n\tfor _, content := range contents {\n\t\t// Include only directories, ignore everything else\n\t\tif content.IsDir() {\n\t\t\tdirectories = append(directories, content)\n\t\t}\n\t}\n\treturn directories, nil\n}", "func ListFunctionsForDir(vlog, events metrics.Metrics, dir string, ctx build.Context) (PackageFunctionList, error) {\n\tvar pkgFuncs PackageFunctionList\n\tpkgFuncs.Path = dir\n\tpkgFuncs.Package, _ = srcpath.RelativeToSrc(dir)\n\n\tpkgs, err := ast.FilteredPackageWithBuildCtx(vlog, dir, ctx)\n\tif err != nil {\n\t\tif _, ok := err.(*build.NoGoError); ok {\n\t\t\treturn pkgFuncs, ErrSkipDir\n\t\t}\n\n\t\tevents.Emit(metrics.Error(err), metrics.With(\"dir\", dir))\n\t\treturn pkgFuncs, err\n\t}\n\n\tif len(pkgs) == 0 {\n\t\treturn pkgFuncs, ErrSkipDir\n\t}\n\n\tpkgItem := pkgs[0]\n\tif pkgItem.HasAnnotation(\"@ignore\") {\n\t\treturn pkgFuncs, ErrSkipDir\n\t}\n\n\tpkgHash, err := generateHash(pkgItem.Files)\n\tif err != nil {\n\t\treturn pkgFuncs, err\n\t}\n\n\tbinaryName := pkgItem.Name\n\n\tvar binaryDesc string\n\tif binAnnon, _, ok := pkgItem.AnnotationFirstFor(\"@binaryName\"); ok {\n\t\tbinaryName = binAnnon.Param(\"name\")\n\t\tif binaryName == \"\" {\n\t\t\tbinaryName = pkgItem.Name\n\t\t}\n\n\t\tif desc, ok := binAnnon.Attr(\"desc\").(string); ok {\n\t\t\tif desc != \"\" && !strings.HasSuffix(desc, \".\") {\n\t\t\t\tdesc += \".\"\n\t\t\t\tbinaryDesc = doc.Synopsis(desc)\n\t\t\t}\n\t\t}\n\t}\n\n\tif binaryDesc == \"\" {\n\t\tbinaryDesc = haiku()\n\t}\n\n\tpkgFuncs.Name = binaryName\n\tpkgFuncs.Desc = binaryDesc\n\n\tfns, err := pullFunctions(pkgItem)\n\tif err != nil {\n\t\treturn pkgFuncs, err\n\t}\n\n\tfns.Hash = pkgHash\n\tpkgFuncs.List = append(pkgFuncs.List, fns)\n\n\treturn pkgFuncs, nil\n}", "func (resolver *NpmResolver) ListPkgPaths() (io.Reader, error) {\n\tbuffer := &bytes.Buffer{}\n\tcmd := exec.Command(\"npm\", \"ls\", \"--all\", \"--production\", \"--parseable\")\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = buffer\n\t// Error occurs all the time in npm commands, so no return statement here\n\terr := cmd.Run()\n\treturn buffer, err\n}", "func (d *driver) List(ctx context.Context, path string) ([]string, error) {\n\tdefer debugTime()()\n\toutput, err := d.shell.FileList(d.fullPath(path))\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"no link named\") {\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: path}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tkeys := make([]string, 0, len(output.Links))\n\tfor _, link := range output.Links {\n\t\tkeys = append(keys, _path.Join(path, link.Name))\n\t}\n\n\treturn keys, nil\n}", "func walkDir(dname string) []string {\n\t//list for all found files0\n\tvar fileList []string\n\t// walk files\n\tfilepath.Walk(dname, func(path string, f os.FileInfo, err error) error {\n\t\tif err == nil {\n\t\t\tif f.Mode().IsRegular() {\n\t\t\t\tfileList = append(fileList, path)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn fileList\n}", "func listFiles(root string) ([]string, error) {\n var paths = make([]string, 0)\n var walker filepath.WalkFunc = func(path string, info os.FileInfo, err error) error {\n if err != nil {\n return err\n } else {\n if ! info.IsDir() {\n path, _ = filepath.Rel(root, path)\n paths = append(paths, path)\n }\n }\n return nil\n }\n err := filepath.Walk(root, walker)\n\n return paths, err\n}", "func (st *fakeConn) ListDir(ctx context.Context, dirPath string, full bool) (res []DirEntry, err error) {\n\tif dirPath == \"error\" {\n\t\treturn res, fmt.Errorf(\"Dummy error\")\n\n\t}\n\treturn res, err\n}", "func dirents(dir string) []os.FileInfo {\n\tsema <- struct{}{} // acquire token\n\tdefer func() { <-sema }() // release token\n\n\tentries, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"ch08ex09: %v\\n\", err)\n\t\treturn nil\n\t}\n\treturn entries\n}", "func scanDir(dir string) error {\n\n\tvar files []string\n\tvar m = make(map[string]int)\n\tm[\"directories\"] = 0\n\tm[\"others\"] = 0\n\tm[\"symlinks\"] = 0\n\n\tfmt.Printf(\"Path: %s\\n\", dir)\n\n filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n files = append(files, path)\n return nil\n\t})\n\t\n for _, file := range files {\n state, err := os.Lstat(file)\n\t\tif(err != nil){\n\t\t\tfmt.Println(err)\n\t\t}\n\n\t\tif state.Mode() & os.ModeSymlink != 0{\n\t\t\tm[\"symlinks\"] = m[\"symlinks\"] + 1\n\t\t}\n\n\t\tswitch mode := state.Mode(); {\n\n\t\tcase mode.IsDir():\n\t\t\tm[\"directories\"] = m[\"directories\"] + 1\n\n\t\tcase mode.IsRegular():\n\t\t\tm[\"others\"] = m[\"others\"] + 1\n\n\t\t}\n\t}\t\n\n\tfor key, value := range m{\n\t\tfmt.Println(key, \":\", value);\n\t}\n\n\treturn nil\n}", "func namesFor(dev string) []string {\n\tvar names []string\n\tnames = append(names, dev)\n\tnames = append(names, PathFor(dev))\n\n\t// Check for a symlink\n\ts, err := filepath.EvalSymlinks(dev)\n\tif err != nil {\n\t\tklog.Infof(\"device %q did not evaluate as a symlink: %v\", dev, err)\n\t} else {\n\t\ta, err := filepath.Abs(s)\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"unable to make filepath %q absolute: %v\", s, err)\n\t\t} else {\n\t\t\ts = a\n\t\t}\n\t\tnames = append(names, s)\n\t}\n\n\treturn names\n}", "func ScanDir(dirname string) []os.FileInfo {\n\tempty := []os.FileInfo{}\n\tif !PathExists(dirname) {\n\t\treturn empty\n\t}\n\tdir, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn empty\n\t}\n\tlist, err := dir.Readdir(-1)\n\tdir.Close()\n\tif err != nil {\n\t\treturn empty\n\t}\n\treturn list\n}", "func ListDirectory(path string) ([]string, error) {\n\tvar list []string\n\terr := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() {\n\t\t\t// We only support yaml at the moment, so we might well filter on it\n\t\t\tswitch filepath.Ext(path) {\n\t\t\tcase \".yaml\":\n\t\t\t\tfallthrough\n\t\t\tcase \".yml\":\n\t\t\t\tlist = append(list, path)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn list, err\n}", "func listFiles(dirname string) []string {\n\tf, _ := os.Open(dirname)\n\n\tnames, _ := f.Readdirnames(-1)\n\tf.Close()\n\n\tsort.Strings(names)\n\n\tdirs := []string{}\n\tfiles := []string{}\n\n\t// sort: directories in front of files\n\tfor _, name := range names {\n\t\tpath := filepath.Join(dirname, name)\n\t\tfio, err := os.Lstat(path)\n\n\t\tif nil != err {\n\t\t\tlogger.Warnf(\"Can't read file info [%s]\", path)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif fio.IsDir() {\n\t\t\t// exclude the .git, .svn, .hg direcitory\n\t\t\tif \".git\" == fio.Name() || \".svn\" == fio.Name() || \".hg\" == fio.Name() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdirs = append(dirs, name)\n\t\t} else {\n\t\t\t// exclude the .DS_Store directory on Mac OS X\n\t\t\tif \".DS_Store\" == fio.Name() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfiles = append(files, name)\n\t\t}\n\t}\n\n\treturn append(dirs, files...)\n}", "func dirpath(x uint, n uint) []uint {\n\td := []uint{}\n\tp := parent(x, n)\n\tr := root(n)\n\tfor p != r {\n\t\td = append([]uint{p}, d...)\n\t\tp = parent(p, n)\n\t}\n\treturn d\n}", "func symlinkDir(srcDir string, destDir string) (err error) {\n\tsrcInfo, err := os.Stat(srcDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.MkdirAll(destDir, srcInfo.Mode())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdirectory, _ := os.Open(srcDir)\n\tdefer directory.Close()\n\tobjects, err := directory.Readdir(-1)\n\n\tfor _, obj := range objects {\n\t\tsrcPath := filepath.Join(srcDir, obj.Name())\n\t\tdestPath := filepath.Join(destDir, obj.Name())\n\n\t\tif obj.IsDir() {\n\t\t\terr = symlinkDir(srcPath, destPath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\terr = symlinkFile(srcPath, destPath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\treturn\n}", "func dirList(path string) ([]string, error) {\n\tnames := []string{}\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tlog.Printf(\"Template error: %v\", err)\n\t\treturn names, nil\n\t}\n\tfor _, f := range files {\n\t\tnames = append(names, f.Name())\n\t}\n\treturn names, nil\n}", "func listDir(itemsDir string) []string {\n\tf, err := os.Open(itemsDir)\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot open dir \", itemsDir)\n\t}\n\titems, err := f.Readdirnames(0)\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot get list of items from \", itemsDir)\n\t}\n\treturn items\n}", "func dirlist(top string) stringSet {\n\toutset := newStringSet()\n\there, _ := os.Getwd()\n\tos.Chdir(top)\n\tfilepath.Walk(\".\", func(path string, info os.FileInfo, err error) error {\n\t\toutset.Add(filepath.Clean(path)) // Remove leading ./ if any\n\t\treturn nil\n\t})\n\tos.Chdir(here)\n\treturn outset\n}", "func listPackages(dir string) (directories []string) {\n\t// add subdirectories\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tcomplete.Log(\"failed reading directory %s: %s\", dir, err)\n\t\treturn\n\t}\n\n\t// build paths array\n\tpaths := make([]string, 0, len(files)+1)\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\tpaths = append(paths, filepath.Join(dir, f.Name()))\n\t\t}\n\t}\n\tpaths = append(paths, dir)\n\n\t// import packages according to given paths\n\tfor _, p := range paths {\n\t\tpkg, err := build.ImportDir(p, 0)\n\t\tif err != nil {\n\t\t\tcomplete.Log(\"failed importing directory %s: %s\", p, err)\n\t\t\tcontinue\n\t\t}\n\t\tdirectories = append(directories, pkg.Dir)\n\t}\n\treturn\n}", "func ListingDirectory(ctx Ctx, folder string) ([]*FileInfo, error) {\n\tfullPath := path.Join(ctx.GetRoot(), folder)\n\tvar files []*FileInfo\n\tf, err := os.Open(fullPath)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist, err := f.Readdir(-1)\n\tfor _, i := range list {\n\n\t\titem := &FileInfo{\n\t\t\tName: i.Name(),\n\t\t\tSize: i.Size(),\n\t\t\tExtension: filepath.Ext(i.Name()),\n\t\t\tModTime: i.ModTime(),\n\t\t\tIsDir: i.IsDir(),\n\t\t\tPath: folder,\n\t\t}\n\t\tfiles = append(files, item)\n\n\t}\n\treturn files, nil\n\n}", "func walk(dir string) ([]string, error) {\n\n\tfileList := []string{}\n\terr := filepath.Walk(dir, func(path string, info os.FileInfo, e error) error {\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\n\t\t// check if it is a regular file (not dir)\n\t\tif info.Mode().IsRegular() {\n\t\t\tfileList = append(fileList, path)\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn fileList, err\n}", "func ListFile(root string) (entries []*FilePathInfo, err error) {\n\treturn listCondEntries(root, func(info os.FileInfo) (bool, error) { return isFileFi(&info), nil })\n}", "func GetSampleSymlinks(vfs avfs.Featurer) []*Symlink {\n\tif !vfs.HasFeature(avfs.FeatSymlink) {\n\t\treturn nil\n\t}\n\n\tsymlinks := []*Symlink{\n\t\t{NewName: \"/A/lroot\", OldName: \"/\"},\n\t\t{NewName: \"/lC\", OldName: \"/C\"},\n\t\t{NewName: \"/B/1/lafile2.txt\", OldName: \"/A/afile2.txt\"},\n\t\t{NewName: \"/B/2/lf\", OldName: \"/B/2/F\"},\n\t\t{NewName: \"/B/2/F/3/llf\", OldName: \"/B/2/lf\"},\n\t\t{NewName: \"/C/lllf\", OldName: \"/B/2/F/3/llf\"},\n\t\t{NewName: \"/A/l3file2.txt\", OldName: \"/C/lllf/3/3file2.txt\"},\n\t\t{NewName: \"/C/lNonExist\", OldName: \"/A/path/to/a/non/existing/file\"},\n\t}\n\n\treturn symlinks\n}", "func (d *dir) list(path string, output []string) []string {\n\tdirPath := filepath.Join(path, d.name)\n\toutput = append(output, dirPath)\n\tfor _, subDir := range d.children {\n\t\toutput = subDir.list(dirPath, output)\n\t}\n\treturn output\n}", "func dirents(dir string) []os.FileInfo {\n\n\tsema <- struct{}{} // acquire token\n\tdefer func() { <-sema }() // release token\n\n\tf, err := os.Open(dir)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"decodeTest: %v\\n\", err)\n\t\treturn nil\n\t}\n\tdefer f.Close()\n\n\tentries, err := f.Readdir(0) // 0 => no limit; read all entries\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"decodeTest: %v\\n\", err)\n\t\t// Don't return: Readdir may return partial results.\n\t}\n\treturn entries\n}", "func walk(filename string, linkDirname string, walkFn filepath.WalkFunc) error {\n\tsymWalkFunc := func(path string, info os.FileInfo, err error) error {\n\n\t\tif fname, err := filepath.Rel(filename, path); err == nil {\n\t\t\tpath = filepath.Join(linkDirname, fname)\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\n\t\tif err == nil && info.Mode()&os.ModeSymlink == os.ModeSymlink {\n\t\t\tfinalPath, err := filepath.EvalSymlinks(path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tinfo, err := os.Lstat(finalPath)\n\t\t\tif err != nil {\n\t\t\t\treturn walkFn(path, info, err)\n\t\t\t}\n\t\t\tif info.IsDir() {\n\t\t\t\treturn walk(finalPath, path, walkFn)\n\t\t\t}\n\t\t}\n\n\t\treturn walkFn(path, info, err)\n\t}\n\treturn filepath.Walk(filename, symWalkFunc)\n}", "func Ls(dir string) ([]os.FileInfo, error) {\n\tfiles, err := ioutil.ReadDir(dir)\n\tsort.Sort(FileInfoByType(files))\n\treturn files, err\n}", "func (td *TreeDirectory) List() []TreeDirectoryEntry {\n\tvar o []TreeDirectoryEntry\n\tfor _, e := range td.flatDents {\n\t\to = append(o, *e)\n\t}\n\treturn o\n}", "func Scan(root string, cfg Config) ([]string, error) {\n\tfiles := []string{}\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\trel, err := filepath.Rel(root, path)\n\t\tif err != nil {\n\t\t\trel = path\n\t\t}\n\n\t\tif rel == \".git\" {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\tif !cfg.shouldExamine(root, path) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !info.IsDir() {\n\t\t\tfiles = append(files, rel)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn files, nil\n}", "func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {\n\tentries, err = f.Fs.List(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f.processEntries(entries)\n}", "func GetSampleSymlinksEval(vfs avfs.Featurer) []*SymlinkEval {\n\tif !vfs.HasFeature(avfs.FeatSymlink) {\n\t\treturn nil\n\t}\n\n\tsl := []*SymlinkEval{\n\t\t{NewName: \"/A/lroot/\", OldName: \"/\", WantErr: nil, IsSymlink: true, Mode: os.ModeDir | 0o777},\n\t\t{NewName: \"/A/lroot/B\", OldName: \"/B\", WantErr: nil, IsSymlink: false, Mode: os.ModeDir | 0o755},\n\t\t{NewName: \"/C/lNonExist\", OldName: \"A/path\", WantErr: avfs.ErrNoSuchFileOrDir, IsSymlink: true},\n\t\t{NewName: \"/\", OldName: \"/\", WantErr: nil, IsSymlink: false, Mode: os.ModeDir | 0o777},\n\t\t{NewName: \"/lC\", OldName: \"/C\", WantErr: nil, IsSymlink: true, Mode: os.ModeDir | 0o750},\n\t\t{NewName: \"/B/1/lafile2.txt\", OldName: \"/A/afile2.txt\", WantErr: nil, IsSymlink: true, Mode: 0o644},\n\t\t{NewName: \"/B/2/lf\", OldName: \"/B/2/F\", WantErr: nil, IsSymlink: true, Mode: os.ModeDir | 0o755},\n\t\t{NewName: \"/B/2/F/3/llf\", OldName: \"/B/2/F\", WantErr: nil, IsSymlink: true, Mode: os.ModeDir | 0o755},\n\t\t{NewName: \"/C/lllf\", OldName: \"/B/2/F\", WantErr: nil, IsSymlink: true, Mode: os.ModeDir | 0o755},\n\t\t{NewName: \"/B/2/F/3/llf\", OldName: \"/B/2/F\", WantErr: nil, IsSymlink: true, Mode: os.ModeDir | 0o755},\n\t\t{NewName: \"/C/lllf/3/3file1.txt\", OldName: \"/B/2/F/3/3file1.txt\", WantErr: nil, IsSymlink: false, Mode: 0o640},\n\t}\n\n\treturn sl\n}", "func ScanDir(dir string) []string {\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tlog.Printf(\"read [%s] error, err = %s\\n\", dir, err)\n\t}\n\tvar fileList []string\n\tfor _, file := range files {\n\t\tfileList = append(fileList, dir+file.Name())\n\t}\n\treturn fileList\n}", "func getList(baseurl string, resolution string, subdir string) []string {\n\tvar list []string\n\n\t// fetch the list of srtm files\n\turl := baseurl + \"/\" + resolution + \"/\" + subdir\n\n\tresp, err := http.Get(url)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\troot, err := html.Parse(resp.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfiles := scrape.FindAll(root, scrape.ByTag(atom.A))\n\n\tfor _, file := range files {\n\t\tfileurl := url + \"/\" + scrape.Attr(file, \"href\")\n\n\t\tif strings.Contains(fileurl, \".zip\") {\n\t\t\t// fmt.Printf(\"%2d %s (%s)\\n\", i, scrape.Text(file), fileurl)\n\t\t\tlist = append(list, fileurl)\n\t\t}\n\t}\n\n\treturn list\n}", "func ListFiles(dir string) ([]string, error) {\n\tvar files []string\n\terr := filepath.Walk(dir, func(active string, info os.FileInfo, err error) error {\n\t\t// ignore directories\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trel, err := filepath.Rel(dir, active)\n\t\tfiles = append(files, rel)\n\t\treturn nil\n\t})\n\treturn files, err\n}", "func (fs *Fs) ListDirs(dir string) []string {\n\tvar s []string\n\tfiles, err := ioutil.ReadDir(filepath.Join(fs.Path, dir))\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot list dirs in %s, %s\", filepath.Join(fs.Path, dir), err.Error())\n\t}\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\ts = append(s, file.Name())\n\t\t}\n\t}\n\treturn s\n}", "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\t// defer log.Trace(f, \"dir=%q\", dir)(\"entries = %v, err=%v\", &entries, &err)\n\tif f.root == \"\" && dir == \"\" {\n\t\tentries = make(fs.DirEntries, 0, len(f.upstreams))\n\t\tfor combineDir := range f.upstreams {\n\t\t\td := fs.NewDir(combineDir, f.when)\n\t\t\tentries = append(entries, d)\n\t\t}\n\t\treturn entries, nil\n\t}\n\tu, uRemote, err := f.findUpstream(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tentries, err = u.f.List(ctx, uRemote)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn u.wrapEntries(ctx, entries)\n}", "func CreateSymLinks(sourceDir, targetDir string, overwriteSymlinks bool) {\n\tfiles, err := ioutil.ReadDir(sourceDir)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t_, parentDir := filepath.Split(sourceDir)\n\n\tfor _, f := range files {\n\t\tlog.Info(\"Creating symlink for \" + f.Name())\n\n\t\tsymlinkPath := filepath.Join(targetDir, f.Name())\n\n\t\tif overwriteSymlinks {\n\t\t\tif _, err := os.Lstat(symlinkPath); err == nil {\n\t\t\t\tos.Remove(symlinkPath)\n\t\t\t}\n\t\t}\n\n\t\terr = os.Symlink(filepath.Join(parentDir, f.Name()), symlinkPath)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tdirectoryID, err := f.dirCache.FindDir(ctx, dir, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar iErr error\n\t_, err = f.listAll(ctx, directoryID,\n\t\tfunc(info *api.File) bool {\n\t\t\tremote := path.Join(dir, info.Name)\n\t\t\to, err := f.newObjectWithInfo(ctx, remote, info)\n\t\t\tif err != nil {\n\t\t\t\tiErr = err\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tentries = append(entries, o)\n\t\t\treturn false\n\t\t},\n\t\tfunc(info *api.Collection) bool {\n\t\t\tremote := path.Join(dir, info.Name)\n\t\t\tid := info.Ref\n\t\t\t// cache the directory ID for later lookups\n\t\t\tf.dirCache.Put(remote, id)\n\t\t\td := fs.NewDir(remote, info.TimeCreated).SetID(id)\n\t\t\tentries = append(entries, d)\n\t\t\treturn false\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif iErr != nil {\n\t\treturn nil, iErr\n\t}\n\treturn entries, nil\n}", "func ListAll(root string) (entries []*FilePathInfo, err error) {\n\treturn listCondEntries(root, func(info os.FileInfo) (bool, error) { return true, nil })\n}", "func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) {\n\tr0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result)))\n\tres = Errno(r0)\n\treturn\n}", "func (e *Enumerate) DeviceSyspaths() (s []string, err error) {\n\te.lock()\n\tdefer e.unlock()\n\tif C.udev_enumerate_scan_devices(e.ptr) < 0 {\n\t\terr = errors.New(\"udev: udev_enumerate_scan_devices failed\")\n\t} else {\n\t\ts = make([]string, 0)\n\t\tfor l := C.udev_enumerate_get_list_entry(e.ptr); l != nil; l = C.udev_list_entry_get_next(l) {\n\t\t\ts = append(s, C.GoString(C.udev_list_entry_get_name(l)))\n\t\t}\n\t}\n\treturn\n}", "func ListDir(dirPth string, suffix string) (files []string, err error) {\n\tfiles = make([]string, 0, 10)\n\tdir, err := ioutil.ReadDir(dirPth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuffix = strings.ToUpper(suffix) //忽略后缀匹配的大小写\n\tfor _, fi := range dir {\n\t\tif fi.IsDir() { // 忽略目录\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(strings.ToUpper(fi.Name()), suffix) { //匹配文件\n\t\t\tfiles = append(files, fi.Name())\n\t\t}\n\t}\n\treturn files, nil\n}", "func walk(dir string) (files []string, err error) {\n\tdir, err = filepath.Abs(dir)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = filepath.Walk(dir,\n\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !info.Mode().IsRegular() {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\trel, err := filepath.Rel(dir, path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfiles = append(files, rel)\n\n\t\t\treturn nil\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "func listDirFiles(dir string, suffix []string) (fileAbsPaths []string, err error) {\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, f := range files {\n\t\t// if is hidden file, continue\n\t\tif checkIsHiddenFile(f.Name()) {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Debug(path.Join(dir, f.Name()))\n\t\tabsPath := path.Join(dir, f.Name())\n\t\t// if is dir, recursive loop to find files\n\t\tif f.IsDir() {\n\t\t\tvar childKeys []string\n\t\t\tchildKeys, err = listDirFiles(absPath, suffix)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfileAbsPaths = append(fileAbsPaths, childKeys...)\n\t\t} else {\n\t\t\t// if is file, append to keys\n\t\t\tfileAbsPaths = append(fileAbsPaths, absPath)\n\t\t}\n\t}\n\n\treturn\n}", "func ListFiles(rootDir string, predicate FileInfoPredicate) []string {\n\n\tvar files []string\n\n\terr := filepath.Walk(rootDir, func(filePath string, fileInfo os.FileInfo, err error) error {\n\n\t\tif predicate == nil || predicate(fileInfo) {\n\t\t\tfiles = append(files, filePath)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn files\n}", "func dirlist(conn net.Conn) {\n\tdefer conn.Write([]byte(\"\\n\"))\n\tdir, err := os.Open(\".\")\n\tif err != nil {\n\t\tconn.Write([]byte(err.Error()))\n\t}\n\n\tnames, err := dir.Readdirnames(-1)\n\tif err != nil {\n\t\tconn.Write([]byte(err.Error()))\n\t}\n\n\tfor _, name := range names {\n\t\tconn.Write([]byte(name + \"\\n\"))\n\t}\n}", "func list(root string) ([]*Source, error) {\n\tvar fs []*Source\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\tif !(info.IsDir() || info.Name()[0] == '.') {\n\t\t\tff, err := openSourceFile(path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfs = append(fs, ff)\n\t\t}\n\t\treturn err\n\t})\n\n\tsort.SliceStable(fs, func(i, j int) bool {\n\t\treturn fs[i].num < fs[j].num\n\t})\n\n\treturn fs, err\n}", "func ListDirFiles(uri string) ([]models.TmpLaw, error) {\n\tfiles, err := ioutil.ReadDir(uri)\n\tvar filelist []models.TmpLaw\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Could not open Folder\")\n\t}\n\n\tfor _, f := range files {\n\t\tif !f.IsDir() {\n\t\t\tfile := models.TmpLaw{Name: f.Name(), Path: uri}\n\t\t\tfilelist = append(filelist, file)\n\t\t}\n\t}\n\n\treturn filelist, nil\n}", "func ListFilesInDirectory(dirname string) []os.FileInfo {\n\tfiles, err := ioutil.ReadDir(dirname)\n\tcheck(\"listdir\", err)\n\treturn files\n}", "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tvar iErr error\n\t_, err = f.listAll(ctx, dir, false, false, defaultDepth, func(remote string, isDir bool, info *api.Prop) bool {\n\t\tif isDir {\n\t\t\td := fs.NewDir(remote, time.Time(info.Modified))\n\t\t\t// .SetID(info.ID)\n\t\t\t// FIXME more info from dir? can set size, items?\n\t\t\tentries = append(entries, d)\n\t\t} else {\n\t\t\to, err := f.newObjectWithInfo(ctx, remote, info)\n\t\t\tif err != nil {\n\t\t\t\tiErr = err\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tentries = append(entries, o)\n\t\t}\n\t\treturn false\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif iErr != nil {\n\t\treturn nil, iErr\n\t}\n\treturn entries, nil\n}", "func (f *FileList) Dirs() []string {\n\treturn f.dirs\n}", "func ListDir(type_ string, user string) []map[string]string {\n\tuserDir := c.FileStore + \"/\" + glb.MD5Sum(user)\n\tglb.ReplaceRept(&userDir, \"/\")\n\tuserDir = strings.TrimRight(userDir, \"/\")\n\t\n\t//fmt.Println(userDir)\n\tif glb.FileExist(userDir) {\n\t\tos.Remove(userDir)\n\t}\n\tif !glb.DirExist(userDir) {\n\t\tos.MkdirAll(userDir+\"/plain\", 0775)\n\t\tos.MkdirAll(userDir+\"/secret/cache\", 0775)\n\t\tos.MkdirAll(userDir+\"/plain_share\", 0775)\n\t\tos.MkdirAll(userDir+\"/secret_share\", 0775)\n\t}\n\t\n\tvar (\n\t\tfileList []map[string]string\n\t\tdirToRead string\n\t)\n\tswitch type_ {\n\tcase \"plain\":\n\t\tdirToRead = userDir + \"/plain\"\n\t\tlist, _ := ioutil.ReadDir(dirToRead)\n\t\tfor _, file := range list {\n\t\t\tfileList = append(fileList, map[string]string{\n\t\t\t\t\"name\": file.Name(),\n\t\t\t\t\"size\": glb.ComputeSize(file.Size()),\n\t\t\t\t\"date\": file.ModTime().Format(\"2006-01-02 15:04:05\"),\n\t\t\t\t\"link\": \"\",\n\t\t\t})\n\t\t}\n\t\treturn fileList\n\tcase \"plain_share\":\n\t\tdirToRead = userDir + \"/plain_share\"\n\t\tlist, _ := ioutil.ReadDir(dirToRead)\n\t\tfor _, file := range list {\n\t\t\tfileList = append(fileList, map[string]string{\n\t\t\t\t\"name\": file.Name(),\n\t\t\t\t\"size\": glb.ComputeSize(file.Size()),\n\t\t\t\t\"date\": file.ModTime().Format(\"2006-01-02 15:04:05\"),\n\t\t\t\t\"link\": \"\",\n\t\t\t})\n\t\t}\n\t\treturn fileList\n\tcase \"secret\":\n\t\tdirToRead = userDir + \"/secret\"\n\t\tlist, _ := ioutil.ReadDir(dirToRead)\n\t\tfor _, file := range list {\n\t\t\tfileList = append(fileList, map[string]string{\n\t\t\t\t\"name\": file.Name(),\n\t\t\t\t\"size\": glb.ComputeSize(file.Size()),\n\t\t\t\t\"date\": file.ModTime().Format(\"2006-01-02 15:04:05\"),\n\t\t\t\t\"link\": \"\",\n\t\t\t})\n\t\t}\n\t\treturn fileList\n\t\n\tcase \"secret_share\":\n\t\treturn nil\n\t}\n\treturn nil\n}", "func walkTree(workspace string) ([]*finalizeFileInfo, error) {\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get pwd: %v\", err)\n\t}\n\t// make everything relative to the workspace\n\t_ = os.Chdir(workspace)\n\tdirMap := make(map[string]*finalizeFileInfo)\n\tfileList := make([]*finalizeFileInfo, 0)\n\tvar entry *finalizeFileInfo\n\t_ = filepath.Walk(\".\", func(fp string, fi os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tisRoot := fp == \".\"\n\t\tname := fi.Name()\n\t\tm := fi.Mode()\n\t\tvar fType fileType\n\t\tswitch {\n\t\tcase m&os.ModeSocket == os.ModeSocket:\n\t\t\tfType = fileSocket\n\t\tcase m&os.ModeSymlink == os.ModeSymlink:\n\t\t\tfType = fileSymlink\n\t\tcase m&os.ModeNamedPipe == os.ModeNamedPipe:\n\t\t\tfType = fileFifo\n\t\tcase m&os.ModeDir == os.ModeDir:\n\t\t\tfType = fileDirectory\n\t\tcase m&os.ModeDevice == os.ModeDevice && m&os.ModeCharDevice == os.ModeCharDevice:\n\t\t\tfType = fileChar\n\t\tcase m&os.ModeDevice == os.ModeDevice && m&os.ModeCharDevice != os.ModeCharDevice:\n\t\t\tfType = fileBlock\n\t\tdefault:\n\t\t\tfType = fileRegular\n\t\t}\n\t\txattrNames, err := xattr.List(fp)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list xattrs for %s: %v\", fp, err)\n\t\t}\n\t\txattrs := map[string]string{}\n\t\tfor _, name := range xattrNames {\n\t\t\tval, err := xattr.Get(fp, name)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to get xattr %s for %s: %v\", name, fp, err)\n\t\t\t}\n\t\t\txattrs[name] = string(val)\n\t\t}\n\t\tnlink, uid, gid := getFileProperties(fi)\n\n\t\tentry = &finalizeFileInfo{\n\t\t\tpath: fp,\n\t\t\tname: name,\n\t\t\tisDir: fi.IsDir(),\n\t\t\tisRoot: isRoot,\n\t\t\tmodTime: fi.ModTime(),\n\t\t\tmode: m,\n\t\t\tfileType: fType,\n\t\t\tsize: fi.Size(),\n\t\t\txattrs: xattrs,\n\t\t\tuid: uid,\n\t\t\tgid: gid,\n\t\t\tlinks: nlink,\n\t\t}\n\n\t\t// we will have to save it as its parent\n\t\tparentDir := filepath.Dir(fp)\n\t\tparentDirInfo := dirMap[parentDir]\n\n\t\tif fi.IsDir() {\n\t\t\tentry.children = make([]*finalizeFileInfo, 0, 20)\n\t\t\tdirMap[fp] = entry\n\t\t} else {\n\t\t\t// calculate blocks\n\t\t\tentry.size = fi.Size()\n\t\t}\n\t\tif !isRoot {\n\t\t\tparentDirInfo.children = append(parentDirInfo.children, entry)\n\t\t\tdirMap[parentDir] = parentDirInfo\n\t\t}\n\t\tfileList = append(fileList, entry)\n\t\treturn nil\n\t})\n\t// reset the workspace\n\t_ = os.Chdir(cwd)\n\n\treturn fileList, nil\n}", "func (d *Directory) List(p string) ([]INodeInfo, error) {\n\tdir, err := d.checkPathExists(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn generateINodeInfos(dir.INodes), nil\n}", "func getFileList(dir string) ([]string, error) {\n\tvar fileNames []string\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn fileNames, err\n\t}\n\n\tfor _, file := range files {\n\t\tif !file.IsDir() && filepath.Ext(file.Name()) == \".out\" {\n\t\t\tfileNames = append(fileNames, file.Name())\n\t\t}\n\t}\n\treturn fileNames, nil\n}", "func dirents(dir string) []os.FileInfo {\r\n\tsema <- struct{}{} // acquire token\r\n\tdefer func() { <-sema }() // release token\r\n\r\n\tentries, err := ioutil.ReadDir(dir)\r\n\tif err != nil {\r\n\t\tfmt.Fprintf(os.Stderr, \"du: %v\\n\", err)\r\n\t\treturn nil\r\n\t}\r\n\treturn entries\r\n}", "func ListDiagrams(dir string) ([]string, error) {\n\tvar diagrams []string\n\n\tcwd, err := filepath.Abs(filepath.Dir(\"\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tpath := cwd + dir\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, file := range files {\n\t\tdiagrams = append(diagrams, file.Name())\n\t}\n\n\treturn diagrams, nil\n}", "func (nm2md NM2MD) Symlink(destMaildir *maildir.Maildir, fileList []string) []error {\n\tvar errs []error\n\tvar swg sizedwaitgroup.SizedWaitGroup = sizedwaitgroup.New(swgLimit)\n\tfor _, file := range fileList {\n\t\tswg.Add()\n\t\tgo func(file string) {\n\t\t\tdefer swg.Done()\n\t\t\terr := destMaildir.SymlinkFile(file)\n\t\t\tif err != nil {\n\t\t\t\tutils.PrintDebugErrorMsg(err, nm2md.ApplicationOptions.Debug)\n\t\t\t\terrs = append(errs, err)\n\t\t\t}\n\t\t}(file)\n\t}\n\tswg.Wait()\n\tif len(errs) > 0 {\n\t\tutils.PrintDebugMsg(\"Some files can not be linked - this usually happens if the maildir and the notmuch index are not synced. Try to run `notmuch new'\", nm2md.ApplicationOptions.Debug)\n\t}\n\treturn errs\n}", "func getFilelist(path string, e *error) []string {\n\tfileV := []string{}\n\tfilepath.Walk(path, func(path string, f os.FileInfo, err error) error {\n\t\tif f == nil {\n\t\t\t*e = err\n\t\t\treturn nil\n\t\t}\n\t\tif f.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tfileV = append(fileV, path)\n\t\treturn nil\n\t})\n\treturn fileV\n}", "func ListFiles(dir string) []string {\n\tvar out []string\n\terr := filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !f.IsDir() {\n\t\t\tout = append(out, path)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlogs.WithFields(logs.Fields{\n\t\t\t\"Directory\": dir,\n\t\t\t\"Error\": err,\n\t\t}).Println(\"Unable to read directory\")\n\t\treturn nil\n\t}\n\treturn out\n}", "func walkDir(path string) ([]string, []string) {\n\tvar dirs []string\n\tvar files []string\n\terr := filepath.Walk(path, func(path string, f os.FileInfo, err error) error {\n\t\tif f.IsDir() {\n\t\t\tdirs = append(dirs, path)\n\t\t} else {\n\t\t\tfiles = append(files, path)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\treturn dirs, files\n}", "func (o *Block) GetSymlinks(ctx context.Context) (symlinks [][]byte, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfaceBlock, \"Symlinks\").Store(&symlinks)\n\treturn\n}", "func getDirectory(path string) []string {\n\tvar result []string\n\twalk := func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif info.IsDir() && !strings.HasSuffix(path, \"/\") {\n\t\t\tpath = path + \"/\"\n\t\t}\n\t\tresult = append(result, filepath.ToSlash(path))\n\t\treturn nil\n\t}\n\tfilepath.Walk(path, walk)\n\treturn result\n}", "func (x *XDGDir) Dirs() []string {\n\tdirs := []string{x.Home()}\n\tif x.dirsEnv != \"\" {\n\t\txtra := os.Getenv(x.dirsEnv)\n\t\tif xtra == \"\" {\n\t\t\txtra = x.dirsDefault\n\t\t}\n\t\tfor _, path := range filepath.SplitList(xtra) {\n\t\t\tif path != \"\" {\n\t\t\t\tdirs = append(dirs, path)\n\t\t\t}\n\t\t}\n\t}\n\treturn dirs\n}", "func readdirnames(dirfd int) (names []string, err error) {\n\tnames = make([]string, 0, 100)\n\tvar buf [STATMAX]byte\n\n\tfor {\n\t\tn, e := Read(dirfd, buf[:])\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfor b := buf[:n]; len(b) > 0; {\n\t\t\tvar s []byte\n\t\t\ts, b = gdirname(b)\n\t\t\tif s == nil {\n\t\t\t\treturn nil, ErrBadStat\n\t\t\t}\n\t\t\tnames = append(names, string(s))\n\t\t}\n\t}\n\treturn\n}", "func dirents(dir string) []os.FileInfo {\n\tentries, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"du1: %v\\n\", err)\n\t\treturn nil\n\t}\n\treturn entries\n}", "func linkDir(src, dst string) error {\n\treturn syscall.Link(src, dst)\n}", "func (kc *MessageBufferHandle) dirList(path string) ([]string, error) {\n\n\tfiles, err := ioutil.ReadDir(path) // sorted\n\tvar results []string\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar count = 0\n\tkc.bufferList = kc.bufferList[:0]\n\tfor _, f := range files {\n\t\tname := f.Name()\n\n\t\tif name[0:1] == readyPrefix {\n\t\t\tcount++\n\t\t\tkc.appendBuffers(f)\n\t\t\tresults = append(results, name)\n\t\t}\n\t}\n\t//fmt.Println(\"DIRLIST, found=\", count)\n\treturn results, nil\n}", "func (s *fsStore) List(typ namespace.Type) []string {\n\tout := []string{}\n\tdir := filepath.Join(s.root, typ.StringLower())\n\tfl, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn out\n\t}\n\tfor _, inf := range fl {\n\t\tout = append(out, inf.Name())\n\t}\n\treturn out\n}", "func (fs osFsEval) Llistxattr(path string) ([]string, error) {\n\treturn system.Llistxattr(path)\n}", "func parseDirectoryListing(r io.Reader) (res []string) {\n\tz := html.NewTokenizer(r)\n\tfor {\n\t\ttt := z.Next()\n\t\tswitch {\n\t\tcase tt == html.StartTagToken:\n\t\t\tt := z.Token()\n\t\t\tif t.Data == \"a\" {\n\t\t\t\tfor _, a := range t.Attr {\n\t\t\t\t\tif a.Key == \"href\" {\n\t\t\t\t\t\tif path.Ext(a.Val) == \".zip\" {\n\t\t\t\t\t\t\tres = append(res, rootURL+a.Val)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase tt == html.ErrorToken:\n\t\t\treturn\n\t\t}\n\t}\n}", "func (s *FileEnumerator) Enumerate() ([]string, error) {\n\tpath := s.config.Path\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// if we got a symlink, use its destination\n\tif info.Mode()&os.ModeSymlink != 0 {\n\t\tdestination, err := filepath.EvalSymlinks(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpath = destination\n\t\tinfo, err = os.Stat(destination)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif info != nil && !info.IsDir() {\n\t\treturn []string{path}, nil\n\t}\n\n\tkeys := make([]string, 0)\n\n\terr = filepath.WalkDir(path, func(path string, d fs.DirEntry, err error) error {\n\t\t// Not tested, we should remove a file or folder after WalkDir has enumerated the whole tree in memory\n\t\t// This edge case does not really need to be covered by tests\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Skip symlinks\n\t\tif d.Type()&os.ModeSymlink != 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Ignore .backup files generated by terraform\n\t\tif strings.HasSuffix(path, \".backup\") {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !d.IsDir() {\n\t\t\tkeys = append(keys, path)\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn keys, err\n}", "func List(root string, includePatterns []string, excludePatterns []string) ([]string, error) {\n\troot = filepath.FromSlash(root)\n\tnewincludes, bases := baseDirs(root, includePatterns)\n\tret := []string{}\n\tfor _, b := range bases {\n\t\terr := filepath.Walk(\n\t\t\tb,\n\t\t\tfunc(p string, fi os.FileInfo, err error) error {\n\t\t\t\tif err != nil || fi.Mode()&os.ModeSymlink != 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tcleanpath, err := filter.File(p, newincludes, excludePatterns)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif fi.IsDir() {\n\t\t\t\t\tm, err := filter.MatchAny(p, excludePatterns)\n\t\t\t\t\t// We skip the dir only if it's explicitly excluded\n\t\t\t\t\tif err != nil && !m {\n\t\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t\t}\n\t\t\t\t} else if cleanpath != \"\" {\n\t\t\t\t\tret = append(ret, cleanpath)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn normPaths(root, ret)\n}", "func ListFilesRecursively(dir string) (files []File, err error) {\n\tdir = filepath.Clean(dir)\n\tfiles = []File{}\n\terr = filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {\n\t\tfile := File{\n\t\t\tPath: path,\n\t\t\tSize: f.Size(),\n\t\t\tMode: f.Mode(),\n\t\t\tModTime: f.ModTime(),\n\t\t\tIsDir: f.IsDir(),\n\t\t}\n\t\tif ComputeHashes {\n\t\t\th, err := hashstructure.Hash(file, nil)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tfile.Hash = h\n\t\t}\n\t\tfiles = append(files, file)\n\t\treturn nil\n\t})\n\treturn\n}", "func (retriever *CredRetrieverRemoteFs) ListPaths() []string {\n\treturn retriever.Paths\n}", "func List(home string) ([]Stat, error) {\n\terr := ensureDir(home)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tchildren, err := os.ReadDir(home)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar futures []Stat\n\tfor _, child := range children {\n\t\tif !child.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tname := child.Name()\n\n\t\tf := Open(home, name)\n\t\tcomplete, err := f.isComplete()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfutures = append(futures, Stat{name, complete})\n\t}\n\treturn futures, nil\n}", "func (retriever *CredRetrieverLocalFs) ListPaths() []string {\n\treturn retriever.Paths\n}", "func listForName(name string) (map[string]os.FileInfo, error) {\n\tstat, err := os.Stat(name)\n\tif err != nil {\n\t\treturn nil, errors.Annotatef(err, \"name %s\", name)\n\t}\n\n\tlist := make(map[string]os.FileInfo)\n\tlist[name] = stat\n\n\tif !stat.IsDir() {\n\t\t// not a directory, return\n\t\treturn list, nil\n\t}\n\n\tentries, err := os.ReadDir(name)\n\tif err != nil {\n\t\treturn nil, errors.Annotatef(err, \"directory %s\", name)\n\t}\n\n\tfor _, entry := range entries {\n\t\tfi, err := entry.Info()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotatef(err, \"directory %s\", name)\n\t\t}\n\t\tfp := filepath.Join(name, fi.Name())\n\t\tlist[fp] = fi\n\t}\n\n\treturn list, nil\n}", "func ReadDirWithLinks()[]string{\n\tvar link Links\n\tdirSlice:=make([]string,0)\n\tcurPath:=currentPath()\n\tdirPath:=curPath+\"/pars_result\"\n\tfor _,i:=range ReadDir(dirPath){\n\t\tfmt.Println(i)\n\t}\n\tvar dir string\n\tfmt.Println(\"Enter directory witch contain scrapping hosts:\")\n\t_, _ = fmt.Fscan(os.Stdin, &dir)\n\n\tfor _,i:=range ReadDir(dirPath+\"/\"+dir+\"/\"){\n\t\tdirSlice = append(dirSlice, dirPath+\"/\"+dir+\"/\"+i+\"/\")\n\t}\n\n\tfileSlice:=make([]string,0)\n\tfor _,i:=range dirSlice{\n\t\tfmt.Println(i)\n\t\tfor _,j:=range ReadDir(i){\n\t\t\tfmt.Println(j)\n\t\t\tfileSlice = append(fileSlice, i+\"/\"+j)\n\t\t}\n\t}\n\n\thosts:=make([]string,0)\n\tfor _,i:=range fileSlice{\n\n\t\tfor _,j:=range OpenAndReadLinks(i,link){\n\n\t\t\thosts = append(hosts, j)\n\n\t\t}\n\t}\n\n\treturn hosts\n}", "func PathList(s string) []string {\n\treturn mgutil.PathList(s)\n}", "func dirents(p string) []os.FileInfo {\n\tsema <- struct{}{} // acquire token\n\tdefer func() { <-sema }() // release token\n\tentries, err := ioutil.ReadDir(p)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"du1: %v\\n\", err)\n\t}\n\treturn entries\n}", "func (root *Directory) listing(skipRoot bool) *DirList {\n\tif root == nil {\n\t\treturn nil\n\t}\n\n\t// determine number of entries n and maximum height\n\tn := 0;\n\tminDepth := 1 << 30;\t// infinity\n\tmaxDepth := 0;\n\tfor d := range root.iter(skipRoot) {\n\t\tn++;\n\t\tif minDepth > d.Depth {\n\t\t\tminDepth = d.Depth\n\t\t}\n\t\tif maxDepth < d.Depth {\n\t\t\tmaxDepth = d.Depth\n\t\t}\n\t}\n\tmaxHeight := maxDepth - minDepth + 1;\n\n\tif n == 0 {\n\t\treturn nil\n\t}\n\n\t// create list\n\tlist := make([]DirEntry, n);\n\ti := 0;\n\tfor d := range root.iter(skipRoot) {\n\t\tp := &list[i];\n\t\tp.Depth = d.Depth - minDepth;\n\t\tp.Height = maxHeight - p.Depth;\n\t\t// the path is relative to root.Path - remove the root.Path\n\t\t// prefix (the prefix should always be present but avoid\n\t\t// crashes and check)\n\t\tpath := d.Path;\n\t\tif strings.HasPrefix(d.Path, root.Path) {\n\t\t\tpath = d.Path[len(root.Path):len(d.Path)]\n\t\t}\n\t\t// remove trailing '/' if any - path must be relative\n\t\tif len(path) > 0 && path[0] == '/' {\n\t\t\tpath = path[1:len(path)]\n\t\t}\n\t\tp.Path = path;\n\t\tp.Name = d.Name;\n\t\tp.Synopsis = d.Text;\n\t\ti++;\n\t}\n\n\treturn &DirList{maxHeight, list};\n}", "func (dlr *DirectoryListResponse) Directories() []string {\n\tvar dir []string\n\tlSchema := (PathList)(*dlr)\n\tfor _, path := range lSchema.Paths {\n\t\tif path.IsDirectory == nil || (path.IsDirectory != nil && !*path.IsDirectory) {\n\t\t\tcontinue\n\t\t}\n\t\tdir = append(dir, *path.Name)\n\t}\n\treturn dir\n}", "func getAllFileNamesInDir(root string) ([]string, error) {\n\tvar allFiles []string\n\terr := filepath.Walk(root,\n\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"walk into %q: %w\",\n\t\t\t\t\tpath, err)\n\t\t\t}\n\t\t\tif !info.IsDir() {\n\t\t\t\tallFiles = append(allFiles, path)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\treturn allFiles, err\n}", "func getList(p *Pkg) pkgList {\n\tinstallPkgs := pkgList{p.fullName()}\n\n\tfor _, pkg := range p.dependencies {\n\t\tinstallPkgs = append(installPkgs, pkg.fullName())\n\t}\n\n\treturn installPkgs\n}", "func listFiles(folder string) []string {\n\tvar files []string\n\tfilepath.Walk(folder, func(fp string, info os.FileInfo, err error) error {\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tparts := strings.SplitAfter(fp, fmt.Sprintf(\"%s%c\", folder, os.PathSeparator))\n\t\tnfp := strings.Join(parts[1:], string(os.PathSeparator))\n\t\tfiles = append(files, nfp)\n\t\treturn nil\n\t})\n\n\treturn files\n}", "func (v *dir) List(ctx context.Context) ([]plugin.Entry, error) {\n\tif v.dirmap != nil {\n\t\t// Children have been pre-populated by a source parent.\n\t\treturn v.generateChildren(v.dirmap), nil\n\t}\n\n\t// Generate child hierarchy. Don't store it on this entry, but populate new dirs from it.\n\tdirmap, err := v.impl.VolumeList(ctx, v.path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v.generateChildren(&dirMap{mp: dirmap}), nil\n}", "func readFiles(rootpath string) {\n\tvar realpath, symname string\n\t// path walker error channel\n\terrorChannel := make(chan os.Error, 64)\n\n\t// check if this is a symlink\n\tif dir, err := os.Stat(rootpath); err == nil {\n\t\tif dir.FollowedSymlink {\n\t\t\trealpath, _ = os.Readlink(rootpath)\n\t\t\tif realpath[0] != '/' {\n\t\t\t\trealpath = rootpath[0:strings.LastIndex(rootpath, \"/\")+1] + realpath\n\t\t\t}\n\t\t\tsymname = rootpath[len(rootPath)+1:]\n\t\t} else {\n\t\t\trealpath = rootpath\n\t\t}\n\t} else {\n\t\tlogger.Warn(\"%s\\n\", err)\n\t}\n\n\t// visitor for the path walker\n\tvisitor := &goFileVisitor{rootpath, realpath, symname}\n\n\tpath.Walk(visitor.realpath, visitor, errorChannel)\n\n\tselect {\n\tcase err := <-errorChannel:\n\t\tlogger.Error(\"Error while traversing directories: %s\\n\", err)\n\tdefault:\n\t}\n}", "func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error) {\n\tpool.Lock()\n\tdefer pool.Unlock()\n\n\tdirs, err := ioutil.ReadDir(pool.rootPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tif len(dirs) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif progress != nil {\n\t\tprogress.InitBar(int64(len(dirs)), false)\n\t\tdefer progress.ShutdownBar()\n\t}\n\n\tresult := []string{}\n\n\tfor _, dir := range dirs {\n\t\terr = filepath.Walk(filepath.Join(pool.rootPath, dir.Name()), func(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !info.IsDir() {\n\t\t\t\tresult = append(result, path[len(pool.rootPath)+1:])\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif progress != nil {\n\t\t\tprogress.AddBar(1)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func list(c Config) ([]packageT, error) {\n\tpackages := []packageT{}\n\n\tfor _, dir := range c.Scan {\n\t\tstdout, stderr, err := run(\"go\", \"list\", \"-f\", \"{{.ImportPath}} {{.Doc}}\", dir)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"go list error: %v; stderr: %v\", err, stderr)\n\t\t}\n\n\t\tfor _, line := range stdout {\n\t\t\tspace := strings.Index(line, \" \")\n\t\t\tpkg := packageT{}\n\n\t\t\tif space == -1 {\n\t\t\t\tpkg.FullImportPath = strings.TrimSpace(line)\n\t\t\t} else {\n\t\t\t\tpkg.FullImportPath = line[:space]\n\t\t\t\tpkg.Doc = line[space+1:]\n\t\t\t}\n\t\t\tpkg.RelImportPath = pkg.FullImportPath\n\t\t\tif c.RelativeTo != \"\" {\n\t\t\t\tpkg.RelImportPath = removePathPrefix(pkg.FullImportPath, c.RelativeTo)\n\t\t\t}\n\t\t\tpkg.Name = filepath.Base(pkg.RelImportPath)\n\t\t\tpkg.Depth = len(strings.Split(pkg.RelImportPath, \"/\"))\n\n\t\t\tpackages = append(packages, pkg)\n\t\t}\n\t}\n\n\t// The \"go list\" tool doesn't list directories without any *.go files; we\n\t// need to add them since we need it for the UI.\n\tadd := []packageT{}\n\tfor _, p := range packages {\n\tloopstart:\n\t\tup := filepath.Dir(p.FullImportPath)\n\t\tif up == \".\" || up == c.RelativeTo {\n\t\t\tcontinue\n\t\t}\n\n\t\tpath := filepath.Join(c.Clonedir, \"/src/\", up, \"/*.go\")\n\t\tgoFiles, _ := filepath.Glob(path)\n\t\tif len(goFiles) > 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Don't add duplicates.\n\t\tfound := false\n\t\tfor _, a := range add {\n\t\t\tif a.FullImportPath == up {\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\tcontinue\n\t\t}\n\t\tp = packageT{\n\t\t\tName: filepath.Base(up),\n\t\t\tFullImportPath: up,\n\t\t\tRelImportPath: removePathPrefix(up, c.RelativeTo),\n\t\t\tDepth: p.Depth - 1,\n\t\t}\n\n\t\tadd = append(add, p)\n\t\t// To-do the loop with \"p\" set to the newly added package to make sure\n\t\t// that all dirs are added.\n\t\tgoto loopstart\n\t}\n\tpackages = append(packages, add...)\n\n\tsort.Slice(packages, func(i, j int) bool {\n\t\treturn packages[i].FullImportPath < packages[j].FullImportPath\n\t})\n\n\t// Packages without any subpackages are indent level 0.\n\tfor i := range packages {\n\t\tif i+1 == len(packages) {\n\t\t\tbreak\n\t\t}\n\t\t//fmt.Println(packages[i].Name, packages[i].Depth, \" -> \", packages[i+1].Depth, packages[i+1].Name)\n\t\tif packages[i].Depth != 1 {\n\t\t\tcontinue\n\t\t}\n\t\tif packages[i+1].Depth == 1 {\n\t\t\tpackages[i].Depth = 0\n\t\t}\n\t}\n\n\treturn packages, nil\n}", "func (fl *FolderList) Symlink(\n\t_ context.Context, _ *fuse.SymlinkRequest) (fs.Node, error) {\n\treturn nil, fuse.ENOTSUP\n}", "func symlinkDirectoriesOnly(srcDir string, destDir string) (err error) {\n\tsrcInfo, err := os.Stat(srcDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.MkdirAll(destDir, srcInfo.Mode())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdirectory, err := os.Open(srcDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer directory.Close()\n\tobjects, err := directory.Readdir(-1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, obj := range objects {\n\t\tsrcPath := filepath.Join(srcDir, obj.Name())\n\t\tdestPath := filepath.Join(destDir, obj.Name())\n\n\t\tif obj.IsDir() {\n\t\t\terr = symlinkFile(srcPath, destPath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\treturn\n}", "func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error) {\n\tpool.Lock()\n\tdefer pool.Unlock()\n\n\tdirs, err := os.ReadDir(pool.rootPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tif len(dirs) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif progress != nil {\n\t\tprogress.InitBar(int64(len(dirs)), false, aptly.BarGeneralBuildFileList)\n\t\tdefer progress.ShutdownBar()\n\t}\n\n\tresult := []string{}\n\n\tfor _, dir := range dirs {\n\t\terr = filepath.Walk(filepath.Join(pool.rootPath, dir.Name()), func(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !info.IsDir() {\n\t\t\t\tresult = append(result, path[len(pool.rootPath)+1:])\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif progress != nil {\n\t\t\tprogress.AddBar(1)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func dirents(dir string) []os.FileInfo{\n\tsema <- struct{}{} // acquire token\n\tdefer func(){ <- sema }() // release token\n\t//...\n}", "func (d *gluster) readDirSorted(dirname string, followLink bool) ([]*mEntry, error) {\n\tf, err := d.vol.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tentries, err := f.Readdir(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmEntries := make([]*mEntry, 0, len(entries))\n\tfor _, e := range entries {\n\t\tname := e.Name()\n\t\tif name == \".\" || name == \"..\" {\n\t\t\tcontinue\n\t\t}\n\t\tif e.IsDir() {\n\t\t\tmEntries = append(mEntries, &mEntry{nil, name + dirSuffix, e, false})\n\t\t} else if !e.Mode().IsRegular() && followLink {\n\t\t\tfi, err := d.vol.Stat(filepath.Join(dirname, name))\n\t\t\tif err != nil {\n\t\t\t\tmEntries = append(mEntries, &mEntry{nil, name, e, true})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif fi.IsDir() {\n\t\t\t\tname += dirSuffix\n\t\t\t}\n\t\t\tmEntries = append(mEntries, &mEntry{nil, name, fi, false})\n\t\t} else {\n\t\t\tmEntries = append(mEntries, &mEntry{nil, name, e, !e.Mode().IsRegular()})\n\t\t}\n\t}\n\tsort.Slice(mEntries, func(i, j int) bool { return mEntries[i].Name() < mEntries[j].Name() })\n\treturn mEntries, err\n}" ]
[ "0.7091254", "0.6260142", "0.59422743", "0.59207684", "0.5883933", "0.5831181", "0.56262785", "0.56241775", "0.5610881", "0.55877554", "0.55340964", "0.55306727", "0.5507032", "0.5453065", "0.54427683", "0.54297984", "0.5383217", "0.5370796", "0.5356137", "0.53501934", "0.53411984", "0.53188926", "0.5266418", "0.52524453", "0.52438885", "0.52322876", "0.52220005", "0.51941156", "0.51935744", "0.5190191", "0.51884156", "0.51784235", "0.5174744", "0.51559883", "0.5154769", "0.5136408", "0.5134746", "0.51257426", "0.5113654", "0.5100986", "0.50940585", "0.5084766", "0.50803226", "0.5075804", "0.5055397", "0.50461113", "0.5037771", "0.50100875", "0.50050807", "0.498824", "0.49863738", "0.497713", "0.49764806", "0.49763706", "0.4967323", "0.49575636", "0.4926697", "0.49200138", "0.49140257", "0.49022305", "0.48905385", "0.48819226", "0.48756292", "0.4875064", "0.4866765", "0.48602837", "0.48589343", "0.48586544", "0.48503953", "0.48461518", "0.4842856", "0.4842291", "0.48366264", "0.48307148", "0.4823622", "0.48170048", "0.48147625", "0.4812306", "0.4806924", "0.48021775", "0.4789594", "0.47876063", "0.47862047", "0.47787717", "0.47771236", "0.47767657", "0.4771289", "0.4769162", "0.4759937", "0.47589213", "0.4757822", "0.4757725", "0.47462663", "0.4742561", "0.47276607", "0.47251853", "0.47153977", "0.47109017", "0.4709426", "0.4701807" ]
0.8587401
0
ReadResponse reads a server response into the received o.
func (o *DeleteThemeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 204: result := NewDeleteThemeNoContent() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 400: result := NewDeleteThemeBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewDeleteThemeNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("unknown error", response, response.Code()) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *ResourceHandler) ReadResponse(dataOut unsafe.Pointer, bytesToRead int32, bytesRead *int32, callback *Callback) int32 {\n\treturn lookupResourceHandlerProxy(d.Base()).ReadResponse(d, dataOut, bytesToRead, bytesRead, callback)\n}", "func (o *GetServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *InteractionBindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewInteractionBindOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewInteractionBindNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewInteractionBindInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *InteractionUnbindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewInteractionUnbindOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewInteractionUnbindNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewInteractionUnbindInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (r *ResponseReader) ReadResponse(req *Request) (res *Response, err error) {\n\tres = CreateEmptyResponse(req)\n\t_, err = readFirstLine(r, res)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = readHeaders(r, res)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, err = readBodyContent(r, res)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn res, nil\n}", "func (c *Conn) ReadResponse(rmsg *Response) error {\n\tdata, err := c.ReadDataUnit()\n\tif err != nil {\n\t\treturn err\n\t}\n\tcolor.Printf(\"@{c}<!-- RESPONSE -->\\n%s\\n\\n\", string(data))\n\terr = xml.Unmarshal(data, rmsg)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// color.Fprintf(os.Stderr, \"@{y}%s\\n\", spew.Sprintf(\"%+v\", msg))\n\tif len(rmsg.Results) != 0 {\n\t\tr := rmsg.Results[0]\n\t\tif r.IsError() {\n\t\t\treturn r\n\t\t}\n\t}\n\treturn nil\n}", "func (o *VerifyConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewVerifyConnectionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetAvailableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetAvailableOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *ClosePositionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewClosePositionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewClosePositionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewClosePositionUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewClosePositionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 405:\n\t\tresult := NewClosePositionMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *DescribeServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDescribeServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewDescribeServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewDescribeServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 409:\n\t\tresult := NewDescribeServerConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewDescribeServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetServerSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetServerSessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetServerSessionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewGetServerSessionUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetServerSessionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewGetServerSessionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /dsmcontroller/namespaces/{namespace}/servers/{podName}/session returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "func (o *StartReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewStartOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (resp *PharosResponse) readResponse() {\n\tif !resp.hasBeenRead && resp.Response != nil && resp.Response.Body != nil {\n\t\tresp.data, resp.Error = ioutil.ReadAll(resp.Response.Body)\n\t\tresp.Response.Body.Close()\n\t\tresp.hasBeenRead = true\n\t}\n}", "func (o *HelloWorldReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHelloWorldOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewHelloWorldBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewHelloWorldInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (reader *BasicRpcReader) ReadResponse(r io.Reader, method string, requestID int32, resp proto.Message) error {\n\trrh := &hadoop.RpcResponseHeaderProto{}\n\terr := readRPCPacket(r, rrh, resp)\n\tif err != nil {\n\t\treturn err\n\t} else if int32(rrh.GetCallId()) != requestID {\n\t\treturn errors.New(\"unexpected sequence number\")\n\t} else if rrh.GetStatus() != hadoop.RpcResponseHeaderProto_SUCCESS {\n\t\treturn &NamenodeError{\n\t\t\tmethod: method,\n\t\t\tmessage: rrh.GetErrorMsg(),\n\t\t\tcode: int(rrh.GetErrorDetail()),\n\t\t\texception: rrh.GetExceptionClassName(),\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *UpdateAntivirusServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewUpdateAntivirusServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewUpdateAntivirusServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *HasEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHasEventsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewHasEventsUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewHasEventsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetV2OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewGetV2InternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SaveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewSaveNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewSaveInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *TestWriteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTestWriteOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewTestWriteUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *AllConnectionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewAllConnectionsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewAllConnectionsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewAllConnectionsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SendDataToDeviceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSendDataToDeviceOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewSendDataToDeviceBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewSendDataToDeviceInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *HealthNoopReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHealthNoopOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PutOutOfRotationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewPutOutOfRotationNoContent()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "func (o *GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *StatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewStatusOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewStatusUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewStatusForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *ReplaceServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewReplaceServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 202:\n\t\tresult := NewReplaceServerAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewReplaceServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewReplaceServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewReplaceServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func ReadResponse(r *bfe_bufio.Reader, req *Request) (*Response, error) {\n\ttp := textproto.NewReader(r)\n\tresp := &Response{\n\t\tRequest: req,\n\t}\n\n\t// Parse the first line of the response.\n\tline, 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\tf := strings.SplitN(line, \" \", 3)\n\tif len(f) < 2 {\n\t\treturn nil, &badStringError{\"malformed HTTP response\", line}\n\t}\n\treasonPhrase := \"\"\n\tif len(f) > 2 {\n\t\treasonPhrase = f[2]\n\t}\n\tresp.Status = f[1] + \" \" + reasonPhrase\n\tresp.StatusCode, err = strconv.Atoi(f[1])\n\tif err != nil {\n\t\treturn nil, &badStringError{\"malformed HTTP status code\", f[1]}\n\t}\n\n\tresp.Proto = f[0]\n\tvar ok bool\n\tif resp.ProtoMajor, resp.ProtoMinor, ok = ParseHTTPVersion(resp.Proto); !ok {\n\t\treturn nil, &badStringError{\"malformed HTTP version\", resp.Proto}\n\t}\n\n\t// Parse the response headers.\n\tmimeHeader, err := tp.ReadMIMEHeader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp.Header = Header(mimeHeader)\n\n\tfixPragmaCacheControl(resp.Header)\n\n\terr = readTransfer(resp, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (o *PostChatroomsChannelHashReadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostChatroomsChannelHashReadOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewPostChatroomsChannelHashReadForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *TogglePacketGeneratorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewTogglePacketGeneratorsCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *FrontPutBinaryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewFrontPutBinaryOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SystemPingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewSystemPingOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewSystemPingInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SendDummyAlertReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewSendDummyAlertOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewSendDummyAlertBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewSendDummyAlertNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetViewsConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetViewsConnectionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetViewsConnectionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *SyncCopyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSyncCopyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewSyncCopyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *PostPatientsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostPatientsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewPostPatientsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 405:\n\t\tresult := NewPostPatientsMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (c *Conn) readResponse(res *response_) error {\n\terr := c.readDataUnit()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = IgnoreEOF(scanResponse.Scan(c.decoder, res))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res.Result.IsError() {\n\t\treturn res.Result\n\t}\n\treturn nil\n}", "func (o *AllConnectionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n switch response.Code() {\n \n case 200:\n result := NewAllConnectionsOK()\n if err := result.readResponse(response, consumer, o.formats); err != nil {\n return nil, err\n }\n return result, nil\n \n case 400:\n result := NewAllConnectionsBadRequest()\n if err := result.readResponse(response, consumer, o.formats); err != nil {\n return nil, err\n }\n return nil, result\n \n case 404:\n result := NewAllConnectionsNotFound()\n if err := result.readResponse(response, consumer, o.formats); err != nil {\n return nil, err\n }\n return nil, result\n \n default:\n return nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n }\n}", "func (o *GetMsgVpnReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetMsgVpnOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewGetMsgVpnDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (r *Response) Read(p []byte) (n int, err error) {\n\n\tif r.Error != nil {\n\t\treturn -1, r.Error\n\t}\n\n\treturn r.RawResponse.Body.Read(p)\n}", "func (o *PostPciLinksMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostPciLinksMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostPciLinksMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *THSRAPIODFare2121Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTHSRAPIODFare2121OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewTHSRAPIODFare2121Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewTHSRAPIODFare2121NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *PostGatewayConnectNetaddressReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPostGatewayConnectNetaddressNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostGatewayConnectNetaddressDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *DNSGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDNSGetOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewDNSGetDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetGreetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetGreetStatusOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostAPIV2EventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostAPIV2EventsNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewPostAPIV2EventsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewPostAPIV2EventsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *CreateAntivirusServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCreateAntivirusServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewCreateAntivirusServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *PostCarsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostCarsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 405:\n\t\tresult := NewPostCarsMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *LogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewLogOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewLogNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *ChatGetConnectedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewChatGetConnectedOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewChatGetConnectedBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewChatGetConnectedUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewChatGetConnectedNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *WebModifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewWebModifyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 202:\n\t\tresult := NewWebModifyAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewWebModifyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetHyperflexServerModelsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetHyperflexServerModelsMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetHyperflexServerModelsMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewGetHyperflexServerModelsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *KillQueryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewKillQueryNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewKillQueryBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewKillQueryNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 422:\n\t\tresult := NewKillQueryUnprocessableEntity()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetProgressionViewReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetProgressionViewOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetProgressionViewBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *UpdateRackTopoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUpdateRackTopoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUpdateRackTopoBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *UtilTestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUtilTestOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetByUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetByUIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetByUIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetMeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetMeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewGetMeDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *Delete1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDelete1NoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDelete1NotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *RevokeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRevokeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewRevokeUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewRevokeNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostGatewayDisconnectNetaddressReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPostGatewayDisconnectNetaddressNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostGatewayDisconnectNetaddressDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetProtocolsUsingGETReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetProtocolsUsingGETOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *DestroySessionUsingPOSTReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDestroySessionUsingPOSTOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *CompleteTransactionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewCompleteTransactionNoContent()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "func (o *GetMapNameEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetMapNameEventsOK(o.writer)\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetMapNameEventsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *RecoveryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRecoveryOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewRecoveryInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetPeersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetPeersOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewGetPeersForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *InstallEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewInstallEventsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SetMemoRequiredReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSetMemoRequiredOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewSetMemoRequiredBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewSetMemoRequiredInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *UpdateRackTopoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUpdateRackTopoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUpdateRackTopoBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewUpdateRackTopoNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUpdateRackTopoInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetVoicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetVoicesOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PatchHyperflexServerModelsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPatchHyperflexServerModelsMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPatchHyperflexServerModelsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *BounceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tresult := NewBounceDefault(response.Code())\n\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.Code()/100 == 2 {\n\t\treturn result, nil\n\t}\n\treturn nil, result\n}", "func (o *PostHyperflexHxdpVersionsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostHyperflexHxdpVersionsMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostHyperflexHxdpVersionsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetObmsLibraryIdentifierReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetObmsLibraryIdentifierOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewGetObmsLibraryIdentifierNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewGetObmsLibraryIdentifierDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *DeleteApplianceRestoresMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDeleteApplianceRestoresMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDeleteApplianceRestoresMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewDeleteApplianceRestoresMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *UserQuerySessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUserQuerySessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUserQuerySessionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewUserQuerySessionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested GET /sessionbrowser/namespaces/{namespace}/gamesession returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "func (o *GetDiscoverReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetDiscoverOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (r *overwriteConsumerReader) ReadResponse(resp runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tif r.forStatusCode == ForAllStatusCodes || resp.Code() == r.forStatusCode {\n\t\treturn r.requestReader.ReadResponse(resp, r.consumer)\n\t}\n\n\treturn r.requestReader.ReadResponse(resp, consumer)\n}", "func (o *UnclaimTrafficFilterLinkIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUnclaimTrafficFilterLinkIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUnclaimTrafficFilterLinkIDBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUnclaimTrafficFilterLinkIDInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *GetDebugRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetDebugRequestOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewGetDebugRequestNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *ChangeaspecificSpeedDialReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewChangeaspecificSpeedDialNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostMemoryArraysMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostMemoryArraysMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostMemoryArraysMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (c *Client) readResponse(conn net.Conn) ([]byte, error) {\n\tif c.Timeout > 0 {\n\t\t_ = conn.SetReadDeadline(time.Now().Add(c.Timeout))\n\t}\n\n\tproto := \"udp\"\n\tif _, ok := conn.(*net.TCPConn); ok {\n\t\tproto = \"tcp\"\n\t}\n\n\tif proto == \"udp\" {\n\t\tbufSize := c.UDPSize\n\t\tif bufSize == 0 {\n\t\t\tbufSize = dns.MinMsgSize\n\t\t}\n\t\tresponse := make([]byte, bufSize)\n\t\tn, err := conn.Read(response)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn response[:n], nil\n\t}\n\n\t// If we got here, this is a TCP connection\n\t// so we should read a 2-byte prefix first\n\treturn readPrefixed(conn)\n}", "func (o *PayReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPayOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewPayBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewPayNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 409:\n\t\tresult := NewPayConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tdata, err := ioutil.ReadAll(response.Body())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"Requested POST /platform/public/namespaces/{namespace}/payment/orders/{paymentOrderNo}/pay returns an error %d: %s\", response.Code(), string(data))\n\t}\n}", "func (o *CountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCountOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewCountBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *PostNodesIdentifierObmIdentifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201:\n\t\tresult := NewPostNodesIdentifierObmIdentifyCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewPostNodesIdentifierObmIdentifyNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewPostNodesIdentifierObmIdentifyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetInterpreterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetInterpreterOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetInterpreterNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *DeleteEventsEventIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewDeleteEventsEventIDNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewDeleteEventsEventIDUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewDeleteEventsEventIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *UtilityServiceReadyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUtilityServiceReadyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewUtilityServiceReadyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *HTTPGetPersistenceItemDataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHTTPGetPersistenceItemDataOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewHTTPGetPersistenceItemDataNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *SubscriptionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSubscriptionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *PostEquipmentIoExpandersMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostEquipmentIoExpandersMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostEquipmentIoExpandersMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *FrontSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewFrontSessionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (pr *PushedRequest) ReadResponse(ctx context.Context) (*http.Response, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\tpr.Cancel()\n\t\tpr.pushedStream.bufPipe.CloseWithError(ctx.Err())\n\t\treturn nil, ctx.Err()\n\tcase <-pr.pushedStream.peerReset:\n\t\treturn nil, pr.pushedStream.resetErr\n\tcase resErr := <-pr.pushedStream.resc:\n\t\tif resErr.err != nil {\n\t\t\tfmt.Println(resErr.err.Error())\n\t\t\tpr.Cancel()\n\t\t\tpr.pushedStream.bufPipe.CloseWithError(resErr.err)\n\t\t\treturn nil, resErr.err\n\t\t}\n\t\tresErr.res.Request = pr.Promise\n\t\tresErr.res.TLS = pr.pushedStream.cc.tlsState\n\t\treturn resErr.res, resErr.err\n\t}\n}", "func (o *GetZippedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tresult := NewGetZippedDefault(response.Code())\n\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.Code()/100 == 2 {\n\t\treturn result, nil\n\t}\n\treturn nil, result\n}", "func (o *DeleteFirmwareUpgradesMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDeleteFirmwareUpgradesMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDeleteFirmwareUpgradesMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewDeleteFirmwareUpgradesMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *GetEtherPhysicalPortsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetEtherPhysicalPortsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewGetEtherPhysicalPortsDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func (o *ZoneStreamReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewZoneStreamOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *ByNamespaceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewByNamespaceOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewByNamespaceNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetRequestTrackerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetRequestTrackerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewGetRequestTrackerForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetRequestTrackerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}" ]
[ "0.7640225", "0.7607834", "0.75210214", "0.7509121", "0.74803215", "0.74724656", "0.7433606", "0.74244606", "0.7375357", "0.7367311", "0.73589337", "0.73551553", "0.7350114", "0.7347274", "0.7346054", "0.733966", "0.7336042", "0.73239547", "0.7315819", "0.73155594", "0.7310195", "0.730769", "0.72904205", "0.7287086", "0.72826135", "0.72742283", "0.7274111", "0.72655845", "0.726384", "0.7262403", "0.7255057", "0.72496617", "0.72492456", "0.72479755", "0.72409135", "0.7224629", "0.722366", "0.7219326", "0.7216009", "0.72122216", "0.72110355", "0.72099286", "0.7209348", "0.72004783", "0.71978456", "0.719778", "0.71926844", "0.7177653", "0.71745974", "0.71737057", "0.716626", "0.7155474", "0.71500206", "0.7149536", "0.7148374", "0.7143972", "0.7143686", "0.7141745", "0.71397567", "0.713703", "0.7136677", "0.7136661", "0.7135863", "0.7135147", "0.71337897", "0.71312535", "0.7124361", "0.7123878", "0.71200526", "0.7120036", "0.7119569", "0.71148854", "0.7104891", "0.7100936", "0.70989054", "0.70989", "0.70984536", "0.70977753", "0.709657", "0.70961034", "0.70941985", "0.70932794", "0.70886916", "0.70850074", "0.7083912", "0.7080819", "0.7078785", "0.70775825", "0.70765215", "0.7076268", "0.7070042", "0.70699906", "0.7068155", "0.7068122", "0.7066828", "0.70625323", "0.70621973", "0.70599294", "0.70577264", "0.7054454", "0.70509636" ]
0.0
-1
NewDeleteThemeNoContent creates a DeleteThemeNoContent with default headers values
func NewDeleteThemeNoContent() *DeleteThemeNoContent { return &DeleteThemeNoContent{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewDeleteThemeNotFound() *DeleteThemeNotFound {\n\treturn &DeleteThemeNotFound{}\n}", "func DeleteWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func NewDeleteThemeBadRequest() *DeleteThemeBadRequest {\n\treturn &DeleteThemeBadRequest{}\n}", "func (t *Theme) Clear() { *t = Theme{} }", "func (c *Client) DeleteDefaultMessageType(ctx context.Context, params *DeleteDefaultMessageTypeInput, optFns ...func(*Options)) (*DeleteDefaultMessageTypeOutput, error) {\n\tif params == nil {\n\t\tparams = &DeleteDefaultMessageTypeInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"DeleteDefaultMessageType\", params, optFns, c.addOperationDeleteDefaultMessageTypeMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*DeleteDefaultMessageTypeOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (ctx *DeleteFeedContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func NewNvmeServiceDeleteDefault(code int) *NvmeServiceDeleteDefault {\n\treturn &NvmeServiceDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteMaybeNoContent() *DeleteMaybeNoContent {\n\treturn &DeleteMaybeNoContent{}\n}", "func NoContent(w http.ResponseWriter) {\n\t// No custom handler since there's no custom behavior.\n\tw.Header().Del(\"Content-Type\")\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (ctx *DeleteOutputContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func (handler *BucketWebHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\trespondWithError(w, http.StatusNotImplemented, \"Not implemented\", nil)\n}", "func NewDeleteChannelHandlerNoContent() *DeleteChannelHandlerNoContent {\n\treturn &DeleteChannelHandlerNoContent{}\n}", "func NewDeleteTokenDefault(code int) *DeleteTokenDefault {\n\treturn &DeleteTokenDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDestroySpoonDefault(code int) *DestroySpoonDefault {\n\treturn &DestroySpoonDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *DeleteProjectUserNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "func NewDcimPlatformsDeleteDefault(code int) *DcimPlatformsDeleteDefault {\n\treturn &DcimPlatformsDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func newCreateThemeCmd() *cobra.Command {\n\tvar (\n\t\toptions core.CreateThemeOptions\n\t)\n\tcreateThemeCmd := cobra.Command{\n\t\tUse: \"theme THEME_NAME\",\n\t\tShort: `Create a new verless theme`,\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tname := args[0]\n\n\t\t\treturn core.CreateTheme(options, name)\n\t\t},\n\t}\n\n\tcreateThemeCmd.Flags().StringVarP(&options.Project, \"project\", \"p\", \".\", `project path to create new theme in.`)\n\treturn &createThemeCmd\n}", "func NewProjectDeleteDefault(code int) *ProjectDeleteDefault {\n\treturn &ProjectDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDcimPlatformsDeleteNoContent() *DcimPlatformsDeleteNoContent {\n\treturn &DcimPlatformsDeleteNoContent{}\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"need a definition of delete on our platform\"))\n}", "func (ctx *DeleteFilterContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func (controller *WidgetController) Delete(context *qhttp.Context) {\n\tcontroller.storage.Delete(context.URIParameters[\"id\"])\n\tcontext.SetResponse(\"\", http.StatusNoContent)\n}", "func NewDeleteMascotNoContent() *DeleteMascotNoContent {\n\treturn &DeleteMascotNoContent{}\n}", "func NewDeleteTagDefault(code int) *DeleteTagDefault {\n\treturn &DeleteTagDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteTagDefault(code int) *DeleteTagDefault {\n\treturn &DeleteTagDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewCreateThemeOK() *CreateThemeOK {\n\treturn &CreateThemeOK{}\n}", "func NewDeleteConsulNoContent() *DeleteConsulNoContent {\n\n\treturn &DeleteConsulNoContent{}\n}", "func (ctx *DeleteUserContext) NoContent(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.user+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 204, r)\n}", "func (o *DeleteProductNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "func DeleteFeedNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func Delete(h http.Handler) http.Handler {\n\treturn HTTP(h, DELETE)\n}", "func NewDeleteOneDefault(code int) *DeleteOneDefault {\n\treturn &DeleteOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func Delete(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusNoContent, gin.H{\"code\": merrors.ErrSuccess, \"data\": data})\n\treturn\n}", "func NewDeleteConsulDefault(code int) *DeleteConsulDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &DeleteConsulDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewQtreeDeleteDefault(code int) *QtreeDeleteDefault {\n\treturn &QtreeDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDataDeleteNoContent() *DataDeleteNoContent {\n\treturn &DataDeleteNoContent{}\n}", "func NewDeleteOneNoContent() *DeleteOneNoContent {\n\treturn &DeleteOneNoContent{}\n}", "func (mr *ManifestResource) Delete(_ http.ResponseWriter, req *http.Request, _ httprouter.Params) restful.Exchanger {\n\treturn &DELETEManifestHandler{\n\t\tState: mr.context.liveState(),\n\t\tQueryValues: mr.ParseQuery(req),\n\t\tStateWriter: sous.StateWriter(mr.context.StateManager),\n\t}\n}", "func NewGcpKmsDeleteDefault(code int) *GcpKmsDeleteDefault {\n\treturn &GcpKmsDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDelete1NoContent() *Delete1NoContent {\n\treturn &Delete1NoContent{}\n}", "func NewThemeCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"theme\",\n\t\tShort: \"Handles theme of the site\",\n\t\tLong: `This command handles the theme of the site`,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tlist()\n\t\t},\n\t}\n\treturn cmd\n}", "func NewDeleteCrossConnectDefault(code int) *DeleteCrossConnectDefault {\n\treturn &DeleteCrossConnectDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (h *ResponseHeader) SetNoDefaultContentType(noDefaultContentType bool) {\n\th.noDefaultContentType = noDefaultContentType\n}", "func Delete(cf string) error {\n\tfilename := locateSettingsFile(cf)\n\n\tif _, err := os.Stat(filename); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn err\n\t}\n\n\tif err := os.Remove(filename); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *ApplicationTemplateRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func NewDeleteSpoeAgentDefault(code int) *DeleteSpoeAgentDefault {\n\treturn &DeleteSpoeAgentDefault{\n\t\t_statusCode: code,\n\t\tConfigurationVersion: 0,\n\t}\n}", "func DeleteTemplate(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"URL PATH - %s!\", r.URL.Path[1:])\n}", "func NewThingsDeleteNoContent() *ThingsDeleteNoContent {\n\n\treturn &ThingsDeleteNoContent{}\n}", "func (r *MobileAppContentFileRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (r *ExtensionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (a *ContentApiService) DeleteContentFavorite(ctx _context.Context, contentFavoriteId int64) (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\tlocalVarReturnValue string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/content_favorite/{content_favorite_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"content_favorite_id\"+\"}\", _neturl.QueryEscape(parameterToString(contentFavoriteId, \"\")) , -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 == 204 {\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 == 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 == 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}\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}", "func NewDeleteHyperflexSoftwareVersionPoliciesMoidDefault(code int) *DeleteHyperflexSoftwareVersionPoliciesMoidDefault {\n\treturn &DeleteHyperflexSoftwareVersionPoliciesMoidDefault{\n\t\t_statusCode: code,\n\t}\n}", "func CreateDefaultButton(content string, position mgl32.Vec2) Button {\n\treturn Button{content, position, Color{0.8, 0.8, 0.8}, Color{0.0, 0.0, 0.0}, mgl32.Vec2{32, 128}, false}\n}", "func (ftc *FlavorTemplateController) Delete(w http.ResponseWriter, r *http.Request) (interface{}, int, error) {\n\tdefaultLog.Trace(\"controllers/flavortemplate_controller:Delete() Entering\")\n\tdefer defaultLog.Trace(\"controllers/flavortemplate_controller:Delete() Leaving\")\n\n\ttemplateID := uuid.MustParse(mux.Vars(r)[\"ftId\"])\n\n\t//call store function to delete template from DB.\n\tif err := ftc.FTStore.Delete(templateID); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *commErr.StatusNotFoundError:\n\t\t\tdefaultLog.WithError(err).Error(\"controllers/flavortemplate_controller:Delete() Flavor template with given ID does not exist\")\n\t\t\treturn nil, http.StatusNotFound, &commErr.ResourceError{Message: \"Flavor template with given ID does not exist or has been deleted\"}\n\t\tdefault:\n\t\t\tdefaultLog.WithError(err).Error(\"controllers/flavortemplate_controller:Delete() Failed to delete flavor template with given ID\")\n\t\t\treturn nil, http.StatusInternalServerError, &commErr.ResourceError{Message: \"Failed to delete flavor template with given ID\"}\n\t\t}\n\t}\n\n\treturn nil, http.StatusNoContent, nil\n}", "func (o *ThingsDeleteNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "func NewDeleteUserNoContent() *DeleteUserNoContent {\n\treturn &DeleteUserNoContent{}\n}", "func NewDeleteAPIFeaturesNameDefault(code int) *DeleteAPIFeaturesNameDefault {\n\treturn &DeleteAPIFeaturesNameDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteProjectUserNoContent() *DeleteProjectUserNoContent {\n\n\treturn &DeleteProjectUserNoContent{}\n}", "func NewDeleteZoneNoContent() *DeleteZoneNoContent {\n\treturn &DeleteZoneNoContent{}\n}", "func (o *DeleteConsulNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "func (a *Client) DownloadTheme(params *DownloadThemeParams, authInfo runtime.ClientAuthInfoWriter) (*DownloadThemeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDownloadThemeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"downloadTheme\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/themes/{uuid}/actions/download\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DownloadThemeReader{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.(*DownloadThemeOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*DownloadThemeDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func NewDeleteZoneDefault(code int) *DeleteZoneDefault {\n\treturn &DeleteZoneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteSmbShareDefault(code int) *DeleteSmbShareDefault {\n\treturn &DeleteSmbShareDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteCommand() *cobra.Command {\n\tvar (\n\t\tflags listFlags\n\t\tall bool\n\t\tallNamespaces bool\n\t\tdryRun bool\n\t)\n\tvar command = &cobra.Command{\n\t\tUse: \"delete [--dry-run] [WORKFLOW...|[--all] [--older] [--completed] [--resubmitted] [--prefix PREFIX] [--selector SELECTOR]]\",\n\t\tShort: \"delete workflows\",\n\t\tExample: `# Delete a workflow:\n\n argo delete my-wf\n\n# Delete the latest workflow:\n\n argo delete @latest\n`,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tctx, apiClient := client.NewAPIClient()\n\t\t\tserviceClient := apiClient.NewWorkflowServiceClient()\n\t\t\tvar workflows wfv1.Workflows\n\t\t\tif !allNamespaces {\n\t\t\t\tflags.namespace = client.Namespace()\n\t\t\t}\n\t\t\tfor _, name := range args {\n\t\t\t\tworkflows = append(workflows, wfv1.Workflow{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{Name: name, Namespace: flags.namespace},\n\t\t\t\t})\n\t\t\t}\n\t\t\tif all || flags.completed || flags.resubmitted || flags.prefix != \"\" || flags.labels != \"\" || flags.finishedAfter != \"\" {\n\t\t\t\tlisted, err := listWorkflows(ctx, serviceClient, flags)\n\t\t\t\terrors.CheckError(err)\n\t\t\t\tworkflows = append(workflows, listed...)\n\t\t\t}\n\t\t\tfor _, wf := range workflows {\n\t\t\t\tif !dryRun {\n\t\t\t\t\t_, err := serviceClient.DeleteWorkflow(ctx, &workflowpkg.WorkflowDeleteRequest{Name: wf.Name, Namespace: wf.Namespace})\n\t\t\t\t\tif err != nil && status.Code(err) == codes.NotFound {\n\t\t\t\t\t\tfmt.Printf(\"Workflow '%s' not found\\n\", wf.Name)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\terrors.CheckError(err)\n\t\t\t\t\tfmt.Printf(\"Workflow '%s' deleted\\n\", wf.Name)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Printf(\"Workflow '%s' deleted (dry-run)\\n\", wf.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n\n\tcommand.Flags().BoolVar(&allNamespaces, \"all-namespaces\", false, \"Delete workflows from all namespaces\")\n\tcommand.Flags().BoolVar(&all, \"all\", false, \"Delete all workflows\")\n\tcommand.Flags().BoolVar(&flags.completed, \"completed\", false, \"Delete completed workflows\")\n\tcommand.Flags().BoolVar(&flags.resubmitted, \"resubmitted\", false, \"Delete resubmitted workflows\")\n\tcommand.Flags().StringVar(&flags.prefix, \"prefix\", \"\", \"Delete workflows by prefix\")\n\tcommand.Flags().StringVar(&flags.finishedAfter, \"older\", \"\", \"Delete completed workflows finished before the specified duration (e.g. 10m, 3h, 1d)\")\n\tcommand.Flags().StringVarP(&flags.labels, \"selector\", \"l\", \"\", \"Selector (label query) to filter on, not including uninitialized ones\")\n\tcommand.Flags().BoolVar(&dryRun, \"dry-run\", false, \"Do not delete the workflow, only print what would happen\")\n\treturn command\n}", "func NewDeleteImageDefault(code int) *DeleteImageDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &DeleteImageDefault{\n\t\t_statusCode: code,\n\t}\n}", "func Deleted(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": false, \"msg\": \"`+msg+`\"}`, 200, service, \"application/json\")\n\treturn nil\n}", "func NewDeleteCapabilityDefault(code int) *DeleteCapabilityDefault {\n\treturn &DeleteCapabilityDefault{\n\t\t_statusCode: code,\n\t}\n}", "func DeleteOrder(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n}", "func Delete(s *discordgo.Session, m *discordgo.MessageCreate) {\n}", "func (s *s3ManifestService) Delete(ctx context.Context, dgst godigest.Digest) error {\n\treturn fmt.Errorf(\"unimplemented\")\n}", "func NewAPIDeleteUserNoContent() *APIDeleteUserNoContent {\n\treturn &APIDeleteUserNoContent{}\n}", "func (o *DeleteExecutionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "func NewDeleteAPIKeyDefault(code int) *DeleteAPIKeyDefault {\n\treturn &DeleteAPIKeyDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteCommand(parent cmd.Registerer, g *global.Data, m manifest.Data) *DeleteCommand {\n\tc := DeleteCommand{\n\t\tBase: cmd.Base{\n\t\t\tGlobals: g,\n\t\t},\n\t\tmanifest: m,\n\t}\n\tc.CmdClause = parent.Command(\"delete\", \"Delete a resource link for a Fastly service version\").Alias(\"remove\")\n\n\t// Required.\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: \"id\",\n\t\tDescription: flagIDDescription,\n\t\tDst: &c.input.ID,\n\t\tRequired: true,\n\t})\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagVersionName,\n\t\tDescription: cmd.FlagVersionDesc,\n\t\tDst: &c.serviceVersion.Value,\n\t\tRequired: true,\n\t})\n\n\t// At least one of the following is required.\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagServiceIDName,\n\t\tShort: 's',\n\t\tDescription: cmd.FlagServiceIDDesc,\n\t\tDst: &c.manifest.Flag.ServiceID,\n\t})\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagServiceName,\n\t\tAction: c.serviceName.Set,\n\t\tDescription: cmd.FlagServiceDesc,\n\t\tDst: &c.serviceName.Value,\n\t})\n\n\t// Optional.\n\tc.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{\n\t\tAction: c.autoClone.Set,\n\t\tDst: &c.autoClone.Value,\n\t})\n\tc.RegisterFlagBool(c.JSONFlag()) // --json\n\n\treturn &c\n}", "func NewDestroySpoonNoContent() *DestroySpoonNoContent {\n\treturn &DestroySpoonNoContent{}\n}", "func Delete(config *HTTPConfig) (*HTTPResult, error) {\n\treturn HandleRequest(\"DELETE\", config)\n}", "func (a *PreferencesMetaEntryApiService) PreferencesmetaentriesIdDelete(ctx _context.Context, id int32) (*_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 + \"/preferencesmetaentries/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func NoContent(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "func NewDeleteDatasetNoContent() *DeleteDatasetNoContent {\n\treturn &DeleteDatasetNoContent{}\n}", "func (ctx *DeleteCommentContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func (c *SeaterController) NoContent(code ...int) {\n\tif len(code) > 0 {\n\t\tc.Code(code[0])\n\t} else {\n\t\tc.Code(204)\n\t}\n\tc.Ctx.Output.Body([]byte(\"\"))\n}", "func NewDeleteProductNoContent() *DeleteProductNoContent {\n\n\treturn &DeleteProductNoContent{}\n}", "func NewPostAccountUpgradeNoContent() *PostAccountUpgradeNoContent {\n\treturn &PostAccountUpgradeNoContent{}\n}", "func NewDeleteCrossConnectNoContent() *DeleteCrossConnectNoContent {\n\treturn &DeleteCrossConnectNoContent{}\n}", "func Delete(uri string) error {\n\treq, err := http.NewRequest(\"DELETE\", Host+uri, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := Client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != 204 {\n\t\treturn fmt.Errorf(\"got %d\", res.StatusCode)\n\t}\n\n\treturn nil\n}", "func (h *RequestHeader) SetNoDefaultContentType(noDefaultContentType bool) {\n\th.noDefaultContentType = noDefaultContentType\n}", "func NewHTTPNoContentResponse(message string) Message {\n\treturn &defaultMessage{\n\t\tmessage,\n\t\thttp.StatusNoContent,\n\t\t\"no_content\",\n\t}\n}", "func deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Received a content request. Preparing response\")\n\tresp := response{\n\t\tSuccessful: false,\n\t\tErrMsg: errors.New(\"Unknown failure\"),\n\t}\n\twriter := json.NewEncoder(w)\n\tdefer writer.Encode(resp)\n\n\t// Parse the request.\n\tfmt.Println(\"Parsing request\")\n\tdata := form{}\n\tresp.ErrMsg = json.NewDecoder(r.Body).Decode(&data)\n\n\tfmt.Println(\"Obtained following data: \")\n\tfmt.Printf(\"%+v\\n\", data)\n\n\t// Validate requestor token\n\tvalid := true\n\tvalid, resp.ErrMsg = session.Validate(data.User, data.Token)\n\n\tfilepath = path + data.ID + data.ContentType\n\n\tmodErr = update.ModifyContentFilePath(\"\")\n\tdeleteErr = delete(filepath)\n\n\tif modErr != nil {\n\t\tresp.ErrMsg = modErr\n\t} else {\n\t\tresp.ErrMsg = deleteErr\n\t}\n\n}", "func (handler *ObjectWebHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\trespondWithError(w, http.StatusNotImplemented, \"Not implemented\", nil)\n}", "func (ctx *Context) NoContent(code int) error {\n\tctx.ResponseWriter.WriteHeader(code)\n\treturn nil\n}", "func (o *Delete1NoContent) Code() int {\n\treturn 204\n}", "func (a *Manager) Delete(ctx *ws.Context) {\n\thttp.SetCookie(ctx.ResponseWriter, &http.Cookie{\n\t\tName: a.name,\n\t\tMaxAge: -1,\n\t\tPath: a.path,\n\t\tSecure: a.secure,\n\t\tHttpOnly: true,\n\t\tSameSite: http.SameSiteStrictMode,\n\t})\n}", "func NewDeleteHost(rt *runtime.Runtime) operations.DeleteHostHandler {\n\treturn &deleteHost{rt: rt}\n}", "func NewDeleteTagNoContent() *DeleteTagNoContent {\n\treturn &DeleteTagNoContent{}\n}", "func NewDeleteTagNoContent() *DeleteTagNoContent {\n\treturn &DeleteTagNoContent{}\n}", "func Delete(ctx context.Context, url string, body Body, options ...RequestOption) (*Response, error) {\n\tr, err := newRequest(ctx, http.MethodDelete, url, body, options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr.Header.Set(\"Content-Type\", body.ContentType())\n\treturn doRequest(http.DefaultClient, r)\n}", "func DeleteBrowsing(c echo.Context) error {\n\t// TODO: implement delete browsing function\n\treturn c.JSON(http.StatusOK, \"{'hello': 'world'}\")\n}", "func (o *DeregisterInfraEnvNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "func DeleteTweet(w http.ResponseWriter, r *http.Request) {\n\tID := r.URL.Query().Get(\"id\")\n\tif len(ID) < 1 {\n\t\thttp.Error(w, \"Debe enviar el parametro ID\", http.StatusBadRequest)\n\t\treturn\n\t}\n\terr := bd.DeleteTweet(ID, IDUsuario)\n\tif err != nil {\n\t\thttp.Error(w, \"Error eliminando el tweet \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n}", "func NewDeleteCommand() *cobra.Command {\n\tvar (\n\t\tall bool\n\t)\n\n\tvar command = &cobra.Command{\n\t\tUse: \"delete [CRON_WORKFLOW... | --all]\",\n\t\tShort: \"delete a cron workflow\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tctx, apiClient := client.NewAPIClient()\n\t\t\tserviceClient := apiClient.NewCronWorkflowServiceClient()\n\t\t\tif all {\n\t\t\t\tcronWfList, err := serviceClient.ListCronWorkflows(ctx, &cronworkflowpkg.ListCronWorkflowsRequest{\n\t\t\t\t\tNamespace: client.Namespace(),\n\t\t\t\t})\n\t\t\t\terrors.CheckError(err)\n\t\t\t\tfor _, cronWf := range cronWfList.Items {\n\t\t\t\t\targs = append(args, cronWf.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, name := range args {\n\t\t\t\t_, err := serviceClient.DeleteCronWorkflow(ctx, &cronworkflowpkg.DeleteCronWorkflowRequest{\n\t\t\t\t\tName: name,\n\t\t\t\t\tNamespace: client.Namespace(),\n\t\t\t\t})\n\t\t\t\terrors.CheckError(err)\n\t\t\t}\n\t\t},\n\t}\n\n\tcommand.Flags().BoolVar(&all, \"all\", false, \"Delete all workflow templates\")\n\treturn command\n}" ]
[ "0.51285815", "0.50762606", "0.50533164", "0.5020623", "0.48811886", "0.48745328", "0.48675218", "0.48242143", "0.47746152", "0.47457886", "0.47407877", "0.47266787", "0.4707639", "0.46994165", "0.46992642", "0.4682423", "0.46783772", "0.46686035", "0.46617064", "0.46519268", "0.46341845", "0.4630926", "0.46194872", "0.46129698", "0.46129698", "0.46028036", "0.45960012", "0.4578251", "0.45745137", "0.45678383", "0.45604822", "0.45547017", "0.45531464", "0.45497206", "0.45390922", "0.4525179", "0.45156464", "0.45085406", "0.45074144", "0.45033064", "0.44766492", "0.447366", "0.44722602", "0.4469811", "0.4469582", "0.44659013", "0.44612882", "0.44524252", "0.44443685", "0.44421744", "0.44402474", "0.44401038", "0.44337812", "0.44254625", "0.4423801", "0.44236103", "0.43993166", "0.43977505", "0.4387239", "0.43865782", "0.43784744", "0.43656865", "0.43621904", "0.43565288", "0.43513003", "0.4351281", "0.4351047", "0.4349724", "0.43497002", "0.43492448", "0.4342332", "0.43321317", "0.43291754", "0.4327737", "0.43242583", "0.4323941", "0.43167996", "0.43130192", "0.43107727", "0.43100813", "0.4309241", "0.43080008", "0.43079802", "0.43014315", "0.4299655", "0.4290822", "0.42884332", "0.42882523", "0.42824328", "0.42790568", "0.42786235", "0.4277689", "0.4277062", "0.42767927", "0.42767927", "0.42760497", "0.4272353", "0.4272172", "0.4270224", "0.4265881" ]
0.64764637
0
NewDeleteThemeBadRequest creates a DeleteThemeBadRequest with default headers values
func NewDeleteThemeBadRequest() *DeleteThemeBadRequest { return &DeleteThemeBadRequest{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCreateThemeBadRequest() *CreateThemeBadRequest {\n\treturn &CreateThemeBadRequest{}\n}", "func NewDeleteBadRequest(body *DeleteBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewSetDefaultThemeBadRequest() *SetDefaultThemeBadRequest {\n\treturn &SetDefaultThemeBadRequest{}\n}", "func (ctx *DeleteHostContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func NewSystemDeleteBadRequest() *SystemDeleteBadRequest {\n\treturn &SystemDeleteBadRequest{}\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *DeleteOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewWeaviateSchemaActionsDeleteBadRequest() *WeaviateSchemaActionsDeleteBadRequest {\n\n\treturn &WeaviateSchemaActionsDeleteBadRequest{}\n}", "func NewDataDeleteBadRequest() *DataDeleteBadRequest {\n\treturn &DataDeleteBadRequest{}\n}", "func (ctx *DeleteFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewGroupDeletesBadRequest() *GroupDeletesBadRequest {\n\treturn &GroupDeletesBadRequest{}\n}", "func NewDeleteUserBadRequest() *DeleteUserBadRequest {\n\n\treturn &DeleteUserBadRequest{}\n}", "func NewDeleteMediaBadRequest(body *DeleteMediaBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func (client *LROSADsClient) delete202RetryInvalidHeaderCreateRequest(ctx context.Context, options *LROSADsClientBeginDelete202RetryInvalidHeaderOptions) (*policy.Request, error) {\n\turlPath := \"/lro/error/delete/202/retry/invalidheader\"\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (ctx *CreateHostContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func (ctx *CreateMessageContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (m *WindowsUpdatesCatalogRequestBuilder) Delete(ctx context.Context, requestConfiguration *WindowsUpdatesCatalogRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func NewDeleteUserBadRequest() *DeleteUserBadRequest {\n\treturn &DeleteUserBadRequest{}\n}", "func NewDeleteProjectUserBadRequest() *DeleteProjectUserBadRequest {\n\n\treturn &DeleteProjectUserBadRequest{}\n}", "func CreateBadRequest(errorMessage string) BadRequest {\n\treturn BadRequest{Error: errorMessage}\n}", "func (ctx *DeleteUserContext) BadRequest(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteEnvironmentBadRequest() *DeleteEnvironmentBadRequest {\n\treturn &DeleteEnvironmentBadRequest{}\n}", "func NewDeleteDatasetBadRequest() *DeleteDatasetBadRequest {\n\treturn &DeleteDatasetBadRequest{}\n}", "func NewNewThreadBadRequest() *NewThreadBadRequest {\n\treturn &NewThreadBadRequest{}\n}", "func (ctx *CreateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *CreateItemContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteProductBadRequest() *DeleteProductBadRequest {\n\n\treturn &DeleteProductBadRequest{}\n}", "func NewDeleteBundleCustomFieldsBadRequest() *DeleteBundleCustomFieldsBadRequest {\n\treturn &DeleteBundleCustomFieldsBadRequest{}\n}", "func NewProjectDeleteBadRequest() *ProjectDeleteBadRequest {\n\treturn &ProjectDeleteBadRequest{}\n}", "func (ctx *CreateOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (client *LROSADsClient) delete204SucceededCreateRequest(ctx context.Context, options *LROSADsClientBeginDelete204SucceededOptions) (*policy.Request, error) {\n\turlPath := \"/lro/error/delete/204/nolocation\"\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (ctx *DeleteDogContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func (client *LROSADsClient) delete202NonRetry400CreateRequest(ctx context.Context, options *LROSADsClientBeginDelete202NonRetry400Options) (*policy.Request, error) {\n\turlPath := \"/lro/nonretryerror/delete/202/retry/400\"\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewDeleteBadRequestResponseBody(res *goa.ServiceError) *DeleteBadRequestResponseBody {\n\tbody := &DeleteBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func (o *DeleteBundleCustomFieldsBadRequest) Code() int {\n\treturn 400\n}", "func NewCreateBadRequest() *CreateBadRequest {\n\n\treturn &CreateBadRequest{}\n}", "func NewDeleteThemeNotFound() *DeleteThemeNotFound {\n\treturn &DeleteThemeNotFound{}\n}", "func (ctx *SignupAuthenticationContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteDebugRequestBadRequest() *DeleteDebugRequestBadRequest {\n\treturn &DeleteDebugRequestBadRequest{}\n}", "func (m *GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionRequestBuilder) Delete(ctx context.Context, requestConfiguration *GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func NewDeleteRoleBadRequest() *DeleteRoleBadRequest {\n\treturn &DeleteRoleBadRequest{}\n}", "func NewCheckDeletionStatusBadRequest() *CheckDeletionStatusBadRequest {\n\treturn &CheckDeletionStatusBadRequest{}\n}", "func (ctx *CreateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteStageInput, error) {\n\tres := &svcsdk.DeleteStageInput{}\n\n\tif r.ko.Spec.APIID != nil {\n\t\tres.SetApiId(*r.ko.Spec.APIID)\n\t}\n\tif r.ko.Spec.StageName != nil {\n\t\tres.SetStageName(*r.ko.Spec.StageName)\n\t}\n\n\treturn res, nil\n}", "func NewDeleteLinkBadRequest() *DeleteLinkBadRequest {\n\treturn &DeleteLinkBadRequest{}\n}", "func NewCreateBlueprintRequestUsingPOST1BadRequest() *CreateBlueprintRequestUsingPOST1BadRequest {\n\treturn &CreateBlueprintRequestUsingPOST1BadRequest{}\n}", "func NewBadRequest(field string, message string, args ...interface{}) *AppError {\n\treturn NewError(InvalidArgument, field, message, args...)\n}", "func NewDeleteConnectorUsingDELETEBadRequest() *DeleteConnectorUsingDELETEBadRequest {\n\treturn &DeleteConnectorUsingDELETEBadRequest{}\n}", "func NewDeleteUserCredentialsAPIBadRequest() *DeleteUserCredentialsAPIBadRequest {\n\treturn &DeleteUserCredentialsAPIBadRequest{}\n}", "func NewCreateBadRequest(body *CreateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteIscsiLunBadRequest() *DeleteIscsiLunBadRequest {\n\treturn &DeleteIscsiLunBadRequest{}\n}", "func NewDeleteIscsiLunBadRequest() *DeleteIscsiLunBadRequest {\n\treturn &DeleteIscsiLunBadRequest{}\n}", "func (ctx *RegisterAuthenticationContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteUserGroupsBadRequest() *DeleteUserGroupsBadRequest {\n\treturn &DeleteUserGroupsBadRequest{}\n}", "func (client *LROSADsClient) post202RetryInvalidHeaderCreateRequest(ctx context.Context, options *LROSADsClientBeginPost202RetryInvalidHeaderOptions) (*policy.Request, error) {\n\turlPath := \"/lro/error/post/202/retry/invalidheader\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.Product != nil {\n\t\tif err := runtime.MarshalAsJSON(req, *options.Product); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn req, nil\n\t}\n\treturn req, nil\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\th.RenderHTMLStatus(w, http.StatusBadRequest, \"400\", nil)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusBadRequest, apiErrorBadRequest)\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t}\n}", "func (ctx *CreateSecretsContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func NewServiceCreateBadRequest() *ServiceCreateBadRequest {\n\treturn &ServiceCreateBadRequest{}\n}", "func (ctx *CreateUserContext) BadRequest(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewBadRequest(err error, msg ...string) *Errs {\n\tif err == nil {\n\t\terr = ErrBadRequest\n\t}\n\n\treturn &Errs{\n\t\tcodeHTTP: http.StatusBadRequest,\n\t\terr: err,\n\t\tkind: trace(2),\n\t\tmessage: msg,\n\t}\n}", "func NewDeleteVersionControlRequestBadRequest() *DeleteVersionControlRequestBadRequest {\n\treturn &DeleteVersionControlRequestBadRequest{}\n}", "func NewDeleteFeedSpacesBadRequest() *DeleteFeedSpacesBadRequest {\n\treturn &DeleteFeedSpacesBadRequest{}\n}", "func SetNewBadRequestByFormat(ef *ErrorFormat) *ErrorMessage {\n\treturn &ErrorMessage{\n\t\tCode: http.StatusBadRequest,\n\t\tErrorList: []*ErrorFormat{\n\t\t\tef,\n\t\t},\n\t}\n}", "func NewDeleteRuntimeContainerBadRequest() *DeleteRuntimeContainerBadRequest {\n\n\treturn &DeleteRuntimeContainerBadRequest{}\n}", "func (ctx *UpdateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *ListMessageContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteShipmentBadRequest() *DeleteShipmentBadRequest {\n\n\treturn &DeleteShipmentBadRequest{}\n}", "func NewDeletePostbyIDBadRequest() *DeletePostbyIDBadRequest {\n\n\treturn &DeletePostbyIDBadRequest{}\n}", "func NewGetTagBadRequest() *GetTagBadRequest {\n\n\treturn &GetTagBadRequest{}\n}", "func NewGetTagBadRequest() *GetTagBadRequest {\n\n\treturn &GetTagBadRequest{}\n}", "func (ctx *LoginAuthenticationContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteAPIKeyBadRequest() *DeleteAPIKeyBadRequest {\n\treturn &DeleteAPIKeyBadRequest{}\n}", "func (ctx *PubPshbContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteRegistryClientBadRequest() *DeleteRegistryClientBadRequest {\n\treturn &DeleteRegistryClientBadRequest{}\n}", "func NewCreateServiceBadRequest() *CreateServiceBadRequest {\n\treturn &CreateServiceBadRequest{}\n}", "func CreateBadRequestResponse(w http.ResponseWriter, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tbytes, _ := json.Marshal(err.Error())\n\tw.Write(bytes)\n}", "func (ctx *GetFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *CreateProfileContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *GetByIDHostContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func NewAllDashboardsBadRequest() *AllDashboardsBadRequest {\n return &AllDashboardsBadRequest{\n }\n}", "func (ctx *StopFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteMessageBadRequestResponseBody(res *goa.ServiceError) *DeleteMessageBadRequestResponseBody {\n\tbody := &DeleteMessageBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func NewWeaviateActionsPatchBadRequest() *WeaviateActionsPatchBadRequest {\n\n\treturn &WeaviateActionsPatchBadRequest{}\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ValidateDeleteBadRequestResponseBody(body *DeleteBadRequestResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "func (ctx *CreateCommentContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (o *DeleteProductBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "func NewAdminDeleteThirdPartyConfigBadRequest() *AdminDeleteThirdPartyConfigBadRequest {\n\treturn &AdminDeleteThirdPartyConfigBadRequest{}\n}", "func NewDeleteUserCredentialsEmbedBadRequest() *DeleteUserCredentialsEmbedBadRequest {\n\treturn &DeleteUserCredentialsEmbedBadRequest{}\n}", "func NewDeleteUserCredentialsEmbedBadRequest() *DeleteUserCredentialsEmbedBadRequest {\n\treturn &DeleteUserCredentialsEmbedBadRequest{}\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WithPayload(payload *models.ErrorResponse) *WeaviateSchemaActionsDeleteBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateProjectBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "func NewHelloWorldBadRequest() *HelloWorldBadRequest {\n\treturn &HelloWorldBadRequest{}\n}", "func NewCreateConsistencyGroupBadRequest() *CreateConsistencyGroupBadRequest {\n\treturn &CreateConsistencyGroupBadRequest{}\n}", "func (ctx *StartFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (o *DeleteUserBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "func BadRequest(format string, args ...interface{}) error {\n\treturn New(http.StatusBadRequest, format, args...)\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (ctx *ListFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (client HTTPSuccessClient) Delete202Responder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted),\n autorest.ByClosing())\n result.Response = resp\n return\n}" ]
[ "0.63706344", "0.6016929", "0.57827175", "0.5706843", "0.5542518", "0.5511571", "0.54724455", "0.54291373", "0.5393061", "0.5367258", "0.5347187", "0.53305286", "0.53289235", "0.5319839", "0.5315047", "0.5310001", "0.5284267", "0.52522665", "0.52363086", "0.52321243", "0.520356", "0.5201051", "0.5182819", "0.5177719", "0.51571137", "0.51350355", "0.5130031", "0.51259345", "0.512122", "0.50915456", "0.5081555", "0.5051604", "0.50322646", "0.49980974", "0.49944076", "0.49784967", "0.497285", "0.49439976", "0.49329072", "0.4925971", "0.49213067", "0.49166766", "0.49143425", "0.4911463", "0.4908698", "0.48956597", "0.4894269", "0.48899412", "0.4888477", "0.48880616", "0.4876986", "0.4876986", "0.4871977", "0.48681498", "0.48618558", "0.48581412", "0.48558563", "0.4847347", "0.48428136", "0.48403707", "0.48353672", "0.4834546", "0.4822465", "0.4820008", "0.48191652", "0.48171157", "0.48153755", "0.48113924", "0.48047635", "0.48047635", "0.47995487", "0.4794877", "0.4787699", "0.47863024", "0.4776364", "0.47760838", "0.47722384", "0.47678027", "0.4762127", "0.47588843", "0.47529626", "0.47526112", "0.47505143", "0.47500578", "0.47482303", "0.47456557", "0.47453424", "0.47448492", "0.47448263", "0.47448263", "0.47421098", "0.47419608", "0.47418705", "0.47382042", "0.47341248", "0.473222", "0.47316933", "0.4728191", "0.47232276", "0.47135502" ]
0.7043915
0
NewDeleteThemeNotFound creates a DeleteThemeNotFound with default headers values
func NewDeleteThemeNotFound() *DeleteThemeNotFound { return &DeleteThemeNotFound{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCreateThemeNotFound() *CreateThemeNotFound {\n\treturn &CreateThemeNotFound{}\n}", "func NewDeleteThemeBadRequest() *DeleteThemeBadRequest {\n\treturn &DeleteThemeBadRequest{}\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func (ctx *DeleteHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewSetDefaultThemeNotFound() *SetDefaultThemeNotFound {\n\treturn &SetDefaultThemeNotFound{}\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func (m *WindowsUpdatesCatalogRequestBuilder) Delete(ctx context.Context, requestConfiguration *WindowsUpdatesCatalogRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func notFound(resource string) middleware.Responder {\n\tmessage := fmt.Sprintf(\"404 %s not found\", resource)\n\treturn operations.NewGetChartDefault(http.StatusNotFound).WithPayload(\n\t\t&models.Error{Code: helpers.Int64ToPtr(http.StatusNotFound), Message: &message},\n\t)\n}", "func (app *application) default404(w http.ResponseWriter, r *http.Request) {\n\tapp.render(w, r, \"404.page.tmpl\", nil)\n}", "func NewCreateThemeBadRequest() *CreateThemeBadRequest {\n\treturn &CreateThemeBadRequest{}\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func notFound(resp *ApiResponse, msg string) error {\n resp.StatusCode = http.StatusNotFound\n resp.Message = []byte(msg)\n resp.ErrorMessage = http.StatusText(http.StatusNotFound)\n\n return nil\n}", "func notFound(w http.ResponseWriter, req *http.Request) {\n\t// w.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tapiError := apirouter.ErrorFromRequest(req, fmt.Sprintf(\"404 occurred: %s\", req.RequestURI), \"Whoops - this request is not recognized\", http.StatusNotFound, http.StatusNotFound, \"\")\n\tapirouter.ReturnResponse(w, req, apiError.Code, apiError)\n}", "func NewNotFound() error {\n\treturn requestError{\n\t\tClientError: ClientError{\n\t\t\tErrors: []clientErrorSubError{{Message: \"status code 404\"}},\n\t\t},\n\t}\n}", "func (wa *webapi) defaultHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (ctx *DeleteOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func notFound(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\thttp.NotFound(w, req)\n}", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func NotFound(fn http.HandlerFunc) {\n\tinfoMutex.Lock()\n\tvestigo.CustomNotFoundHandlerFunc(fn)\n\tinfoMutex.Unlock()\n}", "func NewSetDefaultThemeBadRequest() *SetDefaultThemeBadRequest {\n\treturn &SetDefaultThemeBadRequest{}\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func NewDeleteThemeNoContent() *DeleteThemeNoContent {\n\treturn &DeleteThemeNoContent{}\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func (b *Baa) DefaultNotFoundHandler(c *Context) {\n\tcode := http.StatusNotFound\n\tmsg := http.StatusText(code)\n\thttp.Error(c.Resp, msg, code)\n}", "func ERROR_TRX_NOT_FOUND(w http.ResponseWriter) {\n\tbuildForeignError(w, http.StatusNotFound, \"ERROR_TRX_NOT_FOUND\", \"\")\n}", "func NotFound(w http.ResponseWriter, _ error) {\n\t(Response{Error: \"resource not found\"}).json(w, http.StatusNotFound)\n}", "func (ctx *GetByIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetAllHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (suite *TenantTestSuite) TestDeleteNotFound() {\n\trequest, _ := http.NewRequest(\"DELETE\", \"/api/v2/admin/tenants/id\", strings.NewReader(\"\"))\n\trequest.Header.Set(\"x-api-key\", suite.clientkey)\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\tresponse := httptest.NewRecorder()\n\n\tsuite.router.ServeHTTP(response, request)\n\n\tcode := response.Code\n\toutput := response.Body.String()\n\n\tsuite.Equal(404, code, \"Internal Server Error\")\n\tsuite.Equal(suite.respTenantNotFound, output, \"Response body mismatch\")\n}", "func custom404(w http.ResponseWriter, r *http.Request, url string) {\n\tlog.Printf(\"custom404: sending 404 for %s\", url)\n\tb.pageDisplayer.DisplayPage(w, \"404.html\", nil)\n}", "func (ctx *DeleteFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func custom404PageHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/html\") // set the content header type\n\tw.WriteHeader(http.StatusNotFound) // this automatically generates a 404 status code\n\tdata404Page := \"This page does not exist ... 404!\" // page content\n\tio.WriteString(w, data404Page)\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func NewDestroySpoonDefault(code int) *DestroySpoonDefault {\n\treturn &DestroySpoonDefault{\n\t\t_statusCode: code,\n\t}\n}", "func DeleteWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func NewCreateThemeOK() *CreateThemeOK {\n\treturn &CreateThemeOK{}\n}", "func custom404PageHandler(w http.ResponseWriter, r *http.Request, status int) {\n\tw.Header().Set(\"Content-Type\", \"text/html\") // set the content header type\n\tw.WriteHeader(status) // this automatically generates a 404 status code\n\tif reflect.DeepEqual(status, http.StatusNotFound) {\n\t\tdata404Page := \"This page does not exist ... 404!\" // custom error message content\n\t\tio.WriteString(w, data404Page)\n\t}\n}", "func noFound(msg string) error {\n\treturn status.Error(codes.NotFound, msg)\n}", "func NotFound(err error) error {\n\treturn New(http.StatusNotFound, err)\n}", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\treturn\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewNotFound(parameters ...wparams.ParamStorer) Error {\n\treturn newGenericError(nil, DefaultNotFound, wparams.NewParamStorer(parameters...))\n}", "func (ctx *GetDogsByHostIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (o *GetNFTContractTokenNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func (m *GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionRequestBuilder) Delete(ctx context.Context, requestConfiguration *GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func NewProjectDeleteDefault(code int) *ProjectDeleteDefault {\n\treturn &ProjectDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *ThingsDeleteNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func NotFound(format string, args ...interface{}) error {\n\targs = append(args, withDefaultMessage(NotFoundDefaultMsg))\n\treturn Errorf(http.StatusNotFound, format, args...)\n}", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func NewDeleteMediaNotFound(body *DeleteMediaNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewNotFound(s string, v ...interface{}) error {\n\treturn asNotFound(fmt.Errorf(s, v...))\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (o *DeleteDebugRequestNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func (o *CancelLaunchNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func (m *ZebraFotaConnectorRequestBuilder) Delete(ctx context.Context, requestConfiguration *ZebraFotaConnectorRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (o *DeleteUserNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func NewNotFound(name, group, resource string) error {\n\treturn errors.NewNotFound(schema.GroupResource{Group: group, Resource: resource}, name)\n}", "func (o *DeleteServiceIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func (ctx *UpdateOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewNvmeServiceDeleteDefault(code int) *NvmeServiceDeleteDefault {\n\treturn &NvmeServiceDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *UpdateDeploymentNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func ERROR_ASSET_NOT_FOUND(w http.ResponseWriter, payload string) {\n\tbuildForeignError(w, http.StatusNotFound, \"ERROR_ASSET_NOT_FOUND\", payload)\n}", "func NewNotFound() *AppError {\n\treturn NewNotFoundR(StatusText(NotFound))\n}", "func (ctx *DeleteLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (handler *BucketWebHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\trespondWithError(w, http.StatusNotImplemented, \"Not implemented\", nil)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func NewNotFound(err error, msg ...string) *Errs {\n\tif err == nil {\n\t\terr = ErrNotFound\n\t}\n\treturn &Errs{\n\t\tcodeHTTP: http.StatusNotFound,\n\t\terr: err,\n\t\tkind: trace(2),\n\t\tmessage: msg,\n\t}\n}", "func (a *Client) DownloadTheme(params *DownloadThemeParams, authInfo runtime.ClientAuthInfoWriter) (*DownloadThemeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDownloadThemeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"downloadTheme\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/themes/{uuid}/actions/download\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DownloadThemeReader{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.(*DownloadThemeOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*DownloadThemeDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (ctx *DeleteUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func return404(w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.Header().Set(\"Server\", \"nginx\") // tell its nginx\n\tw.WriteHeader(http.StatusNotFound) // 404\n\n\t// write default nginx 404 page\n\tfmt.Fprintf(w, defaultnginx404)\n}", "func (o *GetProfileVersionsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func (r Response) NotFound(code string, payload Payload, header ...ResponseHeader) {\n\tr.Response(code, http.NotFound, payload, header...)\n}", "func NotFound(rw http.ResponseWriter) {\n\tHttpError(rw, \"not found\", 404)\n}", "func (o *GetProjectSummaryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func (m *TermStoreRequestBuilder) Delete(ctx context.Context, requestConfiguration *TermStoreRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func NewNotFound(a Attributes) error {\n\tname, resource, err := extractResourceName(a)\n\tif err != nil {\n\t\treturn apierrors.NewInternalError(err)\n\t}\n\treturn apierrors.NewNotFound(resource, name)\n}", "func NewThingsDeleteNotFound() *ThingsDeleteNotFound {\n\n\treturn &ThingsDeleteNotFound{}\n}", "func ServeNotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n}", "func notFoundHandler(res http.ResponseWriter, req *http.Request) {\n\tdefer server.LogRequest(req, http.StatusNotFound)\n\n\tres.WriteHeader(http.StatusNotFound)\n\trenderBaseTemplate(res, \"404.html\", nil)\n}", "func notFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\n\twritten, err := json.Marshal(struct{ Message string }{Message: \"Bulamadık :(\"})\n\tif err != nil {\n\t\tbadImplementationHandler(w, r, err)\n\t}\n\t_, err = w.Write(written)\n\tif err != nil {\n\n\t\tbadImplementationHandler(w, r, err)\n\t}\n}", "func WithNotFound(f http.Handler) ConfigOption {\n\treturn ConfigOptionFunc(func(c *Config) { c.NotFound = f })\n}", "func HelmReposDelete(c *gin.Context) {\n\tlog := logger.WithFields(logrus.Fields{\"tag\": \"HelmReposDelete\"})\n\tlog.Info(\"Delete helm repository\")\n\n\tclusterName, ok := GetCommonClusterNameFromRequest(c)\n\tif ok != true {\n\t\treturn\n\t}\n\n\trepoName := c.Param(\"name\")\n\tlog.Debugln(\"repoName:\", repoName)\n\n\terr := helm.ReposDelete(clusterName, repoName)\n\tif err != nil {\n\t\tlog.Error(\"Error during get helm repo delete.\", err.Error())\n\t\tif err.Error() == helm.ErrRepoNotFound.Error() {\n\t\t\tc.JSON(http.StatusOK, htype.DeleteResponse{\n\t\t\t\tStatus: http.StatusOK,\n\t\t\t\tMessage: err.Error(),\n\t\t\t\tName: repoName})\n\t\t\treturn\n\n\t\t}\n\t\tc.JSON(http.StatusBadRequest, htype.ErrorResponse{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: \"error deleting helm repos\",\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, htype.DeleteResponse{\n\t\tStatus: http.StatusOK,\n\t\tMessage: \"resource deleted successfully.\",\n\t\tName: repoName})\n\treturn\n}", "func NewPostInstallNotFound() *PostInstallNotFound {\n\treturn &PostInstallNotFound{}\n}", "func NewDeleteComponentNotFound() *DeleteComponentNotFound {\n\treturn &DeleteComponentNotFound{}\n}", "func (ctx *Context) NotFound(err error, message string) *HTTPError {\n\treturn notFoundError(err, message)\n}", "func (o *GetMempoolOperationsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "func (c ApiWrapper) NotFound(msg string, objs ...interface{}) revel.Result {\n\treturn c.renderErrorString(404, fmt.Sprintf(msg, objs))\n}", "func NewDeleteTagDefault(code int) *DeleteTagDefault {\n\treturn &DeleteTagDefault{\n\t\t_statusCode: code,\n\t}\n}" ]
[ "0.5825536", "0.5431607", "0.5397742", "0.5253453", "0.5179543", "0.50643545", "0.5009888", "0.5009654", "0.49757707", "0.4956416", "0.49374968", "0.4926125", "0.49068528", "0.49068528", "0.4873671", "0.4864614", "0.48539996", "0.48494837", "0.48274532", "0.48115093", "0.48103118", "0.48092186", "0.47606158", "0.47531486", "0.47519186", "0.47390676", "0.47195905", "0.47088745", "0.470851", "0.470851", "0.46953592", "0.4691851", "0.46680313", "0.46648806", "0.46566486", "0.4647821", "0.46474376", "0.46373335", "0.46144602", "0.46035972", "0.45901066", "0.4585593", "0.45765463", "0.45627323", "0.4560979", "0.45393264", "0.45249775", "0.4524256", "0.45199502", "0.4515882", "0.4510001", "0.45083445", "0.45068964", "0.45065293", "0.45049936", "0.45046383", "0.44969124", "0.44947413", "0.44921407", "0.44920337", "0.44919193", "0.44878915", "0.44782978", "0.44782123", "0.446571", "0.4464563", "0.4459804", "0.44545856", "0.4449333", "0.444661", "0.44432864", "0.44401646", "0.44330797", "0.4425922", "0.44250983", "0.44228643", "0.44127446", "0.44122607", "0.44019744", "0.44003206", "0.4398984", "0.43943816", "0.43907398", "0.4387843", "0.43857172", "0.43856248", "0.43848526", "0.4379534", "0.43757138", "0.4372983", "0.43714446", "0.43697545", "0.436723", "0.4361859", "0.43600392", "0.43593395", "0.4357087", "0.4354081", "0.43535745", "0.43533167" ]
0.64312243
0